a341d254e1
Vier-Etappen-Umbau der MC2-Oberfläche für Endnutzer (kein Fachjargon): 1. Klartext-Schicht (lib/roleMeta.ts): Rollen-Kürzel → Zweck-Namen mit Icons (hermes=Lucys Hirn, embed=Lucys Gedächtnis, vision=Lucys Augen, …), zentral in ModelBadges/ModelsCard/Cockpit. Veraltete Rollenliste korrigiert (Phantom-„fast" raus; embed/coder-lite ergänzt). 2. „Geht's Lucy gut?"-Panel (lib/useLucyHealth.ts + LucyHealthCard): 5 Fähigkeiten in Klartext, Ampel-Verdikt, Speicher-Ampel, 1-Klick-Reparatur (echte Unit-Namen). 3. Einfach/Experte-Schalter (lib/useExpertMode.ts + ExpertToggle) + Schutzgeländer: Hirn/Gedächtnis (protected) nicht löschbar/entladbar; Ctx/Spec/Slots/Lane-Details im Einfach-Modus versteckt. 4. „Immer-bereit-Set"-Manager (WarmSetManager): brains-Gruppe in Klartext + ehrliches Speicher-Budget (inkl. KV) mit Verdrängungs-Hinweis. Live gegen die Box verifiziert. frontend/dist mitgebaut. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
5514 lines
1.9 MiB
Plaintext
5514 lines
1.9 MiB
Plaintext
var B8=Object.defineProperty;var WN=t=>{throw TypeError(t)};var H8=(t,e,n)=>e in t?B8(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var $s=(t,e,n)=>H8(t,typeof e!="symbol"?e+"":e,n),sE=(t,e,n)=>e.has(t)||WN("Cannot "+n);var ge=(t,e,n)=>(sE(t,e,"read from private field"),n?n.call(t):e.get(t)),Wt=(t,e,n)=>e.has(t)?WN("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),wt=(t,e,n,r)=>(sE(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),_n=(t,e,n)=>(sE(t,e,"access private method"),n);var vb=(t,e,n,r)=>({set _(i){wt(t,e,i,n)},get _(){return ge(t,e,r)}});function V8(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function Qw(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var aE={exports:{}},o0={},oE={exports:{}},gn={};/**
|
||
* @license React
|
||
* react.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var $N;function G8(){if($N)return gn;$N=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),a=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),f=Symbol.iterator;function p(G){return G===null||typeof G!="object"?null:(G=f&&G[f]||G["@@iterator"],typeof G=="function"?G:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,S={};function w(G,W,oe){this.props=G,this.context=W,this.refs=S,this.updater=oe||y}w.prototype.isReactComponent={},w.prototype.setState=function(G,W){if(typeof G!="object"&&typeof G!="function"&&G!=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,G,W,"setState")},w.prototype.forceUpdate=function(G){this.updater.enqueueForceUpdate(this,G,"forceUpdate")};function b(){}b.prototype=w.prototype;function M(G,W,oe){this.props=G,this.context=W,this.refs=S,this.updater=oe||y}var T=M.prototype=new b;T.constructor=M,x(T,w.prototype),T.isPureReactComponent=!0;var C=Array.isArray,L=Object.prototype.hasOwnProperty,N={current:null},D={key:!0,ref:!0,__self:!0,__source:!0};function F(G,W,oe){var se,le={},Me=null,Se=null;if(W!=null)for(se in W.ref!==void 0&&(Se=W.ref),W.key!==void 0&&(Me=""+W.key),W)L.call(W,se)&&!D.hasOwnProperty(se)&&(le[se]=W[se]);var $e=arguments.length-2;if($e===1)le.children=oe;else if(1<$e){for(var Ee=Array($e),Ge=0;Ge<$e;Ge++)Ee[Ge]=arguments[Ge+2];le.children=Ee}if(G&&G.defaultProps)for(se in $e=G.defaultProps,$e)le[se]===void 0&&(le[se]=$e[se]);return{$$typeof:t,type:G,key:Me,ref:Se,props:le,_owner:N.current}}function V(G,W){return{$$typeof:t,type:G.type,key:W,ref:G.ref,props:G.props,_owner:G._owner}}function I(G){return typeof G=="object"&&G!==null&&G.$$typeof===t}function U(G){var W={"=":"=0",":":"=2"};return"$"+G.replace(/[=:]/g,function(oe){return W[oe]})}var X=/\/+/g;function te(G,W){return typeof G=="object"&&G!==null&&G.key!=null?U(""+G.key):W.toString(36)}function re(G,W,oe,se,le){var Me=typeof G;(Me==="undefined"||Me==="boolean")&&(G=null);var Se=!1;if(G===null)Se=!0;else switch(Me){case"string":case"number":Se=!0;break;case"object":switch(G.$$typeof){case t:case e:Se=!0}}if(Se)return Se=G,le=le(Se),G=se===""?"."+te(Se,0):se,C(le)?(oe="",G!=null&&(oe=G.replace(X,"$&/")+"/"),re(le,W,oe,"",function(Ge){return Ge})):le!=null&&(I(le)&&(le=V(le,oe+(!le.key||Se&&Se.key===le.key?"":(""+le.key).replace(X,"$&/")+"/")+G)),W.push(le)),1;if(Se=0,se=se===""?".":se+":",C(G))for(var $e=0;$e<G.length;$e++){Me=G[$e];var Ee=se+te(Me,$e);Se+=re(Me,W,oe,Ee,le)}else if(Ee=p(G),typeof Ee=="function")for(G=Ee.call(G),$e=0;!(Me=G.next()).done;)Me=Me.value,Ee=se+te(Me,$e++),Se+=re(Me,W,oe,Ee,le);else if(Me==="object")throw W=String(G),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(G).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.");return Se}function pe(G,W,oe){if(G==null)return G;var se=[],le=0;return re(G,se,"","",function(Me){return W.call(oe,Me,le++)}),se}function ee(G){if(G._status===-1){var W=G._result;W=W(),W.then(function(oe){(G._status===0||G._status===-1)&&(G._status=1,G._result=oe)},function(oe){(G._status===0||G._status===-1)&&(G._status=2,G._result=oe)}),G._status===-1&&(G._status=0,G._result=W)}if(G._status===1)return G._result.default;throw G._result}var ce={current:null},B={transition:null},J={ReactCurrentDispatcher:ce,ReactCurrentBatchConfig:B,ReactCurrentOwner:N};function Z(){throw Error("act(...) is not supported in production builds of React.")}return gn.Children={map:pe,forEach:function(G,W,oe){pe(G,function(){W.apply(this,arguments)},oe)},count:function(G){var W=0;return pe(G,function(){W++}),W},toArray:function(G){return pe(G,function(W){return W})||[]},only:function(G){if(!I(G))throw Error("React.Children.only expected to receive a single React element child.");return G}},gn.Component=w,gn.Fragment=n,gn.Profiler=i,gn.PureComponent=M,gn.StrictMode=r,gn.Suspense=l,gn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=J,gn.act=Z,gn.cloneElement=function(G,W,oe){if(G==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+G+".");var se=x({},G.props),le=G.key,Me=G.ref,Se=G._owner;if(W!=null){if(W.ref!==void 0&&(Me=W.ref,Se=N.current),W.key!==void 0&&(le=""+W.key),G.type&&G.type.defaultProps)var $e=G.type.defaultProps;for(Ee in W)L.call(W,Ee)&&!D.hasOwnProperty(Ee)&&(se[Ee]=W[Ee]===void 0&&$e!==void 0?$e[Ee]:W[Ee])}var Ee=arguments.length-2;if(Ee===1)se.children=oe;else if(1<Ee){$e=Array(Ee);for(var Ge=0;Ge<Ee;Ge++)$e[Ge]=arguments[Ge+2];se.children=$e}return{$$typeof:t,type:G.type,key:le,ref:Me,props:se,_owner:Se}},gn.createContext=function(G){return G={$$typeof:a,_currentValue:G,_currentValue2:G,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},G.Provider={$$typeof:s,_context:G},G.Consumer=G},gn.createElement=F,gn.createFactory=function(G){var W=F.bind(null,G);return W.type=G,W},gn.createRef=function(){return{current:null}},gn.forwardRef=function(G){return{$$typeof:o,render:G}},gn.isValidElement=I,gn.lazy=function(G){return{$$typeof:d,_payload:{_status:-1,_result:G},_init:ee}},gn.memo=function(G,W){return{$$typeof:c,type:G,compare:W===void 0?null:W}},gn.startTransition=function(G){var W=B.transition;B.transition={};try{G()}finally{B.transition=W}},gn.unstable_act=Z,gn.useCallback=function(G,W){return ce.current.useCallback(G,W)},gn.useContext=function(G){return ce.current.useContext(G)},gn.useDebugValue=function(){},gn.useDeferredValue=function(G){return ce.current.useDeferredValue(G)},gn.useEffect=function(G,W){return ce.current.useEffect(G,W)},gn.useId=function(){return ce.current.useId()},gn.useImperativeHandle=function(G,W,oe){return ce.current.useImperativeHandle(G,W,oe)},gn.useInsertionEffect=function(G,W){return ce.current.useInsertionEffect(G,W)},gn.useLayoutEffect=function(G,W){return ce.current.useLayoutEffect(G,W)},gn.useMemo=function(G,W){return ce.current.useMemo(G,W)},gn.useReducer=function(G,W,oe){return ce.current.useReducer(G,W,oe)},gn.useRef=function(G){return ce.current.useRef(G)},gn.useState=function(G){return ce.current.useState(G)},gn.useSyncExternalStore=function(G,W,oe){return ce.current.useSyncExternalStore(G,W,oe)},gn.useTransition=function(){return ce.current.useTransition()},gn.version="18.3.1",gn}var XN;function ep(){return XN||(XN=1,oE.exports=G8()),oE.exports}/**
|
||
* @license React
|
||
* react-jsx-runtime.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 qN;function W8(){if(qN)return o0;qN=1;var t=ep(),e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function a(o,l,c){var d,f={},p=null,y=null;c!==void 0&&(p=""+c),l.key!==void 0&&(p=""+l.key),l.ref!==void 0&&(y=l.ref);for(d in l)r.call(l,d)&&!s.hasOwnProperty(d)&&(f[d]=l[d]);if(o&&o.defaultProps)for(d in l=o.defaultProps,l)f[d]===void 0&&(f[d]=l[d]);return{$$typeof:e,type:o,key:p,ref:y,props:f,_owner:i.current}}return o0.Fragment=n,o0.jsx=a,o0.jsxs=a,o0}var KN;function $8(){return KN||(KN=1,aE.exports=W8()),aE.exports}var g=$8(),P=ep();const t5=Qw(P),Jw=V8({__proto__:null,default:t5},[P]);var yb={},lE={exports:{}},Xs={},cE={exports:{}},uE={};/**
|
||
* @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 YN;function X8(){return YN||(YN=1,(function(t){function e(B,J){var Z=B.length;B.push(J);e:for(;0<Z;){var G=Z-1>>>1,W=B[G];if(0<i(W,J))B[G]=J,B[Z]=W,Z=G;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var J=B[0],Z=B.pop();if(Z!==J){B[0]=Z;e:for(var G=0,W=B.length,oe=W>>>1;G<oe;){var se=2*(G+1)-1,le=B[se],Me=se+1,Se=B[Me];if(0>i(le,Z))Me<W&&0>i(Se,le)?(B[G]=Se,B[Me]=Z,G=Me):(B[G]=le,B[se]=Z,G=se);else if(Me<W&&0>i(Se,Z))B[G]=Se,B[Me]=Z,G=Me;else break e}}return J}function i(B,J){var Z=B.sortIndex-J.sortIndex;return Z!==0?Z:B.id-J.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();t.unstable_now=function(){return a.now()-o}}var l=[],c=[],d=1,f=null,p=3,y=!1,x=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(B){for(var 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,ee(L);else{var J=n(c);J!==null&&ce(C,J.startTime-B)}}function L(B,J){x=!1,S&&(S=!1,b(F),F=-1),y=!0;var Z=p;try{for(T(J),f=n(l);f!==null&&(!(f.expirationTime>J)||B&&!U());){var G=f.callback;if(typeof G=="function"){f.callback=null,p=f.priorityLevel;var W=G(f.expirationTime<=J);J=t.unstable_now(),typeof W=="function"?f.callback=W:f===n(l)&&r(l),T(J)}else r(l);f=n(l)}if(f!==null)var oe=!0;else{var se=n(c);se!==null&&ce(C,se.startTime-J),oe=!1}return oe}finally{f=null,p=Z,y=!1}}var N=!1,D=null,F=-1,V=5,I=-1;function U(){return!(t.unstable_now()-I<V)}function X(){if(D!==null){var B=t.unstable_now();I=B;var J=!0;try{J=D(!0,B)}finally{J?te():(N=!1,D=null)}}else N=!1}var te;if(typeof M=="function")te=function(){M(X)};else if(typeof MessageChannel<"u"){var re=new MessageChannel,pe=re.port2;re.port1.onmessage=X,te=function(){pe.postMessage(null)}}else te=function(){w(X,0)};function ee(B){D=B,N||(N=!0,te())}function ce(B,J){F=w(function(){B(t.unstable_now())},J)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(B){B.callback=null},t.unstable_continueExecution=function(){x||y||(x=!0,ee(L))},t.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<B?Math.floor(1e3/B):5},t.unstable_getCurrentPriorityLevel=function(){return p},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(B){switch(p){case 1:case 2:case 3:var J=3;break;default:J=p}var Z=p;p=J;try{return B()}finally{p=Z}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(B,J){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var Z=p;p=B;try{return J()}finally{p=Z}},t.unstable_scheduleCallback=function(B,J,Z){var G=t.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?G+Z:G):Z=G,B){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=Z+W,B={id:d++,callback:J,priorityLevel:B,startTime:Z,expirationTime:W,sortIndex:-1},Z>G?(B.sortIndex=Z,e(c,B),n(l)===null&&B===n(c)&&(S?(b(F),F=-1):S=!0,ce(C,Z-G))):(B.sortIndex=W,e(l,B),x||y||(x=!0,ee(L))),B},t.unstable_shouldYield=U,t.unstable_wrapCallback=function(B){var J=p;return function(){var Z=p;p=J;try{return B.apply(this,arguments)}finally{p=Z}}}})(uE)),uE}var ZN;function q8(){return ZN||(ZN=1,cE.exports=X8()),cE.exports}/**
|
||
* @license React
|
||
* react-dom.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var QN;function K8(){if(QN)return Xs;QN=1;var t=ep(),e=q8();function n(u){for(var h="https://reactjs.org/docs/error-decoder.html?invariant="+u,_=1;_<arguments.length;_++)h+="&args[]="+encodeURIComponent(arguments[_]);return"Minified React error #"+u+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,i={};function s(u,h){a(u,h),a(u+"Capture",h)}function a(u,h){for(i[u]=h,u=0;u<h.length;u++)r.add(h[u])}var o=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),l=Object.prototype.hasOwnProperty,c=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,d={},f={};function p(u){return l.call(f,u)?!0:l.call(d,u)?!1:c.test(u)?f[u]=!0:(d[u]=!0,!1)}function y(u,h,_,A){if(_!==null&&_.type===0)return!1;switch(typeof h){case"function":case"symbol":return!0;case"boolean":return A?!1:_!==null?!_.acceptsBooleans:(u=u.toLowerCase().slice(0,5),u!=="data-"&&u!=="aria-");default:return!1}}function x(u,h,_,A){if(h===null||typeof h>"u"||y(u,h,_,A))return!0;if(A)return!1;if(_!==null)switch(_.type){case 3:return!h;case 4:return h===!1;case 5:return isNaN(h);case 6:return isNaN(h)||1>h}return!1}function S(u,h,_,A,k,j,$){this.acceptsBooleans=h===2||h===3||h===4,this.attributeName=A,this.attributeNamespace=k,this.mustUseProperty=_,this.propertyName=u,this.type=h,this.sanitizeURL=j,this.removeEmptyString=$}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(u){w[u]=new S(u,0,!1,u,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(u){var h=u[0];w[h]=new S(h,1,!1,u[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(u){w[u]=new S(u,2,!1,u.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(u){w[u]=new S(u,2,!1,u,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(u){w[u]=new S(u,3,!1,u.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(u){w[u]=new S(u,3,!0,u,null,!1,!1)}),["capture","download"].forEach(function(u){w[u]=new S(u,4,!1,u,null,!1,!1)}),["cols","rows","size","span"].forEach(function(u){w[u]=new S(u,6,!1,u,null,!1,!1)}),["rowSpan","start"].forEach(function(u){w[u]=new S(u,5,!1,u.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function M(u){return u[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(u){var h=u.replace(b,M);w[h]=new S(h,1,!1,u,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(u){var h=u.replace(b,M);w[h]=new S(h,1,!1,u,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(u){var h=u.replace(b,M);w[h]=new S(h,1,!1,u,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(u){w[u]=new S(u,1,!1,u.toLowerCase(),null,!1,!1)}),w.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(u){w[u]=new S(u,1,!1,u.toLowerCase(),null,!0,!0)});function T(u,h,_,A){var k=w.hasOwnProperty(h)?w[h]:null;(k!==null?k.type!==0:A||!(2<h.length)||h[0]!=="o"&&h[0]!=="O"||h[1]!=="n"&&h[1]!=="N")&&(x(h,_,k,A)&&(_=null),A||k===null?p(h)&&(_===null?u.removeAttribute(h):u.setAttribute(h,""+_)):k.mustUseProperty?u[k.propertyName]=_===null?k.type===3?!1:"":_:(h=k.attributeName,A=k.attributeNamespace,_===null?u.removeAttribute(h):(k=k.type,_=k===3||k===4&&_===!0?"":""+_,A?u.setAttributeNS(A,h,_):u.setAttribute(h,_))))}var C=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,L=Symbol.for("react.element"),N=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),F=Symbol.for("react.strict_mode"),V=Symbol.for("react.profiler"),I=Symbol.for("react.provider"),U=Symbol.for("react.context"),X=Symbol.for("react.forward_ref"),te=Symbol.for("react.suspense"),re=Symbol.for("react.suspense_list"),pe=Symbol.for("react.memo"),ee=Symbol.for("react.lazy"),ce=Symbol.for("react.offscreen"),B=Symbol.iterator;function J(u){return u===null||typeof u!="object"?null:(u=B&&u[B]||u["@@iterator"],typeof u=="function"?u:null)}var Z=Object.assign,G;function W(u){if(G===void 0)try{throw Error()}catch(_){var h=_.stack.trim().match(/\n( *(at )?)/);G=h&&h[1]||""}return`
|
||
`+G+u}var oe=!1;function se(u,h){if(!u||oe)return"";oe=!0;var _=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(h)if(h=function(){throw Error()},Object.defineProperty(h.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(h,[])}catch(Ie){var A=Ie}Reflect.construct(u,[],h)}else{try{h.call()}catch(Ie){A=Ie}u.call(h.prototype)}else{try{throw Error()}catch(Ie){A=Ie}u()}}catch(Ie){if(Ie&&A&&typeof Ie.stack=="string"){for(var k=Ie.stack.split(`
|
||
`),j=A.stack.split(`
|
||
`),$=k.length-1,ae=j.length-1;1<=$&&0<=ae&&k[$]!==j[ae];)ae--;for(;1<=$&&0<=ae;$--,ae--)if(k[$]!==j[ae]){if($!==1||ae!==1)do if($--,ae--,0>ae||k[$]!==j[ae]){var me=`
|
||
`+k[$].replace(" at new "," at ");return u.displayName&&me.includes("<anonymous>")&&(me=me.replace("<anonymous>",u.displayName)),me}while(1<=$&&0<=ae);break}}}finally{oe=!1,Error.prepareStackTrace=_}return(u=u?u.displayName||u.name:"")?W(u):""}function le(u){switch(u.tag){case 5:return W(u.type);case 16:return W("Lazy");case 13:return W("Suspense");case 19:return W("SuspenseList");case 0:case 2:case 15:return u=se(u.type,!1),u;case 11:return u=se(u.type.render,!1),u;case 1:return u=se(u.type,!0),u;default:return""}}function Me(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 te:return"Suspense";case re:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case U:return(u.displayName||"Context")+".Consumer";case I:return(u._context.displayName||"Context")+".Provider";case X:var h=u.render;return u=u.displayName,u||(u=h.displayName||h.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case pe:return h=u.displayName||null,h!==null?h:Me(u.type)||"Memo";case ee:h=u._payload,u=u._init;try{return Me(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 Me(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 $e(u){switch(typeof u){case"boolean":case"number":case"string":case"undefined":return u;case"object":return u;default:return""}}function Ee(u){var h=u.type;return(u=u.nodeName)&&u.toLowerCase()==="input"&&(h==="checkbox"||h==="radio")}function Ge(u){var h=Ee(u)?"checked":"value",_=Object.getOwnPropertyDescriptor(u.constructor.prototype,h),A=""+u[h];if(!u.hasOwnProperty(h)&&typeof _<"u"&&typeof _.get=="function"&&typeof _.set=="function"){var k=_.get,j=_.set;return Object.defineProperty(u,h,{configurable:!0,get:function(){return k.call(this)},set:function($){A=""+$,j.call(this,$)}}),Object.defineProperty(u,h,{enumerable:_.enumerable}),{getValue:function(){return A},setValue:function($){A=""+$},stopTracking:function(){u._valueTracker=null,delete u[h]}}}}function Xe(u){u._valueTracker||(u._valueTracker=Ge(u))}function fe(u){if(!u)return!1;var h=u._valueTracker;if(!h)return!0;var _=h.getValue(),A="";return u&&(A=Ee(u)?u.checked?"true":"false":u.value),u=A,u!==_?(h.setValue(u),!0):!1}function 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 Ve(u,h){var _=h.checked;return Z({},h,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:_??u._wrapperState.initialChecked})}function Le(u,h){var _=h.defaultValue==null?"":h.defaultValue,A=h.checked!=null?h.checked:h.defaultChecked;_=$e(h.value!=null?h.value:_),u._wrapperState={initialChecked:A,initialValue:_,controlled:h.type==="checkbox"||h.type==="radio"?h.checked!=null:h.value!=null}}function We(u,h){h=h.checked,h!=null&&T(u,"checked",h,!1)}function Je(u,h){We(u,h);var _=$e(h.value),A=h.type;if(_!=null)A==="number"?(_===0&&u.value===""||u.value!=_)&&(u.value=""+_):u.value!==""+_&&(u.value=""+_);else if(A==="submit"||A==="reset"){u.removeAttribute("value");return}h.hasOwnProperty("value")?De(u,h.type,_):h.hasOwnProperty("defaultValue")&&De(u,h.type,$e(h.defaultValue)),h.checked==null&&h.defaultChecked!=null&&(u.defaultChecked=!!h.defaultChecked)}function de(u,h,_){if(h.hasOwnProperty("value")||h.hasOwnProperty("defaultValue")){var A=h.type;if(!(A!=="submit"&&A!=="reset"||h.value!==void 0&&h.value!==null))return;h=""+u._wrapperState.initialValue,_||h===u.value||(u.value=h),u.defaultValue=h}_=u.name,_!==""&&(u.name=""),u.defaultChecked=!!u._wrapperState.initialChecked,_!==""&&(u.name=_)}function De(u,h,_){(h!=="number"||Q(u.ownerDocument)!==u)&&(_==null?u.defaultValue=""+u._wrapperState.initialValue:u.defaultValue!==""+_&&(u.defaultValue=""+_))}var K=Array.isArray;function H(u,h,_,A){if(u=u.options,h){h={};for(var k=0;k<_.length;k++)h["$"+_[k]]=!0;for(_=0;_<u.length;_++)k=h.hasOwnProperty("$"+u[_].value),u[_].selected!==k&&(u[_].selected=k),k&&A&&(u[_].defaultSelected=!0)}else{for(_=""+$e(_),h=null,k=0;k<u.length;k++){if(u[k].value===_){u[k].selected=!0,A&&(u[k].defaultSelected=!0);return}h!==null||u[k].disabled||(h=u[k])}h!==null&&(h.selected=!0)}}function xe(u,h){if(h.dangerouslySetInnerHTML!=null)throw Error(n(91));return Z({},h,{value:void 0,defaultValue:void 0,children:""+u._wrapperState.initialValue})}function je(u,h){var _=h.value;if(_==null){if(_=h.children,h=h.defaultValue,_!=null){if(h!=null)throw Error(n(92));if(K(_)){if(1<_.length)throw Error(n(93));_=_[0]}h=_}h==null&&(h=""),_=h}u._wrapperState={initialValue:$e(_)}}function Oe(u,h){var _=$e(h.value),A=$e(h.defaultValue);_!=null&&(_=""+_,_!==u.value&&(u.value=_),h.defaultValue==null&&u.defaultValue!==_&&(u.defaultValue=_)),A!=null&&(u.defaultValue=""+A)}function Fe(u){var h=u.textContent;h===u._wrapperState.initialValue&&h!==""&&h!==null&&(u.value=h)}function xt(u){switch(u){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function rt(u,h){return u==null||u==="http://www.w3.org/1999/xhtml"?xt(h):u==="http://www.w3.org/2000/svg"&&h==="foreignObject"?"http://www.w3.org/1999/xhtml":u}var ft,zt=(function(u){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(h,_,A,k){MSApp.execUnsafeLocalFunction(function(){return u(h,_,A,k)})}:u})(function(u,h){if(u.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in u)u.innerHTML=h;else{for(ft=ft||document.createElement("div"),ft.innerHTML="<svg>"+h.valueOf().toString()+"</svg>",h=ft.firstChild;u.firstChild;)u.removeChild(u.firstChild);for(;h.firstChild;)u.appendChild(h.firstChild)}});function Ye(u,h){if(h){var _=u.firstChild;if(_&&_===u.lastChild&&_.nodeType===3){_.nodeValue=h;return}}u.textContent=h}var ne={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},tt=["Webkit","ms","Moz","O"];Object.keys(ne).forEach(function(u){tt.forEach(function(h){h=h+u.charAt(0).toUpperCase()+u.substring(1),ne[h]=ne[u]})});function Mt(u,h,_){return h==null||typeof h=="boolean"||h===""?"":_||typeof h!="number"||h===0||ne.hasOwnProperty(u)&&ne[u]?(""+h).trim():h+"px"}function vt(u,h){u=u.style;for(var _ in h)if(h.hasOwnProperty(_)){var A=_.indexOf("--")===0,k=Mt(_,h[_],A);_==="float"&&(_="cssFloat"),A?u.setProperty(_,k):u[_]=k}}var Zt=Z({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 he(u,h){if(h){if(Zt[u]&&(h.children!=null||h.dangerouslySetInnerHTML!=null))throw Error(n(137,u));if(h.dangerouslySetInnerHTML!=null){if(h.children!=null)throw Error(n(60));if(typeof h.dangerouslySetInnerHTML!="object"||!("__html"in h.dangerouslySetInnerHTML))throw Error(n(61))}if(h.style!=null&&typeof h.style!="object")throw Error(n(62))}}function Ke(u,h){if(u.indexOf("-")===-1)return typeof h.is=="string";switch(u){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ue=null;function Ze(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var Pe=null,Be=null,at=null;function pt(u){if(u=mo(u)){if(typeof Pe!="function")throw Error(n(280));var h=u.stateNode;h&&(h=Wp(h),Pe(u.stateNode,u.type,h))}}function Jt(u){Be?at?at.push(u):at=[u]:Be=u}function pn(){if(Be){var u=Be,h=at;if(at=Be=null,pt(u),h)for(u=0;u<h.length;u++)pt(h[u])}}function Fn(u,h){return u(h)}function en(){}var Vn=!1;function pr(u,h,_){if(Vn)return u(h,_);Vn=!0;try{return Fn(u,h,_)}finally{Vn=!1,(Be!==null||at!==null)&&(en(),pn())}}function Mi(u,h){var _=u.stateNode;if(_===null)return null;var A=Wp(_);if(A===null)return null;_=A[h];e:switch(h){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(A=!A.disabled)||(u=u.type,A=!(u==="button"||u==="input"||u==="select"||u==="textarea")),u=!A;break e;default:u=!1}if(u)return null;if(_&&typeof _!="function")throw Error(n(231,h,typeof _));return _}var ro=!1;if(o)try{var Ei={};Object.defineProperty(Ei,"passive",{get:function(){ro=!0}}),window.addEventListener("test",Ei,Ei),window.removeEventListener("test",Ei,Ei)}catch{ro=!1}function Yo(u,h,_,A,k,j,$,ae,me){var Ie=Array.prototype.slice.call(arguments,3);try{h.apply(_,Ie)}catch(et){this.onError(et)}}var Is=!1,io=null,Ai=!1,Ca=null,so={onError:function(u){Is=!0,io=u}};function du(u,h,_,A,k,j,$,ae,me){Is=!1,io=null,Yo.apply(so,arguments)}function fu(u,h,_,A,k,j,$,ae,me){if(du.apply(this,arguments),Is){if(Is){var Ie=io;Is=!1,io=null}else throw Error(n(198));Ai||(Ai=!0,Ca=Ie)}}function Pa(u){var h=u,_=u;if(u.alternate)for(;h.return;)h=h.return;else{u=h;do h=u,(h.flags&4098)!==0&&(_=h.return),u=h.return;while(u)}return h.tag===3?_:null}function hu(u){if(u.tag===13){var h=u.memoizedState;if(h===null&&(u=u.alternate,u!==null&&(h=u.memoizedState)),h!==null)return h.dehydrated}return null}function Wl(u){if(Pa(u)!==u)throw Error(n(188))}function Y(u){var h=u.alternate;if(!h){if(h=Pa(u),h===null)throw Error(n(188));return h!==u?null:u}for(var _=u,A=h;;){var k=_.return;if(k===null)break;var j=k.alternate;if(j===null){if(A=k.return,A!==null){_=A;continue}break}if(k.child===j.child){for(j=k.child;j;){if(j===_)return Wl(k),u;if(j===A)return Wl(k),h;j=j.sibling}throw Error(n(188))}if(_.return!==A.return)_=k,A=j;else{for(var $=!1,ae=k.child;ae;){if(ae===_){$=!0,_=k,A=j;break}if(ae===A){$=!0,A=k,_=j;break}ae=ae.sibling}if(!$){for(ae=j.child;ae;){if(ae===_){$=!0,_=j,A=k;break}if(ae===A){$=!0,A=j,_=k;break}ae=ae.sibling}if(!$)throw Error(n(189))}}if(_.alternate!==A)throw Error(n(190))}if(_.tag!==3)throw Error(n(188));return _.stateNode.current===_?u:h}function be(u){return u=Y(u),u!==null?Te(u):null}function Te(u){if(u.tag===5||u.tag===6)return u;for(u=u.child;u!==null;){var h=Te(u);if(h!==null)return h;u=u.sibling}return null}var Ne=e.unstable_scheduleCallback,we=e.unstable_cancelCallback,it=e.unstable_shouldYield,yt=e.unstable_requestPaint,ct=e.unstable_now,Et=e.unstable_getCurrentPriorityLevel,Ut=e.unstable_ImmediatePriority,Ht=e.unstable_UserBlockingPriority,Nt=e.unstable_NormalPriority,Sn=e.unstable_LowPriority,Mn=e.unstable_IdlePriority,yn=null,Kt=null;function jt(u){if(Kt&&typeof Kt.onCommitFiberRoot=="function")try{Kt.onCommitFiberRoot(yn,u,void 0,(u.current.flags&128)===128)}catch{}}var mt=Math.clz32?Math.clz32:Rr,xn=Math.log,tn=Math.LN2;function Rr(u){return u>>>=0,u===0?32:31-(xn(u)/tn|0)|0}var li=64,In=4194304;function Ls(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 Gn(u,h){var _=u.pendingLanes;if(_===0)return 0;var A=0,k=u.suspendedLanes,j=u.pingedLanes,$=_&268435455;if($!==0){var ae=$&~k;ae!==0?A=Ls(ae):(j&=$,j!==0&&(A=Ls(j)))}else $=_&~k,$!==0?A=Ls($):j!==0&&(A=Ls(j));if(A===0)return 0;if(h!==0&&h!==A&&(h&k)===0&&(k=A&-A,j=h&-h,k>=j||k===16&&(j&4194240)!==0))return h;if((A&4)!==0&&(A|=_&16),h=u.entangledLanes,h!==0)for(u=u.entanglements,h&=A;0<h;)_=31-mt(h),k=1<<_,A|=u[_],h&=~k;return A}function ra(u,h){switch(u){case 1:case 2:case 4:return h+250;case 8:case 16:case 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 h+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Zo(u,h){for(var _=u.suspendedLanes,A=u.pingedLanes,k=u.expirationTimes,j=u.pendingLanes;0<j;){var $=31-mt(j),ae=1<<$,me=k[$];me===-1?((ae&_)===0||(ae&A)!==0)&&(k[$]=ra(ae,h)):me<=h&&(u.expiredLanes|=ae),j&=~ae}}function Xr(u){return u=u.pendingLanes&-1073741825,u!==0?u:u&1073741824?1073741824:0}function ci(){var u=li;return li<<=1,(li&4194240)===0&&(li=64),u}function Hd(u){for(var h=[],_=0;31>_;_++)h.push(u);return h}function Qo(u,h,_){u.pendingLanes|=h,h!==536870912&&(u.suspendedLanes=0,u.pingedLanes=0),u=u.eventTimes,h=31-mt(h),u[h]=_}function PM(u,h){var _=u.pendingLanes&~h;u.pendingLanes=h,u.suspendedLanes=0,u.pingedLanes=0,u.expiredLanes&=h,u.mutableReadLanes&=h,u.entangledLanes&=h,h=u.entanglements;var A=u.eventTimes;for(u=u.expirationTimes;0<_;){var k=31-mt(_),j=1<<k;h[k]=0,A[k]=-1,u[k]=-1,_&=~j}}function pu(u,h){var _=u.entangledLanes|=h;for(u=u.entanglements;_;){var A=31-mt(_),k=1<<A;k&h|u[A]&h&&(u[A]|=h),_&=~k}}var Cn=0;function mu(u){return u&=-u,1<u?4<u?(u&268435455)!==0?16:536870912:4:1}var Vd,hv,Ex,hp,pp,$l=!1,mp=[],Ra=null,un=null,ao=null,Xl=new Map,gu=new Map,Jo=[],RM="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Nr(u,h){switch(u){case"focusin":case"focusout":Ra=null;break;case"dragenter":case"dragleave":un=null;break;case"mouseover":case"mouseout":ao=null;break;case"pointerover":case"pointerout":Xl.delete(h.pointerId);break;case"gotpointercapture":case"lostpointercapture":gu.delete(h.pointerId)}}function ql(u,h,_,A,k,j){return u===null||u.nativeEvent!==j?(u={blockedOn:h,domEventName:_,eventSystemFlags:A,nativeEvent:j,targetContainers:[k]},h!==null&&(h=mo(h),h!==null&&hv(h)),u):(u.eventSystemFlags|=A,h=u.targetContainers,k!==null&&h.indexOf(k)===-1&&h.push(k),u)}function NM(u,h,_,A,k){switch(h){case"focusin":return Ra=ql(Ra,u,h,_,A,k),!0;case"dragenter":return un=ql(un,u,h,_,A,k),!0;case"mouseover":return ao=ql(ao,u,h,_,A,k),!0;case"pointerover":var j=k.pointerId;return Xl.set(j,ql(Xl.get(j)||null,u,h,_,A,k)),!0;case"gotpointercapture":return j=k.pointerId,gu.set(j,ql(gu.get(j)||null,u,h,_,A,k)),!0}return!1}function gp(u){var h=al(u.target);if(h!==null){var _=Pa(h);if(_!==null){if(h=_.tag,h===13){if(h=hu(_),h!==null){u.blockedOn=h,pp(u.priority,function(){Ex(_)});return}}else if(h===3&&_.stateNode.current.memoizedState.isDehydrated){u.blockedOn=_.tag===3?_.stateNode.containerInfo:null;return}}}u.blockedOn=null}function vp(u){if(u.blockedOn!==null)return!1;for(var h=u.targetContainers;0<h.length;){var _=Ds(u.domEventName,u.eventSystemFlags,h[0],u.nativeEvent);if(_===null){_=u.nativeEvent;var A=new _.constructor(_.type,_);ue=A,_.target.dispatchEvent(A),ue=null}else return h=mo(_),h!==null&&hv(h),u.blockedOn=_,!1;h.shift()}return!0}function Gd(u,h,_){vp(u)&&_.delete(h)}function Na(){$l=!1,Ra!==null&&vp(Ra)&&(Ra=null),un!==null&&vp(un)&&(un=null),ao!==null&&vp(ao)&&(ao=null),Xl.forEach(Gd),gu.forEach(Gd)}function Wd(u,h){u.blockedOn===h&&(u.blockedOn=null,$l||($l=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Na)))}function $d(u){function h(k){return Wd(k,u)}if(0<mp.length){Wd(mp[0],u);for(var _=1;_<mp.length;_++){var A=mp[_];A.blockedOn===u&&(A.blockedOn=null)}}for(Ra!==null&&Wd(Ra,u),un!==null&&Wd(un,u),ao!==null&&Wd(ao,u),Xl.forEach(h),gu.forEach(h),_=0;_<Jo.length;_++)A=Jo[_],A.blockedOn===u&&(A.blockedOn=null);for(;0<Jo.length&&(_=Jo[0],_.blockedOn===null);)gp(_),_.blockedOn===null&&Jo.shift()}var Ti=C.ReactCurrentBatchConfig,Os=!0;function yp(u,h,_,A){var k=Cn,j=Ti.transition;Ti.transition=null;try{Cn=1,xp(u,h,_,A)}finally{Cn=k,Ti.transition=j}}function pv(u,h,_,A){var k=Cn,j=Ti.transition;Ti.transition=null;try{Cn=4,xp(u,h,_,A)}finally{Cn=k,Ti.transition=j}}function xp(u,h,_,A){if(Os){var k=Ds(u,h,_,A);if(k===null)Fp(u,h,A,bp,_),Nr(u,A);else if(NM(k,u,h,_,A))A.stopPropagation();else if(Nr(u,A),h&4&&-1<RM.indexOf(u)){for(;k!==null;){var j=mo(k);if(j!==null&&Vd(j),j=Ds(u,h,_,A),j===null&&Fp(u,h,A,bp,_),j===k)break;k=j}k!==null&&A.stopPropagation()}else Fp(u,h,A,null,_)}}var bp=null;function Ds(u,h,_,A){if(bp=null,u=Ze(A),u=al(u),u!==null)if(h=Pa(u),h===null)u=null;else if(_=h.tag,_===13){if(u=hu(h),u!==null)return u;u=null}else if(_===3){if(h.stateNode.current.memoizedState.isDehydrated)return h.tag===3?h.stateNode.containerInfo:null;u=null}else h!==u&&(u=null);return bp=u,null}function Ax(u){switch(u){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Et()){case Ut:return 1;case Ht:return 4;case Nt:case Sn:return 16;case Mn:return 536870912;default:return 16}default:return 16}}var ia=null,mv=null,$i=null;function Xd(){if($i)return $i;var u,h=mv,_=h.length,A,k="value"in ia?ia.value:ia.textContent,j=k.length;for(u=0;u<_&&h[u]===k[u];u++);var $=_-u;for(A=1;A<=$&&h[_-A]===k[j-A];A++);return $i=k.slice(u,1<A?1-A:void 0)}function Kl(u){var h=u.keyCode;return"charCode"in u?(u=u.charCode,u===0&&h===13&&(u=13)):u=h,u===10&&(u=13),32<=u||u===13?u:0}function oo(){return!0}function _p(){return!1}function Ci(u){function h(_,A,k,j,$){this._reactName=_,this._targetInst=k,this.type=A,this.nativeEvent=j,this.target=$,this.currentTarget=null;for(var ae in u)u.hasOwnProperty(ae)&&(_=u[ae],this[ae]=_?_(j):j[ae]);return this.isDefaultPrevented=(j.defaultPrevented!=null?j.defaultPrevented:j.returnValue===!1)?oo:_p,this.isPropagationStopped=_p,this}return Z(h.prototype,{preventDefault:function(){this.defaultPrevented=!0;var _=this.nativeEvent;_&&(_.preventDefault?_.preventDefault():typeof _.returnValue!="unknown"&&(_.returnValue=!1),this.isDefaultPrevented=oo)},stopPropagation:function(){var _=this.nativeEvent;_&&(_.stopPropagation?_.stopPropagation():typeof _.cancelBubble!="unknown"&&(_.cancelBubble=!0),this.isPropagationStopped=oo)},persist:function(){},isPersistent:oo}),h}var Yl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(u){return u.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},qd=Ci(Yl),Zl=Z({},Yl,{view:0,detail:0}),vu=Ci(Zl),Xi,js,Us,yu=Z({},Zl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:tl,button:0,buttons:0,relatedTarget:function(u){return u.relatedTarget===void 0?u.fromElement===u.srcElement?u.toElement:u.fromElement:u.relatedTarget},movementX:function(u){return"movementX"in u?u.movementX:(u!==Us&&(Us&&u.type==="mousemove"?(Xi=u.screenX-Us.screenX,js=u.screenY-Us.screenY):js=Xi=0,Us=u),Xi)},movementY:function(u){return"movementY"in u?u.movementY:js}}),gv=Ci(yu),lo=Z({},yu,{dataTransfer:0}),el=Ci(lo),wp=Z({},Zl,{relatedTarget:0}),Sp=Ci(wp),Mp=Z({},Yl,{animationName:0,elapsedTime:0,pseudoElement:0}),Tx=Ci(Mp),Cx=Z({},Yl,{clipboardData:function(u){return"clipboardData"in u?u.clipboardData:window.clipboardData}}),vv=Ci(Cx),Ep=Z({},Yl,{data:0}),yv=Ci(Ep),Px={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Rx={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},xv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function xu(u){var h=this.nativeEvent;return h.getModifierState?h.getModifierState(u):(u=xv[u])?!!h[u]:!1}function tl(){return xu}var Ap=Z({},Zl,{key:function(u){if(u.key){var h=Px[u.key]||u.key;if(h!=="Unidentified")return h}return u.type==="keypress"?(u=Kl(u),u===13?"Enter":String.fromCharCode(u)):u.type==="keydown"||u.type==="keyup"?Rx[u.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:tl,charCode:function(u){return u.type==="keypress"?Kl(u):0},keyCode:function(u){return u.type==="keydown"||u.type==="keyup"?u.keyCode:0},which:function(u){return u.type==="keypress"?Kl(u):u.type==="keydown"||u.type==="keyup"?u.keyCode:0}}),Tp=Ci(Ap),Fs=Z({},yu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),us=Ci(Fs),Ql=Z({},Zl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:tl}),co=Ci(Ql),uo=Z({},Yl,{propertyName:0,elapsedTime:0,pseudoElement:0}),Jl=Ci(uo),Nx=Z({},yu,{deltaX:function(u){return"deltaX"in u?u.deltaX:"wheelDeltaX"in u?-u.wheelDeltaX:0},deltaY:function(u){return"deltaY"in u?u.deltaY:"wheelDeltaY"in u?-u.wheelDeltaY:"wheelDelta"in u?-u.wheelDelta:0},deltaZ:0,deltaMode:0}),bv=Ci(Nx),_v=[9,13,27,32],Pi=o&&"CompositionEvent"in window,qr=null;o&&"documentMode"in document&&(qr=document.documentMode);var Qn=o&&"TextEvent"in window&&!qr,bu=o&&(!Pi||qr&&8<qr&&11>=qr),zs=" ",wv=!1;function Sv(u,h){switch(u){case"keyup":return _v.indexOf(h.keyCode)!==-1;case"keydown":return h.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Cp(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var nl=!1;function kx(u,h){switch(u){case"compositionend":return Cp(h);case"keypress":return h.which!==32?null:(wv=!0,zs);case"textInput":return u=h.data,u===zs&&wv?null:u;default:return null}}function Kd(u,h){if(nl)return u==="compositionend"||!Pi&&Sv(u,h)?(u=Xd(),$i=mv=ia=null,nl=!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.char.length)return h.char;if(h.which)return String.fromCharCode(h.which)}return null;case"compositionend":return bu&&h.locale!=="ko"?null:h.data;default:return null}}var _u={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Pp(u){var h=u&&u.nodeName&&u.nodeName.toLowerCase();return h==="input"?!!_u[u.type]:h==="textarea"}function wu(u,h,_,A){Jt(A),h=zp(h,"onChange"),0<h.length&&(_=new qd("onChange","change",null,_,A),u.push({event:_,listeners:h}))}var rl=null,Su=null;function Ix(u){Tu(u,0)}function fo(u){var h=mr(u);if(fe(h))return u}function Lx(u,h){if(u==="change")return h}var Mu=!1;if(o){var qi;if(o){var ec="oninput"in document;if(!ec){var tc=document.createElement("div");tc.setAttribute("oninput","return;"),ec=typeof tc.oninput=="function"}qi=ec}else qi=!1;Mu=qi&&(!document.documentMode||9<document.documentMode)}function sa(){rl&&(rl.detachEvent("onpropertychange",Rp),Su=rl=null)}function Rp(u){if(u.propertyName==="value"&&fo(Su)){var h=[];wu(h,Su,u,Ze(u)),pr(Ix,h)}}function Eu(u,h,_){u==="focusin"?(sa(),rl=h,Su=_,rl.attachEvent("onpropertychange",Rp)):u==="focusout"&&sa()}function Ox(u){if(u==="selectionchange"||u==="keyup"||u==="keydown")return fo(Su)}function Mv(u,h){if(u==="click")return fo(h)}function nr(u,h){if(u==="input"||u==="change")return fo(h)}function Np(u,h){return u===h&&(u!==0||1/u===1/h)||u!==u&&h!==h}var ds=typeof Object.is=="function"?Object.is:Np;function nc(u,h){if(ds(u,h))return!0;if(typeof u!="object"||u===null||typeof h!="object"||h===null)return!1;var _=Object.keys(u),A=Object.keys(h);if(_.length!==A.length)return!1;for(A=0;A<_.length;A++){var k=_[A];if(!l.call(h,k)||!ds(u[k],h[k]))return!1}return!0}function Yd(u){for(;u&&u.firstChild;)u=u.firstChild;return u}function fs(u,h){var _=Yd(u);u=0;for(var A;_;){if(_.nodeType===3){if(A=u+_.textContent.length,u<=h&&A>=h)return{node:_,offset:h-u};u=A}e:{for(;_;){if(_.nextSibling){_=_.nextSibling;break e}_=_.parentNode}_=void 0}_=Yd(_)}}function rc(u,h){return u&&h?u===h?!0:u&&u.nodeType===3?!1:h&&h.nodeType===3?rc(u,h.parentNode):"contains"in u?u.contains(h):u.compareDocumentPosition?!!(u.compareDocumentPosition(h)&16):!1:!1}function rr(){for(var u=window,h=Q();h instanceof u.HTMLIFrameElement;){try{var _=typeof h.contentWindow.location.href=="string"}catch{_=!1}if(_)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=rr(),_=u.focusedElem,A=u.selectionRange;if(h!==_&&_&&_.ownerDocument&&rc(_.ownerDocument.documentElement,_)){if(A!==null&&Dr(_)){if(h=A.start,u=A.end,u===void 0&&(u=h),"selectionStart"in _)_.selectionStart=h,_.selectionEnd=Math.min(u,_.value.length);else if(u=(h=_.ownerDocument||document)&&h.defaultView||window,u.getSelection){u=u.getSelection();var k=_.textContent.length,j=Math.min(A.start,k);A=A.end===void 0?j:Math.min(A.end,k),!u.extend&&j>A&&(k=A,A=j,j=k),k=fs(_,j);var $=fs(_,A);k&&$&&(u.rangeCount!==1||u.anchorNode!==k.node||u.anchorOffset!==k.offset||u.focusNode!==$.node||u.focusOffset!==$.offset)&&(h=h.createRange(),h.setStart(k.node,k.offset),u.removeAllRanges(),j>A?(u.addRange(h),u.extend($.node,$.offset)):(h.setEnd($.node,$.offset),u.addRange(h)))}}for(h=[],u=_;u=u.parentNode;)u.nodeType===1&&h.push({element:u,left:u.scrollLeft,top:u.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_<h.length;_++)u=h[_],u.element.scrollLeft=u.left,u.element.scrollTop=u.top}}var kp=o&&"documentMode"in document&&11>=document.documentMode,ka=null,ic=null,Zd=null,Ur=!1;function Ip(u,h,_){var A=_.window===_?_.document:_.nodeType===9?_:_.ownerDocument;Ur||ka==null||ka!==Q(A)||(A=ka,"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}),Zd&&nc(Zd,A)||(Zd=A,A=zp(ic,"onSelect"),0<A.length&&(h=new qd("onSelect","select",null,h,_),u.push({event:h,listeners:A}),h.target=ka)))}function Au(u,h){var _={};return _[u.toLowerCase()]=h.toLowerCase(),_["Webkit"+u]="webkit"+h,_["Moz"+u]="moz"+h,_}var il={animationend:Au("Animation","AnimationEnd"),animationiteration:Au("Animation","AnimationIteration"),animationstart:Au("Animation","AnimationStart"),transitionend:Au("Transition","TransitionEnd")},aa={},oa={};o&&(oa=document.createElement("div").style,"AnimationEvent"in window||(delete il.animationend.animation,delete il.animationiteration.animation,delete il.animationstart.animation),"TransitionEvent"in window||delete il.transitionend.transition);function Ia(u){if(aa[u])return aa[u];if(!il[u])return u;var h=il[u],_;for(_ in h)if(h.hasOwnProperty(_)&&_ in oa)return aa[u]=h[_];return u}var Qd=Ia("animationend"),Jd=Ia("animationiteration"),Ev=Ia("animationstart"),Av=Ia("transitionend"),Tv=new Map,Cv="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function ho(u,h){Tv.set(u,h),s(h,[u])}for(var Lp=0;Lp<Cv.length;Lp++){var ef=Cv[Lp],tf=ef.toLowerCase(),Dx=ef[0].toUpperCase()+ef.slice(1);ho(tf,"on"+Dx)}ho(Qd,"onAnimationEnd"),ho(Jd,"onAnimationIteration"),ho(Ev,"onAnimationStart"),ho("dblclick","onDoubleClick"),ho("focusin","onFocus"),ho("focusout","onBlur"),ho(Av,"onTransitionEnd"),a("onMouseEnter",["mouseout","mouseover"]),a("onMouseLeave",["mouseout","mouseover"]),a("onPointerEnter",["pointerout","pointerover"]),a("onPointerLeave",["pointerout","pointerover"]),s("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),s("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),s("onBeforeInput",["compositionend","keypress","textInput","paste"]),s("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var sl="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Op=new Set("cancel close invalid load scroll toggle".split(" ").concat(sl));function Dp(u,h,_){var A=u.type||"unknown-event";u.currentTarget=_,fu(A,h,void 0,u),u.currentTarget=null}function Tu(u,h){h=(h&4)!==0;for(var _=0;_<u.length;_++){var A=u[_],k=A.event;A=A.listeners;e:{var j=void 0;if(h)for(var $=A.length-1;0<=$;$--){var ae=A[$],me=ae.instance,Ie=ae.currentTarget;if(ae=ae.listener,me!==j&&k.isPropagationStopped())break e;Dp(k,ae,Ie),j=me}else for($=0;$<A.length;$++){if(ae=A[$],me=ae.instance,Ie=ae.currentTarget,ae=ae.listener,me!==j&&k.isPropagationStopped())break e;Dp(k,ae,Ie),j=me}}}if(Ai)throw u=Ca,Ai=!1,Ca=null,u}function $n(u,h){var _=h[oc];_===void 0&&(_=h[oc]=new Set);var A=u+"__bubble";_.has(A)||(Up(h,u,2,!1),_.add(A))}function jp(u,h,_){var A=0;h&&(A|=4),Up(_,u,A,h)}var nf="_reactListening"+Math.random().toString(36).slice(2);function Cu(u){if(!u[nf]){u[nf]=!0,r.forEach(function(_){_!=="selectionchange"&&(Op.has(_)||jp(_,!1,u),jp(_,!0,u))});var h=u.nodeType===9?u:u.ownerDocument;h===null||h[nf]||(h[nf]=!0,jp("selectionchange",!1,h))}}function Up(u,h,_,A){switch(Ax(h)){case 1:var k=yp;break;case 4:k=pv;break;default:k=xp}_=k.bind(null,h,_,u),k=void 0,!ro||h!=="touchstart"&&h!=="touchmove"&&h!=="wheel"||(k=!0),A?k!==void 0?u.addEventListener(h,_,{capture:!0,passive:k}):u.addEventListener(h,_,!0):k!==void 0?u.addEventListener(h,_,{passive:k}):u.addEventListener(h,_,!1)}function Fp(u,h,_,A,k){var j=A;if((h&1)===0&&(h&2)===0&&A!==null)e:for(;;){if(A===null)return;var $=A.tag;if($===3||$===4){var ae=A.stateNode.containerInfo;if(ae===k||ae.nodeType===8&&ae.parentNode===k)break;if($===4)for($=A.return;$!==null;){var me=$.tag;if((me===3||me===4)&&(me=$.stateNode.containerInfo,me===k||me.nodeType===8&&me.parentNode===k))return;$=$.return}for(;ae!==null;){if($=al(ae),$===null)return;if(me=$.tag,me===5||me===6){A=j=$;continue e}ae=ae.parentNode}}A=A.return}pr(function(){var Ie=j,et=Ze(_),nt=[];e:{var Qe=Tv.get(u);if(Qe!==void 0){var _t=qd,Ct=u;switch(u){case"keypress":if(Kl(_)===0)break e;case"keydown":case"keyup":_t=Tp;break;case"focusin":Ct="focus",_t=Sp;break;case"focusout":Ct="blur",_t=Sp;break;case"beforeblur":case"afterblur":_t=Sp;break;case"click":if(_.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":_t=gv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":_t=el;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":_t=co;break;case Qd:case Jd:case Ev:_t=Tx;break;case Av:_t=Jl;break;case"scroll":_t=vu;break;case"wheel":_t=bv;break;case"copy":case"cut":case"paste":_t=vv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":_t=us}var kt=(h&4)!==0,Ir=!kt&&u==="scroll",Ae=kt?Qe!==null?Qe+"Capture":null:Qe;kt=[];for(var ve=Ie,Ce;ve!==null;){Ce=ve;var ot=Ce.stateNode;if(Ce.tag===5&&ot!==null&&(Ce=ot,Ae!==null&&(ot=Mi(ve,Ae),ot!=null&&kt.push(Pu(ve,ot,Ce)))),Ir)break;ve=ve.return}0<kt.length&&(Qe=new _t(Qe,Ct,null,_,et),nt.push({event:Qe,listeners:kt}))}}if((h&7)===0){e:{if(Qe=u==="mouseover"||u==="pointerover",_t=u==="mouseout"||u==="pointerout",Qe&&_!==ue&&(Ct=_.relatedTarget||_.fromElement)&&(al(Ct)||Ct[hs]))break e;if((_t||Qe)&&(Qe=et.window===et?et:(Qe=et.ownerDocument)?Qe.defaultView||Qe.parentWindow:window,_t?(Ct=_.relatedTarget||_.toElement,_t=Ie,Ct=Ct?al(Ct):null,Ct!==null&&(Ir=Pa(Ct),Ct!==Ir||Ct.tag!==5&&Ct.tag!==6)&&(Ct=null)):(_t=null,Ct=Ie),_t!==Ct)){if(kt=gv,ot="onMouseLeave",Ae="onMouseEnter",ve="mouse",(u==="pointerout"||u==="pointerover")&&(kt=us,ot="onPointerLeave",Ae="onPointerEnter",ve="pointer"),Ir=_t==null?Qe:mr(_t),Ce=Ct==null?Qe:mr(Ct),Qe=new kt(ot,ve+"leave",_t,_,et),Qe.target=Ir,Qe.relatedTarget=Ce,ot=null,al(et)===Ie&&(kt=new kt(Ae,ve+"enter",Ct,_,et),kt.target=Ce,kt.relatedTarget=Ir,ot=kt),Ir=ot,_t&&Ct)t:{for(kt=_t,Ae=Ct,ve=0,Ce=kt;Ce;Ce=sc(Ce))ve++;for(Ce=0,ot=Ae;ot;ot=sc(ot))Ce++;for(;0<ve-Ce;)kt=sc(kt),ve--;for(;0<Ce-ve;)Ae=sc(Ae),Ce--;for(;ve--;){if(kt===Ae||Ae!==null&&kt===Ae.alternate)break t;kt=sc(kt),Ae=sc(Ae)}kt=null}else kt=null;_t!==null&&jx(nt,Qe,_t,kt,!1),Ct!==null&&Ir!==null&&jx(nt,Ir,Ct,kt,!0)}}e:{if(Qe=Ie?mr(Ie):window,_t=Qe.nodeName&&Qe.nodeName.toLowerCase(),_t==="select"||_t==="input"&&Qe.type==="file")var Dt=Lx;else if(Pp(Qe))if(Mu)Dt=nr;else{Dt=Ox;var Vt=Eu}else(_t=Qe.nodeName)&&_t.toLowerCase()==="input"&&(Qe.type==="checkbox"||Qe.type==="radio")&&(Dt=Mv);if(Dt&&(Dt=Dt(u,Ie))){wu(nt,Dt,_,et);break e}Vt&&Vt(u,Qe,Ie),u==="focusout"&&(Vt=Qe._wrapperState)&&Vt.controlled&&Qe.type==="number"&&De(Qe,"number",Qe.value)}switch(Vt=Ie?mr(Ie):window,u){case"focusin":(Pp(Vt)||Vt.contentEditable==="true")&&(ka=Vt,ic=Ie,Zd=null);break;case"focusout":Zd=ic=ka=null;break;case"mousedown":Ur=!0;break;case"contextmenu":case"mouseup":case"dragend":Ur=!1,Ip(nt,_,et);break;case"selectionchange":if(kp)break;case"keydown":case"keyup":Ip(nt,_,et)}var Gt;if(Pi)e:{switch(u){case"compositionstart":var nn="onCompositionStart";break e;case"compositionend":nn="onCompositionEnd";break e;case"compositionupdate":nn="onCompositionUpdate";break e}nn=void 0}else nl?Sv(u,_)&&(nn="onCompositionEnd"):u==="keydown"&&_.keyCode===229&&(nn="onCompositionStart");nn&&(bu&&_.locale!=="ko"&&(nl||nn!=="onCompositionStart"?nn==="onCompositionEnd"&&nl&&(Gt=Xd()):(ia=et,mv="value"in ia?ia.value:ia.textContent,nl=!0)),Vt=zp(Ie,nn),0<Vt.length&&(nn=new yv(nn,u,null,_,et),nt.push({event:nn,listeners:Vt}),Gt?nn.data=Gt:(Gt=Cp(_),Gt!==null&&(nn.data=Gt)))),(Gt=Qn?kx(u,_):Kd(u,_))&&(Ie=zp(Ie,"onBeforeInput"),0<Ie.length&&(et=new yv("onBeforeInput","beforeinput",null,_,et),nt.push({event:et,listeners:Ie}),et.data=Gt))}Tu(nt,h)})}function Pu(u,h,_){return{instance:u,listener:h,currentTarget:_}}function zp(u,h){for(var _=h+"Capture",A=[];u!==null;){var k=u,j=k.stateNode;k.tag===5&&j!==null&&(k=j,j=Mi(u,_),j!=null&&A.unshift(Pu(u,j,k)),j=Mi(u,h),j!=null&&A.push(Pu(u,j,k))),u=u.return}return A}function sc(u){if(u===null)return null;do u=u.return;while(u&&u.tag!==5);return u||null}function jx(u,h,_,A,k){for(var j=h._reactName,$=[];_!==null&&_!==A;){var ae=_,me=ae.alternate,Ie=ae.stateNode;if(me!==null&&me===A)break;ae.tag===5&&Ie!==null&&(ae=Ie,k?(me=Mi(_,j),me!=null&&$.unshift(Pu(_,me,ae))):k||(me=Mi(_,j),me!=null&&$.push(Pu(_,me,ae)))),_=_.return}$.length!==0&&u.push({event:h,listeners:$})}var kM=/\r\n?/g,Ux=/\u0000|\uFFFD/g;function Pv(u){return(typeof u=="string"?u:""+u).replace(kM,`
|
||
`).replace(Ux,"")}function rf(u,h,_){if(h=Pv(h),Pv(u)!==h&&_)throw Error(n(425))}function sf(){}var Ru=null,Rv=null;function Nv(u,h){return u==="textarea"||u==="noscript"||typeof h.children=="string"||typeof h.children=="number"||typeof h.dangerouslySetInnerHTML=="object"&&h.dangerouslySetInnerHTML!==null&&h.dangerouslySetInnerHTML.__html!=null}var kv=typeof setTimeout=="function"?setTimeout:void 0,Iv=typeof clearTimeout=="function"?clearTimeout:void 0,Bp=typeof Promise=="function"?Promise:void 0,IM=typeof queueMicrotask=="function"?queueMicrotask:typeof Bp<"u"?function(u){return Bp.resolve(null).then(u).catch(Fx)}:kv;function Fx(u){setTimeout(function(){throw u})}function Hp(u,h){var _=h,A=0;do{var k=_.nextSibling;if(u.removeChild(_),k&&k.nodeType===8)if(_=k.data,_==="/$"){if(A===0){u.removeChild(k),$d(h);return}A--}else _!=="$"&&_!=="$?"&&_!=="$!"||A++;_=k}while(_);$d(h)}function po(u){for(;u!=null;u=u.nextSibling){var h=u.nodeType;if(h===1||h===3)break;if(h===8){if(h=u.data,h==="$"||h==="$!"||h==="$?")break;if(h==="/$")return null}}return u}function Lv(u){u=u.previousSibling;for(var h=0;u;){if(u.nodeType===8){var _=u.data;if(_==="$"||_==="$!"||_==="$?"){if(h===0)return u;h--}else _==="/$"&&h++}u=u.previousSibling}return null}var ac=Math.random().toString(36).slice(2),kr="__reactFiber$"+ac,Nu="__reactProps$"+ac,hs="__reactContainer$"+ac,oc="__reactEvents$"+ac,Vp="__reactListeners$"+ac,Gp="__reactHandles$"+ac;function al(u){var h=u[kr];if(h)return h;for(var _=u.parentNode;_;){if(h=_[hs]||_[kr]){if(_=h.alternate,h.child!==null||_!==null&&_.child!==null)for(u=Lv(u);u!==null;){if(_=u[kr])return _;u=Lv(u)}return h}u=_,_=u.parentNode}return null}function mo(u){return u=u[kr]||u[hs],!u||u.tag!==5&&u.tag!==6&&u.tag!==13&&u.tag!==3?null:u}function mr(u){if(u.tag===5||u.tag===6)return u.stateNode;throw Error(n(33))}function Wp(u){return u[Nu]||null}var Ov=[],Fr=-1;function lr(u){return{current:u}}function Xn(u){0>Fr||(u.current=Ov[Fr],Ov[Fr]=null,Fr--)}function Wn(u,h){Fr++,Ov[Fr]=u.current,u.current=h}var go={},Kr=lr(go),Ri=lr(!1),vo=go;function lc(u,h){var _=u.type.contextTypes;if(!_)return go;var A=u.stateNode;if(A&&A.__reactInternalMemoizedUnmaskedChildContext===h)return A.__reactInternalMemoizedMaskedChildContext;var k={},j;for(j in _)k[j]=h[j];return A&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=h,u.__reactInternalMemoizedMaskedChildContext=k),k}function ui(u){return u=u.childContextTypes,u!=null}function af(){Xn(Ri),Xn(Kr)}function Dv(u,h,_){if(Kr.current!==go)throw Error(n(168));Wn(Kr,h),Wn(Ri,_)}function of(u,h,_){var A=u.stateNode;if(h=h.childContextTypes,typeof A.getChildContext!="function")return _;A=A.getChildContext();for(var k in A)if(!(k in h))throw Error(n(108,Se(u)||"Unknown",k));return Z({},_,A)}function cc(u){return u=(u=u.stateNode)&&u.__reactInternalMemoizedMergedChildContext||go,vo=Kr.current,Wn(Kr,u),Wn(Ri,Ri.current),!0}function jv(u,h,_){var A=u.stateNode;if(!A)throw Error(n(169));_?(u=of(u,h,vo),A.__reactInternalMemoizedMergedChildContext=u,Xn(Ri),Xn(Kr),Wn(Kr,u)):Xn(Ri),Wn(Ri,_)}var la=null,lf=!1,$p=!1;function cf(u){la===null?la=[u]:la.push(u)}function zx(u){lf=!0,cf(u)}function La(){if(!$p&&la!==null){$p=!0;var u=0,h=Cn;try{var _=la;for(Cn=1;u<_.length;u++){var A=_[u];do A=A(!0);while(A!==null)}la=null,lf=!1}catch(k){throw la!==null&&(la=la.slice(u+1)),Ne(Ut,La),k}finally{Cn=h,$p=!1}}return null}var uc=[],Ki=0,Xp=null,qp=0,Ni=[],zr=0,dc=null,dt=1,Bs="";function yo(u,h){uc[Ki++]=qp,uc[Ki++]=Xp,Xp=u,qp=h}function Uv(u,h,_){Ni[zr++]=dt,Ni[zr++]=Bs,Ni[zr++]=dc,dc=u;var A=dt;u=Bs;var k=32-mt(A)-1;A&=~(1<<k),_+=1;var j=32-mt(h)+k;if(30<j){var $=k-k%5;j=(A&(1<<$)-1).toString(32),A>>=$,k-=$,dt=1<<32-mt(h)+k|_<<k|A,Bs=j+u}else dt=1<<j|_<<k|A,Bs=u}function Fv(u){u.return!==null&&(yo(u,1),Uv(u,1,0))}function xo(u){for(;u===Xp;)Xp=uc[--Ki],uc[Ki]=null,qp=uc[--Ki],uc[Ki]=null;for(;u===dc;)dc=Ni[--zr],Ni[zr]=null,Bs=Ni[--zr],Ni[zr]=null,dt=Ni[--zr],Ni[zr]=null}var Yr=null,ki=null,Kn=!1,Hs=null;function zv(u,h){var _=Fa(5,null,null,0);_.elementType="DELETED",_.stateNode=h,_.return=u,h=u.deletions,h===null?(u.deletions=[_],u.flags|=16):h.push(_)}function Bv(u,h){switch(u.tag){case 5:var _=u.type;return h=h.nodeType!==1||_.toLowerCase()!==h.nodeName.toLowerCase()?null:h,h!==null?(u.stateNode=h,Yr=u,ki=po(h.firstChild),!0):!1;case 6:return h=u.pendingProps===""||h.nodeType!==3?null:h,h!==null?(u.stateNode=h,Yr=u,ki=null,!0):!1;case 13:return h=h.nodeType!==8?null:h,h!==null?(_=dc!==null?{id:dt,overflow:Bs}:null,u.memoizedState={dehydrated:h,treeContext:_,retryLane:1073741824},_=Fa(18,null,null,0),_.stateNode=h,_.return=u,u.child=_,Yr=u,ki=null,!0):!1;default:return!1}}function Kp(u){return(u.mode&1)!==0&&(u.flags&128)===0}function Yp(u){if(Kn){var h=ki;if(h){var _=h;if(!Bv(u,h)){if(Kp(u))throw Error(n(418));h=po(_.nextSibling);var A=Yr;h&&Bv(u,h)?zv(A,_):(u.flags=u.flags&-4097|2,Kn=!1,Yr=u)}}else{if(Kp(u))throw Error(n(418));u.flags=u.flags&-4097|2,Kn=!1,Yr=u}}}function Zp(u){for(u=u.return;u!==null&&u.tag!==5&&u.tag!==3&&u.tag!==13;)u=u.return;Yr=u}function ku(u){if(u!==Yr)return!1;if(!Kn)return Zp(u),Kn=!0,!1;var h;if((h=u.tag!==3)&&!(h=u.tag!==5)&&(h=u.type,h=h!=="head"&&h!=="body"&&!Nv(u.type,u.memoizedProps)),h&&(h=ki)){if(Kp(u))throw Hv(),Error(n(418));for(;h;)zv(u,h),h=po(h.nextSibling)}if(Zp(u),u.tag===13){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(n(317));e:{for(u=u.nextSibling,h=0;u;){if(u.nodeType===8){var _=u.data;if(_==="/$"){if(h===0){ki=po(u.nextSibling);break e}h--}else _!=="$"&&_!=="$!"&&_!=="$?"||h++}u=u.nextSibling}ki=null}}else ki=Yr?po(u.stateNode.nextSibling):null;return!0}function Hv(){for(var u=ki;u;)u=po(u.nextSibling)}function ol(){ki=Yr=null,Kn=!1}function Iu(u){Hs===null?Hs=[u]:Hs.push(u)}var LM=C.ReactCurrentBatchConfig;function uf(u,h,_){if(u=_.ref,u!==null&&typeof u!="function"&&typeof u!="object"){if(_._owner){if(_=_._owner,_){if(_.tag!==1)throw Error(n(309));var A=_.stateNode}if(!A)throw Error(n(147,u));var k=A,j=""+u;return h!==null&&h.ref!==null&&typeof h.ref=="function"&&h.ref._stringRef===j?h.ref:(h=function($){var ae=k.refs;$===null?delete ae[j]:ae[j]=$},h._stringRef=j,h)}if(typeof u!="string")throw Error(n(284));if(!_._owner)throw Error(n(290,u))}return u}function df(u,h){throw u=Object.prototype.toString.call(h),Error(n(31,u==="[object Object]"?"object with keys {"+Object.keys(h).join(", ")+"}":u))}function Vv(u){var h=u._init;return h(u._payload)}function Gv(u){function h(Ae,ve){if(u){var Ce=Ae.deletions;Ce===null?(Ae.deletions=[ve],Ae.flags|=16):Ce.push(ve)}}function _(Ae,ve){if(!u)return null;for(;ve!==null;)h(Ae,ve),ve=ve.sibling;return null}function A(Ae,ve){for(Ae=new Map;ve!==null;)ve.key!==null?Ae.set(ve.key,ve):Ae.set(ve.index,ve),ve=ve.sibling;return Ae}function k(Ae,ve){return Ae=Gu(Ae,ve),Ae.index=0,Ae.sibling=null,Ae}function j(Ae,ve,Ce){return Ae.index=Ce,u?(Ce=Ae.alternate,Ce!==null?(Ce=Ce.index,Ce<ve?(Ae.flags|=2,ve):Ce):(Ae.flags|=2,ve)):(Ae.flags|=1048576,ve)}function $(Ae){return u&&Ae.alternate===null&&(Ae.flags|=2),Ae}function ae(Ae,ve,Ce,ot){return ve===null||ve.tag!==6?(ve=JM(Ce,Ae.mode,ot),ve.return=Ae,ve):(ve=k(ve,Ce),ve.return=Ae,ve)}function me(Ae,ve,Ce,ot){var Dt=Ce.type;return Dt===D?et(Ae,ve,Ce.props.children,ot,Ce.key):ve!==null&&(ve.elementType===Dt||typeof Dt=="object"&&Dt!==null&&Dt.$$typeof===ee&&Vv(Dt)===ve.type)?(ot=k(ve,Ce.props),ot.ref=uf(Ae,ve,Ce),ot.return=Ae,ot):(ot=cb(Ce.type,Ce.key,Ce.props,null,Ae.mode,ot),ot.ref=uf(Ae,ve,Ce),ot.return=Ae,ot)}function Ie(Ae,ve,Ce,ot){return ve===null||ve.tag!==4||ve.stateNode.containerInfo!==Ce.containerInfo||ve.stateNode.implementation!==Ce.implementation?(ve=eE(Ce,Ae.mode,ot),ve.return=Ae,ve):(ve=k(ve,Ce.children||[]),ve.return=Ae,ve)}function et(Ae,ve,Ce,ot,Dt){return ve===null||ve.tag!==7?(ve=Cf(Ce,Ae.mode,ot,Dt),ve.return=Ae,ve):(ve=k(ve,Ce),ve.return=Ae,ve)}function nt(Ae,ve,Ce){if(typeof ve=="string"&&ve!==""||typeof ve=="number")return ve=JM(""+ve,Ae.mode,Ce),ve.return=Ae,ve;if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case L:return Ce=cb(ve.type,ve.key,ve.props,null,Ae.mode,Ce),Ce.ref=uf(Ae,null,ve),Ce.return=Ae,Ce;case N:return ve=eE(ve,Ae.mode,Ce),ve.return=Ae,ve;case ee:var ot=ve._init;return nt(Ae,ot(ve._payload),Ce)}if(K(ve)||J(ve))return ve=Cf(ve,Ae.mode,Ce,null),ve.return=Ae,ve;df(Ae,ve)}return null}function Qe(Ae,ve,Ce,ot){var Dt=ve!==null?ve.key:null;if(typeof Ce=="string"&&Ce!==""||typeof Ce=="number")return Dt!==null?null:ae(Ae,ve,""+Ce,ot);if(typeof Ce=="object"&&Ce!==null){switch(Ce.$$typeof){case L:return Ce.key===Dt?me(Ae,ve,Ce,ot):null;case N:return Ce.key===Dt?Ie(Ae,ve,Ce,ot):null;case ee:return Dt=Ce._init,Qe(Ae,ve,Dt(Ce._payload),ot)}if(K(Ce)||J(Ce))return Dt!==null?null:et(Ae,ve,Ce,ot,null);df(Ae,Ce)}return null}function _t(Ae,ve,Ce,ot,Dt){if(typeof ot=="string"&&ot!==""||typeof ot=="number")return Ae=Ae.get(Ce)||null,ae(ve,Ae,""+ot,Dt);if(typeof ot=="object"&&ot!==null){switch(ot.$$typeof){case L:return Ae=Ae.get(ot.key===null?Ce:ot.key)||null,me(ve,Ae,ot,Dt);case N:return Ae=Ae.get(ot.key===null?Ce:ot.key)||null,Ie(ve,Ae,ot,Dt);case ee:var Vt=ot._init;return _t(Ae,ve,Ce,Vt(ot._payload),Dt)}if(K(ot)||J(ot))return Ae=Ae.get(Ce)||null,et(ve,Ae,ot,Dt,null);df(ve,ot)}return null}function Ct(Ae,ve,Ce,ot){for(var Dt=null,Vt=null,Gt=ve,nn=ve=0,pi=null;Gt!==null&&nn<Ce.length;nn++){Gt.index>nn?(pi=Gt,Gt=null):pi=Gt.sibling;var Dn=Qe(Ae,Gt,Ce[nn],ot);if(Dn===null){Gt===null&&(Gt=pi);break}u&&Gt&&Dn.alternate===null&&h(Ae,Gt),ve=j(Dn,ve,nn),Vt===null?Dt=Dn:Vt.sibling=Dn,Vt=Dn,Gt=pi}if(nn===Ce.length)return _(Ae,Gt),Kn&&yo(Ae,nn),Dt;if(Gt===null){for(;nn<Ce.length;nn++)Gt=nt(Ae,Ce[nn],ot),Gt!==null&&(ve=j(Gt,ve,nn),Vt===null?Dt=Gt:Vt.sibling=Gt,Vt=Gt);return Kn&&yo(Ae,nn),Dt}for(Gt=A(Ae,Gt);nn<Ce.length;nn++)pi=_t(Gt,Ae,nn,Ce[nn],ot),pi!==null&&(u&&pi.alternate!==null&&Gt.delete(pi.key===null?nn:pi.key),ve=j(pi,ve,nn),Vt===null?Dt=pi:Vt.sibling=pi,Vt=pi);return u&&Gt.forEach(function(Wu){return h(Ae,Wu)}),Kn&&yo(Ae,nn),Dt}function kt(Ae,ve,Ce,ot){var Dt=J(Ce);if(typeof Dt!="function")throw Error(n(150));if(Ce=Dt.call(Ce),Ce==null)throw Error(n(151));for(var Vt=Dt=null,Gt=ve,nn=ve=0,pi=null,Dn=Ce.next();Gt!==null&&!Dn.done;nn++,Dn=Ce.next()){Gt.index>nn?(pi=Gt,Gt=null):pi=Gt.sibling;var Wu=Qe(Ae,Gt,Dn.value,ot);if(Wu===null){Gt===null&&(Gt=pi);break}u&&Gt&&Wu.alternate===null&&h(Ae,Gt),ve=j(Wu,ve,nn),Vt===null?Dt=Wu:Vt.sibling=Wu,Vt=Wu,Gt=pi}if(Dn.done)return _(Ae,Gt),Kn&&yo(Ae,nn),Dt;if(Gt===null){for(;!Dn.done;nn++,Dn=Ce.next())Dn=nt(Ae,Dn.value,ot),Dn!==null&&(ve=j(Dn,ve,nn),Vt===null?Dt=Dn:Vt.sibling=Dn,Vt=Dn);return Kn&&yo(Ae,nn),Dt}for(Gt=A(Ae,Gt);!Dn.done;nn++,Dn=Ce.next())Dn=_t(Gt,Ae,nn,Dn.value,ot),Dn!==null&&(u&&Dn.alternate!==null&&Gt.delete(Dn.key===null?nn:Dn.key),ve=j(Dn,ve,nn),Vt===null?Dt=Dn:Vt.sibling=Dn,Vt=Dn);return u&&Gt.forEach(function(z8){return h(Ae,z8)}),Kn&&yo(Ae,nn),Dt}function Ir(Ae,ve,Ce,ot){if(typeof Ce=="object"&&Ce!==null&&Ce.type===D&&Ce.key===null&&(Ce=Ce.props.children),typeof Ce=="object"&&Ce!==null){switch(Ce.$$typeof){case L:e:{for(var Dt=Ce.key,Vt=ve;Vt!==null;){if(Vt.key===Dt){if(Dt=Ce.type,Dt===D){if(Vt.tag===7){_(Ae,Vt.sibling),ve=k(Vt,Ce.props.children),ve.return=Ae,Ae=ve;break e}}else if(Vt.elementType===Dt||typeof Dt=="object"&&Dt!==null&&Dt.$$typeof===ee&&Vv(Dt)===Vt.type){_(Ae,Vt.sibling),ve=k(Vt,Ce.props),ve.ref=uf(Ae,Vt,Ce),ve.return=Ae,Ae=ve;break e}_(Ae,Vt);break}else h(Ae,Vt);Vt=Vt.sibling}Ce.type===D?(ve=Cf(Ce.props.children,Ae.mode,ot,Ce.key),ve.return=Ae,Ae=ve):(ot=cb(Ce.type,Ce.key,Ce.props,null,Ae.mode,ot),ot.ref=uf(Ae,ve,Ce),ot.return=Ae,Ae=ot)}return $(Ae);case N:e:{for(Vt=Ce.key;ve!==null;){if(ve.key===Vt)if(ve.tag===4&&ve.stateNode.containerInfo===Ce.containerInfo&&ve.stateNode.implementation===Ce.implementation){_(Ae,ve.sibling),ve=k(ve,Ce.children||[]),ve.return=Ae,Ae=ve;break e}else{_(Ae,ve);break}else h(Ae,ve);ve=ve.sibling}ve=eE(Ce,Ae.mode,ot),ve.return=Ae,Ae=ve}return $(Ae);case ee:return Vt=Ce._init,Ir(Ae,ve,Vt(Ce._payload),ot)}if(K(Ce))return Ct(Ae,ve,Ce,ot);if(J(Ce))return kt(Ae,ve,Ce,ot);df(Ae,Ce)}return typeof Ce=="string"&&Ce!==""||typeof Ce=="number"?(Ce=""+Ce,ve!==null&&ve.tag===6?(_(Ae,ve.sibling),ve=k(ve,Ce),ve.return=Ae,Ae=ve):(_(Ae,ve),ve=JM(Ce,Ae.mode,ot),ve.return=Ae,Ae=ve),$(Ae)):_(Ae,ve)}return Ir}var fc=Gv(!0),ff=Gv(!1),hc=lr(null),pc=null,bo=null,Lu=null;function mc(){Lu=bo=pc=null}function hf(u){var h=hc.current;Xn(hc),u._currentValue=h}function pf(u,h,_){for(;u!==null;){var A=u.alternate;if((u.childLanes&h)!==h?(u.childLanes|=h,A!==null&&(A.childLanes|=h)):A!==null&&(A.childLanes&h)!==h&&(A.childLanes|=h),u===_)break;u=u.return}}function ll(u,h){pc=u,Lu=bo=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(Lu!==u)if(u={context:u,memoizedValue:h,next:null},bo===null){if(pc===null)throw Error(n(308));bo=u,pc.dependencies={lanes:0,firstContext:u}}else bo=bo.next=u;return h}var _o=null;function Wv(u){_o===null?_o=[u]:_o.push(u)}function mf(u,h,_,A){var k=h.interleaved;return k===null?(_.next=_,Wv(h)):(_.next=k.next,k.next=_),h.interleaved=_,ca(u,A)}function ca(u,h){u.lanes|=h;var _=u.alternate;for(_!==null&&(_.lanes|=h),_=u,u=u.return;u!==null;)u.childLanes|=h,_=u.alternate,_!==null&&(_.childLanes|=h),_=u,u=u.return;return _.tag===3?_.stateNode:null}var zn=!1;function on(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function gr(u,h){u=u.updateQueue,h.updateQueue===u&&(h.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,effects:u.effects})}function Bn(u,h){return{eventTime:u,lane:h,tag:0,payload:null,callback:null,next:null}}function Jn(u,h,_){var A=u.updateQueue;if(A===null)return null;if(A=A.shared,(Ln&2)!==0){var k=A.pending;return k===null?h.next=h:(h.next=k.next,k.next=h),A.pending=h,ca(u,_)}return k=A.interleaved,k===null?(h.next=h,Wv(A)):(h.next=k.next,k.next=h),A.interleaved=h,ca(u,_)}function di(u,h,_){if(h=h.updateQueue,h!==null&&(h=h.shared,(_&4194240)!==0)){var A=h.lanes;A&=u.pendingLanes,_|=A,h.lanes=_,pu(u,_)}}function gc(u,h){var _=u.updateQueue,A=u.alternate;if(A!==null&&(A=A.updateQueue,_===A)){var k=null,j=null;if(_=_.firstBaseUpdate,_!==null){do{var $={eventTime:_.eventTime,lane:_.lane,tag:_.tag,payload:_.payload,callback:_.callback,next:null};j===null?k=j=$:j=j.next=$,_=_.next}while(_!==null);j===null?k=j=h:j=j.next=h}else k=j=h;_={baseState:A.baseState,firstBaseUpdate:k,lastBaseUpdate:j,shared:A.shared,effects:A.effects},u.updateQueue=_;return}u=_.lastBaseUpdate,u===null?_.firstBaseUpdate=h:u.next=h,_.lastBaseUpdate=h}function cr(u,h,_,A){var k=u.updateQueue;zn=!1;var j=k.firstBaseUpdate,$=k.lastBaseUpdate,ae=k.shared.pending;if(ae!==null){k.shared.pending=null;var me=ae,Ie=me.next;me.next=null,$===null?j=Ie:$.next=Ie,$=me;var et=u.alternate;et!==null&&(et=et.updateQueue,ae=et.lastBaseUpdate,ae!==$&&(ae===null?et.firstBaseUpdate=Ie:ae.next=Ie,et.lastBaseUpdate=me))}if(j!==null){var nt=k.baseState;$=0,et=Ie=me=null,ae=j;do{var Qe=ae.lane,_t=ae.eventTime;if((A&Qe)===Qe){et!==null&&(et=et.next={eventTime:_t,lane:0,tag:ae.tag,payload:ae.payload,callback:ae.callback,next:null});e:{var Ct=u,kt=ae;switch(Qe=h,_t=_,kt.tag){case 1:if(Ct=kt.payload,typeof Ct=="function"){nt=Ct.call(_t,nt,Qe);break e}nt=Ct;break e;case 3:Ct.flags=Ct.flags&-65537|128;case 0:if(Ct=kt.payload,Qe=typeof Ct=="function"?Ct.call(_t,nt,Qe):Ct,Qe==null)break e;nt=Z({},nt,Qe);break e;case 2:zn=!0}}ae.callback!==null&&ae.lane!==0&&(u.flags|=64,Qe=k.effects,Qe===null?k.effects=[ae]:Qe.push(ae))}else _t={eventTime:_t,lane:Qe,tag:ae.tag,payload:ae.payload,callback:ae.callback,next:null},et===null?(Ie=et=_t,me=nt):et=et.next=_t,$|=Qe;if(ae=ae.next,ae===null){if(ae=k.shared.pending,ae===null)break;Qe=ae,ae=Qe.next,Qe.next=null,k.lastBaseUpdate=Qe,k.shared.pending=null}}while(!0);if(et===null&&(me=nt),k.baseState=me,k.firstBaseUpdate=Ie,k.lastBaseUpdate=et,h=k.shared.interleaved,h!==null){k=h;do $|=k.lane,k=k.next;while(k!==h)}else j===null&&(k.shared.lanes=0);Mf|=$,u.lanes=$,u.memoizedState=nt}}function Ou(u,h,_){if(u=h.effects,h.effects=null,u!==null)for(h=0;h<u.length;h++){var A=u[h],k=A.callback;if(k!==null){if(A.callback=null,A=_,typeof k!="function")throw Error(n(191,k));k.call(A)}}}var Oa={},ms=lr(Oa),vc=lr(Oa),wo=lr(Oa);function br(u){if(u===Oa)throw Error(n(174));return u}function gf(u,h){switch(Wn(wo,h),Wn(vc,u),Wn(ms,Oa),u=h.nodeType,u){case 9:case 11:h=(h=h.documentElement)?h.namespaceURI:rt(null,"");break;default:u=u===8?h.parentNode:h,h=u.namespaceURI||null,u=u.tagName,h=rt(h,u)}Xn(ms),Wn(ms,h)}function cl(){Xn(ms),Xn(vc),Xn(wo)}function yc(u){br(wo.current);var h=br(ms.current),_=rt(h,u.type);h!==_&&(Wn(vc,u),Wn(ms,_))}function Du(u){vc.current===u&&(Xn(ms),Xn(vc))}var Yn=lr(0);function ua(u){for(var h=u;h!==null;){if(h.tag===13){var _=h.memoizedState;if(_!==null&&(_=_.dehydrated,_===null||_.data==="$?"||_.data==="$!"))return h}else if(h.tag===19&&h.memoizedProps.revealOrder!==void 0){if((h.flags&128)!==0)return h}else if(h.child!==null){h.child.return=h,h=h.child;continue}if(h===u)break;for(;h.sibling===null;){if(h.return===null||h.return===u)return null;h=h.return}h.sibling.return=h.return,h=h.sibling}return null}var ju=[];function Da(){for(var u=0;u<ju.length;u++)ju[u]._workInProgressVersionPrimary=null;ju.length=0}var xc=C.ReactCurrentDispatcher,bc=C.ReactCurrentBatchConfig,So=0,qn=null,ur=null,Pn=null,da=!1,fi=!1,ul=0,Yi=0;function Zr(){throw Error(n(321))}function vf(u,h){if(h===null)return!1;for(var _=0;_<h.length&&_<u.length;_++)if(!ds(u[_],h[_]))return!1;return!0}function yf(u,h,_,A,k,j){if(So=j,qn=h,h.memoizedState=null,h.updateQueue=null,h.lanes=0,xc.current=u===null||u.memoizedState===null?Xx:qx,u=_(A,k),fi){j=0;do{if(fi=!1,ul=0,25<=j)throw Error(n(301));j+=1,Pn=ur=null,h.updateQueue=null,xc.current=Kx,u=_(A,k)}while(fi)}if(xc.current=im,h=ur!==null&&ur.next!==null,So=0,Pn=ur=qn=null,da=!1,h)throw Error(n(300));return u}function $v(){var u=ul!==0;return ul=0,u}function Qr(){var u={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Pn===null?qn.memoizedState=Pn=u:Pn=Pn.next=u,Pn}function gs(){if(ur===null){var u=qn.alternate;u=u!==null?u.memoizedState:null}else u=ur.next;var h=Pn===null?qn.memoizedState:Pn.next;if(h!==null)Pn=h,ur=u;else{if(u===null)throw Error(n(310));ur=u,u={memoizedState:ur.memoizedState,baseState:ur.baseState,baseQueue:ur.baseQueue,queue:ur.queue,next:null},Pn===null?qn.memoizedState=Pn=u:Pn=Pn.next=u}return Pn}function Uu(u,h){return typeof h=="function"?h(u):h}function xf(u){var h=gs(),_=h.queue;if(_===null)throw Error(n(311));_.lastRenderedReducer=u;var A=ur,k=A.baseQueue,j=_.pending;if(j!==null){if(k!==null){var $=k.next;k.next=j.next,j.next=$}A.baseQueue=k=j,_.pending=null}if(k!==null){j=k.next,A=A.baseState;var ae=$=null,me=null,Ie=j;do{var et=Ie.lane;if((So&et)===et)me!==null&&(me=me.next={lane:0,action:Ie.action,hasEagerState:Ie.hasEagerState,eagerState:Ie.eagerState,next:null}),A=Ie.hasEagerState?Ie.eagerState:u(A,Ie.action);else{var nt={lane:et,action:Ie.action,hasEagerState:Ie.hasEagerState,eagerState:Ie.eagerState,next:null};me===null?(ae=me=nt,$=A):me=me.next=nt,qn.lanes|=et,Mf|=et}Ie=Ie.next}while(Ie!==null&&Ie!==j);me===null?$=A:me.next=ae,ds(A,h.memoizedState)||(ln=!0),h.memoizedState=A,h.baseState=$,h.baseQueue=me,_.lastRenderedState=A}if(u=_.interleaved,u!==null){k=u;do j=k.lane,qn.lanes|=j,Mf|=j,k=k.next;while(k!==u)}else k===null&&(_.lanes=0);return[h.memoizedState,_.dispatch]}function Mo(u){var h=gs(),_=h.queue;if(_===null)throw Error(n(311));_.lastRenderedReducer=u;var A=_.dispatch,k=_.pending,j=h.memoizedState;if(k!==null){_.pending=null;var $=k=k.next;do j=u(j,$.action),$=$.next;while($!==k);ds(j,h.memoizedState)||(ln=!0),h.memoizedState=j,h.baseQueue===null&&(h.baseState=j),_.lastRenderedState=j}return[j,A]}function Xv(){}function qv(u,h){var _=qn,A=gs(),k=h(),j=!ds(A.memoizedState,k);if(j&&(A.memoizedState=k,ln=!0),A=A.queue,Zv(Bx.bind(null,_,A,u),[u]),A.getSnapshot!==h||j||Pn!==null&&Pn.memoizedState.tag&1){if(_.flags|=2048,fa(9,bf.bind(null,_,A,k,h),void 0,null),hi===null)throw Error(n(349));(So&30)!==0||Qp(_,h,k)}return k}function Qp(u,h,_){u.flags|=16384,u={getSnapshot:h,value:_},h=qn.updateQueue,h===null?(h={lastEffect:null,stores:null},qn.updateQueue=h,h.stores=[u]):(_=h.stores,_===null?h.stores=[u]:_.push(u))}function bf(u,h,_,A){h.value=_,h.getSnapshot=A,Hx(h)&&Kv(u)}function Bx(u,h,_){return _(function(){Hx(h)&&Kv(u)})}function Hx(u){var h=u.getSnapshot;u=u.value;try{var _=h();return!ds(u,_)}catch{return!0}}function Kv(u){var h=ca(u,1);h!==null&&Po(h,u,1,-1)}function Yv(u){var h=Qr();return typeof u=="function"&&(u=u()),h.memoizedState=h.baseState=u,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Uu,lastRenderedState:u},h.queue=u,u=u.dispatch=_c.bind(null,qn,u),[h.memoizedState,u]}function fa(u,h,_,A){return u={tag:u,create:h,destroy:_,deps:A,next:null},h=qn.updateQueue,h===null?(h={lastEffect:null,stores:null},qn.updateQueue=h,h.lastEffect=u.next=u):(_=h.lastEffect,_===null?h.lastEffect=u.next=u:(A=_.next,_.next=u,u.next=A,h.lastEffect=u)),u}function Vx(){return gs().memoizedState}function ja(u,h,_,A){var k=Qr();qn.flags|=u,k.memoizedState=fa(1|h,_,void 0,A===void 0?null:A)}function _f(u,h,_,A){var k=gs();A=A===void 0?null:A;var j=void 0;if(ur!==null){var $=ur.memoizedState;if(j=$.destroy,A!==null&&vf(A,$.deps)){k.memoizedState=fa(h,_,j,A);return}}qn.flags|=u,k.memoizedState=fa(1|h,_,j,A)}function Ii(u,h){return ja(8390656,8,u,h)}function Zv(u,h){return _f(2048,8,u,h)}function Qv(u,h){return _f(4,2,u,h)}function Gx(u,h){return _f(4,4,u,h)}function Wx(u,h){if(typeof h=="function")return u=u(),h(u),function(){h(null)};if(h!=null)return u=u(),h.current=u,function(){h.current=null}}function Jv(u,h,_){return _=_!=null?_.concat([u]):null,_f(4,4,Wx.bind(null,h,u),_)}function Jp(){}function $x(u,h){var _=gs();h=h===void 0?null:h;var A=_.memoizedState;return A!==null&&h!==null&&vf(h,A[1])?A[0]:(_.memoizedState=[u,h],u)}function vs(u,h){var _=gs();h=h===void 0?null:h;var A=_.memoizedState;return A!==null&&h!==null&&vf(h,A[1])?A[0]:(u=u(),_.memoizedState=[u,h],u)}function em(u,h,_){return(So&21)===0?(u.baseState&&(u.baseState=!1,ln=!0),u.memoizedState=_):(ds(_,h)||(_=ci(),qn.lanes|=_,Mf|=_,u.baseState=!0),h)}function OM(u,h){var _=Cn;Cn=_!==0&&4>_?_:4,u(!0);var A=bc.transition;bc.transition={};try{u(!1),h()}finally{Cn=_,bc.transition=A}}function Eo(){return gs().memoizedState}function tm(u,h,_){var A=Hu(u);if(_={lane:A,action:_,hasEagerState:!1,eagerState:null,next:null},wf(u))nm(h,_);else if(_=mf(u,h,_,A),_!==null){var k=xs();Po(_,u,A,k),rm(_,h,A)}}function _c(u,h,_){var A=Hu(u),k={lane:A,action:_,hasEagerState:!1,eagerState:null,next:null};if(wf(u))nm(h,k);else{var j=u.alternate;if(u.lanes===0&&(j===null||j.lanes===0)&&(j=h.lastRenderedReducer,j!==null))try{var $=h.lastRenderedState,ae=j($,_);if(k.hasEagerState=!0,k.eagerState=ae,ds(ae,$)){var me=h.interleaved;me===null?(k.next=k,Wv(h)):(k.next=me.next,me.next=k),h.interleaved=k;return}}catch{}finally{}_=mf(u,h,k,A),_!==null&&(k=xs(),Po(_,u,A,k),rm(_,h,A))}}function wf(u){var h=u.alternate;return u===qn||h!==null&&h===qn}function nm(u,h){fi=da=!0;var _=u.pending;_===null?h.next=h:(h.next=_.next,_.next=h),u.pending=h}function rm(u,h,_){if((_&4194240)!==0){var A=h.lanes;A&=u.pendingLanes,_|=A,h.lanes=_,pu(u,_)}}var im={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},Xx={readContext:ps,useCallback:function(u,h){return Qr().memoizedState=[u,h===void 0?null:h],u},useContext:ps,useEffect:Ii,useImperativeHandle:function(u,h,_){return _=_!=null?_.concat([u]):null,ja(4194308,4,Wx.bind(null,h,u),_)},useLayoutEffect:function(u,h){return ja(4194308,4,u,h)},useInsertionEffect:function(u,h){return ja(4,2,u,h)},useMemo:function(u,h){var _=Qr();return h=h===void 0?null:h,u=u(),_.memoizedState=[u,h],u},useReducer:function(u,h,_){var A=Qr();return h=_!==void 0?_(h):h,A.memoizedState=A.baseState=h,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:h},A.queue=u,u=u.dispatch=tm.bind(null,qn,u),[A.memoizedState,u]},useRef:function(u){var h=Qr();return u={current:u},h.memoizedState=u},useState:Yv,useDebugValue:Jp,useDeferredValue:function(u){return Qr().memoizedState=u},useTransition:function(){var u=Yv(!1),h=u[0];return u=OM.bind(null,u[1]),Qr().memoizedState=u,[h,u]},useMutableSource:function(){},useSyncExternalStore:function(u,h,_){var A=qn,k=Qr();if(Kn){if(_===void 0)throw Error(n(407));_=_()}else{if(_=h(),hi===null)throw Error(n(349));(So&30)!==0||Qp(A,h,_)}k.memoizedState=_;var j={value:_,getSnapshot:h};return k.queue=j,Ii(Bx.bind(null,A,j,u),[u]),A.flags|=2048,fa(9,bf.bind(null,A,j,_,h),void 0,null),_},useId:function(){var u=Qr(),h=hi.identifierPrefix;if(Kn){var _=Bs,A=dt;_=(A&~(1<<32-mt(A)-1)).toString(32)+_,h=":"+h+"R"+_,_=ul++,0<_&&(h+="H"+_.toString(32)),h+=":"}else _=Yi++,h=":"+h+"r"+_.toString(32)+":";return u.memoizedState=h},unstable_isNewReconciler:!1},qx={readContext:ps,useCallback:$x,useContext:ps,useEffect:Zv,useImperativeHandle:Jv,useInsertionEffect:Qv,useLayoutEffect:Gx,useMemo:vs,useReducer:xf,useRef:Vx,useState:function(){return xf(Uu)},useDebugValue:Jp,useDeferredValue:function(u){var h=gs();return em(h,ur.memoizedState,u)},useTransition:function(){var u=xf(Uu)[0],h=gs().memoizedState;return[u,h]},useMutableSource:Xv,useSyncExternalStore:qv,useId:Eo,unstable_isNewReconciler:!1},Kx={readContext:ps,useCallback:$x,useContext:ps,useEffect:Zv,useImperativeHandle:Jv,useInsertionEffect:Qv,useLayoutEffect:Gx,useMemo:vs,useReducer:Mo,useRef:Vx,useState:function(){return Mo(Uu)},useDebugValue:Jp,useDeferredValue:function(u){var h=gs();return ur===null?h.memoizedState=u:em(h,ur.memoizedState,u)},useTransition:function(){var u=Mo(Uu)[0],h=gs().memoizedState;return[u,h]},useMutableSource:Xv,useSyncExternalStore:qv,useId:Eo,unstable_isNewReconciler:!1};function Vs(u,h){if(u&&u.defaultProps){h=Z({},h),u=u.defaultProps;for(var _ in u)h[_]===void 0&&(h[_]=u[_]);return h}return h}function Sf(u,h,_,A){h=u.memoizedState,_=_(A,h),_=_==null?h:Z({},h,_),u.memoizedState=_,u.lanes===0&&(u.updateQueue.baseState=_)}var sm={isMounted:function(u){return(u=u._reactInternals)?Pa(u)===u:!1},enqueueSetState:function(u,h,_){u=u._reactInternals;var A=xs(),k=Hu(u),j=Bn(A,k);j.payload=h,_!=null&&(j.callback=_),h=Jn(u,j,k),h!==null&&(Po(h,u,k,A),di(h,u,k))},enqueueReplaceState:function(u,h,_){u=u._reactInternals;var A=xs(),k=Hu(u),j=Bn(A,k);j.tag=1,j.payload=h,_!=null&&(j.callback=_),h=Jn(u,j,k),h!==null&&(Po(h,u,k,A),di(h,u,k))},enqueueForceUpdate:function(u,h){u=u._reactInternals;var _=xs(),A=Hu(u),k=Bn(_,A);k.tag=2,h!=null&&(k.callback=h),h=Jn(u,k,A),h!==null&&(Po(h,u,A,_),di(h,u,A))}};function Yx(u,h,_,A,k,j,$){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(A,j,$):h.prototype&&h.prototype.isPureReactComponent?!nc(_,A)||!nc(k,j):!0}function m(u,h,_){var A=!1,k=go,j=h.contextType;return typeof j=="object"&&j!==null?j=ps(j):(k=ui(h)?vo:Kr.current,A=h.contextTypes,j=(A=A!=null)?lc(u,k):go),h=new h(_,j),u.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=sm,u.stateNode=h,h._reactInternals=u,A&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=k,u.__reactInternalMemoizedMaskedChildContext=j),h}function v(u,h,_,A){u=h.state,typeof h.componentWillReceiveProps=="function"&&h.componentWillReceiveProps(_,A),typeof h.UNSAFE_componentWillReceiveProps=="function"&&h.UNSAFE_componentWillReceiveProps(_,A),h.state!==u&&sm.enqueueReplaceState(h,h.state,null)}function E(u,h,_,A){var k=u.stateNode;k.props=_,k.state=u.memoizedState,k.refs={},on(u);var j=h.contextType;typeof j=="object"&&j!==null?k.context=ps(j):(j=ui(h)?vo:Kr.current,k.context=lc(u,j)),k.state=u.memoizedState,j=h.getDerivedStateFromProps,typeof j=="function"&&(Sf(u,h,j,_),k.state=u.memoizedState),typeof h.getDerivedStateFromProps=="function"||typeof k.getSnapshotBeforeUpdate=="function"||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(h=k.state,typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount(),h!==k.state&&sm.enqueueReplaceState(k,k.state,null),cr(u,_,k,A),k.state=u.memoizedState),typeof k.componentDidMount=="function"&&(u.flags|=4194308)}function R(u,h){try{var _="",A=h;do _+=le(A),A=A.return;while(A);var k=_}catch(j){k=`
|
||
Error generating stack: `+j.message+`
|
||
`+j.stack}return{value:u,source:h,stack:k,digest:null}}function O(u,h,_){return{value:u,source:null,stack:_??null,digest:h??null}}function z(u,h){try{console.error(h.value)}catch(_){setTimeout(function(){throw _})}}var ie=typeof WeakMap=="function"?WeakMap:Map;function ye(u,h,_){_=Bn(-1,_),_.tag=3,_.payload={element:null};var A=h.value;return _.callback=function(){rb||(rb=!0,WM=A),z(u,h)},_}function ze(u,h,_){_=Bn(-1,_),_.tag=3;var A=u.type.getDerivedStateFromError;if(typeof A=="function"){var k=h.value;_.payload=function(){return A(k)},_.callback=function(){z(u,h)}}var j=u.stateNode;return j!==null&&typeof j.componentDidCatch=="function"&&(_.callback=function(){z(u,h),typeof A!="function"&&(zu===null?zu=new Set([this]):zu.add(this));var $=h.stack;this.componentDidCatch(h.value,{componentStack:$!==null?$:""})}),_}function st(u,h,_){var A=u.pingCache;if(A===null){A=u.pingCache=new ie;var k=new Set;A.set(h,k)}else k=A.get(h),k===void 0&&(k=new Set,A.set(h,k));k.has(_)||(k.add(_),u=P8.bind(null,u,h,_),h.then(u,u))}function St(u){do{var h;if((h=u.tag===13)&&(h=u.memoizedState,h=h!==null?h.dehydrated!==null:!0),h)return u;u=u.return}while(u!==null);return null}function rn(u,h,_,A,k){return(u.mode&1)===0?(u===h?u.flags|=65536:(u.flags|=128,_.flags|=131072,_.flags&=-52805,_.tag===1&&(_.alternate===null?_.tag=17:(h=Bn(-1,1),h.tag=2,Jn(_,h,1))),_.lanes|=1),u):(u.flags|=65536,u.lanes=k,u)}var Bt=C.ReactCurrentOwner,ln=!1;function bt(u,h,_,A){h.child=u===null?ff(h,null,_,A):fc(h,u.child,_,A)}function Jr(u,h,_,A,k){_=_.render;var j=h.ref;return ll(h,k),A=yf(u,h,_,A,j,k),_=$v(),u!==null&&!ln?(h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~k,wc(u,h,k)):(Kn&&_&&Fv(h),h.flags|=1,bt(u,h,A,k),h.child)}function ys(u,h,_,A,k){if(u===null){var j=_.type;return typeof j=="function"&&!QM(j)&&j.defaultProps===void 0&&_.compare===null&&_.defaultProps===void 0?(h.tag=15,h.type=j,Re(u,h,j,A,k)):(u=cb(_.type,null,A,h,h.mode,k),u.ref=h.ref,u.return=h,h.child=u)}if(j=u.child,(u.lanes&k)===0){var $=j.memoizedProps;if(_=_.compare,_=_!==null?_:nc,_($,A)&&u.ref===h.ref)return wc(u,h,k)}return h.flags|=1,u=Gu(j,A),u.ref=h.ref,u.return=h,h.child=u}function Re(u,h,_,A,k){if(u!==null){var j=u.memoizedProps;if(nc(j,A)&&u.ref===h.ref)if(ln=!1,h.pendingProps=A=j,(u.lanes&k)!==0)(u.flags&131072)!==0&&(ln=!0);else return h.lanes=u.lanes,wc(u,h,k)}return gt(u,h,_,A,k)}function _e(u,h,_){var A=h.pendingProps,k=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},Wn(om,ha),ha|=_;else{if((_&1073741824)===0)return u=j!==null?j.baseLanes|_:_,h.lanes=h.childLanes=1073741824,h.memoizedState={baseLanes:u,cachePool:null,transitions:null},h.updateQueue=null,Wn(om,ha),ha|=u,null;h.memoizedState={baseLanes:0,cachePool:null,transitions:null},A=j!==null?j.baseLanes:_,Wn(om,ha),ha|=A}else j!==null?(A=j.baseLanes|_,h.memoizedState=null):A=_,Wn(om,ha),ha|=A;return bt(u,h,k,_),h.child}function Ue(u,h){var _=h.ref;(u===null&&_!==null||u!==null&&u.ref!==_)&&(h.flags|=512,h.flags|=2097152)}function gt(u,h,_,A,k){var j=ui(_)?vo:Kr.current;return j=lc(h,j),ll(h,k),_=yf(u,h,_,A,j,k),A=$v(),u!==null&&!ln?(h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~k,wc(u,h,k)):(Kn&&A&&Fv(h),h.flags|=1,bt(u,h,_,k),h.child)}function Lt(u,h,_,A,k){if(ui(_)){var j=!0;cc(h)}else j=!1;if(ll(h,k),h.stateNode===null)Qx(u,h),m(h,_,A),E(h,_,A,k),A=!0;else if(u===null){var $=h.stateNode,ae=h.memoizedProps;$.props=ae;var me=$.context,Ie=_.contextType;typeof Ie=="object"&&Ie!==null?Ie=ps(Ie):(Ie=ui(_)?vo:Kr.current,Ie=lc(h,Ie));var et=_.getDerivedStateFromProps,nt=typeof et=="function"||typeof $.getSnapshotBeforeUpdate=="function";nt||typeof $.UNSAFE_componentWillReceiveProps!="function"&&typeof $.componentWillReceiveProps!="function"||(ae!==A||me!==Ie)&&v(h,$,A,Ie),zn=!1;var Qe=h.memoizedState;$.state=Qe,cr(h,A,$,k),me=h.memoizedState,ae!==A||Qe!==me||Ri.current||zn?(typeof et=="function"&&(Sf(h,_,et,A),me=h.memoizedState),(ae=zn||Yx(h,_,ae,A,Qe,me,Ie))?(nt||typeof $.UNSAFE_componentWillMount!="function"&&typeof $.componentWillMount!="function"||(typeof $.componentWillMount=="function"&&$.componentWillMount(),typeof $.UNSAFE_componentWillMount=="function"&&$.UNSAFE_componentWillMount()),typeof $.componentDidMount=="function"&&(h.flags|=4194308)):(typeof $.componentDidMount=="function"&&(h.flags|=4194308),h.memoizedProps=A,h.memoizedState=me),$.props=A,$.state=me,$.context=Ie,A=ae):(typeof $.componentDidMount=="function"&&(h.flags|=4194308),A=!1)}else{$=h.stateNode,gr(u,h),ae=h.memoizedProps,Ie=h.type===h.elementType?ae:Vs(h.type,ae),$.props=Ie,nt=h.pendingProps,Qe=$.context,me=_.contextType,typeof me=="object"&&me!==null?me=ps(me):(me=ui(_)?vo:Kr.current,me=lc(h,me));var _t=_.getDerivedStateFromProps;(et=typeof _t=="function"||typeof $.getSnapshotBeforeUpdate=="function")||typeof $.UNSAFE_componentWillReceiveProps!="function"&&typeof $.componentWillReceiveProps!="function"||(ae!==nt||Qe!==me)&&v(h,$,A,me),zn=!1,Qe=h.memoizedState,$.state=Qe,cr(h,A,$,k);var Ct=h.memoizedState;ae!==nt||Qe!==Ct||Ri.current||zn?(typeof _t=="function"&&(Sf(h,_,_t,A),Ct=h.memoizedState),(Ie=zn||Yx(h,_,Ie,A,Qe,Ct,me)||!1)?(et||typeof $.UNSAFE_componentWillUpdate!="function"&&typeof $.componentWillUpdate!="function"||(typeof $.componentWillUpdate=="function"&&$.componentWillUpdate(A,Ct,me),typeof $.UNSAFE_componentWillUpdate=="function"&&$.UNSAFE_componentWillUpdate(A,Ct,me)),typeof $.componentDidUpdate=="function"&&(h.flags|=4),typeof $.getSnapshotBeforeUpdate=="function"&&(h.flags|=1024)):(typeof $.componentDidUpdate!="function"||ae===u.memoizedProps&&Qe===u.memoizedState||(h.flags|=4),typeof $.getSnapshotBeforeUpdate!="function"||ae===u.memoizedProps&&Qe===u.memoizedState||(h.flags|=1024),h.memoizedProps=A,h.memoizedState=Ct),$.props=A,$.state=Ct,$.context=me,A=Ie):(typeof $.componentDidUpdate!="function"||ae===u.memoizedProps&&Qe===u.memoizedState||(h.flags|=4),typeof $.getSnapshotBeforeUpdate!="function"||ae===u.memoizedProps&&Qe===u.memoizedState||(h.flags|=1024),A=!1)}return an(u,h,_,A,j,k)}function an(u,h,_,A,k,j){Ue(u,h);var $=(h.flags&128)!==0;if(!A&&!$)return k&&jv(h,_,!1),wc(u,h,j);A=h.stateNode,Bt.current=h;var ae=$&&typeof _.getDerivedStateFromError!="function"?null:A.render();return h.flags|=1,u!==null&&$?(h.child=fc(h,u.child,null,j),h.child=fc(h,null,ae,j)):bt(u,h,ae,j),h.memoizedState=A.state,k&&jv(h,_,!0),h.child}function sn(u){var h=u.stateNode;h.pendingContext?Dv(u,h.pendingContext,h.pendingContext!==h.context):h.context&&Dv(u,h.context,!1),gf(u,h.containerInfo)}function En(u,h,_,A,k){return ol(),Iu(k),h.flags|=256,bt(u,h,_,A),h.child}var _r={dehydrated:null,treeContext:null,retryLane:0};function bn(u){return{baseLanes:u,cachePool:null,transitions:null}}function Ao(u,h,_){var A=h.pendingProps,k=Yn.current,j=!1,$=(h.flags&128)!==0,ae;if((ae=$)||(ae=u!==null&&u.memoizedState===null?!1:(k&2)!==0),ae?(j=!0,h.flags&=-129):(u===null||u.memoizedState!==null)&&(k|=1),Wn(Yn,k&1),u===null)return Yp(h),u=h.memoizedState,u!==null&&(u=u.dehydrated,u!==null)?((h.mode&1)===0?h.lanes=1:u.data==="$!"?h.lanes=8:h.lanes=1073741824,null):($=A.children,u=A.fallback,j?(A=h.mode,j=h.child,$={mode:"hidden",children:$},(A&1)===0&&j!==null?(j.childLanes=0,j.pendingProps=$):j=ub($,A,0,null),u=Cf(u,A,_,null),j.return=h,u.return=h,j.sibling=u,h.child=j,h.child.memoizedState=bn(_),h.memoizedState=_r,u):e0(h,$));if(k=u.memoizedState,k!==null&&(ae=k.dehydrated,ae!==null))return v8(u,h,$,A,ae,k,_);if(j){j=A.fallback,$=h.mode,k=u.child,ae=k.sibling;var me={mode:"hidden",children:A.children};return($&1)===0&&h.child!==k?(A=h.child,A.childLanes=0,A.pendingProps=me,h.deletions=null):(A=Gu(k,me),A.subtreeFlags=k.subtreeFlags&14680064),ae!==null?j=Gu(ae,j):(j=Cf(j,$,_,null),j.flags|=2),j.return=h,A.return=h,A.sibling=j,h.child=A,A=j,j=h.child,$=u.child.memoizedState,$=$===null?bn(_):{baseLanes:$.baseLanes|_,cachePool:null,transitions:$.transitions},j.memoizedState=$,j.childLanes=u.childLanes&~_,h.memoizedState=_r,A}return j=u.child,u=j.sibling,A=Gu(j,{mode:"visible",children:A.children}),(h.mode&1)===0&&(A.lanes=_),A.return=h,A.sibling=null,u!==null&&(_=h.deletions,_===null?(h.deletions=[u],h.flags|=16):_.push(u)),h.child=A,h.memoizedState=null,A}function e0(u,h){return h=ub({mode:"visible",children:h},u.mode,0,null),h.return=u,u.child=h}function Zx(u,h,_,A){return A!==null&&Iu(A),fc(h,u.child,null,_),u=e0(h,h.pendingProps.children),u.flags|=2,h.memoizedState=null,u}function v8(u,h,_,A,k,j,$){if(_)return h.flags&256?(h.flags&=-257,A=O(Error(n(422))),Zx(u,h,$,A)):h.memoizedState!==null?(h.child=u.child,h.flags|=128,null):(j=A.fallback,k=h.mode,A=ub({mode:"visible",children:A.children},k,0,null),j=Cf(j,k,$,null),j.flags|=2,A.return=h,j.return=h,A.sibling=j,h.child=A,(h.mode&1)!==0&&fc(h,u.child,null,$),h.child.memoizedState=bn($),h.memoizedState=_r,j);if((h.mode&1)===0)return Zx(u,h,$,null);if(k.data==="$!"){if(A=k.nextSibling&&k.nextSibling.dataset,A)var ae=A.dgst;return A=ae,j=Error(n(419)),A=O(j,A,void 0),Zx(u,h,$,A)}if(ae=($&u.childLanes)!==0,ln||ae){if(A=hi,A!==null){switch($&-$){case 4:k=2;break;case 16:k=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:k=32;break;case 536870912:k=268435456;break;default:k=0}k=(k&(A.suspendedLanes|$))!==0?0:k,k!==0&&k!==j.retryLane&&(j.retryLane=k,ca(u,k),Po(A,u,k,-1))}return ZM(),A=O(Error(n(421))),Zx(u,h,$,A)}return k.data==="$?"?(h.flags|=128,h.child=u.child,h=R8.bind(null,u),k._reactRetry=h,null):(u=j.treeContext,ki=po(k.nextSibling),Yr=h,Kn=!0,Hs=null,u!==null&&(Ni[zr++]=dt,Ni[zr++]=Bs,Ni[zr++]=dc,dt=u.id,Bs=u.overflow,dc=h),h=e0(h,A.children),h.flags|=4096,h)}function pN(u,h,_){u.lanes|=h;var A=u.alternate;A!==null&&(A.lanes|=h),pf(u.return,h,_)}function DM(u,h,_,A,k){var j=u.memoizedState;j===null?u.memoizedState={isBackwards:h,rendering:null,renderingStartTime:0,last:A,tail:_,tailMode:k}:(j.isBackwards=h,j.rendering=null,j.renderingStartTime=0,j.last=A,j.tail=_,j.tailMode=k)}function mN(u,h,_){var A=h.pendingProps,k=A.revealOrder,j=A.tail;if(bt(u,h,A.children,_),A=Yn.current,(A&2)!==0)A=A&1|2,h.flags|=128;else{if(u!==null&&(u.flags&128)!==0)e:for(u=h.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&pN(u,_,h);else if(u.tag===19)pN(u,_,h);else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===h)break e;for(;u.sibling===null;){if(u.return===null||u.return===h)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}A&=1}if(Wn(Yn,A),(h.mode&1)===0)h.memoizedState=null;else switch(k){case"forwards":for(_=h.child,k=null;_!==null;)u=_.alternate,u!==null&&ua(u)===null&&(k=_),_=_.sibling;_=k,_===null?(k=h.child,h.child=null):(k=_.sibling,_.sibling=null),DM(h,!1,k,_,j);break;case"backwards":for(_=null,k=h.child,h.child=null;k!==null;){if(u=k.alternate,u!==null&&ua(u)===null){h.child=k;break}u=k.sibling,k.sibling=_,_=k,k=u}DM(h,!0,_,null,j);break;case"together":DM(h,!1,null,null,void 0);break;default:h.memoizedState=null}return h.child}function Qx(u,h){(h.mode&1)===0&&u!==null&&(u.alternate=null,h.alternate=null,h.flags|=2)}function wc(u,h,_){if(u!==null&&(h.dependencies=u.dependencies),Mf|=h.lanes,(_&h.childLanes)===0)return null;if(u!==null&&h.child!==u.child)throw Error(n(153));if(h.child!==null){for(u=h.child,_=Gu(u,u.pendingProps),h.child=_,_.return=h;u.sibling!==null;)u=u.sibling,_=_.sibling=Gu(u,u.pendingProps),_.return=h;_.sibling=null}return h.child}function y8(u,h,_){switch(h.tag){case 3:sn(h),ol();break;case 5:yc(h);break;case 1:ui(h.type)&&cc(h);break;case 4:gf(h,h.stateNode.containerInfo);break;case 10:var A=h.type._context,k=h.memoizedProps.value;Wn(hc,A._currentValue),A._currentValue=k;break;case 13:if(A=h.memoizedState,A!==null)return A.dehydrated!==null?(Wn(Yn,Yn.current&1),h.flags|=128,null):(_&h.child.childLanes)!==0?Ao(u,h,_):(Wn(Yn,Yn.current&1),u=wc(u,h,_),u!==null?u.sibling:null);Wn(Yn,Yn.current&1);break;case 19:if(A=(_&h.childLanes)!==0,(u.flags&128)!==0){if(A)return mN(u,h,_);h.flags|=128}if(k=h.memoizedState,k!==null&&(k.rendering=null,k.tail=null,k.lastEffect=null),Wn(Yn,Yn.current),A)break;return null;case 22:case 23:return h.lanes=0,_e(u,h,_)}return wc(u,h,_)}var gN,jM,vN,yN;gN=function(u,h){for(var _=h.child;_!==null;){if(_.tag===5||_.tag===6)u.appendChild(_.stateNode);else if(_.tag!==4&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===h)break;for(;_.sibling===null;){if(_.return===null||_.return===h)return;_=_.return}_.sibling.return=_.return,_=_.sibling}},jM=function(){},vN=function(u,h,_,A){var k=u.memoizedProps;if(k!==A){u=h.stateNode,br(ms.current);var j=null;switch(_){case"input":k=Ve(u,k),A=Ve(u,A),j=[];break;case"select":k=Z({},k,{value:void 0}),A=Z({},A,{value:void 0}),j=[];break;case"textarea":k=xe(u,k),A=xe(u,A),j=[];break;default:typeof k.onClick!="function"&&typeof A.onClick=="function"&&(u.onclick=sf)}he(_,A);var $;_=null;for(Ie in k)if(!A.hasOwnProperty(Ie)&&k.hasOwnProperty(Ie)&&k[Ie]!=null)if(Ie==="style"){var ae=k[Ie];for($ in ae)ae.hasOwnProperty($)&&(_||(_={}),_[$]="")}else Ie!=="dangerouslySetInnerHTML"&&Ie!=="children"&&Ie!=="suppressContentEditableWarning"&&Ie!=="suppressHydrationWarning"&&Ie!=="autoFocus"&&(i.hasOwnProperty(Ie)?j||(j=[]):(j=j||[]).push(Ie,null));for(Ie in A){var me=A[Ie];if(ae=k!=null?k[Ie]:void 0,A.hasOwnProperty(Ie)&&me!==ae&&(me!=null||ae!=null))if(Ie==="style")if(ae){for($ in ae)!ae.hasOwnProperty($)||me&&me.hasOwnProperty($)||(_||(_={}),_[$]="");for($ in me)me.hasOwnProperty($)&&ae[$]!==me[$]&&(_||(_={}),_[$]=me[$])}else _||(j||(j=[]),j.push(Ie,_)),_=me;else Ie==="dangerouslySetInnerHTML"?(me=me?me.__html:void 0,ae=ae?ae.__html:void 0,me!=null&&ae!==me&&(j=j||[]).push(Ie,me)):Ie==="children"?typeof me!="string"&&typeof me!="number"||(j=j||[]).push(Ie,""+me):Ie!=="suppressContentEditableWarning"&&Ie!=="suppressHydrationWarning"&&(i.hasOwnProperty(Ie)?(me!=null&&Ie==="onScroll"&&$n("scroll",u),j||ae===me||(j=[])):(j=j||[]).push(Ie,me))}_&&(j=j||[]).push("style",_);var Ie=j;(h.updateQueue=Ie)&&(h.flags|=4)}},yN=function(u,h,_,A){_!==A&&(h.flags|=4)};function t0(u,h){if(!Kn)switch(u.tailMode){case"hidden":h=u.tail;for(var _=null;h!==null;)h.alternate!==null&&(_=h),h=h.sibling;_===null?u.tail=null:_.sibling=null;break;case"collapsed":_=u.tail;for(var A=null;_!==null;)_.alternate!==null&&(A=_),_=_.sibling;A===null?h||u.tail===null?u.tail=null:u.tail.sibling=null:A.sibling=null}}function Zi(u){var h=u.alternate!==null&&u.alternate.child===u.child,_=0,A=0;if(h)for(var k=u.child;k!==null;)_|=k.lanes|k.childLanes,A|=k.subtreeFlags&14680064,A|=k.flags&14680064,k.return=u,k=k.sibling;else for(k=u.child;k!==null;)_|=k.lanes|k.childLanes,A|=k.subtreeFlags,A|=k.flags,k.return=u,k=k.sibling;return u.subtreeFlags|=A,u.childLanes=_,h}function x8(u,h,_){var A=h.pendingProps;switch(xo(h),h.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Zi(h),null;case 1:return ui(h.type)&&af(),Zi(h),null;case 3:return A=h.stateNode,cl(),Xn(Ri),Xn(Kr),Da(),A.pendingContext&&(A.context=A.pendingContext,A.pendingContext=null),(u===null||u.child===null)&&(ku(h)?h.flags|=4:u===null||u.memoizedState.isDehydrated&&(h.flags&256)===0||(h.flags|=1024,Hs!==null&&(qM(Hs),Hs=null))),jM(u,h),Zi(h),null;case 5:Du(h);var k=br(wo.current);if(_=h.type,u!==null&&h.stateNode!=null)vN(u,h,_,A,k),u.ref!==h.ref&&(h.flags|=512,h.flags|=2097152);else{if(!A){if(h.stateNode===null)throw Error(n(166));return Zi(h),null}if(u=br(ms.current),ku(h)){A=h.stateNode,_=h.type;var j=h.memoizedProps;switch(A[kr]=h,A[Nu]=j,u=(h.mode&1)!==0,_){case"dialog":$n("cancel",A),$n("close",A);break;case"iframe":case"object":case"embed":$n("load",A);break;case"video":case"audio":for(k=0;k<sl.length;k++)$n(sl[k],A);break;case"source":$n("error",A);break;case"img":case"image":case"link":$n("error",A),$n("load",A);break;case"details":$n("toggle",A);break;case"input":Le(A,j),$n("invalid",A);break;case"select":A._wrapperState={wasMultiple:!!j.multiple},$n("invalid",A);break;case"textarea":je(A,j),$n("invalid",A)}he(_,j),k=null;for(var $ in j)if(j.hasOwnProperty($)){var ae=j[$];$==="children"?typeof ae=="string"?A.textContent!==ae&&(j.suppressHydrationWarning!==!0&&rf(A.textContent,ae,u),k=["children",ae]):typeof ae=="number"&&A.textContent!==""+ae&&(j.suppressHydrationWarning!==!0&&rf(A.textContent,ae,u),k=["children",""+ae]):i.hasOwnProperty($)&&ae!=null&&$==="onScroll"&&$n("scroll",A)}switch(_){case"input":Xe(A),de(A,j,!0);break;case"textarea":Xe(A),Fe(A);break;case"select":case"option":break;default:typeof j.onClick=="function"&&(A.onclick=sf)}A=k,h.updateQueue=A,A!==null&&(h.flags|=4)}else{$=k.nodeType===9?k:k.ownerDocument,u==="http://www.w3.org/1999/xhtml"&&(u=xt(_)),u==="http://www.w3.org/1999/xhtml"?_==="script"?(u=$.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild)):typeof A.is=="string"?u=$.createElement(_,{is:A.is}):(u=$.createElement(_),_==="select"&&($=u,A.multiple?$.multiple=!0:A.size&&($.size=A.size))):u=$.createElementNS(u,_),u[kr]=h,u[Nu]=A,gN(u,h,!1,!1),h.stateNode=u;e:{switch($=Ke(_,A),_){case"dialog":$n("cancel",u),$n("close",u),k=A;break;case"iframe":case"object":case"embed":$n("load",u),k=A;break;case"video":case"audio":for(k=0;k<sl.length;k++)$n(sl[k],u);k=A;break;case"source":$n("error",u),k=A;break;case"img":case"image":case"link":$n("error",u),$n("load",u),k=A;break;case"details":$n("toggle",u),k=A;break;case"input":Le(u,A),k=Ve(u,A),$n("invalid",u);break;case"option":k=A;break;case"select":u._wrapperState={wasMultiple:!!A.multiple},k=Z({},A,{value:void 0}),$n("invalid",u);break;case"textarea":je(u,A),k=xe(u,A),$n("invalid",u);break;default:k=A}he(_,k),ae=k;for(j in ae)if(ae.hasOwnProperty(j)){var me=ae[j];j==="style"?vt(u,me):j==="dangerouslySetInnerHTML"?(me=me?me.__html:void 0,me!=null&&zt(u,me)):j==="children"?typeof me=="string"?(_!=="textarea"||me!=="")&&Ye(u,me):typeof me=="number"&&Ye(u,""+me):j!=="suppressContentEditableWarning"&&j!=="suppressHydrationWarning"&&j!=="autoFocus"&&(i.hasOwnProperty(j)?me!=null&&j==="onScroll"&&$n("scroll",u):me!=null&&T(u,j,me,$))}switch(_){case"input":Xe(u),de(u,A,!1);break;case"textarea":Xe(u),Fe(u);break;case"option":A.value!=null&&u.setAttribute("value",""+$e(A.value));break;case"select":u.multiple=!!A.multiple,j=A.value,j!=null?H(u,!!A.multiple,j,!1):A.defaultValue!=null&&H(u,!!A.multiple,A.defaultValue,!0);break;default:typeof k.onClick=="function"&&(u.onclick=sf)}switch(_){case"button":case"input":case"select":case"textarea":A=!!A.autoFocus;break e;case"img":A=!0;break e;default:A=!1}}A&&(h.flags|=4)}h.ref!==null&&(h.flags|=512,h.flags|=2097152)}return Zi(h),null;case 6:if(u&&h.stateNode!=null)yN(u,h,u.memoizedProps,A);else{if(typeof A!="string"&&h.stateNode===null)throw Error(n(166));if(_=br(wo.current),br(ms.current),ku(h)){if(A=h.stateNode,_=h.memoizedProps,A[kr]=h,(j=A.nodeValue!==_)&&(u=Yr,u!==null))switch(u.tag){case 3:rf(A.nodeValue,_,(u.mode&1)!==0);break;case 5:u.memoizedProps.suppressHydrationWarning!==!0&&rf(A.nodeValue,_,(u.mode&1)!==0)}j&&(h.flags|=4)}else A=(_.nodeType===9?_:_.ownerDocument).createTextNode(A),A[kr]=h,h.stateNode=A}return Zi(h),null;case 13:if(Xn(Yn),A=h.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(Kn&&ki!==null&&(h.mode&1)!==0&&(h.flags&128)===0)Hv(),ol(),h.flags|=98560,j=!1;else if(j=ku(h),A!==null&&A.dehydrated!==null){if(u===null){if(!j)throw Error(n(318));if(j=h.memoizedState,j=j!==null?j.dehydrated:null,!j)throw Error(n(317));j[kr]=h}else ol(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;Zi(h),j=!1}else Hs!==null&&(qM(Hs),Hs=null),j=!0;if(!j)return h.flags&65536?h:null}return(h.flags&128)!==0?(h.lanes=_,h):(A=A!==null,A!==(u!==null&&u.memoizedState!==null)&&A&&(h.child.flags|=8192,(h.mode&1)!==0&&(u===null||(Yn.current&1)!==0?ei===0&&(ei=3):ZM())),h.updateQueue!==null&&(h.flags|=4),Zi(h),null);case 4:return cl(),jM(u,h),u===null&&Cu(h.stateNode.containerInfo),Zi(h),null;case 10:return hf(h.type._context),Zi(h),null;case 17:return ui(h.type)&&af(),Zi(h),null;case 19:if(Xn(Yn),j=h.memoizedState,j===null)return Zi(h),null;if(A=(h.flags&128)!==0,$=j.rendering,$===null)if(A)t0(j,!1);else{if(ei!==0||u!==null&&(u.flags&128)!==0)for(u=h.child;u!==null;){if($=ua(u),$!==null){for(h.flags|=128,t0(j,!1),A=$.updateQueue,A!==null&&(h.updateQueue=A,h.flags|=4),h.subtreeFlags=0,A=_,_=h.child;_!==null;)j=_,u=A,j.flags&=14680066,$=j.alternate,$===null?(j.childLanes=0,j.lanes=u,j.child=null,j.subtreeFlags=0,j.memoizedProps=null,j.memoizedState=null,j.updateQueue=null,j.dependencies=null,j.stateNode=null):(j.childLanes=$.childLanes,j.lanes=$.lanes,j.child=$.child,j.subtreeFlags=0,j.deletions=null,j.memoizedProps=$.memoizedProps,j.memoizedState=$.memoizedState,j.updateQueue=$.updateQueue,j.type=$.type,u=$.dependencies,j.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext}),_=_.sibling;return Wn(Yn,Yn.current&1|2),h.child}u=u.sibling}j.tail!==null&&ct()>lm&&(h.flags|=128,A=!0,t0(j,!1),h.lanes=4194304)}else{if(!A)if(u=ua($),u!==null){if(h.flags|=128,A=!0,_=u.updateQueue,_!==null&&(h.updateQueue=_,h.flags|=4),t0(j,!0),j.tail===null&&j.tailMode==="hidden"&&!$.alternate&&!Kn)return Zi(h),null}else 2*ct()-j.renderingStartTime>lm&&_!==1073741824&&(h.flags|=128,A=!0,t0(j,!1),h.lanes=4194304);j.isBackwards?($.sibling=h.child,h.child=$):(_=j.last,_!==null?_.sibling=$:h.child=$,j.last=$)}return j.tail!==null?(h=j.tail,j.rendering=h,j.tail=h.sibling,j.renderingStartTime=ct(),h.sibling=null,_=Yn.current,Wn(Yn,A?_&1|2:_&1),h):(Zi(h),null);case 22:case 23:return YM(),A=h.memoizedState!==null,u!==null&&u.memoizedState!==null!==A&&(h.flags|=8192),A&&(h.mode&1)!==0?(ha&1073741824)!==0&&(Zi(h),h.subtreeFlags&6&&(h.flags|=8192)):Zi(h),null;case 24:return null;case 25:return null}throw Error(n(156,h.tag))}function b8(u,h){switch(xo(h),h.tag){case 1:return ui(h.type)&&af(),u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 3:return cl(),Xn(Ri),Xn(Kr),Da(),u=h.flags,(u&65536)!==0&&(u&128)===0?(h.flags=u&-65537|128,h):null;case 5:return Du(h),null;case 13:if(Xn(Yn),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 Xn(Yn),null;case 4:return cl(),null;case 10:return hf(h.type._context),null;case 22:case 23:return YM(),null;case 24:return null;default:return null}}var Jx=!1,Qi=!1,_8=typeof WeakSet=="function"?WeakSet:Set,At=null;function am(u,h){var _=u.ref;if(_!==null)if(typeof _=="function")try{_(null)}catch(A){wr(u,h,A)}else _.current=null}function UM(u,h,_){try{_()}catch(A){wr(u,h,A)}}var xN=!1;function w8(u,h){if(Ru=Os,u=rr(),Dr(u)){if("selectionStart"in u)var _={start:u.selectionStart,end:u.selectionEnd};else e:{_=(_=u.ownerDocument)&&_.defaultView||window;var A=_.getSelection&&_.getSelection();if(A&&A.rangeCount!==0){_=A.anchorNode;var k=A.anchorOffset,j=A.focusNode;A=A.focusOffset;try{_.nodeType,j.nodeType}catch{_=null;break e}var $=0,ae=-1,me=-1,Ie=0,et=0,nt=u,Qe=null;t:for(;;){for(var _t;nt!==_||k!==0&&nt.nodeType!==3||(ae=$+k),nt!==j||A!==0&&nt.nodeType!==3||(me=$+A),nt.nodeType===3&&($+=nt.nodeValue.length),(_t=nt.firstChild)!==null;)Qe=nt,nt=_t;for(;;){if(nt===u)break t;if(Qe===_&&++Ie===k&&(ae=$),Qe===j&&++et===A&&(me=$),(_t=nt.nextSibling)!==null)break;nt=Qe,Qe=nt.parentNode}nt=_t}_=ae===-1||me===-1?null:{start:ae,end:me}}else _=null}_=_||{start:0,end:0}}else _=null;for(Rv={focusedElem:u,selectionRange:_},Os=!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 kt=Ct.memoizedProps,Ir=Ct.memoizedState,Ae=h.stateNode,ve=Ae.getSnapshotBeforeUpdate(h.elementType===h.type?kt:Vs(h.type,kt),Ir);Ae.__reactInternalSnapshotBeforeUpdate=ve}break;case 3:var Ce=h.stateNode.containerInfo;Ce.nodeType===1?Ce.textContent="":Ce.nodeType===9&&Ce.documentElement&&Ce.removeChild(Ce.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(ot){wr(h,h.return,ot)}if(u=h.sibling,u!==null){u.return=h.return,At=u;break}At=h.return}return Ct=xN,xN=!1,Ct}function n0(u,h,_){var A=h.updateQueue;if(A=A!==null?A.lastEffect:null,A!==null){var k=A=A.next;do{if((k.tag&u)===u){var j=k.destroy;k.destroy=void 0,j!==void 0&&UM(h,_,j)}k=k.next}while(k!==A)}}function eb(u,h){if(h=h.updateQueue,h=h!==null?h.lastEffect:null,h!==null){var _=h=h.next;do{if((_.tag&u)===u){var A=_.create;_.destroy=A()}_=_.next}while(_!==h)}}function FM(u){var h=u.ref;if(h!==null){var _=u.stateNode;switch(u.tag){case 5:u=_;break;default:u=_}typeof h=="function"?h(u):h.current=u}}function bN(u){var h=u.alternate;h!==null&&(u.alternate=null,bN(h)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(h=u.stateNode,h!==null&&(delete h[kr],delete h[Nu],delete h[oc],delete h[Vp],delete h[Gp])),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 _N(u){return u.tag===5||u.tag===3||u.tag===4}function wN(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||_N(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 zM(u,h,_){var A=u.tag;if(A===5||A===6)u=u.stateNode,h?_.nodeType===8?_.parentNode.insertBefore(u,h):_.insertBefore(u,h):(_.nodeType===8?(h=_.parentNode,h.insertBefore(u,_)):(h=_,h.appendChild(u)),_=_._reactRootContainer,_!=null||h.onclick!==null||(h.onclick=sf));else if(A!==4&&(u=u.child,u!==null))for(zM(u,h,_),u=u.sibling;u!==null;)zM(u,h,_),u=u.sibling}function BM(u,h,_){var A=u.tag;if(A===5||A===6)u=u.stateNode,h?_.insertBefore(u,h):_.appendChild(u);else if(A!==4&&(u=u.child,u!==null))for(BM(u,h,_),u=u.sibling;u!==null;)BM(u,h,_),u=u.sibling}var Li=null,To=!1;function Fu(u,h,_){for(_=_.child;_!==null;)SN(u,h,_),_=_.sibling}function SN(u,h,_){if(Kt&&typeof Kt.onCommitFiberUnmount=="function")try{Kt.onCommitFiberUnmount(yn,_)}catch{}switch(_.tag){case 5:Qi||am(_,h);case 6:var A=Li,k=To;Li=null,Fu(u,h,_),Li=A,To=k,Li!==null&&(To?(u=Li,_=_.stateNode,u.nodeType===8?u.parentNode.removeChild(_):u.removeChild(_)):Li.removeChild(_.stateNode));break;case 18:Li!==null&&(To?(u=Li,_=_.stateNode,u.nodeType===8?Hp(u.parentNode,_):u.nodeType===1&&Hp(u,_),$d(u)):Hp(Li,_.stateNode));break;case 4:A=Li,k=To,Li=_.stateNode.containerInfo,To=!0,Fu(u,h,_),Li=A,To=k;break;case 0:case 11:case 14:case 15:if(!Qi&&(A=_.updateQueue,A!==null&&(A=A.lastEffect,A!==null))){k=A=A.next;do{var j=k,$=j.destroy;j=j.tag,$!==void 0&&((j&2)!==0||(j&4)!==0)&&UM(_,h,$),k=k.next}while(k!==A)}Fu(u,h,_);break;case 1:if(!Qi&&(am(_,h),A=_.stateNode,typeof A.componentWillUnmount=="function"))try{A.props=_.memoizedProps,A.state=_.memoizedState,A.componentWillUnmount()}catch(ae){wr(_,h,ae)}Fu(u,h,_);break;case 21:Fu(u,h,_);break;case 22:_.mode&1?(Qi=(A=Qi)||_.memoizedState!==null,Fu(u,h,_),Qi=A):Fu(u,h,_);break;default:Fu(u,h,_)}}function MN(u){var h=u.updateQueue;if(h!==null){u.updateQueue=null;var _=u.stateNode;_===null&&(_=u.stateNode=new _8),h.forEach(function(A){var k=N8.bind(null,u,A);_.has(A)||(_.add(A),A.then(k,k))})}}function Co(u,h){var _=h.deletions;if(_!==null)for(var A=0;A<_.length;A++){var k=_[A];try{var j=u,$=h,ae=$;e:for(;ae!==null;){switch(ae.tag){case 5:Li=ae.stateNode,To=!1;break e;case 3:Li=ae.stateNode.containerInfo,To=!0;break e;case 4:Li=ae.stateNode.containerInfo,To=!0;break e}ae=ae.return}if(Li===null)throw Error(n(160));SN(j,$,k),Li=null,To=!1;var me=k.alternate;me!==null&&(me.return=null),k.return=null}catch(Ie){wr(k,h,Ie)}}if(h.subtreeFlags&12854)for(h=h.child;h!==null;)EN(h,u),h=h.sibling}function EN(u,h){var _=u.alternate,A=u.flags;switch(u.tag){case 0:case 11:case 14:case 15:if(Co(h,u),dl(u),A&4){try{n0(3,u,u.return),eb(3,u)}catch(kt){wr(u,u.return,kt)}try{n0(5,u,u.return)}catch(kt){wr(u,u.return,kt)}}break;case 1:Co(h,u),dl(u),A&512&&_!==null&&am(_,_.return);break;case 5:if(Co(h,u),dl(u),A&512&&_!==null&&am(_,_.return),u.flags&32){var k=u.stateNode;try{Ye(k,"")}catch(kt){wr(u,u.return,kt)}}if(A&4&&(k=u.stateNode,k!=null)){var j=u.memoizedProps,$=_!==null?_.memoizedProps:j,ae=u.type,me=u.updateQueue;if(u.updateQueue=null,me!==null)try{ae==="input"&&j.type==="radio"&&j.name!=null&&We(k,j),Ke(ae,$);var Ie=Ke(ae,j);for($=0;$<me.length;$+=2){var et=me[$],nt=me[$+1];et==="style"?vt(k,nt):et==="dangerouslySetInnerHTML"?zt(k,nt):et==="children"?Ye(k,nt):T(k,et,nt,Ie)}switch(ae){case"input":Je(k,j);break;case"textarea":Oe(k,j);break;case"select":var Qe=k._wrapperState.wasMultiple;k._wrapperState.wasMultiple=!!j.multiple;var _t=j.value;_t!=null?H(k,!!j.multiple,_t,!1):Qe!==!!j.multiple&&(j.defaultValue!=null?H(k,!!j.multiple,j.defaultValue,!0):H(k,!!j.multiple,j.multiple?[]:"",!1))}k[Nu]=j}catch(kt){wr(u,u.return,kt)}}break;case 6:if(Co(h,u),dl(u),A&4){if(u.stateNode===null)throw Error(n(162));k=u.stateNode,j=u.memoizedProps;try{k.nodeValue=j}catch(kt){wr(u,u.return,kt)}}break;case 3:if(Co(h,u),dl(u),A&4&&_!==null&&_.memoizedState.isDehydrated)try{$d(h.containerInfo)}catch(kt){wr(u,u.return,kt)}break;case 4:Co(h,u),dl(u);break;case 13:Co(h,u),dl(u),k=u.child,k.flags&8192&&(j=k.memoizedState!==null,k.stateNode.isHidden=j,!j||k.alternate!==null&&k.alternate.memoizedState!==null||(GM=ct())),A&4&&MN(u);break;case 22:if(et=_!==null&&_.memoizedState!==null,u.mode&1?(Qi=(Ie=Qi)||et,Co(h,u),Qi=Ie):Co(h,u),dl(u),A&8192){if(Ie=u.memoizedState!==null,(u.stateNode.isHidden=Ie)&&!et&&(u.mode&1)!==0)for(At=u,et=u.child;et!==null;){for(nt=At=et;At!==null;){switch(Qe=At,_t=Qe.child,Qe.tag){case 0:case 11:case 14:case 15:n0(4,Qe,Qe.return);break;case 1:am(Qe,Qe.return);var Ct=Qe.stateNode;if(typeof Ct.componentWillUnmount=="function"){A=Qe,_=Qe.return;try{h=A,Ct.props=h.memoizedProps,Ct.state=h.memoizedState,Ct.componentWillUnmount()}catch(kt){wr(A,_,kt)}}break;case 5:am(Qe,Qe.return);break;case 22:if(Qe.memoizedState!==null){CN(nt);continue}}_t!==null?(_t.return=Qe,At=_t):CN(nt)}et=et.sibling}e:for(et=null,nt=u;;){if(nt.tag===5){if(et===null){et=nt;try{k=nt.stateNode,Ie?(j=k.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none"):(ae=nt.stateNode,me=nt.memoizedProps.style,$=me!=null&&me.hasOwnProperty("display")?me.display:null,ae.style.display=Mt("display",$))}catch(kt){wr(u,u.return,kt)}}}else if(nt.tag===6){if(et===null)try{nt.stateNode.nodeValue=Ie?"":nt.memoizedProps}catch(kt){wr(u,u.return,kt)}}else if((nt.tag!==22&&nt.tag!==23||nt.memoizedState===null||nt===u)&&nt.child!==null){nt.child.return=nt,nt=nt.child;continue}if(nt===u)break e;for(;nt.sibling===null;){if(nt.return===null||nt.return===u)break e;et===nt&&(et=null),nt=nt.return}et===nt&&(et=null),nt.sibling.return=nt.return,nt=nt.sibling}}break;case 19:Co(h,u),dl(u),A&4&&MN(u);break;case 21:break;default:Co(h,u),dl(u)}}function dl(u){var h=u.flags;if(h&2){try{e:{for(var _=u.return;_!==null;){if(_N(_)){var A=_;break e}_=_.return}throw Error(n(160))}switch(A.tag){case 5:var k=A.stateNode;A.flags&32&&(Ye(k,""),A.flags&=-33);var j=wN(u);BM(u,j,k);break;case 3:case 4:var $=A.stateNode.containerInfo,ae=wN(u);zM(u,ae,$);break;default:throw Error(n(161))}}catch(me){wr(u,u.return,me)}u.flags&=-3}h&4096&&(u.flags&=-4097)}function S8(u,h,_){At=u,AN(u)}function AN(u,h,_){for(var A=(u.mode&1)!==0;At!==null;){var k=At,j=k.child;if(k.tag===22&&A){var $=k.memoizedState!==null||Jx;if(!$){var ae=k.alternate,me=ae!==null&&ae.memoizedState!==null||Qi;ae=Jx;var Ie=Qi;if(Jx=$,(Qi=me)&&!Ie)for(At=k;At!==null;)$=At,me=$.child,$.tag===22&&$.memoizedState!==null?PN(k):me!==null?(me.return=$,At=me):PN(k);for(;j!==null;)At=j,AN(j),j=j.sibling;At=k,Jx=ae,Qi=Ie}TN(u)}else(k.subtreeFlags&8772)!==0&&j!==null?(j.return=k,At=j):TN(u)}}function TN(u){for(;At!==null;){var h=At;if((h.flags&8772)!==0){var _=h.alternate;try{if((h.flags&8772)!==0)switch(h.tag){case 0:case 11:case 15:Qi||eb(5,h);break;case 1:var A=h.stateNode;if(h.flags&4&&!Qi)if(_===null)A.componentDidMount();else{var k=h.elementType===h.type?_.memoizedProps:Vs(h.type,_.memoizedProps);A.componentDidUpdate(k,_.memoizedState,A.__reactInternalSnapshotBeforeUpdate)}var j=h.updateQueue;j!==null&&Ou(h,j,A);break;case 3:var $=h.updateQueue;if($!==null){if(_=null,h.child!==null)switch(h.child.tag){case 5:_=h.child.stateNode;break;case 1:_=h.child.stateNode}Ou(h,$,_)}break;case 5:var ae=h.stateNode;if(_===null&&h.flags&4){_=ae;var me=h.memoizedProps;switch(h.type){case"button":case"input":case"select":case"textarea":me.autoFocus&&_.focus();break;case"img":me.src&&(_.src=me.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(h.memoizedState===null){var Ie=h.alternate;if(Ie!==null){var et=Ie.memoizedState;if(et!==null){var nt=et.dehydrated;nt!==null&&$d(nt)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Qi||h.flags&512&&FM(h)}catch(Qe){wr(h,h.return,Qe)}}if(h===u){At=null;break}if(_=h.sibling,_!==null){_.return=h.return,At=_;break}At=h.return}}function CN(u){for(;At!==null;){var h=At;if(h===u){At=null;break}var _=h.sibling;if(_!==null){_.return=h.return,At=_;break}At=h.return}}function PN(u){for(;At!==null;){var h=At;try{switch(h.tag){case 0:case 11:case 15:var _=h.return;try{eb(4,h)}catch(me){wr(h,_,me)}break;case 1:var A=h.stateNode;if(typeof A.componentDidMount=="function"){var k=h.return;try{A.componentDidMount()}catch(me){wr(h,k,me)}}var j=h.return;try{FM(h)}catch(me){wr(h,j,me)}break;case 5:var $=h.return;try{FM(h)}catch(me){wr(h,$,me)}}}catch(me){wr(h,h.return,me)}if(h===u){At=null;break}var ae=h.sibling;if(ae!==null){ae.return=h.return,At=ae;break}At=h.return}}var M8=Math.ceil,tb=C.ReactCurrentDispatcher,HM=C.ReactCurrentOwner,Ua=C.ReactCurrentBatchConfig,Ln=0,hi=null,Br=null,Oi=0,ha=0,om=lr(0),ei=0,r0=null,Mf=0,nb=0,VM=0,i0=null,Gs=null,GM=0,lm=1/0,Sc=null,rb=!1,WM=null,zu=null,ib=!1,Bu=null,sb=0,s0=0,$M=null,ab=-1,ob=0;function xs(){return(Ln&6)!==0?ct():ab!==-1?ab:ab=ct()}function Hu(u){return(u.mode&1)===0?1:(Ln&2)!==0&&Oi!==0?Oi&-Oi:LM.transition!==null?(ob===0&&(ob=ci()),ob):(u=Cn,u!==0||(u=window.event,u=u===void 0?16:Ax(u.type)),u)}function Po(u,h,_,A){if(50<s0)throw s0=0,$M=null,Error(n(185));Qo(u,_,A),((Ln&2)===0||u!==hi)&&(u===hi&&((Ln&2)===0&&(nb|=_),ei===4&&Vu(u,Oi)),Ws(u,A),_===1&&Ln===0&&(h.mode&1)===0&&(lm=ct()+500,lf&&La()))}function Ws(u,h){var _=u.callbackNode;Zo(u,h);var A=Gn(u,u===hi?Oi:0);if(A===0)_!==null&&we(_),u.callbackNode=null,u.callbackPriority=0;else if(h=A&-A,u.callbackPriority!==h){if(_!=null&&we(_),h===1)u.tag===0?zx(NN.bind(null,u)):cf(NN.bind(null,u)),IM(function(){(Ln&6)===0&&La()}),_=null;else{switch(mu(A)){case 1:_=Ut;break;case 4:_=Ht;break;case 16:_=Nt;break;case 536870912:_=Mn;break;default:_=Nt}_=FN(_,RN.bind(null,u))}u.callbackPriority=h,u.callbackNode=_}}function RN(u,h){if(ab=-1,ob=0,(Ln&6)!==0)throw Error(n(327));var _=u.callbackNode;if(cm()&&u.callbackNode!==_)return null;var A=Gn(u,u===hi?Oi:0);if(A===0)return null;if((A&30)!==0||(A&u.expiredLanes)!==0||h)h=lb(u,A);else{h=A;var k=Ln;Ln|=2;var j=IN();(hi!==u||Oi!==h)&&(Sc=null,lm=ct()+500,Af(u,h));do try{T8();break}catch(ae){kN(u,ae)}while(!0);mc(),tb.current=j,Ln=k,Br!==null?h=0:(hi=null,Oi=0,h=ei)}if(h!==0){if(h===2&&(k=Xr(u),k!==0&&(A=k,h=XM(u,k))),h===1)throw _=r0,Af(u,0),Vu(u,A),Ws(u,ct()),_;if(h===6)Vu(u,A);else{if(k=u.current.alternate,(A&30)===0&&!E8(k)&&(h=lb(u,A),h===2&&(j=Xr(u),j!==0&&(A=j,h=XM(u,j))),h===1))throw _=r0,Af(u,0),Vu(u,A),Ws(u,ct()),_;switch(u.finishedWork=k,u.finishedLanes=A,h){case 0:case 1:throw Error(n(345));case 2:Tf(u,Gs,Sc);break;case 3:if(Vu(u,A),(A&130023424)===A&&(h=GM+500-ct(),10<h)){if(Gn(u,0)!==0)break;if(k=u.suspendedLanes,(k&A)!==A){xs(),u.pingedLanes|=u.suspendedLanes&k;break}u.timeoutHandle=kv(Tf.bind(null,u,Gs,Sc),h);break}Tf(u,Gs,Sc);break;case 4:if(Vu(u,A),(A&4194240)===A)break;for(h=u.eventTimes,k=-1;0<A;){var $=31-mt(A);j=1<<$,$=h[$],$>k&&(k=$),A&=~j}if(A=k,A=ct()-A,A=(120>A?120:480>A?480:1080>A?1080:1920>A?1920:3e3>A?3e3:4320>A?4320:1960*M8(A/1960))-A,10<A){u.timeoutHandle=kv(Tf.bind(null,u,Gs,Sc),A);break}Tf(u,Gs,Sc);break;case 5:Tf(u,Gs,Sc);break;default:throw Error(n(329))}}}return Ws(u,ct()),u.callbackNode===_?RN.bind(null,u):null}function XM(u,h){var _=i0;return u.current.memoizedState.isDehydrated&&(Af(u,h).flags|=256),u=lb(u,h),u!==2&&(h=Gs,Gs=_,h!==null&&qM(h)),u}function qM(u){Gs===null?Gs=u:Gs.push.apply(Gs,u)}function E8(u){for(var h=u;;){if(h.flags&16384){var _=h.updateQueue;if(_!==null&&(_=_.stores,_!==null))for(var A=0;A<_.length;A++){var k=_[A],j=k.getSnapshot;k=k.value;try{if(!ds(j(),k))return!1}catch{return!1}}}if(_=h.child,h.subtreeFlags&16384&&_!==null)_.return=h,h=_;else{if(h===u)break;for(;h.sibling===null;){if(h.return===null||h.return===u)return!0;h=h.return}h.sibling.return=h.return,h=h.sibling}}return!0}function Vu(u,h){for(h&=~VM,h&=~nb,u.suspendedLanes|=h,u.pingedLanes&=~h,u=u.expirationTimes;0<h;){var _=31-mt(h),A=1<<_;u[_]=-1,h&=~A}}function NN(u){if((Ln&6)!==0)throw Error(n(327));cm();var h=Gn(u,0);if((h&1)===0)return Ws(u,ct()),null;var _=lb(u,h);if(u.tag!==0&&_===2){var A=Xr(u);A!==0&&(h=A,_=XM(u,A))}if(_===1)throw _=r0,Af(u,0),Vu(u,h),Ws(u,ct()),_;if(_===6)throw Error(n(345));return u.finishedWork=u.current.alternate,u.finishedLanes=h,Tf(u,Gs,Sc),Ws(u,ct()),null}function KM(u,h){var _=Ln;Ln|=1;try{return u(h)}finally{Ln=_,Ln===0&&(lm=ct()+500,lf&&La())}}function Ef(u){Bu!==null&&Bu.tag===0&&(Ln&6)===0&&cm();var h=Ln;Ln|=1;var _=Ua.transition,A=Cn;try{if(Ua.transition=null,Cn=1,u)return u()}finally{Cn=A,Ua.transition=_,Ln=h,(Ln&6)===0&&La()}}function YM(){ha=om.current,Xn(om)}function Af(u,h){u.finishedWork=null,u.finishedLanes=0;var _=u.timeoutHandle;if(_!==-1&&(u.timeoutHandle=-1,Iv(_)),Br!==null)for(_=Br.return;_!==null;){var A=_;switch(xo(A),A.tag){case 1:A=A.type.childContextTypes,A!=null&&af();break;case 3:cl(),Xn(Ri),Xn(Kr),Da();break;case 5:Du(A);break;case 4:cl();break;case 13:Xn(Yn);break;case 19:Xn(Yn);break;case 10:hf(A.type._context);break;case 22:case 23:YM()}_=_.return}if(hi=u,Br=u=Gu(u.current,null),Oi=ha=h,ei=0,r0=null,VM=nb=Mf=0,Gs=i0=null,_o!==null){for(h=0;h<_o.length;h++)if(_=_o[h],A=_.interleaved,A!==null){_.interleaved=null;var k=A.next,j=_.pending;if(j!==null){var $=j.next;j.next=k,A.next=$}_.pending=A}_o=null}return u}function kN(u,h){do{var _=Br;try{if(mc(),xc.current=im,da){for(var A=qn.memoizedState;A!==null;){var k=A.queue;k!==null&&(k.pending=null),A=A.next}da=!1}if(So=0,Pn=ur=qn=null,fi=!1,ul=0,HM.current=null,_===null||_.return===null){ei=1,r0=h,Br=null;break}e:{var j=u,$=_.return,ae=_,me=h;if(h=Oi,ae.flags|=32768,me!==null&&typeof me=="object"&&typeof me.then=="function"){var Ie=me,et=ae,nt=et.tag;if((et.mode&1)===0&&(nt===0||nt===11||nt===15)){var Qe=et.alternate;Qe?(et.updateQueue=Qe.updateQueue,et.memoizedState=Qe.memoizedState,et.lanes=Qe.lanes):(et.updateQueue=null,et.memoizedState=null)}var _t=St($);if(_t!==null){_t.flags&=-257,rn(_t,$,ae,j,h),_t.mode&1&&st(j,Ie,h),h=_t,me=Ie;var Ct=h.updateQueue;if(Ct===null){var kt=new Set;kt.add(me),h.updateQueue=kt}else Ct.add(me);break e}else{if((h&1)===0){st(j,Ie,h),ZM();break e}me=Error(n(426))}}else if(Kn&&ae.mode&1){var Ir=St($);if(Ir!==null){(Ir.flags&65536)===0&&(Ir.flags|=256),rn(Ir,$,ae,j,h),Iu(R(me,ae));break e}}j=me=R(me,ae),ei!==4&&(ei=2),i0===null?i0=[j]:i0.push(j),j=$;do{switch(j.tag){case 3:j.flags|=65536,h&=-h,j.lanes|=h;var Ae=ye(j,me,h);gc(j,Ae);break e;case 1:ae=me;var ve=j.type,Ce=j.stateNode;if((j.flags&128)===0&&(typeof ve.getDerivedStateFromError=="function"||Ce!==null&&typeof Ce.componentDidCatch=="function"&&(zu===null||!zu.has(Ce)))){j.flags|=65536,h&=-h,j.lanes|=h;var ot=ze(j,ae,h);gc(j,ot);break e}}j=j.return}while(j!==null)}ON(_)}catch(Dt){h=Dt,Br===_&&_!==null&&(Br=_=_.return);continue}break}while(!0)}function IN(){var u=tb.current;return tb.current=im,u===null?im:u}function ZM(){(ei===0||ei===3||ei===2)&&(ei=4),hi===null||(Mf&268435455)===0&&(nb&268435455)===0||Vu(hi,Oi)}function lb(u,h){var _=Ln;Ln|=2;var A=IN();(hi!==u||Oi!==h)&&(Sc=null,Af(u,h));do try{A8();break}catch(k){kN(u,k)}while(!0);if(mc(),Ln=_,tb.current=A,Br!==null)throw Error(n(261));return hi=null,Oi=0,ei}function A8(){for(;Br!==null;)LN(Br)}function T8(){for(;Br!==null&&!it();)LN(Br)}function LN(u){var h=UN(u.alternate,u,ha);u.memoizedProps=u.pendingProps,h===null?ON(u):Br=h,HM.current=null}function ON(u){var h=u;do{var _=h.alternate;if(u=h.return,(h.flags&32768)===0){if(_=x8(_,h,ha),_!==null){Br=_;return}}else{if(_=b8(_,h),_!==null){_.flags&=32767,Br=_;return}if(u!==null)u.flags|=32768,u.subtreeFlags=0,u.deletions=null;else{ei=6,Br=null;return}}if(h=h.sibling,h!==null){Br=h;return}Br=h=u}while(h!==null);ei===0&&(ei=5)}function Tf(u,h,_){var A=Cn,k=Ua.transition;try{Ua.transition=null,Cn=1,C8(u,h,_,A)}finally{Ua.transition=k,Cn=A}return null}function C8(u,h,_,A){do cm();while(Bu!==null);if((Ln&6)!==0)throw Error(n(327));_=u.finishedWork;var k=u.finishedLanes;if(_===null)return null;if(u.finishedWork=null,u.finishedLanes=0,_===u.current)throw Error(n(177));u.callbackNode=null,u.callbackPriority=0;var j=_.lanes|_.childLanes;if(PM(u,j),u===hi&&(Br=hi=null,Oi=0),(_.subtreeFlags&2064)===0&&(_.flags&2064)===0||ib||(ib=!0,FN(Nt,function(){return cm(),null})),j=(_.flags&15990)!==0,(_.subtreeFlags&15990)!==0||j){j=Ua.transition,Ua.transition=null;var $=Cn;Cn=1;var ae=Ln;Ln|=4,HM.current=null,w8(u,_),EN(_,u),jr(Rv),Os=!!Ru,Rv=Ru=null,u.current=_,S8(_),yt(),Ln=ae,Cn=$,Ua.transition=j}else u.current=_;if(ib&&(ib=!1,Bu=u,sb=k),j=u.pendingLanes,j===0&&(zu=null),jt(_.stateNode),Ws(u,ct()),h!==null)for(A=u.onRecoverableError,_=0;_<h.length;_++)k=h[_],A(k.value,{componentStack:k.stack,digest:k.digest});if(rb)throw rb=!1,u=WM,WM=null,u;return(sb&1)!==0&&u.tag!==0&&cm(),j=u.pendingLanes,(j&1)!==0?u===$M?s0++:(s0=0,$M=u):s0=0,La(),null}function cm(){if(Bu!==null){var u=mu(sb),h=Ua.transition,_=Cn;try{if(Ua.transition=null,Cn=16>u?16:u,Bu===null)var A=!1;else{if(u=Bu,Bu=null,sb=0,(Ln&6)!==0)throw Error(n(331));var k=Ln;for(Ln|=4,At=u.current;At!==null;){var j=At,$=j.child;if((At.flags&16)!==0){var ae=j.deletions;if(ae!==null){for(var me=0;me<ae.length;me++){var Ie=ae[me];for(At=Ie;At!==null;){var et=At;switch(et.tag){case 0:case 11:case 15:n0(8,et,j)}var nt=et.child;if(nt!==null)nt.return=et,At=nt;else for(;At!==null;){et=At;var Qe=et.sibling,_t=et.return;if(bN(et),et===Ie){At=null;break}if(Qe!==null){Qe.return=_t,At=Qe;break}At=_t}}}var Ct=j.alternate;if(Ct!==null){var kt=Ct.child;if(kt!==null){Ct.child=null;do{var Ir=kt.sibling;kt.sibling=null,kt=Ir}while(kt!==null)}}At=j}}if((j.subtreeFlags&2064)!==0&&$!==null)$.return=j,At=$;else e:for(;At!==null;){if(j=At,(j.flags&2048)!==0)switch(j.tag){case 0:case 11:case 15:n0(9,j,j.return)}var Ae=j.sibling;if(Ae!==null){Ae.return=j.return,At=Ae;break e}At=j.return}}var ve=u.current;for(At=ve;At!==null;){$=At;var Ce=$.child;if(($.subtreeFlags&2064)!==0&&Ce!==null)Ce.return=$,At=Ce;else e:for($=ve;At!==null;){if(ae=At,(ae.flags&2048)!==0)try{switch(ae.tag){case 0:case 11:case 15:eb(9,ae)}}catch(Dt){wr(ae,ae.return,Dt)}if(ae===$){At=null;break e}var ot=ae.sibling;if(ot!==null){ot.return=ae.return,At=ot;break e}At=ae.return}}if(Ln=k,La(),Kt&&typeof Kt.onPostCommitFiberRoot=="function")try{Kt.onPostCommitFiberRoot(yn,u)}catch{}A=!0}return A}finally{Cn=_,Ua.transition=h}}return!1}function DN(u,h,_){h=R(_,h),h=ye(u,h,1),u=Jn(u,h,1),h=xs(),u!==null&&(Qo(u,1,h),Ws(u,h))}function wr(u,h,_){if(u.tag===3)DN(u,u,_);else for(;h!==null;){if(h.tag===3){DN(h,u,_);break}else if(h.tag===1){var A=h.stateNode;if(typeof h.type.getDerivedStateFromError=="function"||typeof A.componentDidCatch=="function"&&(zu===null||!zu.has(A))){u=R(_,u),u=ze(h,u,1),h=Jn(h,u,1),u=xs(),h!==null&&(Qo(h,1,u),Ws(h,u));break}}h=h.return}}function P8(u,h,_){var A=u.pingCache;A!==null&&A.delete(h),h=xs(),u.pingedLanes|=u.suspendedLanes&_,hi===u&&(Oi&_)===_&&(ei===4||ei===3&&(Oi&130023424)===Oi&&500>ct()-GM?Af(u,0):VM|=_),Ws(u,h)}function jN(u,h){h===0&&((u.mode&1)===0?h=1:(h=In,In<<=1,(In&130023424)===0&&(In=4194304)));var _=xs();u=ca(u,h),u!==null&&(Qo(u,h,_),Ws(u,_))}function R8(u){var h=u.memoizedState,_=0;h!==null&&(_=h.retryLane),jN(u,_)}function N8(u,h){var _=0;switch(u.tag){case 13:var A=u.stateNode,k=u.memoizedState;k!==null&&(_=k.retryLane);break;case 19:A=u.stateNode;break;default:throw Error(n(314))}A!==null&&A.delete(h),jN(u,_)}var UN;UN=function(u,h,_){if(u!==null)if(u.memoizedProps!==h.pendingProps||Ri.current)ln=!0;else{if((u.lanes&_)===0&&(h.flags&128)===0)return ln=!1,y8(u,h,_);ln=(u.flags&131072)!==0}else ln=!1,Kn&&(h.flags&1048576)!==0&&Uv(h,qp,h.index);switch(h.lanes=0,h.tag){case 2:var A=h.type;Qx(u,h),u=h.pendingProps;var k=lc(h,Kr.current);ll(h,_),k=yf(null,h,A,u,k,_);var j=$v();return h.flags|=1,typeof k=="object"&&k!==null&&typeof k.render=="function"&&k.$$typeof===void 0?(h.tag=1,h.memoizedState=null,h.updateQueue=null,ui(A)?(j=!0,cc(h)):j=!1,h.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,on(h),k.updater=sm,h.stateNode=k,k._reactInternals=h,E(h,A,u,_),h=an(null,h,A,!0,j,_)):(h.tag=0,Kn&&j&&Fv(h),bt(null,h,k,_),h=h.child),h;case 16:A=h.elementType;e:{switch(Qx(u,h),u=h.pendingProps,k=A._init,A=k(A._payload),h.type=A,k=h.tag=I8(A),u=Vs(A,u),k){case 0:h=gt(null,h,A,u,_);break e;case 1:h=Lt(null,h,A,u,_);break e;case 11:h=Jr(null,h,A,u,_);break e;case 14:h=ys(null,h,A,Vs(A.type,u),_);break e}throw Error(n(306,A,""))}return h;case 0:return A=h.type,k=h.pendingProps,k=h.elementType===A?k:Vs(A,k),gt(u,h,A,k,_);case 1:return A=h.type,k=h.pendingProps,k=h.elementType===A?k:Vs(A,k),Lt(u,h,A,k,_);case 3:e:{if(sn(h),u===null)throw Error(n(387));A=h.pendingProps,j=h.memoizedState,k=j.element,gr(u,h),cr(h,A,null,_);var $=h.memoizedState;if(A=$.element,j.isDehydrated)if(j={element:A,isDehydrated:!1,cache:$.cache,pendingSuspenseBoundaries:$.pendingSuspenseBoundaries,transitions:$.transitions},h.updateQueue.baseState=j,h.memoizedState=j,h.flags&256){k=R(Error(n(423)),h),h=En(u,h,A,_,k);break e}else if(A!==k){k=R(Error(n(424)),h),h=En(u,h,A,_,k);break e}else for(ki=po(h.stateNode.containerInfo.firstChild),Yr=h,Kn=!0,Hs=null,_=ff(h,null,A,_),h.child=_;_;)_.flags=_.flags&-3|4096,_=_.sibling;else{if(ol(),A===k){h=wc(u,h,_);break e}bt(u,h,A,_)}h=h.child}return h;case 5:return yc(h),u===null&&Yp(h),A=h.type,k=h.pendingProps,j=u!==null?u.memoizedProps:null,$=k.children,Nv(A,k)?$=null:j!==null&&Nv(A,j)&&(h.flags|=32),Ue(u,h),bt(u,h,$,_),h.child;case 6:return u===null&&Yp(h),null;case 13:return Ao(u,h,_);case 4:return gf(h,h.stateNode.containerInfo),A=h.pendingProps,u===null?h.child=fc(h,null,A,_):bt(u,h,A,_),h.child;case 11:return A=h.type,k=h.pendingProps,k=h.elementType===A?k:Vs(A,k),Jr(u,h,A,k,_);case 7:return bt(u,h,h.pendingProps,_),h.child;case 8:return bt(u,h,h.pendingProps.children,_),h.child;case 12:return bt(u,h,h.pendingProps.children,_),h.child;case 10:e:{if(A=h.type._context,k=h.pendingProps,j=h.memoizedProps,$=k.value,Wn(hc,A._currentValue),A._currentValue=$,j!==null)if(ds(j.value,$)){if(j.children===k.children&&!Ri.current){h=wc(u,h,_);break e}}else for(j=h.child,j!==null&&(j.return=h);j!==null;){var ae=j.dependencies;if(ae!==null){$=j.child;for(var me=ae.firstContext;me!==null;){if(me.context===A){if(j.tag===1){me=Bn(-1,_&-_),me.tag=2;var Ie=j.updateQueue;if(Ie!==null){Ie=Ie.shared;var et=Ie.pending;et===null?me.next=me:(me.next=et.next,et.next=me),Ie.pending=me}}j.lanes|=_,me=j.alternate,me!==null&&(me.lanes|=_),pf(j.return,_,h),ae.lanes|=_;break}me=me.next}}else if(j.tag===10)$=j.type===h.type?null:j.child;else if(j.tag===18){if($=j.return,$===null)throw Error(n(341));$.lanes|=_,ae=$.alternate,ae!==null&&(ae.lanes|=_),pf($,_,h),$=j.sibling}else $=j.child;if($!==null)$.return=j;else for($=j;$!==null;){if($===h){$=null;break}if(j=$.sibling,j!==null){j.return=$.return,$=j;break}$=$.return}j=$}bt(u,h,k.children,_),h=h.child}return h;case 9:return k=h.type,A=h.pendingProps.children,ll(h,_),k=ps(k),A=A(k),h.flags|=1,bt(u,h,A,_),h.child;case 14:return A=h.type,k=Vs(A,h.pendingProps),k=Vs(A.type,k),ys(u,h,A,k,_);case 15:return Re(u,h,h.type,h.pendingProps,_);case 17:return A=h.type,k=h.pendingProps,k=h.elementType===A?k:Vs(A,k),Qx(u,h),h.tag=1,ui(A)?(u=!0,cc(h)):u=!1,ll(h,_),m(h,A,k),E(h,A,k,_),an(null,h,A,!0,u,_);case 19:return mN(u,h,_);case 22:return _e(u,h,_)}throw Error(n(156,h.tag))};function FN(u,h){return Ne(u,h)}function k8(u,h,_,A){this.tag=u,this.key=_,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=h,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=A,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Fa(u,h,_,A){return new k8(u,h,_,A)}function QM(u){return u=u.prototype,!(!u||!u.isReactComponent)}function I8(u){if(typeof u=="function")return QM(u)?1:0;if(u!=null){if(u=u.$$typeof,u===X)return 11;if(u===pe)return 14}return 2}function Gu(u,h){var _=u.alternate;return _===null?(_=Fa(u.tag,h,u.key,u.mode),_.elementType=u.elementType,_.type=u.type,_.stateNode=u.stateNode,_.alternate=u,u.alternate=_):(_.pendingProps=h,_.type=u.type,_.flags=0,_.subtreeFlags=0,_.deletions=null),_.flags=u.flags&14680064,_.childLanes=u.childLanes,_.lanes=u.lanes,_.child=u.child,_.memoizedProps=u.memoizedProps,_.memoizedState=u.memoizedState,_.updateQueue=u.updateQueue,h=u.dependencies,_.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext},_.sibling=u.sibling,_.index=u.index,_.ref=u.ref,_}function cb(u,h,_,A,k,j){var $=2;if(A=u,typeof u=="function")QM(u)&&($=1);else if(typeof u=="string")$=5;else e:switch(u){case D:return Cf(_.children,k,j,h);case F:$=8,k|=8;break;case V:return u=Fa(12,_,h,k|2),u.elementType=V,u.lanes=j,u;case te:return u=Fa(13,_,h,k),u.elementType=te,u.lanes=j,u;case re:return u=Fa(19,_,h,k),u.elementType=re,u.lanes=j,u;case ce:return ub(_,k,j,h);default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case I:$=10;break e;case U:$=9;break e;case X:$=11;break e;case pe:$=14;break e;case ee:$=16,A=null;break e}throw Error(n(130,u==null?u:typeof u,""))}return h=Fa($,_,h,k),h.elementType=u,h.type=A,h.lanes=j,h}function Cf(u,h,_,A){return u=Fa(7,u,A,h),u.lanes=_,u}function ub(u,h,_,A){return u=Fa(22,u,A,h),u.elementType=ce,u.lanes=_,u.stateNode={isHidden:!1},u}function JM(u,h,_){return u=Fa(6,u,null,h),u.lanes=_,u}function eE(u,h,_){return h=Fa(4,u.children!==null?u.children:[],u.key,h),h.lanes=_,h.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},h}function L8(u,h,_,A,k){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=Hd(0),this.expirationTimes=Hd(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Hd(0),this.identifierPrefix=A,this.onRecoverableError=k,this.mutableSourceEagerHydrationData=null}function tE(u,h,_,A,k,j,$,ae,me){return u=new L8(u,h,_,ae,me),h===1?(h=1,j===!0&&(h|=8)):h=0,j=Fa(3,null,null,h),u.current=j,j.stateNode=u,j.memoizedState={element:A,isDehydrated:_,cache:null,transitions:null,pendingSuspenseBoundaries:null},on(j),u}function O8(u,h,_){var A=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:N,key:A==null?null:""+A,children:u,containerInfo:h,implementation:_}}function zN(u){if(!u)return go;u=u._reactInternals;e:{if(Pa(u)!==u||u.tag!==1)throw Error(n(170));var h=u;do{switch(h.tag){case 3:h=h.stateNode.context;break e;case 1:if(ui(h.type)){h=h.stateNode.__reactInternalMemoizedMergedChildContext;break e}}h=h.return}while(h!==null);throw Error(n(171))}if(u.tag===1){var _=u.type;if(ui(_))return of(u,_,h)}return h}function BN(u,h,_,A,k,j,$,ae,me){return u=tE(_,A,!0,u,k,j,$,ae,me),u.context=zN(null),_=u.current,A=xs(),k=Hu(_),j=Bn(A,k),j.callback=h??null,Jn(_,j,k),u.current.lanes=k,Qo(u,k,A),Ws(u,A),u}function db(u,h,_,A){var k=h.current,j=xs(),$=Hu(k);return _=zN(_),h.context===null?h.context=_:h.pendingContext=_,h=Bn(j,$),h.payload={element:u},A=A===void 0?null:A,A!==null&&(h.callback=A),u=Jn(k,h,$),u!==null&&(Po(u,k,$,j),di(u,k,$)),$}function fb(u){if(u=u.current,!u.child)return null;switch(u.child.tag){case 5:return u.child.stateNode;default:return u.child.stateNode}}function HN(u,h){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var _=u.retryLane;u.retryLane=_!==0&&_<h?_:h}}function nE(u,h){HN(u,h),(u=u.alternate)&&HN(u,h)}function D8(){return null}var VN=typeof reportError=="function"?reportError:function(u){console.error(u)};function rE(u){this._internalRoot=u}hb.prototype.render=rE.prototype.render=function(u){var h=this._internalRoot;if(h===null)throw Error(n(409));db(u,h,null,null)},hb.prototype.unmount=rE.prototype.unmount=function(){var u=this._internalRoot;if(u!==null){this._internalRoot=null;var h=u.containerInfo;Ef(function(){db(null,u,null,null)}),h[hs]=null}};function hb(u){this._internalRoot=u}hb.prototype.unstable_scheduleHydration=function(u){if(u){var h=hp();u={blockedOn:null,target:u,priority:h};for(var _=0;_<Jo.length&&h!==0&&h<Jo[_].priority;_++);Jo.splice(_,0,u),_===0&&gp(u)}};function iE(u){return!(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)}function pb(u){return!(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11&&(u.nodeType!==8||u.nodeValue!==" react-mount-point-unstable "))}function GN(){}function j8(u,h,_,A,k){if(k){if(typeof A=="function"){var j=A;A=function(){var Ie=fb($);j.call(Ie)}}var $=BN(h,A,u,0,null,!1,!1,"",GN);return u._reactRootContainer=$,u[hs]=$.current,Cu(u.nodeType===8?u.parentNode:u),Ef(),$}for(;k=u.lastChild;)u.removeChild(k);if(typeof A=="function"){var ae=A;A=function(){var Ie=fb(me);ae.call(Ie)}}var me=tE(u,0,!1,null,null,!1,!1,"",GN);return u._reactRootContainer=me,u[hs]=me.current,Cu(u.nodeType===8?u.parentNode:u),Ef(function(){db(h,me,_,A)}),me}function mb(u,h,_,A,k){var j=_._reactRootContainer;if(j){var $=j;if(typeof k=="function"){var ae=k;k=function(){var me=fb($);ae.call(me)}}db(h,$,u,k)}else $=j8(_,h,u,k,A);return fb($)}Vd=function(u){switch(u.tag){case 3:var h=u.stateNode;if(h.current.memoizedState.isDehydrated){var _=Ls(h.pendingLanes);_!==0&&(pu(h,_|1),Ws(h,ct()),(Ln&6)===0&&(lm=ct()+500,La()))}break;case 13:Ef(function(){var A=ca(u,1);if(A!==null){var k=xs();Po(A,u,1,k)}}),nE(u,1)}},hv=function(u){if(u.tag===13){var h=ca(u,134217728);if(h!==null){var _=xs();Po(h,u,134217728,_)}nE(u,134217728)}},Ex=function(u){if(u.tag===13){var h=Hu(u),_=ca(u,h);if(_!==null){var A=xs();Po(_,u,h,A)}nE(u,h)}},hp=function(){return Cn},pp=function(u,h){var _=Cn;try{return Cn=u,h()}finally{Cn=_}},Pe=function(u,h,_){switch(h){case"input":if(Je(u,_),h=_.name,_.type==="radio"&&h!=null){for(_=u;_.parentNode;)_=_.parentNode;for(_=_.querySelectorAll("input[name="+JSON.stringify(""+h)+'][type="radio"]'),h=0;h<_.length;h++){var A=_[h];if(A!==u&&A.form===u.form){var k=Wp(A);if(!k)throw Error(n(90));fe(A),Je(A,k)}}}break;case"textarea":Oe(u,_);break;case"select":h=_.value,h!=null&&H(u,!!_.multiple,h,!1)}},Fn=KM,en=Ef;var U8={usingClientEntryPoint:!1,Events:[mo,mr,Wp,Jt,pn,KM]},a0={findFiberByHostInstance:al,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},F8={bundleType:a0.bundleType,version:a0.version,rendererPackageName:a0.rendererPackageName,rendererConfig:a0.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(u){return u=be(u),u===null?null:u.stateNode},findFiberByHostInstance:a0.findFiberByHostInstance||D8,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var gb=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!gb.isDisabled&&gb.supportsFiber)try{yn=gb.inject(F8),Kt=gb}catch{}}return Xs.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=U8,Xs.createPortal=function(u,h){var _=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!iE(h))throw Error(n(200));return O8(u,h,null,_)},Xs.createRoot=function(u,h){if(!iE(u))throw Error(n(299));var _=!1,A="",k=VN;return h!=null&&(h.unstable_strictMode===!0&&(_=!0),h.identifierPrefix!==void 0&&(A=h.identifierPrefix),h.onRecoverableError!==void 0&&(k=h.onRecoverableError)),h=tE(u,1,!1,null,null,_,!1,A,k),u[hs]=h.current,Cu(u.nodeType===8?u.parentNode:u),new rE(h)},Xs.findDOMNode=function(u){if(u==null)return null;if(u.nodeType===1)return u;var h=u._reactInternals;if(h===void 0)throw typeof u.render=="function"?Error(n(188)):(u=Object.keys(u).join(","),Error(n(268,u)));return u=be(h),u=u===null?null:u.stateNode,u},Xs.flushSync=function(u){return Ef(u)},Xs.hydrate=function(u,h,_){if(!pb(h))throw Error(n(200));return mb(null,u,h,!0,_)},Xs.hydrateRoot=function(u,h,_){if(!iE(u))throw Error(n(405));var A=_!=null&&_.hydratedSources||null,k=!1,j="",$=VN;if(_!=null&&(_.unstable_strictMode===!0&&(k=!0),_.identifierPrefix!==void 0&&(j=_.identifierPrefix),_.onRecoverableError!==void 0&&($=_.onRecoverableError)),h=BN(h,null,u,1,_??null,k,!1,j,$),u[hs]=h.current,Cu(u),A)for(u=0;u<A.length;u++)_=A[u],k=_._getVersion,k=k(_._source),h.mutableSourceEagerHydrationData==null?h.mutableSourceEagerHydrationData=[_,k]:h.mutableSourceEagerHydrationData.push(_,k);return new hb(h)},Xs.render=function(u,h,_){if(!pb(h))throw Error(n(200));return mb(null,u,h,!1,_)},Xs.unmountComponentAtNode=function(u){if(!pb(u))throw Error(n(40));return u._reactRootContainer?(Ef(function(){mb(null,null,u,!1,function(){u._reactRootContainer=null,u[hs]=null})}),!0):!1},Xs.unstable_batchedUpdates=KM,Xs.unstable_renderSubtreeIntoContainer=function(u,h,_,A){if(!pb(_))throw Error(n(200));if(u==null||u._reactInternals===void 0)throw Error(n(38));return mb(u,h,_,!1,A)},Xs.version="18.3.1-next-f1338f8080-20240426",Xs}var JN;function n5(){if(JN)return lE.exports;JN=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),lE.exports=K8(),lE.exports}var ek;function Y8(){if(ek)return yb;ek=1;var t=n5();return yb.createRoot=t.createRoot,yb.hydrateRoot=t.hydrateRoot,yb}var Z8=Y8();const Q8=Qw(Z8);var Yy=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(){}},bh,pd,fg,WU,J8=(WU=class extends Yy{constructor(){super();Wt(this,bh);Wt(this,pd);Wt(this,fg);wt(this,fg,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){ge(this,pd)||this.setEventListener(ge(this,fg))}onUnsubscribe(){var e;this.hasListeners()||((e=ge(this,pd))==null||e.call(this),wt(this,pd,void 0))}setEventListener(e){var n;wt(this,fg,e),(n=ge(this,pd))==null||n.call(this),wt(this,pd,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){ge(this,bh)!==e&&(wt(this,bh,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof ge(this,bh)=="boolean"?ge(this,bh):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},bh=new WeakMap,pd=new WeakMap,fg=new WeakMap,WU),_P=new J8,eW={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},md,bP,$U,tW=($U=class{constructor(){Wt(this,md,eW);Wt(this,bP,!1)}setTimeoutProvider(t){wt(this,md,t)}setTimeout(t,e){return ge(this,md).setTimeout(t,e)}clearTimeout(t){ge(this,md).clearTimeout(t)}setInterval(t,e){return ge(this,md).setInterval(t,e)}clearInterval(t){ge(this,md).clearInterval(t)}},md=new WeakMap,bP=new WeakMap,$U),ah=new tW;function nW(t){setTimeout(t,0)}var rW=typeof window>"u"||"Deno"in globalThis;function Ys(){}function iW(t,e){return typeof t=="function"?t(e):t}function wT(t){return typeof t=="number"&&t>=0&&t!==1/0}function r5(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Sd(t,e){return typeof t=="function"?t(e):t}function xa(t,e){return typeof t=="function"?t(e):t}function tk(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:a,stale:o}=t;if(a){if(r){if(e.queryHash!==wP(a,e.options))return!1}else if(!fy(e.queryKey,a))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof o=="boolean"&&e.isStale()!==o||i&&i!==e.state.fetchStatus||s&&!s(e))}function nk(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(dy(e.options.mutationKey)!==dy(s))return!1}else if(!fy(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function wP(t,e){return((e==null?void 0:e.queryKeyHashFn)||dy)(t)}function dy(t){return JSON.stringify(t,(e,n)=>MT(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function fy(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>fy(t[n],e[n])):!1}var sW=Object.prototype.hasOwnProperty;function i5(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=rk(t)&&rk(e);if(!r&&!(MT(t)&&MT(e)))return e;const s=(r?t:Object.keys(t)).length,a=r?e:Object.keys(e),o=a.length,l=r?new Array(o):{};let c=0;for(let d=0;d<o;d++){const f=r?d:a[d],p=t[f],y=e[f];if(p===y){l[f]=p,(r?d<s:sW.call(t,f))&&c++;continue}if(p===null||y===null||typeof p!="object"||typeof y!="object"){l[f]=y;continue}const x=i5(p,y,n+1);l[f]=x,x===p&&c++}return s===o&&c===s?t:l}function ST(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}function rk(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function MT(t){if(!ik(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!ik(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function ik(t){return Object.prototype.toString.call(t)==="[object Object]"}function aW(t){return new Promise(e=>{ah.setTimeout(e,t)})}function ET(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?i5(t,e):e}function oW(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function lW(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var SP=Symbol();function s5(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===SP?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function a5(t,e){return typeof t=="function"?t(...e):!!t}function cW(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 hy=(()=>{let t=()=>rW;return{isServer(){return t()},setIsServer(e){t=e}}})();function AT(){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 uW=nW;function dW(){let t=[],e=0,n=o=>{o()},r=o=>{o()},i=uW;const s=o=>{e?t.push(o):i(()=>{n(o)})},a=()=>{const o=t;t=[],o.length&&i(()=>{r(()=>{o.forEach(l=>{n(l)})})})};return{batch:o=>{let l;e++;try{l=o()}finally{e--,e||a()}return l},batchCalls:o=>(...l)=>{s(()=>{o(...l)})},schedule:s,setNotifyFunction:o=>{n=o},setBatchNotifyFunction:o=>{r=o},setScheduler:o=>{i=o}}}var zi=dW(),hg,gd,pg,XU,fW=(XU=class extends Yy{constructor(){super();Wt(this,hg,!0);Wt(this,gd);Wt(this,pg);wt(this,pg,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,gd)||this.setEventListener(ge(this,pg))}onUnsubscribe(){var e;this.hasListeners()||((e=ge(this,gd))==null||e.call(this),wt(this,gd,void 0))}setEventListener(e){var n;wt(this,pg,e),(n=ge(this,gd))==null||n.call(this),wt(this,gd,e(this.setOnline.bind(this)))}setOnline(e){ge(this,hg)!==e&&(wt(this,hg,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return ge(this,hg)}},hg=new WeakMap,gd=new WeakMap,pg=new WeakMap,XU),s1=new fW;function hW(t){return Math.min(1e3*2**t,3e4)}function o5(t){return(t??"online")==="online"?s1.isOnline():!0}var TT=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function l5(t){let e=!1,n=0,r;const i=AT(),s=()=>i.status!=="pending",a=S=>{var w;if(!s()){const b=new TT(S);p(b),(w=t.onCancel)==null||w.call(t,b)}},o=()=>{e=!0},l=()=>{e=!1},c=()=>_P.isFocused()&&(t.networkMode==="always"||s1.isOnline())&&t.canRun(),d=()=>o5(t.networkMode)&&t.canRun(),f=S=>{s()||(r==null||r(),i.resolve(S))},p=S=>{s()||(r==null||r(),i.reject(S))},y=()=>new Promise(S=>{var w;r=b=>{(s()||c())&&S(b)},(w=t.onPause)==null||w.call(t)}).then(()=>{var S;r=void 0,s()||(S=t.onContinue)==null||S.call(t)}),x=()=>{if(s())return;let S;const w=n===0?t.initialPromise:void 0;try{S=w??t.fn()}catch(b){S=Promise.reject(b)}Promise.resolve(S).then(f).catch(b=>{var N;if(s())return;const M=t.retry??(hy.isServer()?0:3),T=t.retryDelay??hW,C=typeof T=="function"?T(n,b):T,L=M===!0||typeof M=="number"&&n<M||typeof M=="function"&&M(n,b);if(e||!L){p(b);return}n++,(N=t.onFail)==null||N.call(t,n,b),aW(C).then(()=>c()?void 0:y()).then(()=>{e?p(b):x()})})};return{promise:i,status:()=>i.status,cancel:a,continue:()=>(r==null||r(),i),cancelRetry:o,continueRetry:l,canStart:d,start:()=>(d()?x():y().then(x),i)}}var _h,qU,c5=(qU=class{constructor(){Wt(this,_h)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),wT(this.gcTime)&&wt(this,_h,ah.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(hy.isServer()?1/0:300*1e3))}clearGcTimeout(){ge(this,_h)!==void 0&&(ah.clearTimeout(ge(this,_h)),wt(this,_h,void 0))}},_h=new WeakMap,qU);function pW(t){return{onFetch:(e,n)=>{var d,f,p,y,x;const r=e.options,i=(p=(f=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:p.direction,s=((y=e.state.data)==null?void 0:y.pages)||[],a=((x=e.state.data)==null?void 0:x.pageParams)||[];let o={pages:[],pageParams:[]},l=0;const c=async()=>{let S=!1;const w=T=>{cW(T,()=>e.signal,()=>S=!0)},b=s5(e.options,e.fetchOptions),M=async(T,C,L)=>{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:L?"backward":"forward",meta:e.options.meta};return w(U),U})(),F=await b(D),{maxPages:V}=e.options,I=L?lW:oW;return{pages:I(T.pages,F,V),pageParams:I(T.pageParams,C,V)}};if(i&&s.length){const T=i==="backward",C=T?mW:sk,L={pages:s,pageParams:a},N=C(r,L);o=await M(L,N,T)}else{const T=t??s.length;do{const C=l===0?a[0]??r.initialPageParam:sk(r,o);if(l>0&&C==null)break;o=await M(o,C),l++}while(l<T)}return o};e.options.persister?e.fetchFn=()=>{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 sk(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 mW(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 mg,wh,gg,Ga,Sh,gi,Wy,Mh,ya,u5,Nc,KU,gW=(KU=class extends c5{constructor(e){super();Wt(this,ya);Wt(this,mg);Wt(this,wh);Wt(this,gg);Wt(this,Ga);Wt(this,Sh);Wt(this,gi);Wt(this,Wy);Wt(this,Mh);wt(this,Mh,!1),wt(this,Wy,e.defaultOptions),this.setOptions(e.options),this.observers=[],wt(this,Sh,e.client),wt(this,Ga,ge(this,Sh).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,wt(this,wh,ok(this.options)),this.state=e.state??ge(this,wh),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return ge(this,mg)}get promise(){var e;return(e=ge(this,gi))==null?void 0:e.promise}setOptions(e){if(this.options={...ge(this,Wy),...e},e!=null&&e._type&&wt(this,mg,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=ok(this.options);n.data!==void 0&&(this.setState(ak(n.data,n.dataUpdatedAt)),wt(this,wh,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ge(this,Ga).remove(this)}setData(e,n){const r=ET(this.state.data,e,this.options);return _n(this,ya,Nc).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,ya,Nc).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(Ys).catch(Ys):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return ge(this,wh)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>xa(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===SP||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Sd(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:!r5(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,Ga).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,Mh)||_n(this,ya,u5).call(this)?ge(this,gi).cancel({revert:!0}):ge(this,gi).cancelRetry()),this.scheduleGc()),ge(this,Ga).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||_n(this,ya,Nc).call(this,{type:"invalidate"})}async fetch(e,n){var c,d,f,p,y,x,S,w,b,M,T;if(this.state.fetchStatus!=="idle"&&((c=ge(this,gi))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(ge(this,gi))return ge(this,gi).continueRetry(),ge(this,gi).promise}if(e&&this.setOptions(e),!this.options.queryFn){const C=this.observers.find(L=>L.options.queryFn);C&&this.setOptions(C.options)}const r=new AbortController,i=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(wt(this,Mh,!0),r.signal)})},s=()=>{const C=s5(this.options,n),N=(()=>{const D={client:ge(this,Sh),queryKey:this.queryKey,meta:this.meta};return i(D),D})();return wt(this,Mh,!1),this.options.persister?this.options.persister(C,N,this):C(N)},o=(()=>{const C={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:ge(this,Sh),state:this.state,fetchFn:s};return i(C),C})(),l=ge(this,mg)==="infinite"?pW(this.options.pages):this.options.behavior;l==null||l.onFetch(o,this),wt(this,gg,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=o.fetchOptions)==null?void 0:d.meta))&&_n(this,ya,Nc).call(this,{type:"fetch",meta:(f=o.fetchOptions)==null?void 0:f.meta}),wt(this,gi,l5({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,onCancel:C=>{C instanceof TT&&C.revert&&this.setState({...ge(this,gg),fetchStatus:"idle"}),r.abort()},onFail:(C,L)=>{_n(this,ya,Nc).call(this,{type:"failed",failureCount:C,error:L})},onPause:()=>{_n(this,ya,Nc).call(this,{type:"pause"})},onContinue:()=>{_n(this,ya,Nc).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.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=(p=ge(this,Ga).config).onSuccess)==null||y.call(p,C,this),(S=(x=ge(this,Ga).config).onSettled)==null||S.call(x,C,this.state.error,this),C}catch(C){if(C instanceof TT){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,ya,Nc).call(this,{type:"error",error:C}),(b=(w=ge(this,Ga).config).onError)==null||b.call(w,C,this),(T=(M=ge(this,Ga).config).onSettled)==null||T.call(M,this.state.data,C,this),C}finally{this.scheduleGc()}}},mg=new WeakMap,wh=new WeakMap,gg=new WeakMap,Ga=new WeakMap,Sh=new WeakMap,gi=new WeakMap,Wy=new WeakMap,Mh=new WeakMap,ya=new WeakSet,u5=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Nc=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,...d5(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...ak(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return wt(this,gg,e.manual?i:void 0),i;case"error":const s=e.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),zi.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),ge(this,Ga).notify({query:this,type:"updated",action:e})})},KU);function d5(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:o5(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function ak(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ok(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Ks,An,$y,ws,Eh,vg,Oc,vd,Xy,yg,xg,Ah,Th,yd,bg,Hn,G0,CT,PT,RT,NT,kT,IT,LT,f5,YU,vW=(YU=class extends Yy{constructor(e,n){super();Wt(this,Hn);Wt(this,Ks);Wt(this,An);Wt(this,$y);Wt(this,ws);Wt(this,Eh);Wt(this,vg);Wt(this,Oc);Wt(this,vd);Wt(this,Xy);Wt(this,yg);Wt(this,xg);Wt(this,Ah);Wt(this,Th);Wt(this,yd);Wt(this,bg,new Set);this.options=n,wt(this,Ks,e),wt(this,vd,null),wt(this,Oc,AT()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(ge(this,An).addObserver(this),lk(ge(this,An),this.options)?_n(this,Hn,G0).call(this):this.updateResult(),_n(this,Hn,NT).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return OT(ge(this,An),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return OT(ge(this,An),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,_n(this,Hn,kT).call(this),_n(this,Hn,IT).call(this),ge(this,An).removeObserver(this)}setOptions(e){const n=this.options,r=ge(this,An);if(this.options=ge(this,Ks).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof xa(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,Hn,LT).call(this),ge(this,An).setOptions(this.options),n._defaulted&&!ST(this.options,n)&&ge(this,Ks).getQueryCache().notify({type:"observerOptionsUpdated",query:ge(this,An),observer:this});const i=this.hasListeners();i&&ck(ge(this,An),r,this.options,n)&&_n(this,Hn,G0).call(this),this.updateResult(),i&&(ge(this,An)!==r||xa(this.options.enabled,ge(this,An))!==xa(n.enabled,ge(this,An))||Sd(this.options.staleTime,ge(this,An))!==Sd(n.staleTime,ge(this,An)))&&_n(this,Hn,CT).call(this);const s=_n(this,Hn,PT).call(this);i&&(ge(this,An)!==r||xa(this.options.enabled,ge(this,An))!==xa(n.enabled,ge(this,An))||s!==ge(this,yd))&&_n(this,Hn,RT).call(this,s)}getOptimisticResult(e){const n=ge(this,Ks).getQueryCache().build(ge(this,Ks),e),r=this.createResult(n,e);return xW(this,r)&&(wt(this,ws,r),wt(this,vg,this.options),wt(this,Eh,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,bg).add(e)}getCurrentQuery(){return ge(this,An)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=ge(this,Ks).defaultQueryOptions(e),r=ge(this,Ks).getQueryCache().build(ge(this,Ks),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return _n(this,Hn,G0).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),ge(this,ws)))}createResult(e,n){var V;const r=ge(this,An),i=this.options,s=ge(this,ws),a=ge(this,Eh),o=ge(this,vg),c=e!==r?e.state:ge(this,$y),{state:d}=e;let f={...d},p=!1,y;if(n._optimisticResults){const I=this.hasListeners(),U=!I&&lk(e,n),X=I&&ck(e,r,n,i);(U||X)&&(f={...f,...d5(d.data,e.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:x,errorUpdatedAt:S,status:w}=f;y=f.data;let b=!1;if(n.placeholderData!==void 0&&y===void 0&&w==="pending"){let I;s!=null&&s.isPlaceholderData&&n.placeholderData===(o==null?void 0:o.placeholderData)?(I=s.data,b=!0):I=typeof n.placeholderData=="function"?n.placeholderData((V=ge(this,xg))==null?void 0:V.state.data,ge(this,xg)):n.placeholderData,I!==void 0&&(w="success",y=ET(s==null?void 0:s.data,I,n),p=!0)}if(n.select&&y!==void 0&&!b)if(s&&y===(a==null?void 0:a.data)&&n.select===ge(this,Xy))y=ge(this,yg);else try{wt(this,Xy,n.select),y=n.select(y),y=ET(s==null?void 0:s.data,y,n),wt(this,yg,y),wt(this,vd,null)}catch(I){wt(this,vd,I)}ge(this,vd)&&(x=ge(this,vd),y=ge(this,yg),S=Date.now(),w="error");const M=f.fetchStatus==="fetching",T=w==="pending",C=w==="error",L=T&&M,N=y!==void 0,F={status:w,fetchStatus:f.fetchStatus,isPending:T,isSuccess:w==="success",isError:C,isInitialLoading:L,isLoading:L,data:y,dataUpdatedAt:f.dataUpdatedAt,error:x,errorUpdatedAt:S,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:f.dataUpdateCount>c.dataUpdateCount||f.errorUpdateCount>c.errorUpdateCount,isFetching:M,isRefetching:M&&!T,isLoadingError:C&&!N,isPaused:f.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:C&&N,isStale:MP(e,n),refetch:this.refetch,promise:ge(this,Oc),isEnabled:xa(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const I=F.data!==void 0,U=F.status==="error"&&!I,X=pe=>{U?pe.reject(F.error):I&&pe.resolve(F.data)},te=()=>{const pe=wt(this,Oc,F.promise=AT());X(pe)},re=ge(this,Oc);switch(re.status){case"pending":e.queryHash===r.queryHash&&X(re);break;case"fulfilled":(U||F.data!==re.value)&&te();break;case"rejected":(!U||F.error!==re.reason)&&te();break}}return F}updateResult(){const e=ge(this,ws),n=this.createResult(ge(this,An),this.options);if(wt(this,Eh,ge(this,An).state),wt(this,vg,this.options),ge(this,Eh).data!==void 0&&wt(this,xg,ge(this,An)),ST(n,e))return;wt(this,ws,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!ge(this,bg).size)return!0;const a=new Set(s??ge(this,bg));return this.options.throwOnError&&a.add("error"),Object.keys(ge(this,ws)).some(o=>{const l=o;return ge(this,ws)[l]!==e[l]&&a.has(l)})};_n(this,Hn,f5).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&_n(this,Hn,NT).call(this)}},Ks=new WeakMap,An=new WeakMap,$y=new WeakMap,ws=new WeakMap,Eh=new WeakMap,vg=new WeakMap,Oc=new WeakMap,vd=new WeakMap,Xy=new WeakMap,yg=new WeakMap,xg=new WeakMap,Ah=new WeakMap,Th=new WeakMap,yd=new WeakMap,bg=new WeakMap,Hn=new WeakSet,G0=function(e){_n(this,Hn,LT).call(this);let n=ge(this,An).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(Ys)),n},CT=function(){_n(this,Hn,kT).call(this);const e=Sd(this.options.staleTime,ge(this,An));if(hy.isServer()||ge(this,ws).isStale||!wT(e))return;const r=r5(ge(this,ws).dataUpdatedAt,e)+1;wt(this,Ah,ah.setTimeout(()=>{ge(this,ws).isStale||this.updateResult()},r))},PT=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(ge(this,An)):this.options.refetchInterval)??!1},RT=function(e){_n(this,Hn,IT).call(this),wt(this,yd,e),!(hy.isServer()||xa(this.options.enabled,ge(this,An))===!1||!wT(ge(this,yd))||ge(this,yd)===0)&&wt(this,Th,ah.setInterval(()=>{(this.options.refetchIntervalInBackground||_P.isFocused())&&_n(this,Hn,G0).call(this)},ge(this,yd)))},NT=function(){_n(this,Hn,CT).call(this),_n(this,Hn,RT).call(this,_n(this,Hn,PT).call(this))},kT=function(){ge(this,Ah)!==void 0&&(ah.clearTimeout(ge(this,Ah)),wt(this,Ah,void 0))},IT=function(){ge(this,Th)!==void 0&&(ah.clearInterval(ge(this,Th)),wt(this,Th,void 0))},LT=function(){const e=ge(this,Ks).getQueryCache().build(ge(this,Ks),this.options);if(e===ge(this,An))return;const n=ge(this,An);wt(this,An,e),wt(this,$y,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},f5=function(e){zi.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(ge(this,ws))}),ge(this,Ks).getQueryCache().notify({query:ge(this,An),type:"observerResultsUpdated"})})},YU);function yW(t,e){return xa(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&xa(e.retryOnMount,t)===!1)}function lk(t,e){return yW(t,e)||t.state.data!==void 0&&OT(t,e,e.refetchOnMount)}function OT(t,e,n){if(xa(e.enabled,t)!==!1&&Sd(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&MP(t,e)}return!1}function ck(t,e,n,r){return(t!==e||xa(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&MP(t,n)}function MP(t,e){return xa(e.enabled,t)!==!1&&t.isStaleByTime(Sd(e.staleTime,t))}function xW(t,e){return!ST(t.getCurrentResult(),e)}var qy,xl,ns,Ch,bl,od,ZU,bW=(ZU=class extends c5{constructor(e){super();Wt(this,bl);Wt(this,qy);Wt(this,xl);Wt(this,ns);Wt(this,Ch);wt(this,qy,e.client),this.mutationId=e.mutationId,wt(this,ns,e.mutationCache),wt(this,xl,[]),this.state=e.state||_W(),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,xl).includes(e)||(ge(this,xl).push(e),this.clearGcTimeout(),ge(this,ns).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){wt(this,xl,ge(this,xl).filter(n=>n!==e)),this.scheduleGc(),ge(this,ns).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){ge(this,xl).length||(this.state.status==="pending"?this.scheduleGc():ge(this,ns).remove(this))}continue(){var e;return((e=ge(this,Ch))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var a,o,l,c,d,f,p,y,x,S,w,b,M,T,C,L,N,D;const n=()=>{_n(this,bl,od).call(this,{type:"continue"})},r={client:ge(this,qy),meta:this.options.meta,mutationKey:this.options.mutationKey};wt(this,Ch,l5({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(F,V)=>{_n(this,bl,od).call(this,{type:"failed",failureCount:F,error:V})},onPause:()=>{_n(this,bl,od).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ge(this,ns).canRun(this)}));const i=this.state.status==="pending",s=!ge(this,Ch).canStart();try{if(i)n();else{_n(this,bl,od).call(this,{type:"pending",variables:e,isPaused:s}),ge(this,ns).config.onMutate&&await ge(this,ns).config.onMutate(e,this,r);const V=await((o=(a=this.options).onMutate)==null?void 0:o.call(a,e,r));V!==this.state.context&&_n(this,bl,od).call(this,{type:"pending",context:V,variables:e,isPaused:s})}const F=await ge(this,Ch).start();return await((c=(l=ge(this,ns).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=(p=ge(this,ns).config).onSettled)==null?void 0:y.call(p,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,bl,od).call(this,{type:"success",data:F}),F}catch(F){try{await((b=(w=ge(this,ns).config).onError)==null?void 0:b.call(w,F,e,this.state.context,this,r))}catch(V){Promise.reject(V)}try{await((T=(M=this.options).onError)==null?void 0:T.call(M,F,e,this.state.context,r))}catch(V){Promise.reject(V)}try{await((L=(C=ge(this,ns).config).onSettled)==null?void 0:L.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,bl,od).call(this,{type:"error",error:F}),F}finally{ge(this,ns).runNext(this)}}},qy=new WeakMap,xl=new WeakMap,ns=new WeakMap,Ch=new WeakMap,bl=new WeakSet,od=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),zi.batch(()=>{ge(this,xl).forEach(r=>{r.onMutationUpdate(e)}),ge(this,ns).notify({mutation:this,type:"updated",action:e})})},ZU);function _W(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Dc,Do,Ky,QU,wW=(QU=class extends Yy{constructor(e={}){super();Wt(this,Dc);Wt(this,Do);Wt(this,Ky);this.config=e,wt(this,Dc,new Set),wt(this,Do,new Map),wt(this,Ky,0)}build(e,n,r){const i=new bW({client:e,mutationCache:this,mutationId:++vb(this,Ky)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){ge(this,Dc).add(e);const n=xb(e);if(typeof n=="string"){const r=ge(this,Do).get(n);r?r.push(e):ge(this,Do).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(ge(this,Dc).delete(e)){const n=xb(e);if(typeof n=="string"){const r=ge(this,Do).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,Do).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=xb(e);if(typeof n=="string"){const r=ge(this,Do).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=xb(e);if(typeof n=="string"){const i=(r=ge(this,Do).get(n))==null?void 0:r.find(s=>s!==e&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){zi.batch(()=>{ge(this,Dc).forEach(e=>{this.notify({type:"removed",mutation:e})}),ge(this,Dc).clear(),ge(this,Do).clear()})}getAll(){return Array.from(ge(this,Dc))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>nk(n,r))}findAll(e={}){return this.getAll().filter(n=>nk(e,n))}notify(e){zi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return zi.batch(()=>Promise.all(e.map(n=>n.continue().catch(Ys))))}},Dc=new WeakMap,Do=new WeakMap,Ky=new WeakMap,QU);function xb(t){var e;return(e=t.options.scope)==null?void 0:e.id}var _l,JU,SW=(JU=class extends Yy{constructor(e={}){super();Wt(this,_l);this.config=e,wt(this,_l,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??wP(i,n);let a=this.get(s);return a||(a=new gW({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(a)),a}add(e){ge(this,_l).has(e.queryHash)||(ge(this,_l).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=ge(this,_l).get(e.queryHash);n&&(e.destroy(),n===e&&ge(this,_l).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){zi.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return ge(this,_l).get(e)}getAll(){return[...ge(this,_l).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>tk(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>tk(e,r)):n}notify(e){zi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){zi.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){zi.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},_l=new WeakMap,JU),Mr,xd,bd,_g,wg,_d,Sg,Mg,e5,MW=(e5=class{constructor(t={}){Wt(this,Mr);Wt(this,xd);Wt(this,bd);Wt(this,_g);Wt(this,wg);Wt(this,_d);Wt(this,Sg);Wt(this,Mg);wt(this,Mr,t.queryCache||new SW),wt(this,xd,t.mutationCache||new wW),wt(this,bd,t.defaultOptions||{}),wt(this,_g,new Map),wt(this,wg,new Map),wt(this,_d,0)}mount(){vb(this,_d)._++,ge(this,_d)===1&&(wt(this,Sg,_P.subscribe(async t=>{t&&(await this.resumePausedMutations(),ge(this,Mr).onFocus())})),wt(this,Mg,s1.subscribe(async t=>{t&&(await this.resumePausedMutations(),ge(this,Mr).onOnline())})))}unmount(){var t,e;vb(this,_d)._--,ge(this,_d)===0&&((t=ge(this,Sg))==null||t.call(this),wt(this,Sg,void 0),(e=ge(this,Mg))==null||e.call(this),wt(this,Mg,void 0))}isFetching(t){return ge(this,Mr).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return ge(this,xd).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ge(this,Mr).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=ge(this,Mr).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(Sd(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return ge(this,Mr).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=ge(this,Mr).get(r.queryHash),s=i==null?void 0:i.state.data,a=iW(e,s);if(a!==void 0)return ge(this,Mr).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(t,e,n){return zi.batch(()=>ge(this,Mr).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ge(this,Mr).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=ge(this,Mr);zi.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=ge(this,Mr);return zi.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=zi.batch(()=>ge(this,Mr).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(Ys).catch(Ys)}invalidateQueries(t,e={}){return zi.batch(()=>(ge(this,Mr).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=zi.batch(()=>ge(this,Mr).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(Ys)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Ys)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=ge(this,Mr).build(this,e);return n.isStaleByTime(Sd(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Ys).catch(Ys)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Ys).catch(Ys)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return s1.isOnline()?ge(this,xd).resumePausedMutations():Promise.resolve()}getQueryCache(){return ge(this,Mr)}getMutationCache(){return ge(this,xd)}getDefaultOptions(){return ge(this,bd)}setDefaultOptions(t){wt(this,bd,t)}setQueryDefaults(t,e){ge(this,_g).set(dy(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...ge(this,_g).values()],n={};return e.forEach(r=>{fy(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){ge(this,wg).set(dy(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...ge(this,wg).values()],n={};return e.forEach(r=>{fy(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...ge(this,bd).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=wP(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===SP&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...ge(this,bd).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){ge(this,Mr).clear(),ge(this,xd).clear()}},Mr=new WeakMap,xd=new WeakMap,bd=new WeakMap,_g=new WeakMap,wg=new WeakMap,_d=new WeakMap,Sg=new WeakMap,Mg=new WeakMap,e5),h5=P.createContext(void 0),Bl=t=>{const e=P.useContext(h5);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},EW=({client:t,children:e})=>(P.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),g.jsx(h5.Provider,{value:t,children:e})),p5=P.createContext(!1),AW=()=>P.useContext(p5);p5.Provider;function TW(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var CW=P.createContext(TW()),PW=()=>P.useContext(CW),RW=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?a5(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},NW=t=>{P.useEffect(()=>{t.clearReset()},[t])},kW=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||a5(n,[t.error,r])),IW=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))}},LW=(t,e)=>t.isLoading&&t.isFetching&&!e,OW=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,uk=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function DW(t,e,n){var y,x,S,w;const r=AW(),i=PW(),s=Bl(),a=s.defaultQueryOptions(t);(x=(y=s.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||x.call(y,a);const o=s.getQueryCache().get(a.queryHash),l=t.subscribed!==!1;a._optimisticResults=r?"isRestoring":l?"optimistic":void 0,IW(a),RW(a,i,o),NW(i);const c=!s.getQueryCache().get(a.queryHash),[d]=P.useState(()=>new e(s,a)),f=d.getOptimisticResult(a),p=!r&&l;if(P.useSyncExternalStore(P.useCallback(b=>{const M=p?d.subscribe(zi.batchCalls(b)):Ys;return d.updateResult(),M},[d,p]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),P.useEffect(()=>{d.setOptions(a)},[a,d]),OW(a,f))throw uk(a,d,i);if(kW({result:f,errorResetBoundary:i,throwOnError:a.throwOnError,query:o,suspense:a.suspense}))throw f.error;if((w=(S=s.getDefaultOptions().queries)==null?void 0:S._experimental_afterQuery)==null||w.call(S,a,f),a.experimental_prefetchInRender&&!hy.isServer()&&LW(f,r)){const b=c?uk(a,d,i):o==null?void 0:o.promise;b==null||b.catch(Ys).finally(()=>{d.updateResult()})}return a.notifyOnChangeProps?f:d.trackResult(f)}function bi(t,e){return DW(t,vW)}/**
|
||
* @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 jW=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),m5=(...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 UW={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 FW=P.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:a,...o},l)=>P.createElement("svg",{ref:l,...UW,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:m5("lucide",i),...o},[...a.map(([c,d])=>P.createElement(c,d)),...Array.isArray(s)?s:[s]]));/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const lt=(t,e)=>{const n=P.forwardRef(({className:r,...i},s)=>P.createElement(FW,{ref:s,iconNode:e,className:m5(`lucide-${jW(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 EP=lt("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 a1=lt("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 zW=lt("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 g5=lt("BookMarked",[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const DT=lt("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 Nl=lt("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 BW=lt("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 o1=lt("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 HW=lt("BrainCircuit",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const VW=lt("BrainCog",[["path",{d:"M12 5a3 3 0 1 0-5.997.142 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588 4 4 0 0 0 7.636 2.106 3.2 3.2 0 0 0 .164-.546c.028-.13.306-.13.335 0a3.2 3.2 0 0 0 .163.546 4 4 0 0 0 7.636-2.106 4 4 0 0 0 .556-6.588 4 4 0 0 0-2.526-5.77A3 3 0 1 0 12 5",key:"1kgmhc"}],["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"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m15.7 10.4-.9.4",key:"ayzo6p"}],["path",{d:"m9.2 13.2-.9.4",key:"1uzb3g"}],["path",{d:"m13.6 15.7-.4-.9",key:"11ifqf"}],["path",{d:"m10.8 9.2-.4-.9",key:"1pmk2v"}],["path",{d:"m15.7 13.5-.9-.4",key:"7ng02m"}],["path",{d:"m9.2 10.9-.9-.4",key:"1x66zd"}],["path",{d:"m10.5 15.7.4-.9",key:"3js94g"}],["path",{d:"m13.1 9.2.4-.9",key:"18n7mc"}]]);/**
|
||
* @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 tp=lt("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 GW=lt("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 Ps=lt("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 v5=lt("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 WW=lt("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 y5=lt("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 x5=lt("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 $W=lt("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 XW=lt("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 qW=lt("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 KW=lt("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 YW=lt("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const l1=lt("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 ZW=lt("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 jT=lt("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 QW=lt("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 UT=lt("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 Pd=lt("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 JW=lt("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 Eg=lt("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 Ag=lt("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 dk=lt("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 c1=lt("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 e9=lt("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 t9=lt("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const n9=lt("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 b5=lt("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 r9=lt("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 i9=lt("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 Q0=lt("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 s9=lt("HeartPulse",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"M3.22 12H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"1uw2ng"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const a9=lt("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const fk=lt("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 o9=lt("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 l9=lt("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 AP=lt("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 c9=lt("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 u9=lt("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 d9=lt("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 f9=lt("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 Xg=lt("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 h9=lt("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 p9=lt("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const m9=lt("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 TP=lt("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 hk=lt("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 g9=lt("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 v9=lt("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 y9=lt("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 x9=lt("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 u1=lt("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 d1=lt("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 b9=lt("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 _9=lt("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 ih=lt("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 _5=lt("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 w9=lt("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 w5=lt("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 S9=lt("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 f1=lt("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 M9=lt("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 E9=lt("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 A9=lt("ShieldQuestion",[["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:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}],["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 rg=lt("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 pk=lt("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 T9=lt("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/**
|
||
* @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 C9=lt("SlidersVertical",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const oh=lt("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 S5=lt("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 P9=lt("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 R9=lt("Telescope",[["path",{d:"m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44",key:"k4qptu"}],["path",{d:"m13.56 11.747 4.332-.924",key:"19l80z"}],["path",{d:"m16 21-3.105-6.21",key:"7oh9d"}],["path",{d:"M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z",key:"m7xp4m"}],["path",{d:"m6.158 8.633 1.114 4.456",key:"74o979"}],["path",{d:"m8 21 3.105-6.21",key:"1fvxut"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}]]);/**
|
||
* @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 M5=lt("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 FT=lt("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 Yc=lt("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 N9=lt("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 zT=lt("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 eS=lt("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 kl=lt("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 Md=lt("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"}]]),W0=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:c9},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:o1},{id:"memory",label:"Gedächtnis",hint:"Geteiltes Memory verwalten",icon:tp},{id:"connect",label:"Verbinden",hint:"IDE-/Agent-Configs erzeugen",icon:u1},{id:"agent",label:"Hermes",hint:"Agent-Status & Verdrahtung",icon:Nl},{id:"terminal",label:"Terminal",hint:"Interaktives Hermes-Agent-Terminal",icon:S5},{id:"voice",label:"Sprechen",hint:"Mit Hermes per Sprache reden (3D-Avatar)",icon:TP},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:XW}];var mk=1,k9=.9,I9=.8,L9=.17,dE=.1,fE=.999,O9=.9999,D9=.99,j9=/[\\\/_+.#"@\[\(\{&]/,U9=/[\\\/_+.#"@\[\(\{&]/g,F9=/[\s-]/,E5=/[\s-]/g;function BT(t,e,n,r,i,s,a){if(s===e.length)return i===t.length?mk:D9;var o=`${i},${s}`;if(a[o]!==void 0)return a[o];for(var l=r.charAt(s),c=n.indexOf(l,i),d=0,f,p,y,x;c>=0;)f=BT(t,e,n,r,c+1,s+1,a),f>d&&(c===i?f*=mk:j9.test(t.charAt(c-1))?(f*=I9,y=t.slice(i,c-1).match(U9),y&&i>0&&(f*=Math.pow(fE,y.length))):F9.test(t.charAt(c-1))?(f*=k9,x=t.slice(i,c-1).match(E5),x&&i>0&&(f*=Math.pow(fE,x.length))):(f*=L9,i>0&&(f*=Math.pow(fE,c-i))),t.charAt(c)!==e.charAt(s)&&(f*=O9)),(f<dE&&n.charAt(c-1)===r.charAt(s+1)||r.charAt(s+1)===r.charAt(s)&&n.charAt(c-1)!==r.charAt(s))&&(p=BT(t,e,n,r,c+1,s+2,a),p*dE>f&&(f=p*dE)),f>d&&(d=f),c=n.indexOf(l,c+1);return a[o]=d,d}function gk(t){return t.toLowerCase().replace(E5," ")}function z9(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,BT(t,e,gk(t),gk(e),0,0,{})}function Ed(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 vk(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Tg(...t){return e=>{let n=!1;const r=t.map(i=>{const s=vk(i,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():vk(t[i],null)}}}}function np(...t){return P.useCallback(Tg(...t),t)}function B9(t,e=[]){let n=[];function r(s,a){const o=P.createContext(a);o.displayName=s+"Context";const l=n.length;n=[...n,a];const c=f=>{var b;const{scope:p,children:y,...x}=f,S=((b=p==null?void 0:p[t])==null?void 0:b[l])||o,w=P.useMemo(()=>x,Object.values(x));return g.jsx(S.Provider,{value:w,children:y})};c.displayName=s+"Provider";function d(f,p){var S;const y=((S=p==null?void 0:p[t])==null?void 0:S[l])||o,x=P.useContext(y);if(x)return x;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[c,d]}const i=()=>{const s=n.map(a=>P.createContext(a));return function(o){const l=(o==null?void 0:o[t])||s;return P.useMemo(()=>({[`__scope${t}`]:{...o,[t]:l}}),[o,l])}};return i.scopeName=t,[r,H9(i,...e)]}function H9(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const a=r.reduce((o,{useScope:l,scopeName:c})=>{const f=l(s)[`__scope${c}`];return{...o,...f}},{});return P.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}var py=globalThis!=null&&globalThis.document?P.useLayoutEffect:()=>{},V9=Jw[" useId ".trim().toString()]||(()=>{}),G9=0;function Gc(t){const[e,n]=P.useState(V9());return py(()=>{n(r=>r??String(G9++))},[t]),e?`radix-${e}`:""}var W9=Jw[" useInsertionEffect ".trim().toString()]||py;function $9({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,a]=X9({defaultProp:e,onChange:n}),o=t!==void 0,l=o?t:i;{const d=P.useRef(t!==void 0);P.useEffect(()=>{const f=d.current;f!==o&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=o},[o,r])}const c=P.useCallback(d=>{var f;if(o){const p=q9(d)?d(t):d;p!==t&&((f=a.current)==null||f.call(a,p))}else s(d)},[o,t,s,a]);return[l,c]}function X9({defaultProp:t,onChange:e}){const[n,r]=P.useState(t),i=P.useRef(n),s=P.useRef(e);return W9(()=>{s.current=e},[e]),P.useEffect(()=>{var a;i.current!==n&&((a=s.current)==null||a.call(s,n),i.current=n)},[n,i]),[n,r,s]}function q9(t){return typeof t=="function"}var tS=n5();function A5(t){const e=P.forwardRef((n,r)=>{let{children:i,...s}=n,a=null,o=!1;const l=[];yk(i)&&typeof bb=="function"&&(i=bb(i._payload)),P.Children.forEach(i,p=>{var y;if(J9(p)){o=!0;const x=p;let S="child"in x.props?x.props.child:x.props.children;yk(S)&&typeof bb=="function"&&(S=bb(S._payload)),a=Y9(x,S),l.push((y=a==null?void 0:a.props)==null?void 0:y.children)}else l.push(p)}),a?a=P.cloneElement(a,void 0,l):!o&&P.Children.count(i)===1&&P.isValidElement(i)&&(a=i);const c=a?Q9(a):void 0,d=np(r,c);if(!a){if(i||i===0)throw new Error(o?r$(t):n$(t));return i}const f=Z9(s,a.props??{});return a.type!==P.Fragment&&(f.ref=r?d:c),P.cloneElement(a,f)});return e.displayName=`${t}.Slot`,e}var K9=Symbol.for("radix.slottable"),Y9=(t,e)=>{if("child"in t.props){const n=t.props.child;return P.isValidElement(n)?P.cloneElement(n,void 0,t.props.children(n.props.children)):null}return P.isValidElement(e)?e:null};function Z9(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...o)=>{const l=s(...o);return i(...o),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function Q9(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 J9(t){return P.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===K9}var e$=Symbol.for("react.lazy");function yk(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===e$&&"_payload"in t&&t$(t._payload)}function t$(t){return typeof t=="object"&&t!==null&&"then"in t}var n$=t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,r$=t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,bb=Jw[" use ".trim().toString()],i$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Gi=i$.reduce((t,e)=>{const n=A5(`Primitive.${e}`),r=P.forwardRef((i,s)=>{const{asChild:a,...o}=i,l=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(l,{...o,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function s$(t,e){t&&tS.flushSync(()=>t.dispatchEvent(e))}function my(t){const e=P.useRef(t);return P.useEffect(()=>{e.current=t}),P.useMemo(()=>((...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)}),[])}function a$(t,e=globalThis==null?void 0:globalThis.document){const n=my(t);P.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var o$="DismissableLayer",HT="dismissableLayer.update",l$="dismissableLayer.pointerDownOutside",c$="dismissableLayer.focusOutside",xk,CP=P.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),T5=P.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:o,onDismiss:l,...c}=t,d=P.useContext(CP),[f,p]=P.useState(null),y=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=P.useState({}),S=np(e,V=>p(V)),w=Array.from(d.layers),[b]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),M=w.indexOf(b),T=f?w.indexOf(f):-1,C=d.layersWithOutsidePointerEventsDisabled.size>0,L=T>=M,N=P.useRef(!1),D=h$(V=>{const I=V.target;if(!(I instanceof Node))return;const U=[...d.branches].some(X=>X.contains(I));!L||U||(s==null||s(V),o==null||o(V),V.defaultPrevented||l==null||l())},{ownerDocument:y,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:N,dismissableSurfaces:d.dismissableSurfaces}),F=p$(V=>{if(r&&N.current)return;const I=V.target;[...d.branches].some(X=>X.contains(I))||(a==null||a(V),o==null||o(V),V.defaultPrevented||l==null||l())},y);return a$(V=>{T===d.layers.size-1&&(i==null||i(V),!V.defaultPrevented&&l&&(V.preventDefault(),l()))},y),P.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(xk=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),bk(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(f),d.layersWithOutsidePointerEventsDisabled.size===0&&(y.body.style.pointerEvents=xk))}},[f,y,n,d]),P.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),bk())},[f,d]),P.useEffect(()=>{const V=()=>x({});return document.addEventListener(HT,V),()=>document.removeEventListener(HT,V)},[]),g.jsx(Gi.div,{...c,ref:S,style:{pointerEvents:C?L?"auto":"none":void 0,...t.style},onFocusCapture:Ed(t.onFocusCapture,F.onFocusCapture),onBlurCapture:Ed(t.onBlurCapture,F.onBlurCapture),onPointerDownCapture:Ed(t.onPointerDownCapture,D.onPointerDownCapture)})});T5.displayName=o$;var u$="DismissableLayerBranch",d$=P.forwardRef((t,e)=>{const n=P.useContext(CP),r=P.useRef(null),i=np(e,r);return P.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),g.jsx(Gi.div,{...t,ref:i})});d$.displayName=u$;function f$(){const t=P.useContext(CP),[e,n]=P.useState(null);return P.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}function h$(t,e){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s}=e,a=my(t),o=P.useRef(!1),l=P.useRef(!1),c=P.useRef(new Map),d=P.useRef(()=>{});return P.useEffect(()=>{function f(){l.current=!1,i.current=!1,c.current.clear()}function p(){return Array.from(c.current.values()).some(Boolean)}function y(M){if(!l.current)return;const T=M.target;T instanceof Node&&[...s].some(L=>L.contains(T))||c.current.set(M.type,!0),M.type==="click"&&window.setTimeout(()=>{l.current&&d.current()},0)}function x(M){l.current&&c.current.set(M.type,!1)}const S=M=>{if(M.target&&!o.current){let T=function(){n.removeEventListener("click",d.current);const L=p();f(),L||C5(l$,a,C,{discrete:!0})};const C={originalEvent:M};l.current=!0,i.current=r&&M.button===0,c.current.clear(),!r||M.button!==0?T():(n.removeEventListener("click",d.current),d.current=T,n.addEventListener("click",d.current,{once:!0}))}else n.removeEventListener("click",d.current),f();o.current=!1},w=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const M of w)n.addEventListener(M,y,!0),n.addEventListener(M,x);const b=window.setTimeout(()=>{n.addEventListener("pointerdown",S)},0);return()=>{window.clearTimeout(b),n.removeEventListener("pointerdown",S),n.removeEventListener("click",d.current);for(const M of w)n.removeEventListener(M,y,!0),n.removeEventListener(M,x)}},[n,a,r,i,s]),{onPointerDownCapture:()=>o.current=!0}}function p$(t,e=globalThis==null?void 0:globalThis.document){const n=my(t),r=P.useRef(!1);return P.useEffect(()=>{const i=s=>{s.target&&!r.current&&C5(c$,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 bk(){const t=new CustomEvent(HT);document.dispatchEvent(t)}function C5(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?s$(i,s):i.dispatchEvent(s)}var hE="focusScope.autoFocusOnMount",pE="focusScope.autoFocusOnUnmount",_k={bubbles:!1,cancelable:!0},m$="FocusScope",P5=P.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...a}=t,[o,l]=P.useState(null),c=my(i),d=my(s),f=P.useRef(null),p=np(e,S=>l(S)),y=P.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;P.useEffect(()=>{if(r){let S=function(T){if(y.paused||!o)return;const C=T.target;o.contains(C)?f.current=C:ld(f.current,{select:!0})},w=function(T){if(y.paused||!o)return;const C=T.relatedTarget;C!==null&&(o.contains(C)||ld(f.current,{select:!0}))},b=function(T){if(document.activeElement===document.body)for(const L of T)L.removedNodes.length>0&&ld(o)};document.addEventListener("focusin",S),document.addEventListener("focusout",w);const M=new MutationObserver(b);return o&&M.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",w),M.disconnect()}}},[r,o,y.paused]),P.useEffect(()=>{if(o){Sk.add(y);const S=document.activeElement;if(!o.contains(S)){const b=new CustomEvent(hE,_k);o.addEventListener(hE,c),o.dispatchEvent(b),b.defaultPrevented||(g$(_$(R5(o)),{select:!0}),document.activeElement===S&&ld(o))}return()=>{o.removeEventListener(hE,c),setTimeout(()=>{const b=new CustomEvent(pE,_k);o.addEventListener(pE,d),o.dispatchEvent(b),b.defaultPrevented||ld(S??document.body,{select:!0}),o.removeEventListener(pE,d),Sk.remove(y)},0)}}},[o,c,d,y]);const x=P.useCallback(S=>{if(!n&&!r||y.paused)return;const w=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,b=document.activeElement;if(w&&b){const M=S.currentTarget,[T,C]=v$(M);T&&C?!S.shiftKey&&b===C?(S.preventDefault(),n&&ld(T,{select:!0})):S.shiftKey&&b===T&&(S.preventDefault(),n&&ld(C,{select:!0})):b===M&&S.preventDefault()}},[n,r,y.paused]);return g.jsx(Gi.div,{tabIndex:-1,...a,ref:p,onKeyDown:x})});P5.displayName=m$;function g$(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(ld(r,{select:e}),document.activeElement!==n)return}function v$(t){const e=R5(t),n=wk(e,t),r=wk(e.reverse(),t);return[n,r]}function R5(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 wk(t,e){for(const n of t)if(!y$(n,{upTo:e}))return n}function y$(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 x$(t){return t instanceof HTMLInputElement&&"select"in t}function ld(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&x$(t)&&e&&t.select()}}var Sk=b$();function b$(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=Mk(t,e),t.unshift(e)},remove(e){var n;t=Mk(t,e),(n=t[0])==null||n.resume()}}}function Mk(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function _$(t){return t.filter(e=>e.tagName!=="A")}var w$="Portal",N5=P.forwardRef((t,e)=>{var o;const{container:n,...r}=t,[i,s]=P.useState(!1);py(()=>s(!0),[]);const a=n||i&&((o=globalThis==null?void 0:globalThis.document)==null?void 0:o.body);return a?tS.createPortal(g.jsx(Gi.div,{...r,ref:e}),a):null});N5.displayName=w$;function S$(t,e){return P.useReducer((n,r)=>e[n][r]??n,t)}var nS=t=>{const{present:e,children:n}=t,r=M$(e),i=typeof n=="function"?n({present:r.isPresent}):P.Children.only(n),s=E$(r.ref,A$(i));return typeof n=="function"||r.isPresent?P.cloneElement(i,{ref:s}):null};nS.displayName="Presence";function M$(t){const[e,n]=P.useState(),r=P.useRef(null),i=P.useRef(t),s=P.useRef("none"),a=t?"mounted":"unmounted",[o,l]=S$(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return P.useEffect(()=>{const c=_b(r.current);s.current=o==="mounted"?c:"none"},[o]),py(()=>{const c=r.current,d=i.current;if(d!==t){const p=s.current,y=_b(c);t?l("MOUNT"):y==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(d&&p!==y?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),py(()=>{if(e){let c;const d=e.ownerDocument.defaultView??window,f=y=>{const S=_b(r.current).includes(CSS.escape(y.animationName));if(y.target===e&&S&&(l("ANIMATION_END"),!i.current)){const w=e.style.animationFillMode;e.style.animationFillMode="forwards",c=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=w)})}},p=y=>{y.target===e&&(s.current=_b(r.current))};return e.addEventListener("animationstart",p),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{d.clearTimeout(c),e.removeEventListener("animationstart",p),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(o),ref:P.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function Ek(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function E$(...t){const e=P.useRef(t);return e.current=t,P.useCallback(n=>{const r=e.current;let i=!1;const s=r.map(a=>{const o=Ek(a,n);return!i&&typeof o=="function"&&(i=!0),o});if(i)return()=>{for(let a=0;a<s.length;a++){const o=s[a];typeof o=="function"?o():Ek(r[a],null)}}},[])}function _b(t){return(t==null?void 0:t.animationName)||"none"}function A$(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)}var wb=0,fl=null;function T$(){P.useEffect(()=>{fl||(fl={start:Ak(),end:Ak()});const{start:t,end:e}=fl;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),wb++,()=>{wb===1&&(fl==null||fl.start.remove(),fl==null||fl.end.remove(),fl=null),wb=Math.max(0,wb-1)}},[])}function Ak(){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 wl=function(){return wl=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},wl.apply(this,arguments)};function k5(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function C$(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}var V_="right-scroll-bar-position",G_="width-before-scroll-bar",P$="with-scroll-bars-hidden",R$="--removed-body-scroll-bar-size";function mE(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function N$(t,e){var n=P.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=e,n.facade}var k$=typeof window<"u"?P.useLayoutEffect:P.useEffect,Tk=new WeakMap;function I$(t,e){var n=N$(null,function(r){return t.forEach(function(i){return mE(i,r)})});return k$(function(){var r=Tk.get(n);if(r){var i=new Set(r),s=new Set(t),a=n.current;i.forEach(function(o){s.has(o)||mE(o,null)}),s.forEach(function(o){i.has(o)||mE(o,a)})}Tk.set(n,t)},[t]),n}function L$(t){return t}function O$(t,e){e===void 0&&(e=L$);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(s){var a=e(s,r);return n.push(a),function(){n=n.filter(function(o){return o!==a})}},assignSyncMedium:function(s){for(r=!0;n.length;){var a=n;n=[],a.forEach(s)}n={push:function(o){return s(o)},filter:function(){return n}}},assignMedium:function(s){r=!0;var a=[];if(n.length){var o=n;n=[],o.forEach(s),a=n}var l=function(){var d=a;a=[],d.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(d){a.push(d),c()},filter:function(d){return a=a.filter(d),n}}}};return i}function D$(t){t===void 0&&(t={});var e=O$(null);return e.options=wl({async:!0,ssr:!1},t),e}var I5=function(t){var e=t.sideCar,n=k5(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return P.createElement(r,wl({},n))};I5.isSideCarExport=!0;function j$(t,e){return t.useMedium(e),I5}var L5=D$(),gE=function(){},rS=P.forwardRef(function(t,e){var n=P.useRef(null),r=P.useState({onScrollCapture:gE,onWheelCapture:gE,onTouchMoveCapture:gE}),i=r[0],s=r[1],a=t.forwardProps,o=t.children,l=t.className,c=t.removeScrollBar,d=t.enabled,f=t.shards,p=t.sideCar,y=t.noRelative,x=t.noIsolation,S=t.inert,w=t.allowPinchZoom,b=t.as,M=b===void 0?"div":b,T=t.gapMode,C=k5(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),L=p,N=I$([n,e]),D=wl(wl({},C),i);return P.createElement(P.Fragment,null,d&&P.createElement(L,{sideCar:L5,removeScrollBar:c,shards:f,noRelative:y,noIsolation:x,inert:S,setCallbacks:s,allowPinchZoom:!!w,lockRef:n,gapMode:T}),a?P.cloneElement(P.Children.only(o),wl(wl({},D),{ref:N})):P.createElement(M,wl({},D,{className:l,ref:N}),o))});rS.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};rS.classNames={fullWidth:G_,zeroRight:V_};var U$=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function F$(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=U$();return e&&t.setAttribute("nonce",e),t}function z$(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function B$(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var H$=function(){var t=0,e=null;return{add:function(n){t==0&&(e=F$())&&(z$(e,n),B$(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},V$=function(){var t=H$();return function(e,n){P.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},O5=function(){var t=V$(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},G$={left:0,top:0,right:0,gap:0},vE=function(t){return parseInt(t||"",10)||0},W$=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[vE(n),vE(r),vE(i)]},$$=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return G$;var e=W$(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$=O5(),ig="data-scroll-locked",q$=function(t,e,n,r){var i=t.left,s=t.top,a=t.right,o=t.gap;return n===void 0&&(n="margin"),`
|
||
.`.concat(P$,` {
|
||
overflow: hidden `).concat(r,`;
|
||
padding-right: `).concat(o,"px ").concat(r,`;
|
||
}
|
||
body[`).concat(ig,`] {
|
||
overflow: hidden `).concat(r,`;
|
||
overscroll-behavior: contain;
|
||
`).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
|
||
padding-left: `.concat(i,`px;
|
||
padding-top: `).concat(s,`px;
|
||
padding-right: `).concat(a,`px;
|
||
margin-left:0;
|
||
margin-top:0;
|
||
margin-right: `).concat(o,"px ").concat(r,`;
|
||
`),n==="padding"&&"padding-right: ".concat(o,"px ").concat(r,";")].filter(Boolean).join(""),`
|
||
}
|
||
|
||
.`).concat(V_,` {
|
||
right: `).concat(o,"px ").concat(r,`;
|
||
}
|
||
|
||
.`).concat(G_,` {
|
||
margin-right: `).concat(o,"px ").concat(r,`;
|
||
}
|
||
|
||
.`).concat(V_," .").concat(V_,` {
|
||
right: 0 `).concat(r,`;
|
||
}
|
||
|
||
.`).concat(G_," .").concat(G_,` {
|
||
margin-right: 0 `).concat(r,`;
|
||
}
|
||
|
||
body[`).concat(ig,`] {
|
||
`).concat(R$,": ").concat(o,`px;
|
||
}
|
||
`)},Ck=function(){var t=parseInt(document.body.getAttribute(ig)||"0",10);return isFinite(t)?t:0},K$=function(){P.useEffect(function(){return document.body.setAttribute(ig,(Ck()+1).toString()),function(){var t=Ck()-1;t<=0?document.body.removeAttribute(ig):document.body.setAttribute(ig,t.toString())}},[])},Y$=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;K$();var s=P.useMemo(function(){return $$(i)},[i]);return P.createElement(X$,{styles:q$(s,!e,i,n?"":"!important")})},VT=!1;if(typeof window<"u")try{var Sb=Object.defineProperty({},"passive",{get:function(){return VT=!0,!0}});window.addEventListener("test",Sb,Sb),window.removeEventListener("test",Sb,Sb)}catch{VT=!1}var um=VT?{passive:!1}:!1,Z$=function(t){return t.tagName==="TEXTAREA"},D5=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!Z$(t)&&n[e]==="visible")},Q$=function(t){return D5(t,"overflowY")},J$=function(t){return D5(t,"overflowX")},Pk=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=j5(t,r);if(i){var s=U5(t,r),a=s[1],o=s[2];if(a>o)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},e7=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},t7=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},j5=function(t,e){return t==="v"?Q$(e):J$(e)},U5=function(t,e){return t==="v"?e7(e):t7(e)},n7=function(t,e){return t==="h"&&e==="rtl"?-1:1},r7=function(t,e,n,r,i){var s=n7(t,window.getComputedStyle(e).direction),a=s*r,o=n.target,l=e.contains(o),c=!1,d=a>0,f=0,p=0;do{if(!o)break;var y=U5(t,o),x=y[0],S=y[1],w=y[2],b=S-w-s*x;(x||b)&&j5(t,o)&&(f+=b,p+=x);var M=o.parentNode;o=M&&M.nodeType===Node.DOCUMENT_FRAGMENT_NODE?M.host:M}while(!l&&o!==document.body||l&&(e.contains(o)||e===o));return(d&&Math.abs(f)<1||!d&&Math.abs(p)<1)&&(c=!0),c},Mb=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Rk=function(t){return[t.deltaX,t.deltaY]},Nk=function(t){return t&&"current"in t?t.current:t},i7=function(t,e){return t[0]===e[0]&&t[1]===e[1]},s7=function(t){return`
|
||
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
||
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
||
`)},a7=0,dm=[];function o7(t){var e=P.useRef([]),n=P.useRef([0,0]),r=P.useRef(),i=P.useState(a7++)[0],s=P.useState(O5)[0],a=P.useRef(t);P.useEffect(function(){a.current=t},[t]),P.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var S=C$([t.lockRef.current],(t.shards||[]).map(Nk),!0).filter(Boolean);return S.forEach(function(w){return w.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),S.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var o=P.useCallback(function(S,w){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!a.current.allowPinchZoom;var b=Mb(S),M=n.current,T="deltaX"in S?S.deltaX:M[0]-b[0],C="deltaY"in S?S.deltaY:M[1]-b[1],L,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,I=V?V===N||V.contains(N):!1;if(I)return!1;var U=Pk(D,N);if(!U)return!0;if(U?L=D:(L=D==="v"?"h":"v",U=Pk(D,N)),!U)return!1;if(!r.current&&"changedTouches"in S&&(T||C)&&(r.current=L),!L)return!0;var X=r.current||L;return r7(X,w,S,X==="h"?T:C)},[]),l=P.useCallback(function(S){var w=S;if(!(!dm.length||dm[dm.length-1]!==s)){var b="deltaY"in w?Rk(w):Mb(w),M=e.current.filter(function(L){return L.name===w.type&&(L.target===w.target||w.target===L.shadowParent)&&i7(L.delta,b)})[0];if(M&&M.should){w.cancelable&&w.preventDefault();return}if(!M){var T=(a.current.shards||[]).map(Nk).filter(Boolean).filter(function(L){return L.contains(w.target)}),C=T.length>0?o(w,T[0]):!a.current.noIsolation;C&&w.cancelable&&w.preventDefault()}}},[]),c=P.useCallback(function(S,w,b,M){var T={name:S,delta:w,target:b,should:M,shadowParent:l7(b)};e.current.push(T),setTimeout(function(){e.current=e.current.filter(function(C){return C!==T})},1)},[]),d=P.useCallback(function(S){n.current=Mb(S),r.current=void 0},[]),f=P.useCallback(function(S){c(S.type,Rk(S),S.target,o(S,t.lockRef.current))},[]),p=P.useCallback(function(S){c(S.type,Mb(S),S.target,o(S,t.lockRef.current))},[]);P.useEffect(function(){return dm.push(s),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",l,um),document.addEventListener("touchmove",l,um),document.addEventListener("touchstart",d,um),function(){dm=dm.filter(function(S){return S!==s}),document.removeEventListener("wheel",l,um),document.removeEventListener("touchmove",l,um),document.removeEventListener("touchstart",d,um)}},[]);var y=t.removeScrollBar,x=t.inert;return P.createElement(P.Fragment,null,x?P.createElement(s,{styles:s7(i)}):null,y?P.createElement(Y$,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function l7(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const c7=j$(L5,o7);var F5=P.forwardRef(function(t,e){return P.createElement(rS,wl({},t,{ref:e,sideCar:c7}))});F5.classNames=rS.classNames;var u7=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},fm=new WeakMap,Eb=new WeakMap,Ab={},yE=0,z5=function(t){return t&&(t.host||z5(t.parentNode))},d7=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=z5(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})},f7=function(t,e,n,r){var i=d7(e,Array.isArray(t)?t:[t]);Ab[n]||(Ab[n]=new WeakMap);var s=Ab[n],a=[],o=new Set,l=new Set(i),c=function(f){!f||o.has(f)||(o.add(f),c(f.parentNode))};i.forEach(c);var d=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(p){if(o.has(p))d(p);else try{var y=p.getAttribute(r),x=y!==null&&y!=="false",S=(fm.get(p)||0)+1,w=(s.get(p)||0)+1;fm.set(p,S),s.set(p,w),a.push(p),S===1&&x&&Eb.set(p,!0),w===1&&p.setAttribute(n,"true"),x||p.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",p,b)}})};return d(e),o.clear(),yE++,function(){a.forEach(function(f){var p=fm.get(f)-1,y=s.get(f)-1;fm.set(f,p),s.set(f,y),p||(Eb.has(f)||f.removeAttribute(r),Eb.delete(f)),y||f.removeAttribute(n)}),yE--,yE||(fm=new WeakMap,fm=new WeakMap,Eb=new WeakMap,Ab={})}},h7=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=u7(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),f7(r,i,n,"aria-hidden")):function(){return null}},iS="Dialog",[B5]=B9(iS),[p7,$o]=B5(iS),H5=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:a=!0}=t,o=P.useRef(null),l=P.useRef(null),[c,d]=$9({prop:r,defaultProp:i??!1,onChange:s,caller:iS});return g.jsx(p7,{scope:e,triggerRef:o,contentRef:l,contentId:Gc(),titleId:Gc(),descriptionId:Gc(),open:c,onOpenChange:d,onOpenToggle:P.useCallback(()=>d(f=>!f),[d]),modal:a,children:n})};H5.displayName=iS;var V5="DialogTrigger",m7=P.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=$o(V5,n),s=np(e,i.triggerRef);return g.jsx(Gi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":RP(i.open),...r,ref:s,onClick:Ed(t.onClick,i.onOpenToggle)})});m7.displayName=V5;var PP="DialogPortal",[g7,G5]=B5(PP,{forceMount:void 0}),W5=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,s=$o(PP,e);return g.jsx(g7,{scope:e,forceMount:n,children:P.Children.map(r,a=>g.jsx(nS,{present:n||s.open,children:g.jsx(N5,{asChild:!0,container:i,children:a})}))})};W5.displayName=PP;var h1="DialogOverlay",$5=P.forwardRef((t,e)=>{const n=G5(h1,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=$o(h1,t.__scopeDialog);return s.modal?g.jsx(nS,{present:r||s.open,children:g.jsx(y7,{...i,ref:e})}):null});$5.displayName=h1;var v7=A5("DialogOverlay.RemoveScroll"),y7=P.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=$o(h1,n),s=f$(),a=np(e,s);return g.jsx(F5,{as:v7,allowPinchZoom:!0,shards:[i.contentRef],children:g.jsx(Gi.div,{"data-state":RP(i.open),...r,ref:a,style:{pointerEvents:"auto",...r.style}})})}),Cg="DialogContent",X5=P.forwardRef((t,e)=>{const n=G5(Cg,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=$o(Cg,t.__scopeDialog);return g.jsx(nS,{present:r||s.open,children:s.modal?g.jsx(x7,{...i,ref:e}):g.jsx(b7,{...i,ref:e})})});X5.displayName=Cg;var x7=P.forwardRef((t,e)=>{const n=$o(Cg,t.__scopeDialog),r=P.useRef(null),i=np(e,n.contentRef,r);return P.useEffect(()=>{const s=r.current;if(s)return h7(s)},[]),g.jsx(q5,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Ed(t.onCloseAutoFocus,s=>{var a;s.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:Ed(t.onPointerDownOutside,s=>{const a=s.detail.originalEvent,o=a.button===0&&a.ctrlKey===!0;(a.button===2||o)&&s.preventDefault()}),onFocusOutside:Ed(t.onFocusOutside,s=>s.preventDefault())})}),b7=P.forwardRef((t,e)=>{const n=$o(Cg,t.__scopeDialog),r=P.useRef(!1),i=P.useRef(!1);return g.jsx(q5,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,o;(a=t.onCloseAutoFocus)==null||a.call(t,s),s.defaultPrevented||(r.current||(o=n.triggerRef.current)==null||o.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=t.onInteractOutside)==null||l.call(t,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const a=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),q5=P.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...a}=t,o=$o(Cg,n);return T$(),g.jsx(g.Fragment,{children:g.jsx(P5,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:g.jsx(T5,{role:"dialog",id:o.contentId,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"data-state":RP(o.open),...a,ref:e,deferPointerDownOutside:!0,onDismiss:()=>o.onOpenChange(!1)})})})}),K5="DialogTitle",_7=P.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=$o(K5,n);return g.jsx(Gi.h2,{id:i.titleId,...r,ref:e})});_7.displayName=K5;var Y5="DialogDescription",w7=P.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=$o(Y5,n);return g.jsx(Gi.p,{id:i.descriptionId,...r,ref:e})});w7.displayName=Y5;var Z5="DialogClose",S7=P.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=$o(Z5,n);return g.jsx(Gi.button,{type:"button",...r,ref:e,onClick:Ed(t.onClick,()=>i.onOpenChange(!1))})});S7.displayName=Z5;function RP(t){return t?"open":"closed"}var l0='[cmdk-group=""]',xE='[cmdk-group-items=""]',M7='[cmdk-group-heading=""]',Q5='[cmdk-item=""]',kk=`${Q5}:not([aria-disabled="true"])`,GT="cmdk-item-select",Gm="data-value",E7=(t,e,n)=>z9(t,e,n),J5=P.createContext(void 0),Zy=()=>P.useContext(J5),eF=P.createContext(void 0),NP=()=>P.useContext(eF),tF=P.createContext(void 0),nF=P.forwardRef((t,e)=>{let n=Wm(()=>{var W,oe;return{search:"",value:(oe=(W=t.value)!=null?W:t.defaultValue)!=null?oe:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Wm(()=>new Set),i=Wm(()=>new Map),s=Wm(()=>new Map),a=Wm(()=>new Set),o=rF(t),{label:l,children:c,value:d,onValueChange:f,filter:p,shouldFilter:y,loop:x,disablePointerSelection:S=!1,vimBindings:w=!0,...b}=t,M=Gc(),T=Gc(),C=Gc(),L=P.useRef(null),N=D7();jh(()=>{if(d!==void 0){let W=d.trim();n.current.value=W,D.emit()}},[d]),jh(()=>{N(6,te)},[]);let D=P.useMemo(()=>({subscribe:W=>(a.current.add(W),()=>a.current.delete(W)),snapshot:()=>n.current,setState:(W,oe,se)=>{var le,Me,Se,$e;if(!Object.is(n.current[W],oe)){if(n.current[W]=oe,W==="search")X(),I(),N(1,U);else if(W==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Ee=document.getElementById(C);Ee?Ee.focus():(le=document.getElementById(M))==null||le.focus()}if(N(7,()=>{var Ee;n.current.selectedItemId=(Ee=re())==null?void 0:Ee.id,D.emit()}),se||N(5,te),((Me=o.current)==null?void 0:Me.value)!==void 0){let Ee=oe??"";($e=(Se=o.current).onValueChange)==null||$e.call(Se,Ee);return}}D.emit()}},emit:()=>{a.current.forEach(W=>W())}}),[]),F=P.useMemo(()=>({value:(W,oe,se)=>{var le;oe!==((le=s.current.get(W))==null?void 0:le.value)&&(s.current.set(W,{value:oe,keywords:se}),n.current.filtered.items.set(W,V(oe,se)),N(2,()=>{I(),D.emit()}))},item:(W,oe)=>(r.current.add(W),oe&&(i.current.has(oe)?i.current.get(oe).add(W):i.current.set(oe,new Set([W]))),N(3,()=>{X(),I(),n.current.value||U(),D.emit()}),()=>{s.current.delete(W),r.current.delete(W),n.current.filtered.items.delete(W);let se=re();N(4,()=>{X(),(se==null?void 0:se.getAttribute("id"))===W&&U(),D.emit()})}),group:W=>(i.current.has(W)||i.current.set(W,new Set),()=>{s.current.delete(W),i.current.delete(W)}),filter:()=>o.current.shouldFilter,label:l||t["aria-label"],getDisablePointerSelection:()=>o.current.disablePointerSelection,listId:M,inputId:C,labelId:T,listInnerRef:L}),[]);function V(W,oe){var se,le;let Me=(le=(se=o.current)==null?void 0:se.filter)!=null?le:E7;return W?Me(W,n.current.search,oe):0}function I(){if(!n.current.search||o.current.shouldFilter===!1)return;let W=n.current.filtered.items,oe=[];n.current.filtered.groups.forEach(le=>{let Me=i.current.get(le),Se=0;Me.forEach($e=>{let Ee=W.get($e);Se=Math.max(Ee,Se)}),oe.push([le,Se])});let se=L.current;pe().sort((le,Me)=>{var Se,$e;let Ee=le.getAttribute("id"),Ge=Me.getAttribute("id");return((Se=W.get(Ge))!=null?Se:0)-(($e=W.get(Ee))!=null?$e:0)}).forEach(le=>{let Me=le.closest(xE);Me?Me.appendChild(le.parentElement===Me?le:le.closest(`${xE} > *`)):se.appendChild(le.parentElement===se?le:le.closest(`${xE} > *`))}),oe.sort((le,Me)=>Me[1]-le[1]).forEach(le=>{var Me;let Se=(Me=L.current)==null?void 0:Me.querySelector(`${l0}[${Gm}="${encodeURIComponent(le[0])}"]`);Se==null||Se.parentElement.appendChild(Se)})}function U(){let W=pe().find(se=>se.getAttribute("aria-disabled")!=="true"),oe=W==null?void 0:W.getAttribute(Gm);D.setState("value",oe||void 0)}function X(){var W,oe,se,le;if(!n.current.search||o.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let Me=0;for(let Se of r.current){let $e=(oe=(W=s.current.get(Se))==null?void 0:W.value)!=null?oe:"",Ee=(le=(se=s.current.get(Se))==null?void 0:se.keywords)!=null?le:[],Ge=V($e,Ee);n.current.filtered.items.set(Se,Ge),Ge>0&&Me++}for(let[Se,$e]of i.current)for(let Ee of $e)if(n.current.filtered.items.get(Ee)>0){n.current.filtered.groups.add(Se);break}n.current.filtered.count=Me}function te(){var W,oe,se;let le=re();le&&(((W=le.parentElement)==null?void 0:W.firstChild)===le&&((se=(oe=le.closest(l0))==null?void 0:oe.querySelector(M7))==null||se.scrollIntoView({block:"nearest"})),le.scrollIntoView({block:"nearest"}))}function re(){var W;return(W=L.current)==null?void 0:W.querySelector(`${Q5}[aria-selected="true"]`)}function pe(){var W;return Array.from(((W=L.current)==null?void 0:W.querySelectorAll(kk))||[])}function ee(W){let oe=pe()[W];oe&&D.setState("value",oe.getAttribute(Gm))}function ce(W){var oe;let se=re(),le=pe(),Me=le.findIndex($e=>$e===se),Se=le[Me+W];(oe=o.current)!=null&&oe.loop&&(Se=Me+W<0?le[le.length-1]:Me+W===le.length?le[0]:le[Me+W]),Se&&D.setState("value",Se.getAttribute(Gm))}function B(W){let oe=re(),se=oe==null?void 0:oe.closest(l0),le;for(;se&&!le;)se=W>0?L7(se,l0):O7(se,l0),le=se==null?void 0:se.querySelector(kk);le?D.setState("value",le.getAttribute(Gm)):ce(W)}let J=()=>ee(pe().length-1),Z=W=>{W.preventDefault(),W.metaKey?J():W.altKey?B(1):ce(1)},G=W=>{W.preventDefault(),W.metaKey?ee(0):W.altKey?B(-1):ce(-1)};return P.createElement(Gi.div,{ref:e,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:W=>{var oe;(oe=b.onKeyDown)==null||oe.call(b,W);let se=W.nativeEvent.isComposing||W.keyCode===229;if(!(W.defaultPrevented||se))switch(W.key){case"n":case"j":{w&&W.ctrlKey&&Z(W);break}case"ArrowDown":{Z(W);break}case"p":case"k":{w&&W.ctrlKey&&G(W);break}case"ArrowUp":{G(W);break}case"Home":{W.preventDefault(),ee(0);break}case"End":{W.preventDefault(),J();break}case"Enter":{W.preventDefault();let le=re();if(le){let Me=new Event(GT);le.dispatchEvent(Me)}}}}},P.createElement("label",{"cmdk-label":"",htmlFor:F.inputId,id:F.labelId,style:U7},l),sS(t,W=>P.createElement(eF.Provider,{value:D},P.createElement(J5.Provider,{value:F},W))))}),A7=P.forwardRef((t,e)=>{var n,r;let i=Gc(),s=P.useRef(null),a=P.useContext(tF),o=Zy(),l=rF(t),c=(r=(n=l.current)==null?void 0:n.forceMount)!=null?r:a==null?void 0:a.forceMount;jh(()=>{if(!c)return o.item(i,a==null?void 0:a.id)},[c]);let d=iF(i,s,[t.value,t.children,s],t.keywords),f=NP(),p=Rd(N=>N.value&&N.value===d.current),y=Rd(N=>c||o.filter()===!1?!0:N.search?N.filtered.items.get(i)>0:!0);P.useEffect(()=>{let N=s.current;if(!(!N||t.disabled))return N.addEventListener(GT,x),()=>N.removeEventListener(GT,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:b,onSelect:M,forceMount:T,keywords:C,...L}=t;return P.createElement(Gi.div,{ref:Tg(s,e),...L,id:i,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!p,"data-disabled":!!w,"data-selected":!!p,onPointerMove:w||o.getDisablePointerSelection()?void 0:S,onClick:w?void 0:x},t.children)}),T7=P.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:i,...s}=t,a=Gc(),o=P.useRef(null),l=P.useRef(null),c=Gc(),d=Zy(),f=Rd(y=>i||d.filter()===!1?!0:y.search?y.filtered.groups.has(a):!0);jh(()=>d.group(a),[]),iF(a,o,[t.value,t.heading,l]);let p=P.useMemo(()=>({id:a,forceMount:i}),[i]);return P.createElement(Gi.div,{ref:Tg(o,e),...s,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&P.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),sS(t,y=>P.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},P.createElement(tF.Provider,{value:p},y))))}),C7=P.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,i=P.useRef(null),s=Rd(a=>!a.search);return!n&&!s?null:P.createElement(Gi.div,{ref:Tg(i,e),...r,"cmdk-separator":"",role:"separator"})}),P7=P.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,i=t.value!=null,s=NP(),a=Rd(c=>c.search),o=Rd(c=>c.selectedItemId),l=Zy();return P.useEffect(()=>{t.value!=null&&s.setState("search",t.value)},[t.value]),P.createElement(Gi.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":o,id:l.inputId,type:"text",value:i?t.value:a,onChange:c=>{i||s.setState("search",c.target.value),n==null||n(c.target.value)}})}),R7=P.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...i}=t,s=P.useRef(null),a=P.useRef(null),o=Rd(c=>c.selectedItemId),l=Zy();return P.useEffect(()=>{if(a.current&&s.current){let c=a.current,d=s.current,f,p=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let y=c.offsetHeight;d.style.setProperty("--cmdk-list-height",y.toFixed(1)+"px")})});return p.observe(c),()=>{cancelAnimationFrame(f),p.unobserve(c)}}},[]),P.createElement(Gi.div,{ref:Tg(s,e),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":o,"aria-label":r,id:l.listId},sS(t,c=>P.createElement("div",{ref:Tg(a,l.listInnerRef),"cmdk-list-sizer":""},c)))}),N7=P.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:s,container:a,...o}=t;return P.createElement(H5,{open:n,onOpenChange:r},P.createElement(W5,{container:a},P.createElement($5,{"cmdk-overlay":"",className:i}),P.createElement(X5,{"aria-label":t.label,"cmdk-dialog":"",className:s},P.createElement(nF,{ref:e,...o}))))}),k7=P.forwardRef((t,e)=>Rd(n=>n.filtered.count===0)?P.createElement(Gi.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),I7=P.forwardRef((t,e)=>{let{progress:n,children:r,label:i="Loading...",...s}=t;return P.createElement(Gi.div,{ref:e,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},sS(t,a=>P.createElement("div",{"aria-hidden":!0},a)))}),hm=Object.assign(nF,{List:R7,Item:A7,Input:P7,Group:T7,Separator:C7,Dialog:N7,Empty:k7,Loading:I7});function L7(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function O7(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function rF(t){let e=P.useRef(t);return jh(()=>{e.current=t}),e}var jh=typeof window>"u"?P.useEffect:P.useLayoutEffect;function Wm(t){let e=P.useRef();return e.current===void 0&&(e.current=t()),e}function Rd(t){let e=NP(),n=()=>t(e.snapshot());return P.useSyncExternalStore(e.subscribe,n,n)}function iF(t,e,n,r=[]){let i=P.useRef(),s=Zy();return jh(()=>{var a;let o=(()=>{var c;for(let d of n){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?(c=d.current.textContent)==null?void 0:c.trim():i.current}})(),l=r.map(c=>c.trim());s.value(t,o,l),(a=e.current)==null||a.setAttribute(Gm,o),i.current=o}),i}var D7=()=>{let[t,e]=P.useState(),n=Wm(()=>new Map);return jh(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,i)=>{n.current.set(r,i),e({})}};function j7(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function sS({asChild:t,children:e},n){return t&&P.isValidElement(e)?P.cloneElement(j7(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 F7({onNavigate:t}){const[e,n]=P.useState(!1);return P.useEffect(()=>{const r=i=>{(i.metaKey||i.ctrlKey)&&i.key.toLowerCase()==="k"&&(i.preventDefault(),n(s=>!s))};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[]),g.jsx(hm.Dialog,{open:e,onOpenChange:n,label:"Befehlspalette",className:"fixed inset-0 z-50 flex items-start justify-center bg-black/50 p-4 pt-[12vh] overscroll-contain",onClick:()=>n(!1),children: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(hm.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(hm.List,{className:"max-h-80 overflow-y-auto p-2",children:[g.jsx(hm.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),g.jsx(hm.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:W0.map(r=>g.jsxs(hm.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))})]})]})})}const sF="mc_expert_mode",WT="mc-expert-mode-change",z7=()=>{try{return localStorage.getItem(sF)==="true"}catch{return!1}};function B7(t){return window.addEventListener(WT,t),window.addEventListener("storage",t),()=>{window.removeEventListener(WT,t),window.removeEventListener("storage",t)}}function Ik(t){localStorage.setItem(sF,String(t)),window.dispatchEvent(new Event(WT))}function aF(){return P.useSyncExternalStore(B7,z7,()=>!1)}function oF(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<i;e++)t[e]&&(n=oF(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function tr(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=oF(t))&&(r&&(r+=" "),r+=e);return r}const kP="-",H7=t=>{const e=G7(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:a=>{const o=a.split(kP);return o[0]===""&&o.length!==1&&o.shift(),lF(o,e)||V7(a)},getConflictingClassGroupIds:(a,o)=>{const l=n[a]||[];return o&&r[a]?[...l,...r[a]]:l}}},lF=(t,e)=>{var a;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?lF(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(kP);return(a=e.validators.find(({validator:o})=>o(s)))==null?void 0:a.classGroupId},Lk=/^\[(.+)\]$/,V7=t=>{if(Lk.test(t)){const e=Lk.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},G7=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return $7(Object.entries(t.classGroups),n).forEach(([s,a])=>{$T(a,r,s,e)}),r},$T=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:Ok(e,i);s.classGroupId=n;return}if(typeof i=="function"){if(W7(i)){$T(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,a])=>{$T(a,Ok(e,s),n,r)})})},Ok=(t,e)=>{let n=t;return e.split(kP).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},W7=t=>t.isThemeGetter,$7=(t,e)=>e?t.map(([n,r])=>{const i=r.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([a,o])=>[e+a,o])):s);return[n,i]}):t,X7=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(s,a)=>{n.set(s,a),e++,e>t&&(e=0,r=n,n=new Map)};return{get(s){let a=n.get(s);if(a!==void 0)return a;if((a=r.get(s))!==void 0)return i(s,a),a},set(s,a){n.has(s)?n.set(s,a):i(s,a)}}},cF="!",q7=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,i=e[0],s=e.length,a=o=>{const l=[];let c=0,d=0,f;for(let w=0;w<o.length;w++){let b=o[w];if(c===0){if(b===i&&(r||o.slice(w,w+s)===e)){l.push(o.slice(d,w)),d=w+s;continue}if(b==="/"){f=w;continue}}b==="["?c++:b==="]"&&c--}const p=l.length===0?o:o.substring(d),y=p.startsWith(cF),x=y?p.substring(1):p,S=f&&f>d?f-d:void 0;return{modifiers:l,hasImportantModifier:y,baseClassName:x,maybePostfixModifierPosition:S}};return n?o=>n({className:o,parseClassName:a}):a},K7=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},Y7=t=>({cache:X7(t.cacheSize),parseClassName:q7(t),...H7(t)}),Z7=/\s+/,Q7=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],a=t.trim().split(Z7);let o="";for(let l=a.length-1;l>=0;l-=1){const c=a[l],{modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:y}=n(c);let x=!!y,S=r(x?p.substring(0,y):p);if(!S){if(!x){o=c+(o.length>0?" "+o:o);continue}if(S=r(p),!S){o=c+(o.length>0?" "+o:o);continue}x=!1}const w=K7(d).join(":"),b=f?w+cF:w,M=b+S;if(s.includes(M))continue;s.push(M);const T=i(S,x);for(let C=0;C<T.length;++C){const L=T[C];s.push(b+L)}o=c+(o.length>0?" "+o:o)}return o};function J7(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=uF(e))&&(r&&(r+=" "),r+=n);return r}const uF=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=uF(t[r]))&&(n&&(n+=" "),n+=e);return n};function eX(t,...e){let n,r,i,s=a;function a(l){const c=e.reduce((d,f)=>f(d),t());return n=Y7(c),r=n.cache.get,i=n.cache.set,s=o,o(l)}function o(l){const c=r(l);if(c)return c;const d=Q7(l,n);return i(l,d),d}return function(){return s(J7.apply(null,arguments))}}const ir=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},dF=/^\[(?:([a-z-]+):)?(.+)\]$/i,tX=/^\d+\/\d+$/,nX=new Set(["px","full","screen"]),rX=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,iX=/\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$/,sX=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,aX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,oX=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Mc=t=>sg(t)||nX.has(t)||tX.test(t),$u=t=>qg(t,"length",mX),sg=t=>!!t&&!Number.isNaN(Number(t)),bE=t=>qg(t,"number",sg),c0=t=>!!t&&Number.isInteger(Number(t)),lX=t=>t.endsWith("%")&&sg(t.slice(0,-1)),dn=t=>dF.test(t),Xu=t=>rX.test(t),cX=new Set(["length","size","percentage"]),uX=t=>qg(t,cX,fF),dX=t=>qg(t,"position",fF),fX=new Set(["image","url"]),hX=t=>qg(t,fX,vX),pX=t=>qg(t,"",gX),u0=()=>!0,qg=(t,e,n)=>{const r=dF.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},mX=t=>iX.test(t)&&!sX.test(t),fF=()=>!1,gX=t=>aX.test(t),vX=t=>oX.test(t),yX=()=>{const t=ir("colors"),e=ir("spacing"),n=ir("blur"),r=ir("brightness"),i=ir("borderColor"),s=ir("borderRadius"),a=ir("borderSpacing"),o=ir("borderWidth"),l=ir("contrast"),c=ir("grayscale"),d=ir("hueRotate"),f=ir("invert"),p=ir("gap"),y=ir("gradientColorStops"),x=ir("gradientColorStopPositions"),S=ir("inset"),w=ir("margin"),b=ir("opacity"),M=ir("padding"),T=ir("saturate"),C=ir("scale"),L=ir("sepia"),N=ir("skew"),D=ir("space"),F=ir("translate"),V=()=>["auto","contain","none"],I=()=>["auto","hidden","clip","visible","scroll"],U=()=>["auto",dn,e],X=()=>[dn,e],te=()=>["",Mc,$u],re=()=>["auto",sg,dn],pe=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ee=()=>["solid","dashed","dotted","double","none"],ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],B=()=>["start","end","center","between","around","evenly","stretch"],J=()=>["","0",dn],Z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],G=()=>[sg,dn];return{cacheSize:500,separator:":",theme:{colors:[u0],spacing:[Mc,$u],blur:["none","",Xu,dn],brightness:G(),borderColor:[t],borderRadius:["none","","full",Xu,dn],borderSpacing:X(),borderWidth:te(),contrast:G(),grayscale:J(),hueRotate:G(),invert:J(),gap:X(),gradientColorStops:[t],gradientColorStopPositions:[lX,$u],inset:U(),margin:U(),opacity:G(),padding:X(),saturate:G(),scale:G(),sepia:J(),skew:G(),space:X(),translate:X()},classGroups:{aspect:[{aspect:["auto","square","video",dn]}],container:["container"],columns:[{columns:[Xu]}],"break-after":[{"break-after":Z()}],"break-before":[{"break-before":Z()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...pe(),dn]}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],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",c0,dn]}],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",dn]}],grow:[{grow:J()}],shrink:[{shrink:J()}],order:[{order:["first","last","none",c0,dn]}],"grid-cols":[{"grid-cols":[u0]}],"col-start-end":[{col:["auto",{span:["full",c0,dn]},dn]}],"col-start":[{"col-start":re()}],"col-end":[{"col-end":re()}],"grid-rows":[{"grid-rows":[u0]}],"row-start-end":[{row:["auto",{span:[c0,dn]},dn]}],"row-start":[{"row-start":re()}],"row-end":[{"row-end":re()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",dn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",dn]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...B()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...B(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...B(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[M]}],px:[{px:[M]}],py:[{py:[M]}],ps:[{ps:[M]}],pe:[{pe:[M]}],pt:[{pt:[M]}],pr:[{pr:[M]}],pb:[{pb:[M]}],pl:[{pl:[M]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[D]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[D]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",dn,e]}],"min-w":[{"min-w":[dn,e,"min","max","fit"]}],"max-w":[{"max-w":[dn,e,"none","full","min","max","fit","prose",{screen:[Xu]},Xu]}],h:[{h:[dn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[dn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[dn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[dn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Xu,$u]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",bE]}],"font-family":[{font:[u0]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",dn]}],"line-clamp":[{"line-clamp":["none",sg,bE]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Mc,dn]}],"list-image":[{"list-image":["none",dn]}],"list-style-type":[{list:["none","disc","decimal",dn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Mc,$u]}],"underline-offset":[{"underline-offset":["auto",Mc,dn]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:X()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",dn]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",dn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...pe(),dX]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",uX]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},hX]}],"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:[o]}],"border-w-x":[{"border-x":[o]}],"border-w-y":[{"border-y":[o]}],"border-w-s":[{"border-s":[o]}],"border-w-e":[{"border-e":[o]}],"border-w-t":[{"border-t":[o]}],"border-w-r":[{"border-r":[o]}],"border-w-b":[{"border-b":[o]}],"border-w-l":[{"border-l":[o]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...ee(),"hidden"]}],"divide-x":[{"divide-x":[o]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[o]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:ee()}],"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:["",...ee()]}],"outline-offset":[{"outline-offset":[Mc,dn]}],"outline-w":[{outline:[Mc,$u]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[Mc,$u]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Xu,pX]}],"shadow-color":[{shadow:[u0]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...ce(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ce()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Xu,dn]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[T]}],sepia:[{sepia:[L]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[T]}],"backdrop-sepia":[{"backdrop-sepia":[L]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",dn]}],duration:[{duration:G()}],ease:[{ease:["linear","in","out","in-out",dn]}],delay:[{delay:G()}],animate:[{animate:["none","spin","ping","pulse","bounce",dn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[c0,dn]}],"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",dn]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",dn]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":X()}],"scroll-mx":[{"scroll-mx":X()}],"scroll-my":[{"scroll-my":X()}],"scroll-ms":[{"scroll-ms":X()}],"scroll-me":[{"scroll-me":X()}],"scroll-mt":[{"scroll-mt":X()}],"scroll-mr":[{"scroll-mr":X()}],"scroll-mb":[{"scroll-mb":X()}],"scroll-ml":[{"scroll-ml":X()}],"scroll-p":[{"scroll-p":X()}],"scroll-px":[{"scroll-px":X()}],"scroll-py":[{"scroll-py":X()}],"scroll-ps":[{"scroll-ps":X()}],"scroll-pe":[{"scroll-pe":X()}],"scroll-pt":[{"scroll-pt":X()}],"scroll-pr":[{"scroll-pr":X()}],"scroll-pb":[{"scroll-pb":X()}],"scroll-pl":[{"scroll-pl":X()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",dn]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Mc,$u,bE]}],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"]}}},xX=eX(yX);function qe(...t){return xX(tr(t))}function Pg(t){return t?t.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}function bX(){const t=aF();return g.jsxs("div",{className:"flex items-center rounded-md border border-border/40 bg-background/40 p-0.5",role:"group","aria-label":"Ansichtsmodus",title:"Einfach zeigt nur das Wichtigste. Experte zeigt alle technischen Details.",children:[g.jsxs("button",{onClick:()=>Ik(!1),"aria-pressed":!t,className:qe("flex items-center gap-1 rounded px-2 py-1 text-xs font-semibold transition-all cursor-pointer",t?"text-muted-foreground hover:text-foreground":"bg-primary/15 text-primary shadow-sm"),children:[g.jsx(oh,{className:"h-3.5 w-3.5"})," Einfach"]}),g.jsxs("button",{onClick:()=>Ik(!0),"aria-pressed":t,className:qe("flex items-center gap-1 rounded px-2 py-1 text-xs font-semibold transition-all cursor-pointer",t?"bg-primary/15 text-primary shadow-sm":"text-muted-foreground hover:text-foreground"),children:[g.jsx(T9,{className:"h-3.5 w-3.5"})," Experte"]})]})}async function Pt(t,e){var l;const n={"Content-Type":"application/json",...e==null?void 0:e.headers},r=localStorage.getItem("mc_sudo_password"),i=localStorage.getItem("mc_hf_token");r&&(n["X-Sudo-Password"]=r);let s=e==null?void 0:e.body;if((((l=e==null?void 0:e.method)==null?void 0:l.toUpperCase())||"GET")==="POST"){if(typeof s=="string")try{const c=JSON.parse(s);let d=!1;r&&!("sudo_password"in c)&&(c.sudo_password=r,d=!0),i&&!("hf_token"in c)&&(c.hf_token=i,d=!0),d&&(s=JSON.stringify(c))}catch{}else if(!s){const c={};r&&(c.sudo_password=r),i&&(c.hf_token=i),Object.keys(c).length>0&&(s=JSON.stringify(c))}}const o=await fetch(t,{...e,headers:n,body:s});if(!o.ok)throw new Error(`${o.status} ${o.statusText}`);return o.json()}const hF=(t,e,n=!1,r=!0)=>Pt("/api/groups",{method:"PUT",body:JSON.stringify({group:t,members:e,swap:n,persist:r})}),_X=t=>Pt("/api/routing/policy",{method:"PUT",body:JSON.stringify(t)}),kn={health:["health"],systemStatus:["system-status"],services:["services"],models:["models"],groups:["groups"],routing:["routing"],routingPolicy:["routing-policy"],voiceMetrics:["voice-metrics"],jobs:["jobs"],tokenStats:["token-stats"],agentStatus:["agent-status"],hermesBrain:["hermes-brain"],updates:["updates"],discover:["discover"],drafts:t=>["drafts",t??""],connect:t=>["connect",t??""],connectHealth:["connect-health"],memory:(t,e)=>["memory",t??"",e??""],memoryGraph:["memory-graph"]},wX=(t=!0)=>bi({queryKey:kn.memoryGraph,queryFn:()=>Pt("/api/memory/graph"),enabled:t}),pF=()=>bi({queryKey:kn.health,queryFn:()=>Pt("/api/health"),refetchInterval:1e4}),rp=(t=5e3)=>bi({queryKey:kn.systemStatus,queryFn:()=>Pt("/api/system/status"),refetchInterval:t}),mF=(t=3e3)=>bi({queryKey:kn.services,queryFn:()=>Pt("/api/system/services"),refetchInterval:t}),Od=(t=4e3)=>bi({queryKey:kn.models,queryFn:()=>Pt("/api/models"),refetchInterval:t}),gF=(t=8e3)=>bi({queryKey:kn.groups,queryFn:()=>Pt("/api/groups"),refetchInterval:t}),SX=(t=5e3)=>bi({queryKey:kn.voiceMetrics,queryFn:()=>Pt("/api/voice/metrics"),refetchInterval:t}),MX=()=>bi({queryKey:kn.routingPolicy,queryFn:()=>Pt("/api/routing/policy")}),EX=(t=2e3)=>bi({queryKey:kn.jobs,queryFn:()=>Pt("/api/jobs"),refetchInterval:t,select:e=>e.jobs??[]}),IP=(t=3e3)=>bi({queryKey:kn.tokenStats,queryFn:()=>Pt("/api/system/token-stats"),refetchInterval:t}),LP=(t=5e3)=>bi({queryKey:kn.agentStatus,queryFn:()=>Pt("/api/agent/status"),refetchInterval:t}),vF=(t=6e4)=>bi({queryKey:kn.hermesBrain,queryFn:()=>Pt("/api/agent/brain"),refetchInterval:t}),OP=t=>bi({queryKey:kn.updates,queryFn:()=>Pt("/api/maintenance/updates"),refetchInterval:t}),AX=()=>bi({queryKey:kn.discover,queryFn:()=>Pt("/api/discover")}),TX=t=>bi({queryKey:kn.drafts(t),queryFn:()=>Pt(`/api/models/drafts?target=${encodeURIComponent(t??"")}`),enabled:!!t}),CX=t=>bi({queryKey:kn.connect(t),queryFn:()=>Pt(t?`/api/connect?${t}`:"/api/connect")}),PX=()=>bi({queryKey:kn.connectHealth,queryFn:()=>Pt("/api/connect/health"),refetchInterval:15e3}),XT=t=>bi({queryKey:kn.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),Pt(`/api/memory?${e}`)},select:e=>t!=null&&t.limit?e.slice(0,t.limit):e});let qT=[],KT=[];const YT=new Set,yF=()=>YT.forEach(t=>t());function xF(t){return YT.add(t),()=>{YT.delete(t)}}function RX(t){qT=[...qT,t].slice(-40),yF()}function NX(t){KT=[...KT,t].slice(-40),yF()}const kX=()=>P.useSyncExternalStore(xF,()=>qT),IX=()=>P.useSyncExternalStore(xF,()=>KT);function LX(){const{data:t,dataUpdatedAt:e}=rp(3e3),{data:n,dataUpdatedAt:r}=IP(3e3),i=P.useRef(null);P.useEffect(()=>{var s,a,o,l;t&&RX({t:Date.now(),cpu:((s=t.cpu)==null?void 0:s.percent)??0,ram:((a=t.ram)==null?void 0:a.percent)??0,gpu:((o=t.gpu)==null?void 0:o.busy_percent)??null,disk:((l=t.disk)==null?void 0:l.percent)??null})},[e]),P.useEffect(()=>{if(!n)return;const s=Date.now(),a=n.prompt_tokens,o=n.completion_tokens;if(i.current){const l=Math.max((s-i.current.t)/1e3,.001);NX({t:s,prompt:Math.max(0,(a-i.current.p)/l),completion:Math.max(0,(o-i.current.c)/l)})}i.current={p:a,c:o,t:s}},[r])}function OX(){const{data:t,error:e}=rp(3e3),n=kX();return{sys:t,hist:n,error:e}}function cd(t){return(t/1024**3).toFixed(1)}function ZT(t){return t?t>1024**3?`${(t/1024**3).toFixed(1)} GB`:`${(t/1024**2).toFixed(0)} MB`:""}function va(t){if(!t)return"—";const e=t/1024**3;return e>=1?`${e.toFixed(1)} GB`:`${(t/1024**2).toFixed(0)} MB`}function DX(t){if(!t)return"";const e=Math.floor(t/60);return e>0?`${e} min`:`${t} s`}function Dk(t){return t?`${Math.round(t/1024)}k`:"—"}var jX=["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 DP(t){if(typeof t!="string")return!1;var e=jX;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"],FX=new Set(UX);function bF(t){return typeof t!="string"?!1:FX.has(t)}function _F(t){return typeof t=="string"&&t.startsWith("data-")}function Bo(t){if(typeof t!="object"||t===null)return{};var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(bF(n)||_F(n))&&(e[n]=t[n]);return e}function aS(t){if(t==null)return null;if(P.isValidElement(t)&&typeof t.props=="object"&&t.props!==null){var e=t.props;return Bo(e)}return typeof t=="object"&&!Array.isArray(t)?Bo(t):null}function Ka(t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(bF(n)||_F(n)||DP(n))&&(e[n]=t[n]);return e}function zX(t){return t==null?null:P.isValidElement(t)?Ka(t.props):typeof t=="object"&&!Array.isArray(t)?Ka(t):null}var BX=["children","width","height","viewBox","className","style","title","desc"];function QT(){return QT=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},QT.apply(null,arguments)}function HX(t,e){if(t==null)return{};var n,r,i=VX(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function VX(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var wF=P.forwardRef((t,e)=>{var n=t.children,r=t.width,i=t.height,s=t.viewBox,a=t.className,o=t.style,l=t.title,c=t.desc,d=HX(t,BX),f=s||{width:r,height:i,x:0,y:0},p=tr("recharts-surface",a);return P.createElement("svg",QT({},Ka(d),{className:p,width:r,height:i,style:o,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:e}),P.createElement("title",null,l),P.createElement("desc",null,c),n)}),GX=["children","className"];function JT(){return JT=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},JT.apply(null,arguments)}function WX(t,e){if(t==null)return{};var n,r,i=$X(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function $X(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var Ya=P.forwardRef((t,e)=>{var n=t.children,r=t.className,i=WX(t,GX),s=tr("recharts-layer",r);return P.createElement("g",JT({className:s},Ka(i),{ref:e}),n)}),XX=P.createContext(null);function Er(t){return function(){return t}}const eC=Math.PI,tC=2*eC,Zf=1e-6,qX=tC-Zf;function SF(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function KX(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return SF;const n=10**e;return function(r){this._+=r[0];for(let i=1,s=r.length;i<s;++i)this._+=Math.round(arguments[i]*n)/n+r[i]}}let YX=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?SF:KX(e)}moveTo(e,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,n){this._append`L${this._x1=+e},${this._y1=+n}`}quadraticCurveTo(e,n,r,i){this._append`Q${+e},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(e,n,r,i,s,a){this._append`C${+e},${+n},${+r},${+i},${this._x1=+s},${this._y1=+a}`}arcTo(e,n,r,i,s){if(e=+e,n=+n,r=+r,i=+i,s=+s,s<0)throw new Error(`negative radius: ${s}`);let a=this._x1,o=this._y1,l=r-e,c=i-n,d=a-e,f=o-n,p=d*d+f*f;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(p>Zf)if(!(Math.abs(f*l-c*d)>Zf)||!s)this._append`L${this._x1=e},${this._y1=n}`;else{let y=r-a,x=i-o,S=l*l+c*c,w=y*y+x*x,b=Math.sqrt(S),M=Math.sqrt(p),T=s*Math.tan((eC-Math.acos((S+p-w)/(2*b*M)))/2),C=T/M,L=T/b;Math.abs(C-1)>Zf&&this._append`L${e+C*d},${n+C*f}`,this._append`A${s},${s},0,0,${+(f*y>d*x)},${this._x1=e+L*l},${this._y1=n+L*c}`}}arc(e,n,r,i,s,a){if(e=+e,n=+n,r=+r,a=!!a,r<0)throw new Error(`negative radius: ${r}`);let o=r*Math.cos(i),l=r*Math.sin(i),c=e+o,d=n+l,f=1^a,p=a?i-s:s-i;this._x1===null?this._append`M${c},${d}`:(Math.abs(this._x1-c)>Zf||Math.abs(this._y1-d)>Zf)&&this._append`L${c},${d}`,r&&(p<0&&(p=p%tC+tC),p>qX?this._append`A${r},${r},0,1,${f},${e-o},${n-l}A${r},${r},0,1,${f},${this._x1=c},${this._y1=d}`:p>Zf&&this._append`A${r},${r},0,${+(p>=eC)},${f},${this._x1=e+r*Math.cos(s)},${this._y1=n+r*Math.sin(s)}`)}rect(e,n,r,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}};function MF(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 YX(e)}function jP(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function EF(t){this._context=t}EF.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 oS(t){return new EF(t)}function AF(t){return t[0]}function TF(t){return t[1]}function CF(t,e){var n=Er(!0),r=null,i=oS,s=null,a=MF(o);t=typeof t=="function"?t:t===void 0?AF:Er(t),e=typeof e=="function"?e:e===void 0?TF:Er(e);function o(l){var c,d=(l=jP(l)).length,f,p=!1,y;for(r==null&&(s=i(y=a())),c=0;c<=d;++c)!(c<d&&n(f=l[c],c,l))===p&&((p=!p)?s.lineStart():s.lineEnd()),p&&s.point(+t(f,c,l),+e(f,c,l));if(y)return s=null,y+""||null}return o.x=function(l){return arguments.length?(t=typeof l=="function"?l:Er(+l),o):t},o.y=function(l){return arguments.length?(e=typeof l=="function"?l:Er(+l),o):e},o.defined=function(l){return arguments.length?(n=typeof l=="function"?l:Er(!!l),o):n},o.curve=function(l){return arguments.length?(i=l,r!=null&&(s=i(r)),o):i},o.context=function(l){return arguments.length?(l==null?r=s=null:s=i(r=l),o):r},o}function Tb(t,e,n){var r=null,i=Er(!0),s=null,a=oS,o=null,l=MF(c);t=typeof t=="function"?t:t===void 0?AF:Er(+t),e=typeof e=="function"?e:Er(e===void 0?0:+e),n=typeof n=="function"?n:n===void 0?TF:Er(+n);function c(f){var p,y,x,S=(f=jP(f)).length,w,b=!1,M,T=new Array(S),C=new Array(S);for(s==null&&(o=a(M=l())),p=0;p<=S;++p){if(!(p<S&&i(w=f[p],p,f))===b)if(b=!b)y=p,o.areaStart(),o.lineStart();else{for(o.lineEnd(),o.lineStart(),x=p-1;x>=y;--x)o.point(T[x],C[x]);o.lineEnd(),o.areaEnd()}b&&(T[p]=+t(w,p,f),C[p]=+e(w,p,f),o.point(r?+r(w,p,f):T[p],n?+n(w,p,f):C[p]))}if(M)return o=null,M+""||null}function d(){return CF().defined(i).curve(a).context(s)}return c.x=function(f){return arguments.length?(t=typeof f=="function"?f:Er(+f),r=null,c):t},c.x0=function(f){return arguments.length?(t=typeof f=="function"?f:Er(+f),c):t},c.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Er(+f),c):r},c.y=function(f){return arguments.length?(e=typeof f=="function"?f:Er(+f),n=null,c):e},c.y0=function(f){return arguments.length?(e=typeof f=="function"?f:Er(+f),c):e},c.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Er(+f),c):n},c.lineX0=c.lineY0=function(){return d().x(t).y(e)},c.lineY1=function(){return d().x(t).y(n)},c.lineX1=function(){return d().x(r).y(e)},c.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Er(!!f),c):i},c.curve=function(f){return arguments.length?(a=f,s!=null&&(o=a(s)),c):a},c.context=function(f){return arguments.length?(f==null?s=o=null:o=a(s=f),c):s},c}class PF{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 ZX(t){return new PF(t,!0)}function QX(t){return new PF(t,!1)}function p1(){}function m1(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 RF(t){this._context=t}RF.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:m1(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:m1(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function JX(t){return new RF(t)}function NF(t){this._context=t}NF.prototype={areaStart:p1,areaEnd:p1,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:m1(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function eq(t){return new NF(t)}function kF(t){this._context=t}kF.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:m1(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function tq(t){return new kF(t)}function IF(t){this._context=t}IF.prototype={areaStart:p1,areaEnd:p1,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 nq(t){return new IF(t)}function jk(t){return t<0?-1:1}function Uk(t,e,n){var r=t._x1-t._x0,i=e-t._x1,s=(t._y1-t._y0)/(r||i<0&&-0),a=(n-t._y1)/(i||r<0&&-0),o=(s*i+a*r)/(r+i);return(jk(s)+jk(a))*Math.min(Math.abs(s),Math.abs(a),.5*Math.abs(o))||0}function Fk(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function _E(t,e,n){var r=t._x0,i=t._y0,s=t._x1,a=t._y1,o=(s-r)/3;t._context.bezierCurveTo(r+o,i+o*e,s-o,a-o*n,s,a)}function g1(t){this._context=t}g1.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:_E(this,this._t0,Fk(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,_E(this,Fk(this,n=Uk(this,t,e)),n);break;default:_E(this,this._t0,n=Uk(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function LF(t){this._context=new OF(t)}(LF.prototype=Object.create(g1.prototype)).point=function(t,e){g1.prototype.point.call(this,e,t)};function OF(t){this._context=t}OF.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 rq(t){return new g1(t)}function iq(t){return new LF(t)}function DF(t){this._context=t}DF.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=zk(t),i=zk(e),s=0,a=1;a<n;++s,++a)this._context.bezierCurveTo(r[0][s],i[0][s],r[1][s],i[1][s],t[a],e[a]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}};function zk(t){var e,n=t.length-1,r,i=new Array(n),s=new Array(n),a=new Array(n);for(i[0]=0,s[0]=2,a[0]=t[0]+2*t[1],e=1;e<n-1;++e)i[e]=1,s[e]=4,a[e]=4*t[e]+2*t[e+1];for(i[n-1]=2,s[n-1]=7,a[n-1]=8*t[n-1]+t[n],e=1;e<n;++e)r=i[e]/s[e-1],s[e]-=r,a[e]-=r*a[e-1];for(i[n-1]=a[n-1]/s[n-1],e=n-2;e>=0;--e)i[e]=(a[e]-i[e+1])/s[e];for(s[n-1]=(t[n]+i[n-1])/2,e=0;e<n-1;++e)s[e]=2*t[e+1]-i[e+1];return[i,s]}function sq(t){return new DF(t)}function lS(t,e){this._context=t,this._t=e}lS.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=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 aq(t){return new lS(t,.5)}function oq(t){return new lS(t,0)}function lq(t){return new lS(t,1)}function Uh(t,e){if((a=t.length)>1)for(var n=1,r,i,s=t[e[0]],a,o=s.length;n<a;++n)for(i=s,s=t[e[n]],r=0;r<o;++r)s[r][1]+=s[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function nC(t){for(var e=t.length,n=new Array(e);--e>=0;)n[e]=e;return n}function cq(t,e){return t[e]}function uq(t){const e=[];return e.key=t,e}function dq(){var t=Er([]),e=nC,n=Uh,r=cq;function i(s){var a=Array.from(t.apply(this,arguments),uq),o,l=a.length,c=-1,d;for(const f of s)for(o=0,++c;o<l;++o)(a[o][c]=[0,+r(f,a[o].key,c,s)]).data=f;for(o=0,d=jP(e(a));o<l;++o)a[d[o]].index=o;return n(a,d),a}return i.keys=function(s){return arguments.length?(t=typeof s=="function"?s:Er(Array.from(s)),i):t},i.value=function(s){return arguments.length?(r=typeof s=="function"?s:Er(+s),i):r},i.order=function(s){return arguments.length?(e=s==null?nC:typeof s=="function"?s:Er(Array.from(s)),i):e},i.offset=function(s){return arguments.length?(n=s??Uh,i):n},i}function fq(t,e){if((r=t.length)>0){for(var n,r,i=0,s=t[0].length,a;i<s;++i){for(a=n=0;n<r;++n)a+=t[n][i][1]||0;if(a)for(n=0;n<r;++n)t[n][i][1]/=a}Uh(t,e)}}function hq(t,e){if((i=t.length)>0){for(var n=0,r=t[e[0]],i,s=r.length;n<s;++n){for(var a=0,o=0;a<i;++a)o+=t[a][n][1]||0;r[n][1]+=r[n][0]=-o/2}Uh(t,e)}}function pq(t,e){if(!(!((a=t.length)>0)||!((s=(i=t[e[0]]).length)>0))){for(var n=0,r=1,i,s,a;r<s;++r){for(var o=0,l=0,c=0;o<a;++o){for(var d=t[e[o]],f=d[r][1]||0,p=d[r-1][1]||0,y=(f-p)/2,x=0;x<o;++x){var S=t[e[x]],w=S[r][1]||0,b=S[r-1][1]||0;y+=w-b}l+=f,c+=y*f}i[r-1][1]+=i[r-1][0]=n,l&&(n-=c/l)}i[r-1][1]+=i[r-1][0]=n,Uh(t,e)}}function rC(t){return t==="__proto__"}function jF(t){switch(typeof t){case"number":case"symbol":return!1;case"string":return t.includes(".")||t.includes("[")||t.includes("]")}}function UP(t){var e;return typeof t=="string"||typeof t=="symbol"?t:Object.is((e=t==null?void 0:t.valueOf)==null?void 0:e.call(t),-0)?"-0":String(t)}function UF(t){if(t==null)return"";if(typeof t=="string")return t;if(Array.isArray(t))return t.map(UF).join(",");const e=String(t);return e==="0"&&Object.is(Number(t),-0)?"-0":e}function FP(t){if(Array.isArray(t))return t.map(UP);if(typeof t=="symbol")return[t];t=UF(t);const e=[],n=t.length;if(n===0)return e;let r=0,i="",s="",a=!1;for(t.charCodeAt(0)===46&&e.push("");r<n;){const o=t[r];if(s)o==="\\"&&r+1<n?(r++,i+=t[r]):o===s?s="":i+=o;else if(a)o==='"'||o==="'"?s=o:o==="]"?(a=!1,e.push(i),i=""):i+=o;else if(o==="[")a=!0,i&&(e.push(i),i="");else if(o==="."){i&&(e.push(i),i="");const l=t[r+1];(l===void 0||l===".")&&e.push("")}else i+=o;r++}return i&&e.push(i),e}function ip(t,e,n){if(t==null)return n;switch(typeof e){case"string":{if(rC(e))return n;const r=t[e];return r===void 0?jF(e)&&!Object.hasOwn(t,e)?ip(t,FP(e),n):n:r}case"number":case"symbol":{typeof e=="number"&&(e=UP(e));const r=t[e];return r===void 0?n:r}default:{if(Array.isArray(e))return mq(t,e,n);if(Object.is(e==null?void 0:e.valueOf(),-0)?e="-0":e=String(e),rC(e))return n;const r=t[e];return r===void 0?n:r}}}function mq(t,e,n){if(e.length===0)return n;let r=t;for(let i=0;i<e.length;i++){if(r==null||rC(e[i]))return n;r=r[e[i]]}return r===void 0?n:r}var gq=4;function wd(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gq,n=10**e,r=Math.round(t*n)/n;return Object.is(r,-0)?0:r}function ji(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return t.reduce((i,s,a)=>{var o=n[a-1];return typeof o=="string"?i+o+s:o!==void 0?i+wd(o)+s:i+s},"")}var Wa=t=>t===0?0:t>0?1:-1,Il=t=>typeof t=="number"&&t!=+t,Fh=t=>typeof t=="string"&&t.length>1&&t.indexOf("%")===t.length-1,It=t=>(typeof t=="number"||t instanceof Number)&&!Il(t),Ll=t=>It(t)||typeof t=="string",vq=0,gy=t=>{var e=++vq;return"".concat(t||"").concat(e)},Nd=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(Fh(e)){if(n==null)return r;var a=e.indexOf("%");s=n*parseFloat(e.slice(0,a))/100}else s=+e;return Il(s)&&(s=r),i&&n!=null&&s>n&&(s=n),s},FF=t=>{if(!Array.isArray(t))return!1;for(var e=t.length,n={},r=0;r<e;r++)if(!n[String(t[r])])n[String(t[r])]=!0;else return!0;return!1};function zc(t,e,n){return It(t)&&It(e)?wd(t+n*(e-t)):e}function zF(t,e,n){if(!(!t||!t.length))return t.find(r=>r&&(typeof e=="function"?e(r):ip(r,e))===n)}var Vi=t=>t===null||typeof t>"u",zP=t=>Vi(t)?t:"".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));function Qs(t){return t!=null}function Kg(){}var BF=t=>"radius"in t&&"startAngle"in t&&"endAngle"in t,BP=(t,e)=>{if(!t||typeof t=="function"||typeof t=="boolean")return null;var n=t;if(P.isValidElement(t)&&(n=t.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(i=>{DP(i)&&typeof n[i]=="function"&&(r[i]=(s=>n[i](n,s)))}),r},yq=(t,e,n)=>r=>(t(e,n,r),null),xq=(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];DP(i)&&typeof s=="function"&&(r||(r={}),r[i]=yq(s,e,n))}),r};function Bk(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 bq(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Bk(Object(n),!0).forEach(function(r){_q(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Bk(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function _q(t,e,n){return(e=wq(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function wq(t){var e=Sq(t,"string");return typeof e=="symbol"?e:e+""}function Sq(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)}function Ja(t,e){var n=bq({},t),r=e,i=Object.keys(e),s=i.reduce((a,o)=>(a[o]===void 0&&r[o]!==void 0&&(a[o]=r[o]),a),n);return s}function Mq(t,e){const n=new Map;for(let r=0;r<t.length;r++){const i=t[r],s=e(i,r,t);n.has(s)||n.set(s,i)}return Array.from(n.values())}function Eq(t,e){return function(...n){return t.apply(this,n.slice(0,e))}}function HF(t){return t}function Aq(t){return function(e){return ip(e,t)}}function iC(t){return t==null||typeof t!="object"&&typeof t!="function"}function Tq(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Cq(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function HP(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const Pq="[object RegExp]",VF="[object String]",GF="[object Number]",WF="[object Boolean]",$F="[object Arguments]",Rq="[object Symbol]",Nq="[object Date]",kq="[object Map]",Iq="[object Set]",Lq="[object Array]",Oq="[object ArrayBuffer]",Dq="[object Object]",jq="[object DataView]",Uq="[object Uint8Array]",Fq="[object Uint8ClampedArray]",zq="[object Uint16Array]",Bq="[object Uint32Array]",Hq="[object Int8Array]",Vq="[object Int16Array]",Gq="[object Int32Array]",Wq="[object Float32Array]",$q="[object Float64Array]",Hk=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function Xq(t){return typeof Hk.Buffer<"u"&&Hk.Buffer.isBuffer(t)}function qq(t,e){return lh(t,void 0,t,new Map,e)}function lh(t,e,n,r=new Map,i=void 0){const s=i==null?void 0:i(t,e,n,r);if(s!==void 0)return s;if(iC(t))return t;if(r.has(t))return r.get(t);if(Array.isArray(t)){const a=new Array(t.length);r.set(t,a);for(let o=0;o<t.length;o++)a[o]=lh(t[o],o,n,r,i);return Object.hasOwn(t,"index")&&(a.index=t.index),Object.hasOwn(t,"input")&&(a.input=t.input),a}if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){const a=new RegExp(t.source,t.flags);return a.lastIndex=t.lastIndex,a}if(t instanceof Map){const a=new Map;r.set(t,a);for(const[o,l]of t)a.set(o,lh(l,o,n,r,i));return a}if(t instanceof Set){const a=new Set;r.set(t,a);for(const o of t)a.add(lh(o,void 0,n,r,i));return a}if(Xq(t))return t.subarray();if(Tq(t)){const a=new(Object.getPrototypeOf(t)).constructor(t.length);r.set(t,a);for(let o=0;o<t.length;o++)a[o]=lh(t[o],o,n,r,i);return a}if(t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);if(t instanceof DataView){const a=new DataView(t.buffer.slice(0),t.byteOffset,t.byteLength);return r.set(t,a),Lo(a,t,n,r,i),a}if(typeof File<"u"&&t instanceof File){const a=new File([t],t.name,{type:t.type});return r.set(t,a),Lo(a,t,n,r,i),a}if(typeof Blob<"u"&&t instanceof Blob){const a=new Blob([t],{type:t.type});return r.set(t,a),Lo(a,t,n,r,i),a}if(t instanceof Error){const a=structuredClone(t);return r.set(t,a),a.message=t.message,a.name=t.name,a.stack=t.stack,a.cause=t.cause,a.constructor=t.constructor,Lo(a,t,n,r,i),a}if(t instanceof Boolean){const a=new Boolean(t.valueOf());return r.set(t,a),Lo(a,t,n,r,i),a}if(t instanceof Number){const a=new Number(t.valueOf());return r.set(t,a),Lo(a,t,n,r,i),a}if(t instanceof String){const a=new String(t.valueOf());return r.set(t,a),Lo(a,t,n,r,i),a}if(typeof t=="object"&&Kq(t)){const a=Object.create(Object.getPrototypeOf(t));return r.set(t,a),Lo(a,t,n,r,i),a}return t}function Lo(t,e,n=t,r,i){const s=[...Object.keys(e),...Cq(e)];for(let a=0;a<s.length;a++){const o=s[a],l=Object.getOwnPropertyDescriptor(t,o);(l==null||l.writable)&&(t[o]=lh(e[o],o,n,r,i))}}function Kq(t){switch(HP(t)){case $F:case Lq:case Oq:case jq:case WF:case Nq:case Wq:case $q:case Hq:case Vq:case Gq:case kq:case GF:case Dq:case Pq:case Iq:case VF:case Rq:case Uq:case Fq:case zq:case Bq:return!0;default:return!1}}function Yq(t){return lh(t,void 0,t,new Map,void 0)}function W_(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}function XF(t){return t!==null&&(typeof t=="object"||typeof t=="function")}function qF(t,e,n){return typeof n!="function"?qF(t,e,()=>{}):sC(t,e,function r(i,s,a,o,l,c){const d=n(i,s,a,o,l,c);return d!==void 0?!!d:sC(i,s,r,c,!1)},new Map,!0)}function sC(t,e,n,r,i=!1){if(e===t)return!0;switch(typeof e){case"object":return Zq(t,e,n,r);case"function":return Object.keys(e).length>0?sC(t,{...e},n,r,i):W_(t,e);default:return XF(t)&&i?typeof e=="string"?e==="":!0:W_(t,e)}}function Zq(t,e,n,r){if(e==null)return!0;if(Array.isArray(e))return KF(t,e,n,r);if(e instanceof Map)return Qq(t,e,n,r);if(e instanceof Set)return Jq(t,e,n,r);const i=Object.keys(e);if(t==null||iC(t))return i.length===0;if(i.length===0)return!0;if(r!=null&&r.has(e))return r.get(e)===t;r==null||r.set(e,t);try{for(let s=0;s<i.length;s++){const a=i[s];if(!iC(t)&&!(a in t)||e[a]===void 0&&t[a]!==void 0||e[a]===null&&t[a]!==null||!n(t[a],e[a],a,t,e,r))return!1}return!0}finally{r==null||r.delete(e)}}function Qq(t,e,n,r){if(e.size===0)return!0;if(!(t instanceof Map))return!1;for(const[i,s]of e.entries())if(n(t.get(i),s,i,t,e,r)===!1)return!1;return!0}function KF(t,e,n,r){if(e.length===0)return!0;if(!Array.isArray(t))return!1;const i=new Set;for(let s=0;s<e.length;s++){const a=e[s];let o=!1;for(let l=0;l<t.length;l++){if(i.has(l))continue;const c=t[l];let d=!1;if(n(c,a,s,t,e,r)&&(d=!0),d){i.add(l),o=!0;break}}if(!o)return!1}return!0}function Jq(t,e,n,r){return e.size===0?!0:t instanceof Set?KF([...t],[...e],n,r):!1}function YF(t,e){return qF(t,e,()=>{})}function eK(t){return t=Yq(t),e=>YF(e,t)}function tK(t,e){return qq(t,(n,r,i,s)=>{if(typeof t=="object"){if(HP(t)==="[object Object]"&&typeof t.constructor!="function"){const a={};return s.set(t,a),Lo(a,t,i,s),a}switch(Object.prototype.toString.call(t)){case GF:case VF:case WF:{const a=new t.constructor(t==null?void 0:t.valueOf());return Lo(a,t),a}case $F:{const a={};return Lo(a,t),a.length=t.length,a[Symbol.iterator]=t[Symbol.iterator],a}default:return}}})}function nK(t){return tK(t)}const rK=/^(?:0|[1-9]\d*)$/;function ZF(t,e=Number.MAX_SAFE_INTEGER){switch(typeof t){case"number":return Number.isInteger(t)&&t>=0&&t<e;case"symbol":return!1;case"string":return rK.test(t)}}function iK(t){return t!==null&&typeof t=="object"&&HP(t)==="[object Arguments]"}function sK(t,e){let n;if(Array.isArray(e)?n=e:typeof e=="string"&&jF(e)&&(t==null?void 0:t[e])==null?n=FP(e):n=[e],n.length===0)return!1;let r=t;for(let i=0;i<n.length;i++){const s=n[i];if((r==null||!Object.hasOwn(r,s))&&!((Array.isArray(r)||iK(r))&&ZF(s)&&s<r.length))return!1;r=r[s]}return!0}function aK(t,e){switch(typeof t){case"object":Object.is(t==null?void 0:t.valueOf(),-0)&&(t="-0");break;case"number":t=UP(t);break}return e=nK(e),function(n){const r=ip(n,t);return r===void 0?sK(n,t):e===void 0?r===void 0:YF(r,e)}}function oK(t){if(t==null)return HF;switch(typeof t){case"function":return t;case"object":return Array.isArray(t)&&t.length===2?aK(t[0],t[1]):eK(t);case"string":case"symbol":case"number":return Aq(t)}}function lK(t){return Number.isSafeInteger(t)&&t>=0}function QF(t){return t!=null&&typeof t!="function"&&lK(t.length)}function cK(t){return typeof t=="object"&&t!==null}function uK(t){return cK(t)&&QF(t)}function Vk(t,e=HF){return uK(t)?Mq(Array.from(t),Eq(oK(e),1)):[]}function dK(t,e,n){return e===!0?Vk(t,n):typeof e=="function"?Vk(t,e):t}var wE={exports:{}},SE={},ME={exports:{}},EE={};/**
|
||
* @license React
|
||
* use-sync-external-store-shim.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var Gk;function fK(){if(Gk)return EE;Gk=1;var t=ep();function e(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,a=t.useDebugValue;function o(f,p){var y=p(),x=r({inst:{value:y,getSnapshot:p}}),S=x[0].inst,w=x[1];return s(function(){S.value=y,S.getSnapshot=p,l(S)&&w({inst:S})},[f,y,p]),i(function(){return l(S)&&w({inst:S}),f(function(){l(S)&&w({inst:S})})},[f]),a(y),y}function l(f){var p=f.getSnapshot;f=f.value;try{var y=p();return!n(f,y)}catch{return!0}}function c(f,p){return p()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:o;return EE.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,EE}var Wk;function hK(){return Wk||(Wk=1,ME.exports=fK()),ME.exports}/**
|
||
* @license React
|
||
* use-sync-external-store-shim/with-selector.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var $k;function pK(){if($k)return SE;$k=1;var t=ep(),e=hK();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,a=t.useEffect,o=t.useMemo,l=t.useDebugValue;return SE.useSyncExternalStoreWithSelector=function(c,d,f,p,y){var x=s(null);if(x.current===null){var S={hasValue:!1,value:null};x.current=S}else S=x.current;x=o(function(){function b(N){if(!M){if(M=!0,T=N,N=p(N),y!==void 0&&S.hasValue){var D=S.value;if(y(D,N))return C=D}return C=N}if(D=C,r(T,N))return D;var F=p(N);return y!==void 0&&y(D,F)?(T=N,D):(T=N,C=F)}var M=!1,T,C,L=f===void 0?null:f;return[function(){return b(d())},L===null?void 0:function(){return b(L())}]},[d,f,p,y]);var w=i(c,x[0],x[1]);return a(function(){S.hasValue=!0,S.value=w},[w]),l(w),w},SE}var Xk;function mK(){return Xk||(Xk=1,wE.exports=pK()),wE.exports}var gK=mK(),VP=P.createContext(null),vK=t=>t,Wr=()=>{var t=P.useContext(VP);return t?t.store.dispatch:vK},$_=()=>{},yK=()=>$_,xK=(t,e)=>t===e;function Ft(t){var e=P.useContext(VP),n=P.useMemo(()=>e?r=>{if(r!=null)return t(r)}:$_,[e,t]);return gK.useSyncExternalStoreWithSelector(e?e.subscription.addNestedSub:yK,e?e.store.getState:$_,e?e.store.getState:$_,n,xK)}function bK(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function _K(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 qk=t=>Array.isArray(t)?t:[t];function wK(t){const e=Array.isArray(t[0])?t[0]:t;return _K(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function SK(t,e){const n=[],{length:r}=t;for(let i=0;i<r;i++)n.push(t[i].apply(null,e));return n}var MK=class{constructor(t){this.value=t}deref(){return this.value}},EK=()=>typeof WeakRef>"u"?MK:WeakRef,JF=EK(),AK=0,Kk=1;function Cb(){return{s:AK,v:void 0,o:null,p:null}}function TK(t){return t instanceof JF?t.deref():t}function e4(t,e={}){let n=Cb();const{resultEqualityCheck:r}=e;let i,s=0;function a(){let o=n;const{length:l}=arguments;for(let f=0,p=l;f<p;f++){const y=arguments[f];if(typeof y=="function"||typeof y=="object"&&y!==null){let x=o.o;x===null&&(o.o=x=new WeakMap);const S=x.get(y);S===void 0?(o=Cb(),x.set(y,o)):o=S}else{let x=o.p;x===null&&(o.p=x=new Map);const S=x.get(y);S===void 0?(o=Cb(),x.set(y,o)):o=S}}const c=o;let d;if(o.s===Kk)d=o.v;else if(d=t.apply(null,arguments),s++,r){const f=TK(i);f!=null&&r(f,d)&&(d=f,s!==0&&s--),i=typeof d=="object"&&d!==null||typeof d=="function"?new JF(d):d}return c.s=Kk,c.v=d,d}return a.clearCache=()=>{n=Cb(),a.resetResultsCount()},a.resultsCount=()=>s,a.resetResultsCount=()=>{s=0},a}function CK(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...i)=>{let s=0,a=0,o,l={},c=i.pop();typeof c=="object"&&(l=c,c=i.pop()),bK(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const d={...n,...l},{memoize:f,memoizeOptions:p=[],argsMemoize:y=e4,argsMemoizeOptions:x=[]}=d,S=qk(p),w=qk(x),b=wK(i),M=f(function(){return s++,c.apply(null,arguments)},...S),T=y(function(){a++;const L=SK(b,arguments);return o=M.apply(null,L),o},...w);return Object.assign(T,{resultFunc:c,memoizedResultFunc:M,dependencies:b,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>o,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:y})};return Object.assign(r,{withTypes:()=>r}),r}var ke=CK(e4);function PK(t,e=1){const n=[],r=Math.floor(e),i=(s,a)=>{for(let o=0;o<s.length;o++){const l=s[o];Array.isArray(l)&&a<r?i(l,a+1):n.push(l)}};return i(t,0),n}function aC(t,e,n){return XF(n)&&(typeof e=="number"&&QF(n)&&ZF(e)&&e<n.length||typeof e=="string"&&e in n)?W_(n[e],t):!1}function Yk(t){return typeof t=="symbol"?1:t===null?2:t===void 0?3:t!==t?4:0}const RK=(t,e,n)=>{if(t!==e){const r=Yk(t),i=Yk(e);if(r===i&&r===0){if(t<e)return n==="desc"?1:-1;if(t>e)return n==="desc"?-1:1}return n==="desc"?i-r:r-i}return 0};function t4(t){return typeof t=="symbol"||t instanceof Symbol}const NK=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,kK=/^\w*$/;function IK(t,e){return Array.isArray(t)?!1:typeof t=="number"||typeof t=="boolean"||t==null||t4(t)?!0:typeof t=="string"&&(kK.test(t)||!NK.test(t))||e!=null}function LK(t,e,n,r){if(t==null)return[];n=n,Array.isArray(t)||(t=Object.values(t)),Array.isArray(e)||(e=e==null?[null]:[e]),e.length===0&&(e=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(o=>String(o));const i=(o,l)=>{let c=o;for(let d=0;d<l.length&&c!=null;++d)c=c[l[d]];return c},s=(o,l)=>l==null||o==null?l:typeof o=="object"&&"key"in o?Object.hasOwn(l,o.key)?l[o.key]:i(l,o.path):typeof o=="function"?o(l):Array.isArray(o)?i(l,o):typeof l=="object"?l[o]:l,a=e.map(o=>(Array.isArray(o)&&o.length===1&&(o=o[0]),o==null||typeof o=="function"||Array.isArray(o)||IK(o)?o:{key:o,path:FP(o)}));return t.map(o=>({original:o,criteria:a.map(l=>s(l,o))})).slice().sort((o,l)=>{for(let c=0;c<a.length;c++){const d=RK(o.criteria[c],l.criteria[c],n[c]);if(d!==0)return d}return 0}).map(o=>o.original)}function cS(t,...e){const n=e.length;return n>1&&aC(t,e[0],e[1])?e=[]:n>2&&aC(e[0],e[1],e[2])&&(e=[e[0]]),LK(t,PK(e),["asc"])}var n4=t=>t.legend.settings,OK=t=>t.legend.size,DK=t=>t.legend.payload;ke([DK,n4],(t,e)=>{var n=e.itemSorter,r=t.flat(1);return n?cS(r,n):r});function jK(t,e){return BK(t)||zK(t,e)||FK(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 FK(t,e){if(t){if(typeof t=="string")return Zk(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)?Zk(t,e):void 0}}function Zk(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function zK(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function BK(t){if(Array.isArray(t))return t}var Pb=1;function Qk(t,e){return Math.abs(t.height-e.height)>Pb||Math.abs(t.left-e.left)>Pb||Math.abs(t.top-e.top)>Pb||Math.abs(t.width-e.width)>Pb}function Jk(t){var e=t.getBoundingClientRect();return{height:e.height,left:e.left,top:e.top,width:e.width}}function HK(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=P.useState({height:0,left:0,top:0,width:0}),n=jK(e,2),r=n[0],i=n[1],s=P.useRef(null),a=P.useRef(r);a.current=r;var o=P.useCallback(l=>{if(s.current!=null&&(s.current.disconnect(),s.current=null),l!=null){var c=Jk(l);if(Qk(c,a.current)&&i(c),typeof ResizeObserver<"u"){var d=new ResizeObserver(()=>{var f=Jk(l);Qk(f,a.current)&&i(f)});d.observe(l),s.current=d}}},[...t]);return P.useEffect(()=>()=>{var l;(l=s.current)===null||l===void 0||l.disconnect()},[]),[r,o]}function Di(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var VK=typeof Symbol=="function"&&Symbol.observable||"@@observable",eI=VK,AE=()=>Math.random().toString(36).substring(7).split("").join("."),GK={INIT:`@@redux/INIT${AE()}`,REPLACE:`@@redux/REPLACE${AE()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${AE()}`},v1=GK;function GP(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 r4(t,e,n){if(typeof t!="function")throw new Error(Di(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Di(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Di(1));return n(r4)(t,e)}let r=t,i=e,s=new Map,a=s,o=0,l=!1;function c(){a===s&&(a=new Map,s.forEach((w,b)=>{a.set(b,w)}))}function d(){if(l)throw new Error(Di(3));return i}function f(w){if(typeof w!="function")throw new Error(Di(4));if(l)throw new Error(Di(5));let b=!0;c();const M=o++;return a.set(M,w),function(){if(b){if(l)throw new Error(Di(6));b=!1,c(),a.delete(M),s=null}}}function p(w){if(!GP(w))throw new Error(Di(7));if(typeof w.type>"u")throw new Error(Di(8));if(typeof w.type!="string")throw new Error(Di(17));if(l)throw new Error(Di(9));try{l=!0,i=r(i,w)}finally{l=!1}return(s=a).forEach(M=>{M()}),w}function y(w){if(typeof w!="function")throw new Error(Di(10));r=w,p({type:v1.REPLACE})}function x(){const w=f;return{subscribe(b){if(typeof b!="object"||b===null)throw new Error(Di(11));function M(){const C=b;C.next&&C.next(d())}return M(),{unsubscribe:w(M)}},[eI](){return this}}}return p({type:v1.INIT}),{dispatch:p,subscribe:f,getState:d,replaceReducer:y,[eI]:x}}function WK(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:v1.INIT})>"u")throw new Error(Di(12));if(typeof n(void 0,{type:v1.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Di(13))})}function i4(t){const e=Object.keys(t),n={};for(let s=0;s<e.length;s++){const a=e[s];typeof t[a]=="function"&&(n[a]=t[a])}const r=Object.keys(n);let i;try{WK(n)}catch(s){i=s}return function(a={},o){if(i)throw i;let l=!1;const c={};for(let d=0;d<r.length;d++){const f=r[d],p=n[f],y=a[f],x=p(y,o);if(typeof x>"u")throw o&&o.type,new Error(Di(14));c[f]=x,l=l||x!==y}return l=l||r.length!==Object.keys(a).length,l?c:a}}function y1(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function $K(...t){return e=>(n,r)=>{const i=e(n,r);let s=()=>{throw new Error(Di(15))};const a={getState:i.getState,dispatch:(l,...c)=>s(l,...c)},o=t.map(l=>l(a));return s=y1(...o)(i.dispatch),{...i,dispatch:s}}}function s4(t){return GP(t)&&"type"in t&&typeof t.type=="string"}var a4=Symbol.for("immer-nothing"),tI=Symbol.for("immer-draftable"),Rs=Symbol.for("immer-state");function Uo(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var wa=Object,Rg=wa.getPrototypeOf,x1="constructor",uS="prototype",oC="configurable",b1="enumerable",X_="writable",vy="value",Zc=t=>!!t&&!!t[Rs];function Ho(t){var e;return t?o4(t)||fS(t)||!!t[tI]||!!((e=t[x1])!=null&&e[tI])||hS(t)||pS(t):!1}var XK=wa[uS][x1].toString(),nI=new WeakMap;function o4(t){if(!t||!WP(t))return!1;const e=Rg(t);if(e===null||e===wa[uS])return!0;const n=wa.hasOwnProperty.call(e,x1)&&e[x1];if(n===Object)return!0;if(!$m(n))return!1;let r=nI.get(n);return r===void 0&&(r=Function.toString.call(n),nI.set(n,r)),r===XK}function dS(t,e,n=!0){Qy(t)===0?(n?Reflect.ownKeys(t):wa.keys(t)).forEach(i=>{e(i,t[i],t)}):t.forEach((r,i)=>e(i,r,t))}function Qy(t){const e=t[Rs];return e?e.type_:fS(t)?1:hS(t)?2:pS(t)?3:0}var rI=(t,e,n=Qy(t))=>n===2?t.has(e):wa[uS].hasOwnProperty.call(t,e),lC=(t,e,n=Qy(t))=>n===2?t.get(e):t[e],_1=(t,e,n,r=Qy(t))=>{r===2?t.set(e,n):r===3?t.add(n):t[e]=n};function qK(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var fS=Array.isArray,hS=t=>t instanceof Map,pS=t=>t instanceof Set,WP=t=>typeof t=="object",$m=t=>typeof t=="function",TE=t=>typeof t=="boolean";function KK(t){const e=+t;return Number.isInteger(e)&&String(e)===t}var Ic=t=>t.copy_||t.base_,$P=t=>t.modified_?t.copy_:t.base_;function cC(t,e){if(hS(t))return new Map(t);if(pS(t))return new Set(t);if(fS(t))return Array[uS].slice.call(t);const n=o4(t);if(e===!0||e==="class_only"&&!n){const r=wa.getOwnPropertyDescriptors(t);delete r[Rs];let i=Reflect.ownKeys(r);for(let s=0;s<i.length;s++){const a=i[s],o=r[a];o[X_]===!1&&(o[X_]=!0,o[oC]=!0),(o.get||o.set)&&(r[a]={[oC]:!0,[X_]:!0,[b1]:o[b1],[vy]:t[a]})}return wa.create(Rg(t),r)}else{const r=Rg(t);if(r!==null&&n)return{...t};const i=wa.create(r);return wa.assign(i,t)}}function XP(t,e=!1){return mS(t)||Zc(t)||!Ho(t)||(Qy(t)>1&&wa.defineProperties(t,{set:Rb,add:Rb,clear:Rb,delete:Rb}),wa.freeze(t),e&&dS(t,(n,r)=>{XP(r,!0)},!1)),t}function YK(){Uo(2)}var Rb={[vy]:YK};function mS(t){return t===null||!WP(t)?!0:wa.isFrozen(t)}var w1="MapSet",uC="Patches",iI="ArrayMethods",l4={};function zh(t){const e=l4[t];return e||Uo(0,t),e}var sI=t=>!!l4[t],yy,c4=()=>yy,ZK=(t,e)=>({drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:sI(w1)?zh(w1):void 0,arrayMethodsPlugin_:sI(iI)?zh(iI):void 0});function aI(t,e){e&&(t.patchPlugin_=zh(uC),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function dC(t){fC(t),t.drafts_.forEach(QK),t.drafts_=null}function fC(t){t===yy&&(yy=t.parent_)}var oI=t=>yy=ZK(yy,t);function QK(t){const e=t[Rs];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function lI(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(t!==void 0&&t!==n){n[Rs].modified_&&(dC(e),Uo(4)),Ho(t)&&(t=cI(e,t));const{patchPlugin_:i}=e;i&&i.generateReplacementPatches_(n[Rs].base_,t,e)}else t=cI(e,n);return JK(e,t,!0),dC(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==a4?t:void 0}function cI(t,e){if(mS(e))return e;const n=e[Rs];if(!n)return S1(e,t.handledSet_,t);if(!gS(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);f4(n,t)}return n.copy_}function JK(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&XP(e,n)}function u4(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var gS=(t,e)=>t.scope_===e,eY=[];function d4(t,e,n,r){const i=Ic(t),s=t.type_;if(r!==void 0&&lC(i,r,s)===e){_1(i,r,n,s);return}if(!t.draftLocations_){const o=t.draftLocations_=new Map;dS(i,(l,c)=>{if(Zc(c)){const d=o.get(c)||[];d.push(l),o.set(c,d)}})}const a=t.draftLocations_.get(e)??eY;for(const o of a)_1(i,o,n,s)}function tY(t,e,n){t.callbacks_.push(function(i){var o;const s=e;if(!s||!gS(s,i))return;(o=i.mapSetPlugin_)==null||o.fixSetContents(s);const a=$P(s);d4(t,s.draft_??s,a,n),f4(s,i)})}function f4(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)}u4(t)}}function nY(t,e,n){const{scope_:r}=t;if(Zc(n)){const i=n[Rs];gS(i,r)&&i.callbacks_.push(function(){q_(t);const a=$P(i);d4(t,n,a,e)})}else Ho(n)&&t.callbacks_.push(function(){const s=Ic(t);t.type_===3?s.has(n)&&S1(n,r.handledSet_,r):lC(s,e,t.type_)===n&&r.drafts_.length>1&&(t.assigned_.get(e)??!1)===!0&&t.copy_&&S1(lC(t.copy_,e,t.type_),r.handledSet_,r)})}function S1(t,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Zc(t)||e.has(t)||!Ho(t)||mS(t)||(e.add(t),dS(t,(r,i)=>{if(Zc(i)){const s=i[Rs];if(gS(s,n)){const a=$P(s);_1(t,r,a,t.type_),u4(s)}}else Ho(i)&&S1(i,e,n)})),t}function rY(t,e){const n=fS(t),r={type_:n?1:0,scope_:e?e.scope_:c4(),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=M1;n&&(i=[r],s=xy);const{revoke:a,proxy:o}=Proxy.revocable(i,s);return r.draft_=o,r.revoke_=a,[o,r]}var M1={get(t,e){if(e===Rs)return t;let n=t.scope_.arrayMethodsPlugin_;const r=t.type_===1&&typeof e=="string";if(r&&n!=null&&n.isArrayOperationMethod(e))return n.createMethodInterceptor(t,e);const i=Ic(t);if(!rI(i,e,t.type_))return iY(t,i,e);const s=i[e];if(t.finalized_||!Ho(s)||r&&t.operationMethod&&(n!=null&&n.isMutatingArrayMethod(t.operationMethod))&&KK(e))return s;if(s===CE(t.base_,e)){q_(t);const a=t.type_===1?+e:e,o=pC(t.scope_,s,t,a);return t.copy_[a]=o}return s},has(t,e){return e in Ic(t)},ownKeys(t){return Reflect.ownKeys(Ic(t))},set(t,e,n){const r=h4(Ic(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=CE(Ic(t),e),s=i==null?void 0:i[Rs];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_.set(e,!1),!0;if(qK(n,i)&&(n!==void 0||rI(t.base_,e,t.type_)))return!0;q_(t),hC(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_.set(e,!0),nY(t,e,n)),!0},deleteProperty(t,e){return q_(t),CE(t.base_,e)!==void 0||e in t.base_?(t.assigned_.set(e,!1),hC(t)):t.assigned_.delete(e),t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Ic(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{[X_]:!0,[oC]:t.type_!==1||e!=="length",[b1]:r[b1],[vy]:n[e]}},defineProperty(){Uo(11)},getPrototypeOf(t){return Rg(t.base_)},setPrototypeOf(){Uo(12)}},xy={};for(let t in M1){let e=M1[t];xy[t]=function(){const n=arguments;return n[0]=n[0][0],e.apply(this,n)}}xy.deleteProperty=function(t,e){return xy.set.call(this,t,e,void 0)};xy.set=function(t,e,n){return M1.set.call(this,t[0],e,n,t[0])};function CE(t,e){const n=t[Rs];return(n?Ic(n):t)[e]}function iY(t,e,n){var i;const r=h4(e,n);return r?vy in r?r[vy]:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function h4(t,e){if(!(e in t))return;let n=Rg(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Rg(n)}}function hC(t){t.modified_||(t.modified_=!0,t.parent_&&hC(t.parent_))}function q_(t){t.copy_||(t.assigned_=new Map,t.copy_=cC(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var sY=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if($m(n)&&!$m(r)){const a=r;r=n;const o=this;return function(c=a,...d){return o.produce(c,f=>r.call(this,f,...d))}}$m(r)||Uo(6),i!==void 0&&!$m(i)&&Uo(7);let s;if(Ho(n)){const a=oI(this),o=pC(a,n,void 0);let l=!0;try{s=r(o),l=!1}finally{l?dC(a):fC(a)}return aI(a,i),lI(s,a)}else if(!n||!WP(n)){if(s=r(n),s===void 0&&(s=n),s===a4&&(s=void 0),this.autoFreeze_&&XP(s,!0),i){const a=[],o=[];zh(uC).generateReplacementPatches_(n,s,{patches_:a,inversePatches_:o}),i(a,o)}return s}else Uo(1,n)},this.produceWithPatches=(n,r)=>{if($m(n))return(o,...l)=>this.produceWithPatches(o,c=>n(c,...l));let i,s;return[this.produce(n,r,(o,l)=>{i=o,s=l}),i,s]},TE(e==null?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),TE(e==null?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),TE(e==null?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Ho(e)||Uo(8),Zc(e)&&(e=$a(e));const n=oI(this),r=pC(n,e,void 0);return r[Rs].isManual_=!0,fC(n),r}finishDraft(e,n){const r=e&&e[Rs];(!r||!r.isManual_)&&Uo(9);const{scope_:i}=r;return aI(i,n),lI(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=zh(uC).applyPatches_;return Zc(e)?i(e,n):this.produce(e,s=>i(s,n))}};function pC(t,e,n,r){const[i,s]=hS(e)?zh(w1).proxyMap_(e,n):pS(e)?zh(w1).proxySet_(e,n):rY(e,n);return((n==null?void 0:n.scope_)??c4()).drafts_.push(i),s.callbacks_=(n==null?void 0:n.callbacks_)??[],s.key_=r,n&&r!==void 0?tY(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 $a(t){return Zc(t)||Uo(10,t),p4(t)}function p4(t){if(!Ho(t)||mS(t))return t;const e=t[Rs];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=cC(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=cC(t,!0);return dS(n,(i,s)=>{_1(n,i,p4(s))},r),e&&(e.finalized_=!1),n}var aY=new sY,m4=aY.produce;function g4(t){return({dispatch:n,getState:r})=>i=>s=>typeof s=="function"?s(n,r,t):i(s)}var oY=g4(),lY=g4,cY=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?y1:y1.apply(null,arguments)};function Aa(t,e){function n(...r){if(e){let i=e(...r);if(!i)throw new Error(Ma(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=>s4(r)&&r.type===t,n}var v4=class $0 extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,$0.prototype)}static get[Symbol.species](){return $0}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new $0(...e[0].concat(this)):new $0(...e.concat(this))}};function uI(t){return Ho(t)?m4(t,()=>{}):t}function Nb(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}function uY(t){return typeof t=="boolean"}var dY=()=>function(e){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=e??{};let a=new v4;return n&&(uY(n)?a.push(oY):a.push(lY(n.extraArgument))),a},y4="RTK_autoBatch",ar=()=>t=>({payload:t,meta:{[y4]:!0}}),dI=t=>e=>{setTimeout(e,t)},fY=(t,e)=>n=>{let r=!1;const i=()=>{r||(r=!0,cancelAnimationFrame(s),clearTimeout(a),n())},s=t(i),a=setTimeout(i,e)},x4=(t={type:"raf"})=>e=>(...n)=>{const r=e(...n);let i=!0,s=!1,a=!1;const o=new Set,l=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?fY(window.requestAnimationFrame,100):dI(10):t.type==="callback"?t.queueNotification:dI(t.timeout),c=()=>{a=!1,s&&(s=!1,o.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const f=()=>i&&d(),p=r.subscribe(f);return o.add(d),()=>{p(),o.delete(d)}},dispatch(d){var f;try{return i=!((f=d==null?void 0:d.meta)!=null&&f[y4]),s=!i,s&&(a||(a=!0,l(c))),r.dispatch(d)}finally{i=!0}}})},hY=t=>function(n){const{autoBatch:r=!0}=n??{};let i=new v4(t);return r&&i.push(x4(typeof r=="object"?r:void 0)),i};function pY(t){const e=dY(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:s=void 0,enhancers:a=void 0}=t||{};let o;if(typeof n=="function")o=n;else if(GP(n))o=i4(n);else throw new Error(Ma(1));let l;typeof r=="function"?l=r(e):l=e();let c=y1;i&&(c=cY({trace:!1,...typeof i=="object"&&i}));const d=$K(...l),f=hY(d);let p=typeof a=="function"?a(f):f();const y=c(...p);return r4(o,s,y)}function b4(t){const e={},n=[];let r;const i={addCase(s,a){const o=typeof s=="string"?s:s.type;if(!o)throw new Error(Ma(28));if(o in e)throw new Error(Ma(29));return e[o]=a,i},addAsyncThunk(s,a){return a.pending&&(e[s.pending.type]=a.pending),a.rejected&&(e[s.rejected.type]=a.rejected),a.fulfilled&&(e[s.fulfilled.type]=a.fulfilled),a.settled&&n.push({matcher:s.settled,reducer:a.settled}),i},addMatcher(s,a){return n.push({matcher:s,reducer:a}),i},addDefaultCase(s){return r=s,i}};return t(i),[e,n,r]}function mY(t){return typeof t=="function"}function gY(t,e){let[n,r,i]=b4(e),s;if(mY(t))s=()=>uI(t());else{const o=uI(t);s=()=>o}function a(o=s(),l){let c=[n[l.type],...r.filter(({matcher:d})=>d(l)).map(({reducer:d})=>d)];return c.filter(d=>!!d).length===0&&(c=[i]),c.reduce((d,f)=>{if(f)if(Zc(d)){const y=f(d,l);return y===void 0?d:y}else{if(Ho(d))return m4(d,p=>f(p,l));{const p=f(d,l);if(p===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return p}}return d},o)}return a.getInitialState=s,a}var vY="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",yY=(t=21)=>{let e="",n=t;for(;n--;)e+=vY[Math.random()*64|0];return e},xY=Symbol.for("rtk-slice-createasyncthunk");function bY(t,e){return`${t}/${e}`}function _Y({creators:t}={}){var n;const e=(n=t==null?void 0:t.asyncThunk)==null?void 0:n[xY];return function(i){const{name:s,reducerPath:a=s}=i;if(!s)throw new Error(Ma(11));const o=(typeof i.reducers=="function"?i.reducers(SY()):i.reducers)||{},l=Object.keys(o),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(C,L){const N=typeof C=="string"?C:C.type;if(!N)throw new Error(Ma(12));if(N in c.sliceCaseReducersByType)throw new Error(Ma(13));return c.sliceCaseReducersByType[N]=L,d},addMatcher(C,L){return c.sliceMatchers.push({matcher:C,reducer:L}),d},exposeAction(C,L){return c.actionCreators[C]=L,d},exposeCaseReducer(C,L){return c.sliceCaseReducersByName[C]=L,d}};l.forEach(C=>{const L=o[C],N={reducerName:C,type:bY(s,C),createNotation:typeof i.reducers=="function"};EY(L)?TY(N,L,d,e):MY(N,L,d)});function f(){const[C={},L=[],N=void 0]=typeof i.extraReducers=="function"?b4(i.extraReducers):[i.extraReducers],D={...C,...c.sliceCaseReducersByType};return gY(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 L)F.addMatcher(V.matcher,V.reducer);N&&F.addDefaultCase(N)})}const p=C=>C,y=new Map,x=new WeakMap;let S;function w(C,L){return S||(S=f()),S(C,L)}function b(){return S||(S=f()),S.getInitialState()}function M(C,L=!1){function N(F){let V=F[C];return typeof V>"u"&&L&&(V=Nb(x,N,b)),V}function D(F=p){const V=Nb(y,L,()=>new WeakMap);return Nb(V,F,()=>{const I={};for(const[U,X]of Object.entries(i.selectors??{}))I[U]=wY(X,F,()=>Nb(x,F,b),L);return I})}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:b,...M(a),injectInto(C,{reducerPath:L,...N}={}){const D=L??a;return C.inject({reducerPath:D,reducer:w},N),{...T,...M(D,!0)}}};return T}}function wY(t,e,n,r){function i(s,...a){let o=e(s);return typeof o>"u"&&r&&(o=n()),t(o,...a)}return i.unwrapped=t,i}var cs=_Y();function SY(){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 MY({type:t,reducerName:e,createNotation:n},r,i){let s,a;if("reducer"in r){if(n&&!AY(r))throw new Error(Ma(17));s=r.reducer,a=r.prepare}else s=r;i.addCase(t,s).exposeCaseReducer(e,s).exposeAction(e,a?Aa(t,a):Aa(t))}function EY(t){return t._reducerDefinitionType==="asyncThunk"}function AY(t){return t._reducerDefinitionType==="reducerWithPrepare"}function TY({type:t,reducerName:e},n,r,i){if(!i)throw new Error(Ma(18));const{payloadCreator:s,fulfilled:a,pending:o,rejected:l,settled:c,options:d}=n,f=i(t,s,d);r.exposeAction(e,f),a&&r.addCase(f.fulfilled,a),o&&r.addCase(f.pending,o),l&&r.addCase(f.rejected,l),c&&r.addMatcher(f.settled,c),r.exposeCaseReducer(e,{fulfilled:a||kb,pending:o||kb,rejected:l||kb,settled:c||kb})}function kb(){}var CY="task",_4="listener",w4="completed",qP="cancelled",PY=`task-${qP}`,RY=`task-${w4}`,mC=`${_4}-${qP}`,NY=`${_4}-${w4}`,vS=class{constructor(t){$s(this,"code");$s(this,"name","TaskAbortError");$s(this,"message");this.code=t,this.message=`${CY} ${qP} (reason: ${t})`}},KP=(t,e)=>{if(typeof t!="function")throw new TypeError(Ma(32))},E1=()=>{},S4=(t,e=E1)=>(t.catch(e),t),M4=(t,e)=>(t.addEventListener("abort",e,{once:!0}),()=>t.removeEventListener("abort",e)),Ph=t=>{if(t.aborted)throw new vS(t.reason)};function E4(t,e){let n=E1;return new Promise((r,i)=>{const s=()=>i(new vS(t.reason));if(t.aborted){s();return}n=M4(t,s),e.finally(()=>n()).then(r,i)}).finally(()=>{n=E1})}var kY=async(t,e)=>{try{return await Promise.resolve(),{status:"ok",value:await t()}}catch(n){return{status:n instanceof vS?"cancelled":"rejected",error:n}}finally{e==null||e()}},A1=t=>e=>S4(E4(t,e).then(n=>(Ph(t),n))),A4=t=>{const e=A1(t);return n=>e(new Promise(r=>setTimeout(r,n)))},{assign:ag}=Object,fI={},yS="listenerMiddleware",IY=(t,e)=>{const n=r=>M4(t,()=>r.abort(t.reason));return(r,i)=>{KP(r);const s=new AbortController;n(s);const a=kY(async()=>{Ph(t),Ph(s.signal);const o=await r({pause:A1(s.signal),delay:A4(s.signal),signal:s.signal});return Ph(s.signal),o},()=>s.abort(RY));return i!=null&&i.autoJoin&&e.push(a.catch(E1)),{result:A1(t)(a),cancel(){s.abort(PY)}}}},LY=(t,e)=>{const n=async(r,i)=>{Ph(e);let s=()=>{};const o=[new Promise((l,c)=>{let d=t({predicate:r,effect:(f,p)=>{p.unsubscribe(),l([f,p.getState(),p.getOriginalState()])}});s=()=>{d(),c()}})];i!=null&&o.push(new Promise(l=>setTimeout(l,i,null)));try{const l=await E4(e,Promise.race(o));return Ph(e),l}finally{s()}};return((r,i)=>S4(n(r,i)))},T4=t=>{let{type:e,actionCreator:n,matcher:r,predicate:i,effect:s}=t;if(e)i=Aa(e).match;else if(n)e=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(Ma(21));return KP(s),{predicate:i,type:e,effect:s}},C4=ag(t=>{const{type:e,predicate:n,effect:r}=T4(t);return{id:yY(),effect:r,type:e,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(Ma(22))}}},{withTypes:()=>C4}),hI=(t,e)=>{const{type:n,effect:r,predicate:i}=T4(e);return Array.from(t.values()).find(s=>(typeof n=="string"?s.type===n:s.predicate===i)&&s.effect===r)},gC=t=>{t.pending.forEach(e=>{e.abort(mC)})},OY=(t,e)=>()=>{for(const n of e.keys())gC(n);t.clear()},pI=(t,e,n)=>{try{t(e,n)}catch(r){setTimeout(()=>{throw r},0)}},P4=ag(Aa(`${yS}/add`),{withTypes:()=>P4}),DY=Aa(`${yS}/removeAll`),R4=ag(Aa(`${yS}/remove`),{withTypes:()=>R4}),jY=(...t)=>{console.error(`${yS}/error`,...t)},Jy=(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:a=jY}=t;KP(a);const o=y=>(y.unsubscribe=()=>e.delete(y.id),e.set(y.id,y),x=>{y.unsubscribe(),x!=null&&x.cancelActive&&gC(y)}),l=(y=>{const x=hI(e,y)??C4(y);return o(x)});ag(l,{withTypes:()=>l});const c=y=>{const x=hI(e,y);return x&&(x.unsubscribe(),y.cancelActive&&gC(x)),!!x};ag(c,{withTypes:()=>c});const d=async(y,x,S,w)=>{const b=new AbortController,M=LY(l,b.signal),T=[];try{y.pending.add(b),r(y),await Promise.resolve(y.effect(x,ag({},S,{getOriginalState:w,condition:(C,L)=>M(C,L).then(Boolean),take:M,delay:A4(b.signal),pause:A1(b.signal),extra:s,signal:b.signal,fork:IY(b.signal,T),unsubscribe:y.unsubscribe,subscribe:()=>{e.set(y.id,y)},cancelActiveListeners:()=>{y.pending.forEach((C,L,N)=>{C!==b&&(C.abort(mC),N.delete(C))})},cancel:()=>{b.abort(mC),y.pending.delete(b)},throwIfCancelled:()=>{Ph(b.signal)}})))}catch(C){C instanceof vS||pI(a,C,{raisedBy:"effect"})}finally{await Promise.all(T),b.abort(NY),i(y),y.pending.delete(b)}},f=OY(e,n);return{middleware:y=>x=>S=>{if(!s4(S))return x(S);if(P4.match(S))return l(S.payload);if(DY.match(S)){f();return}if(R4.match(S))return c(S.payload);let w=y.getState();const b=()=>{if(w===fI)throw new Error(Ma(23));return w};let M;try{if(M=x(S),e.size>0){const T=y.getState(),C=Array.from(e.values());for(const L of C){let N=!1;try{N=L.predicate(S,T,w)}catch(D){N=!1,pI(a,D,{raisedBy:"predicate"})}N&&d(L,S,y,b)}}}finally{w=fI}return M},startListening:l,stopListening:c,clearListeners:f}};function Ma(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},N4=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}}}),xS=N4.actions,FY=xS.setMargin,zY=xS.setLayout,BY=xS.setChartSize,HY=xS.setScale,VY=N4.reducer;function k4(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 Ol(t){return typeof t=="number"&&t>0&&Number.isFinite(t)}function mI(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 Zm(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?mI(Object(n),!0).forEach(function(r){GY(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):mI(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function GY(t,e,n){return(e=WY(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function WY(t){var e=$Y(t,"string");return typeof e=="symbol"?e:e+""}function $Y(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)}function yi(t,e,n){return Vi(t)||Vi(e)?n:Ll(e)?ip(t,e,n):typeof e=="function"?e(t):n}var XY=(t,e,n)=>{if(e&&n){var r=n.width,i=n.height,s=e.align,a=e.verticalAlign,o=e.layout;if((o==="vertical"||o==="horizontal"&&a==="middle")&&s!=="center"&&It(t[s]))return Zm(Zm({},t),{},{[s]:t[s]+(r||0)});if((o==="horizontal"||o==="vertical"&&s==="center")&&a!=="middle"&&It(t[a]))return Zm(Zm({},t),{},{[a]:t[a]+(i||0)})}return t},Hl=(t,e)=>t==="horizontal"&&e==="xAxis"||t==="vertical"&&e==="yAxis"||t==="centric"&&e==="angleAxis"||t==="radial"&&e==="radiusAxis",I4=(t,e,n,r)=>{if(r)return t.map(o=>o.coordinate);var i,s,a=t.map(o=>(o.coordinate===e&&(i=!0),o.coordinate===n&&(s=!0),o.coordinate));return i||a.push(e),s||a.push(n),a},L4=(t,e,n)=>{if(!t)return null;var r=t.duplicateDomain,i=t.type,s=t.range,a=t.scale,o=t.realScaleType,l=t.isCategorical,c=t.categoricalDomain,d=t.tickCount,f=t.ticks,p=t.niceTicks,y=t.axisType;if(!a)return null;var x=o==="scaleBand"&&a.bandwidth?a.bandwidth()/2:2,S=i==="category"&&a.bandwidth?a.bandwidth()/x:0;if(S=y==="angleAxis"&&s&&s.length>=2?Wa(s[0]-s[1])*2*S:S,f||p){var w=(f||p||[]).map((b,M)=>{var T=r?r.indexOf(b):b,C=a.map(T);return wn(C)?{coordinate:C+S,value:b,offset:S,index:M}:null}).filter(Qs);return w}return l&&c?c.map((b,M)=>{var T=a.map(b);return wn(T)?{coordinate:T+S,value:b,index:M,offset:S}:null}).filter(Qs):a.ticks&&d!=null?a.ticks(d).map((b,M)=>{var T=a.map(b);return wn(T)?{coordinate:T+S,value:b,index:M,offset:S}:null}).filter(Qs):a.domain().map((b,M)=>{var T=a.map(b);return wn(T)?{coordinate:T+S,value:r?r[b]:b,index:M,offset:S}:null}).filter(Qs)},qY=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<r;++i)for(var s=0,a=0,o=0;o<n;++o){var l=t[o],c=l==null?void 0:l[i];if(c!=null){var d=c[1],f=c[0],p=Il(d)?f:d;p>=0?(c[0]=s,s+=p,c[1]=s):(c[0]=a,a+=p,c[1]=a)}}}},KY=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<r;++i)for(var s=0,a=0;a<n;++a){var o=t[a],l=o==null?void 0:o[i];if(l!=null){var c=Il(l[1])?l[0]:l[1];c>=0?(l[0]=s,s+=c,l[1]=s):(l[0]=0,l[1]=0)}}}},YY={sign:qY,expand:fq,none:Uh,silhouette:hq,wiggle:pq,positive:KY},ZY=(t,e,n)=>{var r,i=(r=YY[n])!==null&&r!==void 0?r:Uh,s=dq().keys(e).value((o,l)=>Number(yi(o,l,0))).order(nC).offset(i),a=s(t);return a.forEach((o,l)=>{o.forEach((c,d)=>{var f=yi(t[d],e[l],0);Array.isArray(f)&&f.length===2&&It(f[0])&&It(f[1])&&(c[0]=f[0],c[1]=f[1])})}),a};function QY(t){return t==null?void 0:String(t)}function gI(t){var e=t.axis,n=t.ticks,r=t.bandSize,i=t.entry,s=t.index,a=t.dataKey;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!Vi(i[e.dataKey])){var o=zF(n,"value",i[e.dataKey]);if(o)return o.coordinate+r/2}return n!=null&&n[s]?n[s].coordinate+r/2:null}var l=yi(i,Vi(a)?e.dataKey:a),c=e.scale.map(l);return It(c)?c:null}var JY=t=>{var e=t.flat(2).filter(It);return[Math.min(...e),Math.max(...e)]},eZ=t=>[t[0]===1/0?0:t[0],t[1]===-1/0?0:t[1]],tZ=(t,e,n)=>{if(!(t==null||Object.keys(t).length===0))return eZ(Object.keys(t).reduce((r,i)=>{var s=t[i];if(!s)return r;var a=s.stackedData,o=a.reduce((l,c)=>{var d=k4(c,e,n),f=JY(d);return!wn(f[0])||!wn(f[1])?l:[Math.min(l[0],f[0]),Math.max(l[1],f[1])]},[1/0,-1/0]);return[Math.min(o[0],r[0]),Math.max(o[1],r[1])]},[1/0,-1/0]))},vI=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,yI=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,T1=(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=cS(e,d=>d.coordinate),s=1/0,a=1,o=i.length;a<o;a++){var l=i[a],c=i[a-1];s=Math.min(((l==null?void 0:l.coordinate)||0)-((c==null?void 0:c.coordinate)||0),s)}return s===1/0?0:s}return n?void 0:0};function xI(t){var e=t.tooltipEntrySettings,n=t.dataKey,r=t.payload,i=t.value,s=t.name;return Zm(Zm({},e),{},{dataKey:n,payload:r,value:i,name:s})}function O4(t,e){if(t!=null)return String(t);if(typeof e=="string")return e}var nZ=(t,e)=>{if(e==="horizontal")return t.relativeX;if(e==="vertical")return t.relativeY},rZ=(t,e)=>e==="centric"?t.angle:t.radius,ru=t=>t.layout.width,iu=t=>t.layout.height,iZ=t=>t.layout.scale,D4=t=>t.layout.margin,bS=ke(t=>t.cartesianAxis.xAxis,t=>Object.values(t)),_S=ke(t=>t.cartesianAxis.yAxis,t=>Object.values(t)),sZ="data-recharts-item-index",aZ="data-recharts-item-id",ex=60;function bI(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 Ib(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?bI(Object(n),!0).forEach(function(r){oZ(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):bI(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function oZ(t,e,n){return(e=lZ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function lZ(t){var e=cZ(t,"string");return typeof e=="symbol"?e:e+""}function cZ(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 uZ=t=>t.brush.height;function dZ(t){var e=_S(t);return e.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:ex;return n+i}return n},0)}function fZ(t){var e=_S(t);return e.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:ex;return n+i}return n},0)}function hZ(t){var e=bS(t);return e.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function pZ(t){var e=bS(t);return e.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var Wi=ke([ru,iu,D4,uZ,dZ,fZ,hZ,pZ,n4,OK],(t,e,n,r,i,s,a,o,l,c)=>{var d={left:(n.left||0)+i,right:(n.right||0)+s},f={top:(n.top||0)+a,bottom:(n.bottom||0)+o},p=Ib(Ib({},f),d),y=p.bottom;p.bottom+=r,p=XY(p,l,c);var x=t-p.left-p.right,S=e-p.top-p.bottom;return Ib(Ib({brushBottom:y},p),{},{width:Math.max(x,0),height:Math.max(S,0)})}),mZ=ke(Wi,t=>({x:t.left,y:t.top,width:t.width,height:t.height})),j4=ke(ru,iu,(t,e)=>({x:0,y:0,width:t,height:e})),gZ=P.createContext(null),ta=()=>P.useContext(gZ)!=null,wS=t=>t.brush,SS=ke([wS,Wi,D4],(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 vZ(t,e,{signal:n,edges:r}={}){let i,s=null;const a=r!=null&&r.includes("leading"),o=r==null||r.includes("trailing"),l=()=>{s!==null&&(t.apply(i,s),i=void 0,s=null)},c=()=>{o&&l(),y()};let d=null;const f=()=>{d!=null&&clearTimeout(d),d=setTimeout(()=>{d=null,c()},e)},p=()=>{d!==null&&(clearTimeout(d),d=null)},y=()=>{p(),i=void 0,s=null},x=()=>{l()},S=function(...w){if(n!=null&&n.aborted)return;i=this,s=w;const b=d==null;f(),a&&b&&l()};return S.schedule=f,S.cancel=y,S.flush=x,n==null||n.addEventListener("abort",y,{once:!0}),S}function yZ(t,e=0,n={}){typeof n!="object"&&(n={});const{leading:r=!1,trailing:i=!0,maxWait:s}=n,a=Array(2);r&&(a[0]="leading"),i&&(a[1]="trailing");let o,l=null;const c=vZ(function(...p){o=t.apply(this,p),l=null},e,{edges:a}),d=function(...p){return s!=null&&(l===null&&(l=Date.now()),Date.now()-l>=s)?(o=t.apply(this,p),l=Date.now(),c.cancel(),c.schedule(),o):(c.apply(this,p),o)},f=()=>(c.flush(),o);return d.cancel=c.cancel,d.flush=f,d}function xZ(t,e=0,n={}){const{leading:r=!0,trailing:i=!0}=n;return yZ(t,e,{leading:r,maxWait:e,trailing:i})}var C1=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];if(typeof console<"u"&&console.warn&&(n===void 0&&console.warn("LogUtils requires an error message argument"),!e))if(n===void 0)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=0;console.warn(n.replace(/%s/g,()=>i[a++]))}},Sl={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},U4=(t,e,n)=>{var r=n.width,i=r===void 0?Sl.width:r,s=n.height,a=s===void 0?Sl.height:s,o=n.aspect,l=n.maxHeight,c=Fh(i)?t:Number(i),d=Fh(a)?e:Number(a);return o&&o>0&&(c?d=c/o:d&&(c=d*o),l&&d!=null&&d>l&&(d=l)),{calculatedWidth:c,calculatedHeight:d}},bZ={width:0,height:0,overflow:"visible"},_Z={width:0,overflowX:"visible"},wZ={height:0,overflowY:"visible"},SZ={},MZ=t=>{var e=t.width,n=t.height,r=Fh(e),i=Fh(n);return r&&i?bZ:r?_Z:i?wZ:SZ};function EZ(t){var e=t.width,n=t.height,r=t.aspect,i=e,s=n;return i===void 0&&s===void 0?(i=Sl.width,s=Sl.height):i===void 0?i=r&&r>0?void 0:Sl.width:s===void 0&&(s=r&&r>0?void 0:Sl.height),{width:i,height:s}}var AZ=["aspect","initialDimension","width","height","minWidth","minHeight","maxHeight","children","debounce","id","className","onResize","style"];function P1(){return P1=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},P1.apply(null,arguments)}function _I(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 wI(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?_I(Object(n),!0).forEach(function(r){TZ(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):_I(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function TZ(t,e,n){return(e=CZ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function CZ(t){var e=PZ(t,"string");return typeof e=="symbol"?e:e+""}function PZ(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)}function RZ(t,e){return LZ(t)||IZ(t,e)||kZ(t,e)||NZ()}function NZ(){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 kZ(t,e){if(t){if(typeof t=="string")return SI(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)?SI(t,e):void 0}}function SI(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function IZ(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function LZ(t){if(Array.isArray(t))return t}function OZ(t,e){if(t==null)return{};var n,r,i=DZ(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function DZ(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var F4=P.createContext(Sl.initialDimension);function jZ(t){return Ol(t.width)&&Ol(t.height)}function z4(t){var e=t.children,n=t.width,r=t.height,i=P.useMemo(()=>({width:n,height:r}),[n,r]);return jZ(i)?P.createElement(F4.Provider,{value:i},e):null}var YP=()=>P.useContext(F4),UZ=P.forwardRef((t,e)=>{var n=t.aspect,r=t.initialDimension,i=r===void 0?Sl.initialDimension:r,s=t.width,a=t.height,o=t.minWidth,l=o===void 0?Sl.minWidth:o,c=t.minHeight,d=t.maxHeight,f=t.children,p=t.debounce,y=p===void 0?Sl.debounce:p,x=t.id,S=t.className,w=t.onResize,b=t.style,M=b===void 0?{}:b,T=OZ(t,AZ),C=P.useRef(null),L=P.useRef();L.current=w,P.useImperativeHandle(e,()=>C.current);var N=P.useState({containerWidth:i.width,containerHeight:i.height}),D=RZ(N,2),F=D[0],V=D[1],I=P.useCallback((ee,ce)=>{V(B=>{var J=Math.round(ee),Z=Math.round(ce);return B.containerWidth===J&&B.containerHeight===Z?B:{containerWidth:J,containerHeight:Z}})},[]);P.useEffect(()=>{if(C.current==null||typeof ResizeObserver>"u")return Kg;var ee=G=>{var W,oe=G[0];if(oe!=null){var se=oe.contentRect,le=se.width,Me=se.height;I(le,Me),(W=L.current)===null||W===void 0||W.call(L,le,Me)}};y>0&&(ee=xZ(ee,y,{trailing:!0,leading:!1}));var ce=new ResizeObserver(ee),B=C.current.getBoundingClientRect(),J=B.width,Z=B.height;return I(J,Z),ce.observe(C.current),()=>{ce.disconnect()}},[I,y]);var U=F.containerWidth,X=F.containerHeight;C1(!n||n>0,"The aspect(%s) must be greater than zero.",n);var te=U4(U,X,{width:s,height:a,aspect:n,maxHeight:d}),re=te.calculatedWidth,pe=te.calculatedHeight;return C1(U<0||X<0||re!=null&&re>0||pe!=null&&pe>0,`The width(%s) and height(%s) of chart should be greater than 0,
|
||
please check the style of container, or the props width(%s) and height(%s),
|
||
or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
|
||
height and width.`,re,pe,s,a,l,c,n),P.createElement("div",P1({id:x?"".concat(x):void 0,className:tr("recharts-responsive-container",S),style:wI(wI({},M),{},{width:s,height:a,minWidth:l,minHeight:c,maxHeight:d}),ref:C},T),P.createElement("div",{style:MZ({width:s,height:a})},P.createElement(z4,{width:re,height:pe},f)))}),FZ=P.forwardRef((t,e)=>{var n=YP();if(Ol(n.width)&&Ol(n.height))return t.children;var r=EZ({width:t.width,height:t.height,aspect:t.aspect}),i=r.width,s=r.height,a=U4(void 0,void 0,{width:i,height:s,aspect:t.aspect,maxHeight:t.maxHeight}),o=a.calculatedWidth,l=a.calculatedHeight;return It(o)&&It(l)?P.createElement(z4,{width:o,height:l},t.children):P.createElement(UZ,P1({},t,{width:i,height:s,ref:e}))});function ZP(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 MS=()=>{var t,e=ta(),n=Ft(mZ),r=Ft(SS),i=(t=Ft(wS))===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}},zZ={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},B4=()=>{var t;return(t=Ft(Wi))!==null&&t!==void 0?t:zZ},H4=()=>Ft(ru),V4=()=>Ft(iu),hr=t=>t.layout.layoutType,Yg=()=>Ft(hr),QP=()=>{var t=Yg();if(t==="horizontal"||t==="vertical")return t},G4=t=>{var e=t.layout.layoutType;if(e==="centric"||e==="radial")return e},BZ=()=>{var t=Yg();return t!==void 0},tx=t=>{var e=Wr(),n=ta(),r=t.width,i=t.height,s=YP(),a=r,o=i;return s&&(a=s.width>0?s.width:r,o=s.height>0?s.height:i),P.useEffect(()=>{!n&&Ol(a)&&Ol(o)&&e(BY({width:a,height:o}))},[e,n,a,o]),null},W4=Symbol.for("immer-nothing"),MI=Symbol.for("immer-draftable"),Ta=Symbol.for("immer-state");function Fo(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var by=Object.getPrototypeOf;function Ng(t){return!!t&&!!t[Ta]}function Bh(t){var e;return t?$4(t)||Array.isArray(t)||!!t[MI]||!!((e=t.constructor)!=null&&e[MI])||nx(t)||AS(t):!1}var HZ=Object.prototype.constructor.toString(),EI=new WeakMap;function $4(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=EI.get(n);return r===void 0&&(r=Function.toString.call(n),EI.set(n,r)),r===HZ}function R1(t,e,n=!0){ES(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 ES(t){const e=t[Ta];return e?e.type_:Array.isArray(t)?1:nx(t)?2:AS(t)?3:0}function vC(t,e){return ES(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function X4(t,e,n){const r=ES(t);r===2?t.set(e,n):r===3?t.add(n):t[e]=n}function VZ(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function nx(t){return t instanceof Map}function AS(t){return t instanceof Set}function Qf(t){return t.copy_||t.base_}function yC(t,e){if(nx(t))return new Map(t);if(AS(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=$4(t);if(e===!0||e==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(t);delete r[Ta];let i=Reflect.ownKeys(r);for(let s=0;s<i.length;s++){const a=i[s],o=r[a];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[a]={configurable:!0,writable:!0,enumerable:o.enumerable,value:t[a]})}return Object.create(by(t),r)}else{const r=by(t);if(r!==null&&n)return{...t};const i=Object.create(r);return Object.assign(i,t)}}function JP(t,e=!1){return TS(t)||Ng(t)||!Bh(t)||(ES(t)>1&&Object.defineProperties(t,{set:Lb,add:Lb,clear:Lb,delete:Lb}),Object.freeze(t),e&&Object.values(t).forEach(n=>JP(n,!0))),t}function GZ(){Fo(2)}var Lb={value:GZ};function TS(t){return t===null||typeof t!="object"?!0:Object.isFrozen(t)}var WZ={};function Hh(t){const e=WZ[t];return e||Fo(0,t),e}var _y;function q4(){return _y}function $Z(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function AI(t,e){e&&(Hh("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function xC(t){bC(t),t.drafts_.forEach(XZ),t.drafts_=null}function bC(t){t===_y&&(_y=t.parent_)}function TI(t){return _y=$Z(_y,t)}function XZ(t){const e=t[Ta];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function CI(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[Ta].modified_&&(xC(e),Fo(4)),Bh(t)&&(t=N1(e,t),e.parent_||k1(e,t)),e.patches_&&Hh("Patches").generateReplacementPatches_(n[Ta].base_,t,e.patches_,e.inversePatches_)):t=N1(e,n,[]),xC(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==W4?t:void 0}function N1(t,e,n){if(TS(e))return e;const r=t.immer_.shouldUseStrictIteration(),i=e[Ta];if(!i)return R1(e,(s,a)=>PI(t,i,e,s,a,n),r),e;if(i.scope_!==t)return e;if(!i.modified_)return k1(t,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const s=i.copy_;let a=s,o=!1;i.type_===3&&(a=new Set(s),s.clear(),o=!0),R1(a,(l,c)=>PI(t,i,s,l,c,n,o),r),k1(t,s,!1),n&&t.patches_&&Hh("Patches").generatePatches_(i,n,t.patches_,t.inversePatches_)}return i.copy_}function PI(t,e,n,r,i,s,a){if(i==null||typeof i!="object"&&!a)return;const o=TS(i);if(!(o&&!a)){if(Ng(i)){const l=s&&e&&e.type_!==3&&!vC(e.assigned_,r)?s.concat(r):void 0,c=N1(t,i,l);if(X4(n,r,c),Ng(c))t.canAutoFreeze_=!1;else return}else a&&n.add(i);if(Bh(i)&&!o){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1||e&&e.base_&&e.base_[r]===i&&o)return;N1(t,i),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&(nx(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&k1(t,i)}}}function k1(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&JP(e,n)}function qZ(t,e){const n=Array.isArray(t),r={type_:n?1:0,scope_:e?e.scope_:q4(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,s=e2;n&&(i=[r],s=wy);const{revoke:a,proxy:o}=Proxy.revocable(i,s);return r.draft_=o,r.revoke_=a,o}var e2={get(t,e){if(e===Ta)return t;const n=Qf(t);if(!vC(n,e))return KZ(t,n,e);const r=n[e];return t.finalized_||!Bh(r)?r:r===PE(t.base_,e)?(RE(t),t.copy_[e]=wC(r,t)):r},has(t,e){return e in Qf(t)},ownKeys(t){return Reflect.ownKeys(Qf(t))},set(t,e,n){const r=K4(Qf(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=PE(Qf(t),e),s=i==null?void 0:i[Ta];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(VZ(n,i)&&(n!==void 0||vC(t.base_,e)))return!0;RE(t),_C(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return PE(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,RE(t),_C(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Qf(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:r.enumerable,value:n[e]}},defineProperty(){Fo(11)},getPrototypeOf(t){return by(t.base_)},setPrototypeOf(){Fo(12)}},wy={};R1(e2,(t,e)=>{wy[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});wy.deleteProperty=function(t,e){return wy.set.call(this,t,e,void 0)};wy.set=function(t,e,n){return e2.set.call(this,t[0],e,n,t[0])};function PE(t,e){const n=t[Ta];return(n?Qf(n):t)[e]}function KZ(t,e,n){var i;const r=K4(e,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function K4(t,e){if(!(e in t))return;let n=by(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=by(n)}}function _C(t){t.modified_||(t.modified_=!0,t.parent_&&_C(t.parent_))}function RE(t){t.copy_||(t.copy_=yC(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var YZ=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,n,r)=>{if(typeof e=="function"&&typeof n!="function"){const s=n;n=e;const a=this;return function(l=s,...c){return a.produce(l,d=>n.call(this,d,...c))}}typeof n!="function"&&Fo(6),r!==void 0&&typeof r!="function"&&Fo(7);let i;if(Bh(e)){const s=TI(this),a=wC(e,void 0);let o=!0;try{i=n(a),o=!1}finally{o?xC(s):bC(s)}return AI(s,r),CI(i,s)}else if(!e||typeof e!="object"){if(i=n(e),i===void 0&&(i=e),i===W4&&(i=void 0),this.autoFreeze_&&JP(i,!0),r){const s=[],a=[];Hh("Patches").generateReplacementPatches_(e,i,s,a),r(s,a)}return i}else Fo(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(a,...o)=>this.produceWithPatches(a,l=>e(l,...o));let r,i;return[this.produce(e,n,(a,o)=>{r=a,i=o}),r,i]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),typeof(t==null?void 0:t.useStrictIteration)=="boolean"&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Bh(t)||Fo(8),Ng(t)&&(t=ZZ(t));const e=TI(this),n=wC(t,void 0);return n[Ta].isManual_=!0,bC(e),n}finishDraft(t,e){const n=t&&t[Ta];(!n||!n.isManual_)&&Fo(9);const{scope_:r}=n;return AI(r,e),CI(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=Hh("Patches").applyPatches_;return Ng(t)?r(t,e):this.produce(t,i=>r(i,e))}};function wC(t,e){const n=nx(t)?Hh("MapSet").proxyMap_(t,e):AS(t)?Hh("MapSet").proxySet_(t,e):qZ(t,e);return(e?e.scope_:q4()).drafts_.push(n),n}function ZZ(t){return Ng(t)||Fo(10,t),Y4(t)}function Y4(t){if(!Bh(t)||TS(t))return t;const e=t[Ta];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=yC(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=yC(t,!0);return R1(n,(i,s)=>{X4(n,i,Y4(s))},r),e&&(e.finalized_=!1),n}var QZ=new YZ;QZ.produce;var JZ={settings:{layout:"horizontal",align:"center",verticalAlign:"bottom",itemSorter:"value"},size:{width:0,height:0},payload:[]},Z4=cs({name:"legend",initialState:JZ,reducers:{setLegendSize(t,e){t.size.width=e.payload.width,t.size.height=e.payload.height},setLegendSettings(t,e){t.settings.align=e.payload.align,t.settings.layout=e.payload.layout,t.settings.verticalAlign=e.payload.verticalAlign,t.settings.itemSorter=e.payload.itemSorter},addLegendPayload:{reducer(t,e){t.payload.push(e.payload)},prepare:ar()},replaceLegendPayload:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=$a(t).payload.indexOf(r);s>-1&&(t.payload[s]=i)},prepare:ar()},removeLegendPayload:{reducer(t,e){var n=$a(t).payload.indexOf(e.payload);n>-1&&t.payload.splice(n,1)},prepare:ar()}}}),rx=Z4.actions;rx.setLegendSize;rx.setLegendSettings;var eQ=rx.addLegendPayload,tQ=rx.replaceLegendPayload,nQ=rx.removeLegendPayload,rQ=Z4.reducer,NE={exports:{}},kE={};/**
|
||
* @license React
|
||
* use-sync-external-store-with-selector.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var RI;function iQ(){if(RI)return kE;RI=1;var t=ep();function e(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,i=t.useRef,s=t.useEffect,a=t.useMemo,o=t.useDebugValue;return kE.useSyncExternalStoreWithSelector=function(l,c,d,f,p){var y=i(null);if(y.current===null){var x={hasValue:!1,value:null};y.current=x}else x=y.current;y=a(function(){function w(L){if(!b){if(b=!0,M=L,L=f(L),p!==void 0&&x.hasValue){var N=x.value;if(p(N,L))return T=N}return T=L}if(N=T,n(M,L))return N;var D=f(L);return p!==void 0&&p(N,D)?(M=L,N):(M=L,T=D)}var b=!1,M,T,C=d===void 0?null:d;return[function(){return w(c())},C===null?void 0:function(){return w(C())}]},[c,d,f,p]);var S=r(l,y[0],y[1]);return s(function(){x.hasValue=!0,x.value=S},[S]),o(S),S},kE}var NI;function sQ(){return NI||(NI=1,NE.exports=iQ()),NE.exports}sQ();function aQ(t){t()}function oQ(){let t=null,e=null;return{clear(){t=null,e=null},notify(){aQ(()=>{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 kI={notify(){},get:()=>[]};function lQ(t,e){let n,r=kI,i=0,s=!1;function a(S){d();const w=r.subscribe(S);let b=!1;return()=>{b||(b=!0,w(),f())}}function o(){r.notify()}function l(){x.onStateChange&&x.onStateChange()}function c(){return s}function d(){i++,n||(n=t.subscribe(l),r=oQ())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=kI)}function p(){s||(s=!0,d())}function y(){s&&(s=!1,f())}const x={addNestedSub:a,notifyNestedSubs:o,handleChangeWrapper:l,isSubscribed:c,trySubscribe:p,tryUnsubscribe:y,getListeners:()=>r};return x}var cQ=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",uQ=cQ(),dQ=()=>typeof navigator<"u"&&navigator.product==="ReactNative",fQ=dQ(),hQ=()=>uQ||fQ?P.useLayoutEffect:P.useEffect,pQ=hQ();function II(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function mQ(t,e){if(II(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<n.length;i++)if(!Object.prototype.hasOwnProperty.call(e,n[i])||!II(t[n[i]],e[n[i]]))return!1;return!0}var IE=Symbol.for("react-redux-context"),LE=typeof globalThis<"u"?globalThis:{};function gQ(){if(!P.createContext)return{};const t=LE[IE]??(LE[IE]=new Map);let e=t.get(P.createContext);return e||(e=P.createContext(null),t.set(P.createContext,e)),e}var vQ=gQ();function yQ(t){const{children:e,context:n,serverState:r,store:i}=t,s=P.useMemo(()=>{const l=lQ(i);return{store:i,subscription:l,getServerState:r?()=>r:void 0}},[i,r]),a=P.useMemo(()=>i.getState(),[i]);pQ(()=>{const{subscription:l}=s;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),a!==i.getState()&&l.notifyNestedSubs(),()=>{l.tryUnsubscribe(),l.onStateChange=void 0}},[s,a]);const o=n||vQ;return P.createElement(o.Provider,{value:s},e)}var xQ=yQ,bQ=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius","throttledEvents"]);function _Q(t,e){return t==null&&e==null?!0:typeof t=="number"&&typeof e=="number"?t===e||t!==t&&e!==e:t===e}function CS(t,e){var n=new Set([...Object.keys(t),...Object.keys(e)]);for(var r of n)if(bQ.has(r)){if(t[r]==null&&e[r]==null)continue;if(!mQ(t[r],e[r]))return!1}else if(!_Q(t[r],e[r]))return!1;return!0}function SC(){return SC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},SC.apply(null,arguments)}function LI(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 d0(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?LI(Object(n),!0).forEach(function(r){wQ(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):LI(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function wQ(t,e,n){return(e=SQ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function SQ(t){var e=MQ(t,"string");return typeof e=="symbol"?e:e+""}function MQ(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)}function EQ(t,e){return PQ(t)||CQ(t,e)||TQ(t,e)||AQ()}function AQ(){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 TQ(t,e){if(t){if(typeof t=="string")return OI(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)?OI(t,e):void 0}}function OI(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function CQ(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function PQ(t){if(Array.isArray(t))return t}function RQ(t){return Array.isArray(t)&&Ll(t[0])&&Ll(t[1])?t.join(" ~ "):t}var pm={separator:" : ",contentStyle:{margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},itemStyle:{display:"block",paddingTop:4,paddingBottom:4,color:"#000"},labelStyle:{},accessibilityLayer:!1};function NQ(t,e){return e==null?t:cS(t,e)}var kQ=t=>{var e=t.separator,n=e===void 0?pm.separator:e,r=t.contentStyle,i=t.itemStyle,s=t.labelStyle,a=s===void 0?pm.labelStyle:s,o=t.payload,l=t.formatter,c=t.itemSorter,d=t.wrapperClassName,f=t.labelClassName,p=t.label,y=t.labelFormatter,x=t.accessibilityLayer,S=x===void 0?pm.accessibilityLayer:x,w=()=>{if(o&&o.length){var F={padding:0,margin:0},V=NQ(o,c),I=V.map((U,X)=>{if(!U||U.type==="none")return null;var te=U.formatter||l||RQ,re=U.value,pe=U.name,ee=re,ce=pe;if(te){var B=te(re,pe,U,X,o);if(Array.isArray(B)){var J=EQ(B,2);ee=J[0],ce=J[1]}else if(B!=null)ee=B;else return null}var Z=d0(d0({},pm.itemStyle),{},{color:U.color||pm.itemStyle.color},i);return P.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(X),style:Z},Ll(ce)?P.createElement("span",{className:"recharts-tooltip-item-name"},ce):null,Ll(ce)?P.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,P.createElement("span",{className:"recharts-tooltip-item-value"},ee),P.createElement("span",{className:"recharts-tooltip-item-unit"},U.unit||""))});return P.createElement("ul",{className:"recharts-tooltip-item-list",style:F},I)}return null},b=d0(d0({},pm.contentStyle),r),M=d0({margin:0},a),T=!Vi(p),C=T?p:"",L=tr("recharts-default-tooltip",d),N=tr("recharts-tooltip-label",f);T&&y&&o!==void 0&&o!==null&&(C=y(p,o));var D=S?{role:"status","aria-live":"assertive"}:{};return P.createElement("div",SC({className:L,style:b},D),P.createElement("p",{className:N,style:M},P.isValidElement(C)?C:"".concat(C)),w())},f0="recharts-tooltip-wrapper",IQ={visibility:"hidden"};function LQ(t){var e=t.coordinate,n=t.translateX,r=t.translateY;return tr(f0,{["".concat(f0,"-right")]:It(n)&&e&&It(e.x)&&n>=e.x,["".concat(f0,"-left")]:It(n)&&e&&It(e.x)&&n<e.x,["".concat(f0,"-bottom")]:It(r)&&e&&It(e.y)&&r>=e.y,["".concat(f0,"-top")]:It(r)&&e&&It(e.y)&&r<e.y})}function DI(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.key,i=t.offset,s=t.position,a=t.reverseDirection,o=t.tooltipDimension,l=t.viewBox,c=t.viewBoxDimension;if(s&&It(s[r]))return s[r];var d=n[r]-o-(i>0?i:0),f=n[r]+i;if(e[r])return a[r]?d:f;var p=l[r];if(p==null)return 0;if(a[r]){var y=d,x=p;return y<x?Math.max(f,p):Math.max(d,p)}if(c==null)return 0;var S=f+o,w=p+c;return S>w?Math.max(d,p):Math.max(f,p)}function OQ(t){var e=t.translateX,n=t.translateY,r=t.useTranslate3d;return{transform:r?"translate3d(".concat(e,"px, ").concat(n,"px, 0)"):"translate(".concat(e,"px, ").concat(n,"px)")}}function DQ(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.offsetTop,i=t.offsetLeft,s=t.position,a=t.reverseDirection,o=t.tooltipBox,l=t.useTranslate3d,c=t.viewBox,d,f,p;return o.height>0&&o.width>0&&n?(f=DI({allowEscapeViewBox:e,coordinate:n,key:"x",offset:i,position:s,reverseDirection:a,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),p=DI({allowEscapeViewBox:e,coordinate:n,key:"y",offset:r,position:s,reverseDirection:a,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),d=OQ({translateX:f,translateY:p,useTranslate3d:l})):d=IQ,{cssProperties:d,cssClasses:LQ({translateX:f,translateY:p,coordinate:n})}}var jQ=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),ix={isSsr:jQ()};function UQ(t,e){return HQ(t)||BQ(t,e)||zQ(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 zQ(t,e){if(t){if(typeof t=="string")return jI(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)?jI(t,e):void 0}}function jI(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function BQ(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function HQ(t){if(Array.isArray(t))return t}function Q4(){var t=P.useState(()=>ix.isSsr||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches),e=UQ(t,2),n=e[0],r=e[1];return P.useEffect(()=>{if(window.matchMedia){var i=window.matchMedia("(prefers-reduced-motion: reduce)"),s=()=>{r(i.matches)};return i.addEventListener("change",s),()=>{i.removeEventListener("change",s)}}},[]),n}function UI(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 mm(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?UI(Object(n),!0).forEach(function(r){VQ(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):UI(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function VQ(t,e,n){return(e=GQ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function GQ(t){var e=WQ(t,"string");return typeof e=="symbol"?e:e+""}function WQ(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)}function $Q(t,e){return YQ(t)||KQ(t,e)||qQ(t,e)||XQ()}function XQ(){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 qQ(t,e){if(t){if(typeof t=="string")return FI(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)?FI(t,e):void 0}}function FI(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function KQ(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function YQ(t){if(Array.isArray(t))return t}function ZQ(t){if(!(t.prefersReducedMotion&&t.isAnimationActive==="auto")&&t.isAnimationActive&&t.active){var e=typeof t.animationEasing=="string"?t.animationEasing:"ease";return"transform ".concat(t.animationDuration,"ms ").concat(e)}}function QQ(t){var e,n,r,i,s,a,o=Q4(),l=P.useState(()=>({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}})),c=$Q(l,2),d=c[0],f=c[1];P.useEffect(()=>{var b=M=>{if(M.key==="Escape"){var T,C,L,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:(L=(N=t.coordinate)===null||N===void 0?void 0:N.y)!==null&&L!==void 0?L:0}})}};return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b)}},[(e=t.coordinate)===null||e===void 0?void 0:e.x,(n=t.coordinate)===null||n===void 0?void 0:n.y]),d.dismissed&&(((r=(i=t.coordinate)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)!==d.dismissedAtCoordinate.x||((s=(a=t.coordinate)===null||a===void 0?void 0:a.y)!==null&&s!==void 0?s:0)!==d.dismissedAtCoordinate.y)&&f(mm(mm({},d),{},{dismissed:!1}));var p=DQ({allowEscapeViewBox:t.allowEscapeViewBox,coordinate:t.coordinate,offsetLeft:typeof t.offset=="number"?t.offset:t.offset.x,offsetTop:typeof t.offset=="number"?t.offset:t.offset.y,position:t.position,reverseDirection:t.reverseDirection,tooltipBox:{height:t.lastBoundingBox.height,width:t.lastBoundingBox.width},useTranslate3d:t.useTranslate3d,viewBox:t.viewBox}),y=p.cssClasses,x=p.cssProperties,S=t.hasPortalFromProps?{}:mm(mm({transition:ZQ({prefersReducedMotion:o,isAnimationActive:t.isAnimationActive,active:t.active,animationDuration:t.animationDuration,animationEasing:t.animationEasing})},x),{},{pointerEvents:"none",position:"absolute",top:0,left:0}),w=mm(mm({},S),{},{visibility:!d.dismissed&&t.active&&t.hasPayload?"visible":"hidden"},t.wrapperStyle);return P.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:y,style:w,ref:t.innerRef},t.children)}var JQ=P.memo(QQ),J4=()=>{var t;return(t=Ft(e=>e.rootProps.accessibilityLayer))!==null&&t!==void 0?t:!0};function MC(){return MC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},MC.apply(null,arguments)}function zI(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 BI(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?zI(Object(n),!0).forEach(function(r){eJ(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):zI(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function eJ(t,e,n){return(e=tJ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function tJ(t){var e=nJ(t,"string");return typeof e=="symbol"?e:e+""}function nJ(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 HI={curveBasisClosed:eq,curveBasisOpen:tq,curveBasis:JX,curveBumpX:ZX,curveBumpY:QX,curveLinearClosed:nq,curveLinear:oS,curveMonotoneX:rq,curveMonotoneY:iq,curveNatural:sq,curveStep:aq,curveStepAfter:lq,curveStepBefore:oq},I1=t=>wn(t.x)&&wn(t.y),VI=t=>t.base!=null&&I1(t.base)&&I1(t),h0=t=>t.x,p0=t=>t.y,rJ=(t,e)=>{if(typeof t=="function")return t;var n="curve".concat(zP(t));if((n==="curveMonotone"||n==="curveBump")&&e){var r=HI["".concat(n).concat(e==="vertical"?"Y":"X")];if(r)return r}return HI[n]||oS},GI={connectNulls:!1,type:"linear"},iJ=t=>{var e=t.type,n=e===void 0?GI.type:e,r=t.points,i=r===void 0?[]:r,s=t.baseLine,a=t.layout,o=t.connectNulls,l=o===void 0?GI.connectNulls:o,c=rJ(n,a),d=l?i.filter(I1):i;if(Array.isArray(s)){var f,p=i.map((b,M)=>BI(BI({},b),{},{base:s[M]}));a==="vertical"?f=Tb().y(p0).x1(h0).x0(b=>b.base.x):f=Tb().x(h0).y1(p0).y0(b=>b.base.y);var y=f.defined(VI).curve(c),x=l?p.filter(VI):p;return y(x)}var S;a==="vertical"&&It(s)?S=Tb().y(p0).x1(h0).x0(s):It(s)?S=Tb().x(h0).y1(p0).y0(s):S=CF().x(h0).y(p0);var w=S.defined(I1).curve(c);return w(d)},K_=t=>{var e=t.className,n=t.points,r=t.path,i=t.pathRef,s=Yg();if((!n||!n.length)&&!r)return null;var a={type:t.type,points:t.points,baseLine:t.baseLine,layout:t.layout||s,connectNulls:t.connectNulls},o=n&&n.length?iJ(a):r;return P.createElement("path",MC({},Bo(t),BP(t),{className:tr("recharts-curve",e),d:o===null?void 0:o,ref:i}))},sJ=["x","y","top","left","width","height","className"];function EC(){return EC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},EC.apply(null,arguments)}function WI(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 aJ(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?WI(Object(n),!0).forEach(function(r){oJ(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):WI(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function oJ(t,e,n){return(e=lJ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function lJ(t){var e=cJ(t,"string");return typeof e=="symbol"?e:e+""}function cJ(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)}function uJ(t,e){if(t==null)return{};var n,r,i=dJ(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function dJ(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var fJ=(t,e,n,r,i,s)=>"M".concat(t,",").concat(i,"v").concat(r,"M").concat(s,",").concat(e,"h").concat(n),hJ=t=>{var e=t.x,n=e===void 0?0:e,r=t.y,i=r===void 0?0:r,s=t.top,a=s===void 0?0:s,o=t.left,l=o===void 0?0:o,c=t.width,d=c===void 0?0:c,f=t.height,p=f===void 0?0:f,y=t.className,x=uJ(t,sJ),S=aJ({x:n,y:i,top:a,left:l,width:d,height:p},x);return!It(n)||!It(i)||!It(d)||!It(p)||!It(a)||!It(l)?null:P.createElement("path",EC({},Ka(S),{className:tr("recharts-cross",y),d:fJ(n,i,d,p,a,l)}))};function pJ(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 L1=1e-4,ez=(t,e)=>[0,3*t,3*e-6*t,3*t-3*e+1],tz=(t,e)=>t.map((n,r)=>n*e**r).reduce((n,r)=>n+r),$I=(t,e)=>n=>{var r=ez(t,e);return tz(r,n)},mJ=(t,e)=>n=>{var r=ez(t,e),i=[...r.map((s,a)=>s*a).slice(1),0];return tz(i,n)},gJ=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]]},vJ=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];if(n.length===1)switch(n[0]){case"linear":return[0,0,1,1];case"ease":return[.25,.1,.25,1];case"ease-in":return[.42,0,1,1];case"ease-out":return[.42,0,.58,1];case"ease-in-out":return[0,0,.58,1];default:{var i=gJ(n[0]);if(i)return i}}return n.length===4?n:[0,0,1,1]},yJ=(t,e,n,r)=>{var i=$I(t,n),s=$I(e,r),a=mJ(t,n),o=c=>c>1?1:c<0?0:c,l=c=>{for(var d=c>1?1:c,f=d,p=0;p<8;++p){var y=i(f)-d,x=a(f);if(Math.abs(y-d)<L1||x<L1)return s(f);f=o(f-y/x)}return s(f)};return l.isStepper=!1,l},XI=function(){return yJ(...vJ(...arguments))},xJ=function(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.stiff,r=n===void 0?100:n,i=e.damping,s=i===void 0?8:i,a=e.dt,o=a===void 0?16.67:a,l=1,c=[0],d=0,f=0,p=1e4,y=0;y<p;){var x=-(d-l)*r,S=f*s;if(f+=(x-S)*o/1e3,d+=f*o/1e3,c.push(d),Math.abs(d-l)<L1&&Math.abs(f)<L1)break;y++}c[c.length-1]=l;var w=c.length-1;return b=>{var M,T,C;if(b<=0)return 0;if(b>=1)return l;var L=b*w,N=Math.floor(L),D=L-N;return((M=c[N])!==null&&M!==void 0?M:0)+(((T=c[N+1])!==null&&T!==void 0?T:0)-((C=c[N])!==null&&C!==void 0?C:0))*D}},bJ=t=>{if(typeof t=="string")switch(t){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return XI(t);case"spring":return xJ();default:if(t.split("(")[0]==="cubic-bezier")return XI(t)}return typeof t=="function"?t:null},_J=(t,e,n)=>{var r,i=s=>{var a=e.tick(s);if(e.getState()==="active"){if(n(e.getInterpolated()),e.getProgress()===1){e.complete(),r=void 0;return}r=t.setTimeout(i,a);return}r=t.setTimeout(i,a)};return r=t.setTimeout(i,0),()=>{var s;return(s=r)===null||s===void 0?void 0:s()}},nz=P.createContext(_J);nz.Provider;function wJ(t){var e=P.useContext(nz);return P.useMemo(()=>t??e,[t,e])}function SJ(t,e,n){return(e=MJ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function MJ(t){var e=EJ(t,"string");return typeof e=="symbol"?e:e+""}function EJ(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var qI="init",KI="pending",YI="active",AJ="completed";function OE(t){return Math.max(0,t)}class TJ{getAnimationStartedTime(){return this.animationStartedTime}getBeginStartedTime(){return this.beginStartedTime}constructor(e){var n;SJ(this,"state",qI),this.animationId=e.animationId,this.onAnimationEnd=e.onAnimationEnd,this.animationDuration=OE(e.animationDuration),this.animationBegin=OE(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()===qI)return this.state=KI,this.beginStartedTime=e,this.animationBegin;if(this.getState()===KI){if(this.beginStartedTime==null)throw new Error;var n=e-this.beginStartedTime;return n>=this.animationBegin?(this.state=YI,this.animationStartedTime=e,this.nextAnimationUpdate(0)):OE(this.animationBegin-n)}if(this.getState()===YI){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=AJ}getFrom(){return this.from}getTo(){return this.to}getAnimationId(){return this.animationId}getAnimationBegin(){return this.animationBegin}}class CJ extends TJ{nextAnimationUpdate(){return 0}getInterpolated(){return this.easing(zc(this.getFrom(),this.getTo(),this.getProgress()))}}class PJ{setTimeout(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,s=a=>{a-r>=n?e(a):i=requestAnimationFrame(s)};return i=requestAnimationFrame(s),()=>{i!=null&&cancelAnimationFrame(i)}}}function RJ(t,e){return LJ(t)||IJ(t,e)||kJ(t,e)||NJ()}function NJ(){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 kJ(t,e){if(t){if(typeof t=="string")return ZI(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)?ZI(t,e):void 0}}function ZI(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function IJ(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function LJ(t){if(Array.isArray(t))return t}var OJ={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},QI=0,DE=1;function rz(t){var e=Ja(t,OJ),n=e.animationId,r=e.isActive,i=e.canBegin,s=e.duration,a=e.easing,o=e.begin,l=e.onAnimationEnd,c=e.onAnimationStart,d=e.children,f=Q4(),p=r==="auto"?!ix.isSsr&&!f:r,y=wJ(e.animationController),x=P.useState(p?QI:DE),S=RJ(x,2),w=S[0],b=S[1];return P.useEffect(()=>{p||b(DE)},[p]),P.useEffect(()=>{var M=bJ(a);if(!p||!i||M==null)return Kg;var T=new PJ,C=new CJ({animationId:n,easing:M,animationDuration:s,animationBegin:o,onAnimationStart:c,onAnimationEnd:l,from:QI,to:DE});return y(T,C,b)},[y,n,p,i,s,a,o,c,l]),d(Number(w))}function iz(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=P.useRef(gy(e)),r=P.useRef(t);return r.current!==t&&(n.current=gy(e),r.current=t),n.current}var DJ=t=>t.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase())),jJ=(t,e,n)=>t.map(r=>"".concat(DJ(r)," ").concat(e,"ms ").concat(n)).join(","),UJ=["radius"],FJ=["radius"],JI,eL,tL,nL,rL,iL,sL,aL,oL,lL;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 uL(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?cL(Object(n),!0).forEach(function(r){zJ(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):cL(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function zJ(t,e,n){return(e=BJ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function BJ(t){var e=HJ(t,"string");return typeof e=="symbol"?e:e+""}function HJ(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)}function O1(){return O1=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},O1.apply(null,arguments)}function dL(t,e){if(t==null)return{};var n,r,i=VJ(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function VJ(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function GJ(t,e){return qJ(t)||XJ(t,e)||$J(t,e)||WJ()}function WJ(){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 $J(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);n<e;n++)r[n]=t[n];return r}function XJ(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function qJ(t){if(Array.isArray(t))return t}function hl(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var hL=(t,e,n,r,i)=>{var s=wd(n),a=wd(r),o=Math.min(Math.abs(s)/2,Math.abs(a)/2),l=a>=0?1:-1,c=s>=0?1:-1,d=a>=0&&s>=0||a<0&&s<0?1:0,f;if(o>0&&Array.isArray(i)){for(var p=[0,0,0,0],y=0,x=4;y<x;y++){var S,w=(S=i[y])!==null&&S!==void 0?S:0;p[y]=w>o?o:w}f=ji(JI||(JI=hl(["M",",",""])),t,e+l*p[0]),p[0]>0&&(f+=ji(eL||(eL=hl(["A ",",",",0,0,",",",",",""])),p[0],p[0],d,t+c*p[0],e)),f+=ji(tL||(tL=hl(["L ",",",""])),t+n-c*p[1],e),p[1]>0&&(f+=ji(nL||(nL=hl(["A ",",",",0,0,",`,
|
||
`,",",""])),p[1],p[1],d,t+n,e+l*p[1])),f+=ji(rL||(rL=hl(["L ",",",""])),t+n,e+r-l*p[2]),p[2]>0&&(f+=ji(iL||(iL=hl(["A ",",",",0,0,",`,
|
||
`,",",""])),p[2],p[2],d,t+n-c*p[2],e+r)),f+=ji(sL||(sL=hl(["L ",",",""])),t+c*p[3],e+r),p[3]>0&&(f+=ji(aL||(aL=hl(["A ",",",",0,0,",`,
|
||
`,",",""])),p[3],p[3],d,t,e+r-l*p[3])),f+="Z"}else if(o>0&&i===+i&&i>0){var b=Math.min(o,i);f=ji(oL||(oL=hl(["M ",",",`
|
||
A `,",",",0,0,",",",",",`
|
||
L `,",",`
|
||
A `,",",",0,0,",",",",",`
|
||
L `,",",`
|
||
A `,",",",0,0,",",",",",`
|
||
L `,",",`
|
||
A `,",",",0,0,",",",","," Z"])),t,e+l*b,b,b,d,t+c*b,e,t+n-c*b,e,b,b,d,t+n,e+l*b,t+n,e+r-l*b,b,b,d,t+n-c*b,e+r,t+c*b,e+r,b,b,d,t,e+r-l*b)}else f=ji(lL||(lL=hl(["M ",","," h "," v "," h "," Z"])),t,e,n,r,-n);return f},pL={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},KJ=t=>{var e=Ja(t,pL),n=P.useRef(null),r=P.useState(-1),i=GJ(r,2),s=i[0],a=i[1];P.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var B=n.current.getTotalLength();B&&a(B)}catch{}},[]);var o=e.x,l=e.y,c=e.width,d=e.height,f=e.radius,p=e.className,y=e.animationEasing,x=e.animationDuration,S=e.animationBegin,w=e.isAnimationActive,b=e.isUpdateAnimationActive,M=P.useRef(c),T=P.useRef(d),C=P.useRef(o),L=P.useRef(l),N=P.useMemo(()=>({x:o,y:l,width:c,height:d,radius:f}),[o,l,c,d,f]),D=iz(N,"rectangle-");if(o!==+o||l!==+l||c!==+c||d!==+d||c===0||d===0)return null;var F=tr("recharts-rectangle",p);if(!b){var V=Ka(e);V.radius;var I=dL(V,UJ);return P.createElement("path",O1({},I,{x:wd(o),y:wd(l),width:wd(c),height:wd(d),radius:typeof f=="number"?f:void 0,className:F,d:hL(o,l,c,d,f)}))}var U=M.current,X=T.current,te=C.current,re=L.current,pe="0px ".concat(s===-1?1:s,"px"),ee="".concat(s,"px ").concat(s,"px"),ce=jJ(["strokeDasharray"],x,typeof y=="string"?y:pL.animationEasing);return P.createElement(rz,{animationId:D,key:D,canBegin:s>0,duration:x,easing:y,isActive:b,begin:S},B=>{var J=zc(U,c,B),Z=zc(X,d,B),G=zc(te,o,B),W=zc(re,l,B);n.current&&(M.current=J,T.current=Z,C.current=G,L.current=W);var oe;w?B>0?oe={transition:ce,strokeDasharray:ee}:oe={strokeDasharray:pe}:oe={strokeDasharray:ee};var se=Ka(e);se.radius;var le=dL(se,FJ);return P.createElement("path",O1({},le,{radius:typeof f=="number"?f:void 0,className:F,d:hL(G,W,J,Z,f),ref:n,style:uL(uL({},oe),e.style)}))})};function mL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function gL(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?mL(Object(n),!0).forEach(function(r){YJ(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):mL(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function YJ(t,e,n){return(e=ZJ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ZJ(t){var e=QJ(t,"string");return typeof e=="symbol"?e:e+""}function QJ(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 D1=Math.PI/180,JJ=t=>t*180/Math.PI,Bi=(t,e,n,r)=>({x:t+Math.cos(-D1*r)*n,y:e+Math.sin(-D1*r)*n}),eee=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},tee=(t,e)=>{var n=t.x,r=t.y,i=e.x,s=e.y;return Math.sqrt((n-i)**2+(r-s)**2)},nee=(t,e)=>{var n=t.x,r=t.y,i=e.cx,s=e.cy,a=tee({x:n,y:r},{x:i,y:s});if(a<=0)return{radius:a,angle:0};var o=(n-i)/a,l=Math.acos(o);return r>s&&(l=2*Math.PI-l),{radius:a,angle:JJ(l),angleInRadian:l}},ree=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}},iee=(t,e)=>{var n=e.startAngle,r=e.endAngle,i=Math.floor(n/360),s=Math.floor(r/360),a=Math.min(i,s);return t+a*360},see=(t,e)=>{var n=t.relativeX,r=t.relativeY,i=nee({x:n,y:r},e),s=i.radius,a=i.angle,o=e.innerRadius,l=e.outerRadius;if(s<o||s>l||s===0)return null;var c=ree(e),d=c.startAngle,f=c.endAngle,p=a,y;if(d<=f){for(;p>f;)p-=360;for(;p<d;)p+=360;y=p>=d&&p<=f}else{for(;p>d;)p-=360;for(;p<f;)p+=360;y=p>=f&&p<=d}return y?gL(gL({},e),{},{radius:s,angle:iee(p,e)}):null};function sz(t){var e=t.cx,n=t.cy,r=t.radius,i=t.startAngle,s=t.endAngle,a=Bi(e,n,r,i),o=Bi(e,n,r,s);return{points:[a,o],cx:e,cy:n,radius:r,startAngle:i,endAngle:s}}var vL,yL,xL,bL,_L,wL,SL;function AC(){return AC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},AC.apply(null,arguments)}function ch(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var aee=(t,e)=>{var n=Wa(e-t),r=Math.min(Math.abs(e-t),359.999);return n*r},Ob=t=>{var e=t.cx,n=t.cy,r=t.radius,i=t.angle,s=t.sign,a=t.isExternal,o=t.cornerRadius,l=t.cornerIsExternal,c=o*(a?1:-1)+r,d=Math.asin(o/c)/D1,f=l?i:i+s*d,p=Bi(e,n,c,f),y=Bi(e,n,r,f),x=l?i-s*d:i,S=Bi(e,n,c*Math.cos(d*D1),x);return{center:p,circleTangency:y,lineTangency:S,theta:d}},az=t=>{var e=t.cx,n=t.cy,r=t.innerRadius,i=t.outerRadius,s=t.startAngle,a=t.endAngle,o=aee(s,a),l=s+o,c=Bi(e,n,i,s),d=Bi(e,n,i,l),f=ji(vL||(vL=ch(["M ",",",`
|
||
A `,",",`,0,
|
||
`,",",`,
|
||
`,",",`
|
||
`])),c.x,c.y,i,i,+(Math.abs(o)>180),+(s>l),d.x,d.y);if(r>0){var p=Bi(e,n,r,s),y=Bi(e,n,r,l);f+=ji(yL||(yL=ch(["L ",",",`
|
||
A `,",",`,0,
|
||
`,",",`,
|
||
`,","," Z"])),y.x,y.y,r,r,+(Math.abs(o)>180),+(s<=l),p.x,p.y)}else f+=ji(xL||(xL=ch(["L ",","," Z"])),e,n);return f},oee=t=>{var e=t.cx,n=t.cy,r=t.innerRadius,i=t.outerRadius,s=t.cornerRadius,a=t.forceCornerRadius,o=t.cornerIsExternal,l=t.startAngle,c=t.endAngle,d=Wa(c-l),f=Ob({cx:e,cy:n,radius:i,angle:l,sign:d,cornerRadius:s,cornerIsExternal:o}),p=f.circleTangency,y=f.lineTangency,x=f.theta,S=Ob({cx:e,cy:n,radius:i,angle:c,sign:-d,cornerRadius:s,cornerIsExternal:o}),w=S.circleTangency,b=S.lineTangency,M=S.theta,T=o?Math.abs(l-c):Math.abs(l-c)-x-M;if(T<0)return a?ji(bL||(bL=ch(["M ",",",`
|
||
a`,",",",0,0,1,",`,0
|
||
a`,",",",0,0,1,",`,0
|
||
`])),y.x,y.y,s,s,s*2,s,s,-s*2):az({cx:e,cy:n,innerRadius:r,outerRadius:i,startAngle:l,endAngle:c});var C=ji(_L||(_L=ch(["M ",",",`
|
||
A`,",",",0,0,",",",",",`
|
||
A`,",",",0,",",",",",",",`
|
||
A`,",",",0,0,",",",",",`
|
||
`])),y.x,y.y,s,s,+(d<0),p.x,p.y,i,i,+(T>180),+(d<0),w.x,w.y,s,s,+(d<0),b.x,b.y);if(r>0){var L=Ob({cx:e,cy:n,radius:r,angle:l,sign:d,isExternal:!0,cornerRadius:s,cornerIsExternal:o}),N=L.circleTangency,D=L.lineTangency,F=L.theta,V=Ob({cx:e,cy:n,radius:r,angle:c,sign:-d,isExternal:!0,cornerRadius:s,cornerIsExternal:o}),I=V.circleTangency,U=V.lineTangency,X=V.theta,te=o?Math.abs(l-c):Math.abs(l-c)-F-X;if(te<0&&s===0)return"".concat(C,"L").concat(e,",").concat(n,"Z");C+=ji(wL||(wL=ch(["L",",",`
|
||
A`,",",",0,0,",",",",",`
|
||
A`,",",",0,",",",",",",",`
|
||
A`,",",",0,0,",",",",","Z"])),U.x,U.y,s,s,+(d<0),I.x,I.y,r,r,+(te>180),+(d>0),N.x,N.y,s,s,+(d<0),D.x,D.y)}else C+=ji(SL||(SL=ch(["L",",","Z"])),e,n);return C},lee={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},cee=t=>{var e=Ja(t,lee),n=e.cx,r=e.cy,i=e.innerRadius,s=e.outerRadius,a=e.cornerRadius,o=e.forceCornerRadius,l=e.cornerIsExternal,c=e.startAngle,d=e.endAngle,f=e.className;if(s<i||c===d)return null;var p=tr("recharts-sector",f),y=s-i,x=Nd(a,y,0,!0),S;return x>0&&Math.abs(c-d)<360?S=oee({cx:n,cy:r,innerRadius:i,outerRadius:s,cornerRadius:Math.min(x,y/2),forceCornerRadius:o,cornerIsExternal:l,startAngle:c,endAngle:d}):S=az({cx:n,cy:r,innerRadius:i,outerRadius:s,startAngle:c,endAngle:d}),P.createElement("path",AC({},Ka(e),{className:p,d:S}))};function uee(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(BF(e)){if(t==="centric"){var r=e.cx,i=e.cy,s=e.innerRadius,a=e.outerRadius,o=e.angle,l=Bi(r,i,s,o),c=Bi(r,i,a,o);return[{x:l.x,y:l.y},{x:c.x,y:c.y}]}return sz(e)}}function dee(t){return t4(t)?NaN:Number(t)}function jE(t){return t?(t=dee(t),t===1/0||t===-1/0?(t<0?-1:1)*Number.MAX_VALUE:t===t?t:0):t===0?t:0}function oz(t,e,n){n&&typeof n!="number"&&aC(t,e,n)&&(e=n=void 0),t=jE(t),e===void 0?(e=t,t=0):e=jE(e),n=n===void 0?t<e?1:-1:jE(n);const r=Math.max(Math.ceil((e-t)/(n||1)),0),i=new Array(r);for(let s=0;s<r;s++)i[s]=t,t+=n;return i}var Xo=t=>t.chartData,t2=ke([Xo],t=>{var e=t.chartData!=null?t.chartData.length-1:0;return{chartData:t.chartData,computedData:t.computedData,dataEndIndex:e,dataStartIndex:0}}),PS=(t,e,n,r)=>r?t2(t):Xo(t),fee=(t,e,n)=>n?t2(t):Xo(t),hee=ke([PS],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});ke([t2],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});var pee=ke([Xo],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});function n2(t,e){return yee(t)||vee(t,e)||gee(t,e)||mee()}function mee(){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 gee(t,e){if(t){if(typeof t=="string")return ML(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)?ML(t,e):void 0}}function ML(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function vee(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function yee(t){if(Array.isArray(t))return t}function Al(t){if(Array.isArray(t)&&t.length===2){var e=n2(t,2),n=e[0],r=e[1];if(wn(n)&&wn(r))return!0}return!1}function EL(t,e,n){return n?t:[Math.min(t[0],e[0]),Math.max(t[1],e[1])]}function lz(t,e){if(e&&typeof t!="function"&&Array.isArray(t)&&t.length===2){var n=n2(t,2),r=n[0],i=n[1],s,a;if(wn(r))s=r;else if(typeof r=="function")return;if(wn(i))a=i;else if(typeof i=="function")return;var o=[s,a];if(Al(o))return o}}function xee(t,e,n){if(!(!n&&e==null)){if(typeof t=="function"&&e!=null)try{var r=t(e,n);if(Al(r))return EL(r,e,n)}catch{}if(Array.isArray(t)&&t.length===2){var i=n2(t,2),s=i[0],a=i[1],o,l;if(s==="auto")e!=null&&(o=Math.min(...e));else if(It(s))o=s;else if(typeof s=="function")try{e!=null&&(o=s(e==null?void 0:e[0]))}catch{}else if(typeof s=="string"&&vI.test(s)){var c=vI.exec(s);if(c==null||c[1]==null||e==null)o=void 0;else{var d=+c[1];o=e[0]-d}}else o=e==null?void 0:e[0];if(a==="auto")e!=null&&(l=Math.max(...e));else if(It(a))l=a;else if(typeof a=="function")try{e!=null&&(l=a(e==null?void 0:e[1]))}catch{}else if(typeof a=="string"&&yI.test(a)){var f=yI.exec(a);if(f==null||f[1]==null||e==null)l=void 0;else{var p=+f[1];l=e[1]+p}}else l=e==null?void 0:e[1];var y=[o,l];if(Al(y))return e==null?y:EL(y,e,n)}}}var Zg=1e9,bee={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},i2,dr=!0,Za="[DecimalError] ",Rh=Za+"Invalid argument: ",r2=Za+"Exponent out of range: ",Qg=Math.floor,Jf=Math.pow,_ee=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ba,vi=1e7,or=7,cz=9007199254740991,j1=Qg(cz/or),Tt={};Tt.absoluteValue=Tt.abs=function(){var t=new this.constructor(this);return t.s&&(t.s=1),t};Tt.comparedTo=Tt.cmp=function(t){var e,n,r,i,s=this;if(t=new s.constructor(t),s.s!==t.s)return s.s||-t.s;if(s.e!==t.e)return s.e>t.e^s.s<0?1:-1;for(r=s.d.length,i=t.d.length,e=0,n=r<i?r:i;e<n;++e)if(s.d[e]!==t.d[e])return s.d[e]>t.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 Wc(this,new this.constructor(t))};Tt.dividedToIntegerBy=Tt.idiv=function(t){var e=this,n=e.constructor;return Zn(Wc(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(ba))throw Error(Za+"NaN");if(n.s<1)throw Error(Za+(n.s?"NaN":"-Infinity"));return n.eq(ba)?new r(0):(dr=!1,e=Wc(Sy(n,s),Sy(t,s),s),dr=!0,Zn(e,i))};Tt.minus=Tt.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?fz(e,t):uz(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(Za+"NaN");return n.s?(dr=!1,e=Wc(n,t,0,1).times(t),dr=!0,n.minus(e)):Zn(new r(n),i)};Tt.naturalExponential=Tt.exp=function(){return dz(this)};Tt.naturalLogarithm=Tt.ln=function(){return Sy(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?uz(e,t):fz(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(Rh+t);if(e=Vr(i)+1,r=i.d.length-1,n=r*or+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return t&&e>n?e:n};Tt.squareRoot=Tt.sqrt=function(){var t,e,n,r,i,s,a,o=this,l=o.constructor;if(o.s<1){if(!o.s)return new l(0);throw Error(Za+"NaN")}for(t=Vr(o),dr=!1,i=Math.sqrt(+o),i==0||i==1/0?(e=Ml(o.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=Qg((t+1)/2)-(t<0||t%2),i==1/0?e="5e"+t:(e=i.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),r=new l(e)):r=new l(i.toString()),n=l.precision,i=a=n+3;;)if(s=r,r=s.plus(Wc(o,s,a+2)).times(.5),Ml(s.d).slice(0,a)===(e=Ml(r.d)).slice(0,a)){if(e=e.slice(a-3,a+1),i==a&&e=="4999"){if(Zn(s,n+1,0),s.times(s).eq(o)){r=s;break}}else if(e!="9999")break;a+=4}return dr=!0,Zn(r,n)};Tt.times=Tt.mul=function(t){var e,n,r,i,s,a,o,l,c,d=this,f=d.constructor,p=d.d,y=(t=new f(t)).d;if(!d.s||!t.s)return new f(0);for(t.s*=d.s,n=d.e+t.e,l=p.length,c=y.length,l<c&&(s=p,p=y,y=s,a=l,l=c,c=a),s=[],a=l+c,r=a;r--;)s.push(0);for(r=c;--r>=0;){for(e=0,i=l+r;i>r;)o=s[i]+y[r]*p[i-r-1]+e,s[i--]=o%vi|0,e=o/vi|0;s[i]=(s[i]+e)%vi|0}for(;!s[--a];)s.pop();return e?++n:s.shift(),t.d=s,t.e=n,dr?Zn(t,f.precision):t};Tt.toDecimalPlaces=Tt.todp=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(Dl(t,0,Zg),e===void 0?e=r.rounding:Dl(e,0,8),Zn(n,t+Vr(n)+1,e))};Tt.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=Vh(r,!0):(Dl(t,0,Zg),e===void 0?e=i.rounding:Dl(e,0,8),r=Zn(new i(r),t+1,e),n=Vh(r,!0,t+1)),n};Tt.toFixed=function(t,e){var n,r,i=this,s=i.constructor;return t===void 0?Vh(i):(Dl(t,0,Zg),e===void 0?e=s.rounding:Dl(e,0,8),r=Zn(new s(i),t+Vr(i)+1,e),n=Vh(r.abs(),!1,t+Vr(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};Tt.toInteger=Tt.toint=function(){var t=this,e=t.constructor;return Zn(new e(t),Vr(t)+1,e.rounding)};Tt.toNumber=function(){return+this};Tt.toPower=Tt.pow=function(t){var e,n,r,i,s,a,o=this,l=o.constructor,c=12,d=+(t=new l(t));if(!t.s)return new l(ba);if(o=new l(o),!o.s){if(t.s<1)throw Error(Za+"Infinity");return o}if(o.eq(ba))return o;if(r=l.precision,t.eq(ba))return Zn(o,r);if(e=t.e,n=t.d.length-1,a=e>=n,s=o.s,a){if((n=d<0?-d:d)<=cz){for(i=new l(ba),e=Math.ceil(r/or+4),dr=!1;n%2&&(i=i.times(o),TL(i.d,e)),n=Qg(n/2),n!==0;)o=o.times(o),TL(o.d,e);return dr=!0,t.s<0?new l(ba).div(i):Zn(i,r)}}else if(s<0)throw Error(Za+"NaN");return s=s<0&&t.d[Math.max(e,n)]&1?-1:1,o.s=1,dr=!1,i=t.times(Sy(o,r+c)),dr=!0,i=dz(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=Vh(i,n<=s.toExpNeg||n>=s.toExpPos)):(Dl(t,1,Zg),e===void 0?e=s.rounding:Dl(e,0,8),i=Zn(new s(i),t,e),n=Vr(i),r=Vh(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,Zg),e===void 0?e=r.rounding:Dl(e,0,8)),Zn(new r(n),t,e)};Tt.toString=Tt.valueOf=Tt.val=Tt.toJSON=Tt[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=Vr(t),n=t.constructor;return Vh(t,e<=n.toExpNeg||e>=n.toExpPos)};function uz(t,e){var n,r,i,s,a,o,l,c,d=t.constructor,f=d.precision;if(!t.s||!e.s)return e.s||(e=new d(t)),dr?Zn(e,f):e;if(l=t.d,c=e.d,a=t.e,i=e.e,l=l.slice(),s=a-i,s){for(s<0?(r=l,s=-s,o=c.length):(r=c,i=a,o=l.length),a=Math.ceil(f/or),o=a>o?a+1:o+1,s>o&&(s=o,r.length=1),r.reverse();s--;)r.push(0);r.reverse()}for(o=l.length,s=c.length,o-s<0&&(s=o,r=c,c=l,l=r),n=0;s;)n=(l[--s]=l[s]+c[s]+n)/vi|0,l[s]%=vi;for(n&&(l.unshift(n),++i),o=l.length;l[--o]==0;)l.pop();return e.d=l,e.e=i,dr?Zn(e,f):e}function Dl(t,e,n){if(t!==~~t||t<e||t>n)throw Error(Rh+t)}function Ml(t){var e,n,r,i=t.length-1,s="",a=t[0];if(i>0){for(s+=a,e=1;e<i;e++)r=t[e]+"",n=or-r.length,n&&(s+=ud(n)),s+=r;a=t[e],r=a+"",n=or-r.length,n&&(s+=ud(n))}else if(a===0)return"0";for(;a%10===0;)a/=10;return s+a}var Wc=(function(){function t(r,i){var s,a=0,o=r.length;for(r=r.slice();o--;)s=r[o]*i+a,r[o]=s%vi|0,a=s/vi|0;return a&&r.unshift(a),r}function e(r,i,s,a){var o,l;if(s!=a)l=s>a?1:-1;else for(o=l=0;o<s;o++)if(r[o]!=i[o]){l=r[o]>i[o]?1:-1;break}return l}function n(r,i,s){for(var a=0;s--;)r[s]-=a,a=r[s]<i[s]?1:0,r[s]=a*vi+r[s]-i[s];for(;!r[0]&&r.length>1;)r.shift()}return function(r,i,s,a){var o,l,c,d,f,p,y,x,S,w,b,M,T,C,L,N,D,F,V=r.constructor,I=r.s==i.s?1:-1,U=r.d,X=i.d;if(!r.s)return new V(r);if(!i.s)throw Error(Za+"Division by zero");for(l=r.e-i.e,D=X.length,L=U.length,y=new V(I),x=y.d=[],c=0;X[c]==(U[c]||0);)++c;if(X[c]>(U[c]||0)&&--l,s==null?M=s=V.precision:a?M=s+(Vr(r)-Vr(i))+1:M=s,M<0)return new V(0);if(M=M/or+2|0,c=0,D==1)for(d=0,X=X[0],M++;(c<L||d)&&M--;c++)T=d*vi+(U[c]||0),x[c]=T/X|0,d=T%X|0;else{for(d=vi/(X[0]+1)|0,d>1&&(X=t(X,d),U=t(U,d),D=X.length,L=U.length),C=D,S=U.slice(0,D),w=S.length;w<D;)S[w++]=0;F=X.slice(),F.unshift(0),N=X[0],X[1]>=vi/2&&++N;do d=0,o=e(X,S,D,w),o<0?(b=S[0],D!=w&&(b=b*vi+(S[1]||0)),d=b/N|0,d>1?(d>=vi&&(d=vi-1),f=t(X,d),p=f.length,w=S.length,o=e(f,S,p,w),o==1&&(d--,n(f,D<p?F:X,p))):(d==0&&(o=d=1),f=X.slice()),p=f.length,p<w&&f.unshift(0),n(S,f,w),o==-1&&(w=S.length,o=e(X,S,D,w),o<1&&(d++,n(S,D<w?F:X,w))),w=S.length):o===0&&(d++,S=[0]),x[c++]=d,o&&S[0]?S[w++]=U[C]||0:(S=[U[C]],w=1);while((C++<L||S[0]!==void 0)&&M--)}return x[0]||x.shift(),y.e=l,Zn(y,a?s+Vr(y)+1:s)}})();function dz(t,e){var n,r,i,s,a,o,l=0,c=0,d=t.constructor,f=d.precision;if(Vr(t)>16)throw Error(r2+Vr(t));if(!t.s)return new d(ba);for(dr=!1,o=f,a=new d(.03125);t.abs().gte(.1);)t=t.times(a),c+=5;for(r=Math.log(Jf(2,c))/Math.LN10*2+5|0,o+=r,n=i=s=new d(ba),d.precision=o;;){if(i=Zn(i.times(t),o),n=n.times(++l),a=s.plus(Wc(i,n,o)),Ml(a.d).slice(0,o)===Ml(s.d).slice(0,o)){for(;c--;)s=Zn(s.times(s),o);return d.precision=f,e==null?(dr=!0,Zn(s,f)):s}s=a}}function Vr(t){for(var e=t.e*or,n=t.d[0];n>=10;n/=10)e++;return e}function UE(t,e,n){if(e>t.LN10.sd())throw dr=!0,n&&(t.precision=n),Error(Za+"LN10 precision limit exceeded");return Zn(new t(t.LN10),e)}function ud(t){for(var e="";t--;)e+="0";return e}function Sy(t,e){var n,r,i,s,a,o,l,c,d,f=1,p=10,y=t,x=y.d,S=y.constructor,w=S.precision;if(y.s<1)throw Error(Za+(y.s?"NaN":"-Infinity"));if(y.eq(ba))return new S(0);if(e==null?(dr=!1,c=w):c=e,y.eq(10))return e==null&&(dr=!0),UE(S,c);if(c+=p,S.precision=c,n=Ml(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=Ml(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=UE(S,c+2,w).times(s+""),y=Sy(new S(r+"."+n.slice(1)),c-p).plus(l),S.precision=w,e==null?(dr=!0,Zn(y,w)):y;for(o=a=y=Wc(y.minus(ba),y.plus(ba),c),d=Zn(y.times(y),c),i=3;;){if(a=Zn(a.times(d),c),l=o.plus(Wc(a,new S(i),c)),Ml(l.d).slice(0,c)===Ml(o.d).slice(0,c))return o=o.times(2),s!==0&&(o=o.plus(UE(S,c+2,w).times(s+""))),o=Wc(o,new S(f),c),S.precision=w,e==null?(dr=!0,Zn(o,w)):o;o=l,i+=2}}function AL(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=Qg(n/or),t.d=[],r=(n+1)%or,n<0&&(r+=or),r<i){for(r&&t.d.push(+e.slice(0,r)),i-=or;r<i;)t.d.push(+e.slice(r,r+=or));e=e.slice(r),r=or-e.length}else r-=i;for(;r--;)e+="0";if(t.d.push(+e),dr&&(t.e>j1||t.e<-j1))throw Error(r2+n)}else t.s=0,t.e=0,t.d=[0];return t}function Zn(t,e,n){var r,i,s,a,o,l,c,d,f=t.d;for(a=1,s=f[0];s>=10;s/=10)a++;if(r=e-a,r<0)r+=or,i=e,c=f[d=0];else{if(d=Math.ceil((r+1)/or),s=f.length,d>=s)return t;for(c=s=f[d],a=1;s>=10;s/=10)a++;r%=or,i=r-or+a}if(n!==void 0&&(s=Jf(10,a-i-1),o=c/s%10|0,l=e<0||f[d+1]!==void 0||c%s,l=n<4?(o||l)&&(n==0||n==(t.s<0?3:2)):o>5||o==5&&(n==4||l||n==6&&(r>0?i>0?c/Jf(10,a-i):0:f[d-1])%10&1||n==(t.s<0?8:7))),e<1||!f[0])return l?(s=Vr(t),f.length=1,e=e-s-1,f[0]=Jf(10,(or-e%or)%or),t.e=Qg(-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=Jf(10,or-r),f[d]=i>0?(c/Jf(10,a-i)%Jf(10,i)|0)*s:0),l)for(;;)if(d==0){(f[0]+=s)==vi&&(f[0]=1,++t.e);break}else{if(f[d]+=s,f[d]!=vi)break;f[d--]=0,s=1}for(r=f.length;f[--r]===0;)f.pop();if(dr&&(t.e>j1||t.e<-j1))throw Error(r2+Vr(t));return t}function fz(t,e){var n,r,i,s,a,o,l,c,d,f,p=t.constructor,y=p.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new p(t),dr?Zn(e,y):e;if(l=t.d,f=e.d,r=e.e,c=t.e,l=l.slice(),a=c-r,a){for(d=a<0,d?(n=l,a=-a,o=f.length):(n=f,r=c,o=l.length),i=Math.max(Math.ceil(y/or),o)+2,a>i&&(a=i,n.length=1),n.reverse(),i=a;i--;)n.push(0);n.reverse()}else{for(i=l.length,o=f.length,d=i<o,d&&(o=i),i=0;i<o;i++)if(l[i]!=f[i]){d=l[i]<f[i];break}a=0}for(d&&(n=l,l=f,f=n,e.s=-e.s),o=l.length,i=f.length-o;i>0;--i)l[o++]=0;for(i=f.length;i>a;){if(l[--i]<f[i]){for(s=i;s&&l[--s]===0;)l[s]=vi-1;--l[s],l[i]+=vi}l[i]-=f[i]}for(;l[--o]===0;)l.pop();for(;l[0]===0;l.shift())--r;return l[0]?(e.d=l,e.e=r,dr?Zn(e,y):e):new p(0)}function Vh(t,e,n){var r,i=Vr(t),s=Ml(t.d),a=s.length;return e?(n&&(r=n-a)>0?s=s.charAt(0)+"."+s.slice(1)+ud(r):a>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(i<0?"e":"e+")+i):i<0?(s="0."+ud(-i-1)+s,n&&(r=n-a)>0&&(s+=ud(r))):i>=a?(s+=ud(i+1-a),n&&(r=n-i-1)>0&&(s=s+"."+ud(r))):((r=i+1)<a&&(s=s.slice(0,r)+"."+s.slice(r)),n&&(r=n-a)>0&&(i+1===a&&(s+="."),s+=ud(r))),t.s<0?"-"+s:s}function TL(t,e){if(t.length>e)return t.length=e,!0}function hz(t){var e,n,r;function i(s){var a=this;if(!(a instanceof i))return new i(s);if(a.constructor=i,s instanceof i){a.s=s.s,a.e=s.e,a.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(Rh+s);if(s>0)a.s=1;else if(s<0)s=-s,a.s=-1;else{a.s=0,a.e=0,a.d=[0];return}if(s===~~s&&s<1e7){a.e=0,a.d=[s];return}return AL(a,s.toString())}else if(typeof s!="string")throw Error(Rh+s);if(s.charCodeAt(0)===45?(s=s.slice(1),a.s=-1):a.s=1,_ee.test(s))AL(a,s);else throw Error(Rh+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=hz,i.config=i.set=wee,t===void 0&&(t={}),t)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e<r.length;)t.hasOwnProperty(n=r[e++])||(t[n]=this[n]);return i.config(t),i}function wee(t){if(!t||typeof t!="object")throw Error(Za+"Object expected");var e,n,r,i=["precision",1,Zg,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(e=0;e<i.length;e+=3)if((r=t[n=i[e]])!==void 0)if(Qg(r)===r&&r>=i[e+1]&&r<=i[e+2])this[n]=r;else throw Error(Rh+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(Rh+n+": "+r);return this}var i2=hz(bee);ba=new i2(1);const Tn=i2;function pz(t){var e;return t===0?e=1:e=Math.floor(new Tn(t).abs().log(10).toNumber())+1,e}function mz(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 My(t,e){return Aee(t)||Eee(t,e)||Mee(t,e)||See()}function See(){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 Mee(t,e){if(t){if(typeof t=="string")return CL(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)?CL(t,e):void 0}}function CL(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Eee(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function Aee(t){if(Array.isArray(t))return t}var gz=t=>{var e=My(t,2),n=e[0],r=e[1],i=n,s=r;return n>r&&(i=r,s=n),[i,s]},s2=(t,e,n)=>{if(t.lte(0))return new Tn(0);var r=pz(t.toNumber()),i=new Tn(10).pow(r),s=t.div(i),a=r!==1?.05:.1,o=new Tn(Math.ceil(s.div(a).toNumber())).add(n).mul(a),l=o.mul(i);return e?new Tn(l.toNumber()):new Tn(Math.ceil(l.toNumber()))},vz=(t,e,n)=>{var r;if(t.lte(0))return new Tn(0);var i=[1,2,2.5,5],s=t.toNumber(),a=Math.floor(new Tn(s).abs().log(10).toNumber()),o=new Tn(10).pow(a),l=t.div(o).toNumber(),c=i.findIndex(y=>y>=l-1e-10);if(c===-1&&(o=o.mul(10),c=0),c+=n,c>=i.length){var d=Math.floor(c/i.length);c%=i.length,o=o.mul(new Tn(10).pow(d))}var f=(r=i[c])!==null&&r!==void 0?r:1,p=new Tn(f).mul(o);return e?p:new Tn(Math.ceil(p.toNumber()))},Tee=(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(pz(t)-1),i=new Tn(Math.floor(i.div(r).toNumber())).mul(r)):s>1&&(i=new Tn(Math.floor(t)))}else t===0?i=new Tn(Math.floor((e-1)/2)):n||(i=new Tn(Math.floor(t)));for(var a=Math.floor((e-1)/2),o=[],l=0;l<e;l++)o.push(i.add(new Tn(l-a).mul(r)).toNumber());return o},yz=function(e,n,r,i){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:s2;if(!Number.isFinite((n-e)/(r-1)))return{step:new Tn(0),tickMin:new Tn(0),tickMax:new Tn(0)};var o=a(new Tn(n).sub(e).div(r-1),i,s),l;e<=0&&n>=0?l=new Tn(0):(l=new Tn(e).add(n).div(2),l=l.sub(new Tn(l).mod(o)));var c=Math.ceil(l.sub(e).div(o).toNumber()),d=Math.ceil(new Tn(n).sub(l).div(o).toNumber()),f=c+d+1;return f>r?yz(e,n,r,i,s+1,a):(f<r&&(d=n>0?d+(r-f):d,c=n>0?c:c+(r-f)),{step:o,tickMin:l.sub(new Tn(c).mul(o)),tickMax:l.add(new Tn(d).mul(o))})},PL=function(e){var n=My(e,2),r=n[0],i=n[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",l=Math.max(s,2),c=gz([r,i]),d=My(c,2),f=d[0],p=d[1];if(f===-1/0||p===1/0){var y=p===1/0?[f,...Array(s-1).fill(1/0)]:[...Array(s-1).fill(-1/0),p];return r>i?y.reverse():y}if(f===p)return Tee(f,s,a);var x=o==="snap125"?vz:s2,S=yz(f,p,l,a,0,x),w=S.step,b=S.tickMin,M=S.tickMax,T=mz(b,M.add(new Tn(.1).mul(w)),w);return r>i?T.reverse():T},RL=function(e,n){var r=My(e,2),i=r[0],s=r[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",l=gz([i,s]),c=My(l,2),d=c[0],f=c[1];if(d===-1/0||f===1/0)return[i,s];if(d===f)return[d];var p=o==="snap125"?vz:s2,y=Math.max(n,2),x=p(new Tn(f).sub(d).div(y-1),a,0),S=[...mz(new Tn(d),new Tn(f),x),f];return a===!1&&(S=S.map(w=>Math.round(w))),i>s?S.reverse():S},Cee=t=>t.rootProps.barCategoryGap,RS=t=>t.rootProps.stackOffset,xz=t=>t.rootProps.reverseStackOrder,a2=t=>t.options.chartName,o2=t=>t.rootProps.syncId,bz=t=>t.rootProps.syncMethod,l2=t=>t.options.eventEmitter,Pee=t=>t.rootProps.baseValue,Es={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},Pf={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},pl={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},NS=(t,e)=>{if(!(!t||!e))return t!=null&&t.reversed?[e[1],e[0]]:e};function kS(t,e,n){if(n!=="auto")return n;if(t!=null)return Hl(t,e)?"category":"number"}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 U1(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?NL(Object(n),!0).forEach(function(r){Ree(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):NL(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ree(t,e,n){return(e=Nee(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Nee(t){var e=kee(t,"string");return typeof e=="symbol"?e:e+""}function kee(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 kL={allowDataOverflow:Pf.allowDataOverflow,allowDecimals:Pf.allowDecimals,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:Pf.angleAxisId,includeHidden:!1,name:void 0,reversed:Pf.reversed,scale:Pf.scale,tick:Pf.tick,tickCount:void 0,ticks:void 0,type:Pf.type,unit:void 0,niceTicks:"auto"},IL={allowDataOverflow:pl.allowDataOverflow,allowDecimals:pl.allowDecimals,allowDuplicatedCategory:pl.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:pl.radiusAxisId,includeHidden:pl.includeHidden,name:void 0,reversed:pl.reversed,scale:pl.scale,tick:pl.tick,tickCount:pl.tickCount,ticks:void 0,type:pl.type,unit:void 0,niceTicks:"auto"},Iee=(t,e)=>{if(e!=null)return t.polarAxis.angleAxis[e]},c2=ke([Iee,G4],(t,e)=>{var n;if(t!=null)return t;var r=(n=kS(e,"angleAxis",kL.type))!==null&&n!==void 0?n:"category";return U1(U1({},kL),{},{type:r})}),Lee=(t,e)=>t.polarAxis.radiusAxis[e],u2=ke([Lee,G4],(t,e)=>{var n;if(t!=null)return t;var r=(n=kS(e,"radiusAxis",IL.type))!==null&&n!==void 0?n:"category";return U1(U1({},IL),{},{type:r})}),IS=t=>t.polarOptions,d2=ke([ru,iu,Wi],eee),_z=ke([IS,d2],(t,e)=>{if(t!=null)return Nd(t.innerRadius,e,0)}),wz=ke([IS,d2],(t,e)=>{if(t!=null)return Nd(t.outerRadius,e,e*.8)}),Oee=t=>{if(t==null)return[0,0];var e=t.startAngle,n=t.endAngle;return[e,n]},Sz=ke([IS],Oee);ke([c2,Sz],NS);var Mz=ke([d2,_z,wz],(t,e,n)=>{if(!(t==null||e==null||n==null))return[e,n]});ke([u2,Mz],NS);var Ez=ke([hr,IS,_z,wz,ru,iu],(t,e,n,r,i,s)=>{if(!(t!=="centric"&&t!=="radial"||e==null||n==null||r==null)){var a=e.cx,o=e.cy,l=e.startAngle,c=e.endAngle;return{cx:Nd(a,i,i/2),cy:Nd(o,s,s/2),innerRadius:n,outerRadius:r,startAngle:l,endAngle:c,clockWise:!1}}}),_i=(t,e)=>e,LS=(t,e,n)=>n;function f2(t){return t==null?void 0:t.id}function Az(t,e,n){var r=e.chartData,i=r===void 0?[]:r,s=n.allowDuplicatedCategory,a=n.dataKey,o=new Map;return t.forEach(l=>{var c,d=(c=l.data)!==null&&c!==void 0?c:i;if(!(d==null||d.length===0)){var f=f2(l);d.forEach((p,y)=>{var x=a==null||s?y:String(yi(p,a,null)),S=yi(p,l.dataKey,0),w;o.has(x)?w=o.get(x):w={},Object.assign(w,{[f]:S}),o.set(x,w)})}}),Array.from(o.values())}function h2(t){return"stackId"in t&&t.stackId!=null&&t.dataKey!=null}var OS=(t,e)=>t===e?!0:t==null||e==null?!1:t[0]===e[0]&&t[1]===e[1];function DS(t,e){return Array.isArray(t)&&Array.isArray(e)&&t.length===0&&e.length===0?!0:t===e}function Dee(t,e){if(t.length===e.length){for(var n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}return!1}var wi=t=>{var e=hr(t);return e==="horizontal"?"xAxis":e==="vertical"?"yAxis":e==="centric"?"angleAxis":"radiusAxis"},Jg=t=>t.tooltip.settings.axisId;function p2(t){if(t!=null){var e=t.ticks,n=t.bandwidth,r=t.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>t.domain(),range:(function(s){function a(){return s.apply(this,arguments)}return a.toString=function(){return s.toString()},a})(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(s){var a=i[0],o=i[1];return a<=o?s>=a&&s<=o:s>=o&&s<=a},bandwidth:n?()=>n.call(t):void 0,ticks:e?s=>e.call(t,s):void 0,map:(s,a)=>{var o=t(s);if(o!=null){if(t.bandwidth&&a!==null&&a!==void 0&&a.position){var l=t.bandwidth();switch(a.position){case"middle":o+=l/2;break;case"end":o+=l;break}}return o}}}}}var jee=(t,e)=>{if(e!=null)switch(t){case"linear":{if(!Al(e)){for(var n,r,i=0;i<e.length;i++){var s=e[i];wn(s)&&((n===void 0||s<n)&&(n=s),(r===void 0||s>r)&&(r=s))}return n!==void 0&&r!==void 0?[n,r]:void 0}return e}default:return e}};function Ad(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Uee(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function m2(t){let e,n,r;t.length!==2?(e=Ad,n=(o,l)=>Ad(t(o),l),r=(o,l)=>t(o)-l):(e=t===Ad||t===Uee?t:Fee,n=t,r=t);function i(o,l,c=0,d=o.length){if(c<d){if(e(l,l)!==0)return d;do{const f=c+d>>>1;n(o[f],l)<0?c=f+1:d=f}while(c<d)}return c}function s(o,l,c=0,d=o.length){if(c<d){if(e(l,l)!==0)return d;do{const f=c+d>>>1;n(o[f],l)<=0?c=f+1:d=f}while(c<d)}return c}function a(o,l,c=0,d=o.length){const f=i(o,l,c,d-1);return f>c&&r(o[f-1],l)>-r(o[f],l)?f-1:f}return{left:i,center:a,right:s}}function Fee(){return 0}function Tz(t){return t===null?NaN:+t}function*zee(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const Bee=m2(Ad),sx=Bee.right;m2(Tz).center;class LL 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(OL(this,e))}has(e){return super.has(OL(this,e))}set(e,n){return super.set(Hee(this,e),n)}delete(e){return super.delete(Vee(this,e))}}function OL({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function Hee({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function Vee({_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 Wee(t=Ad){if(t===Ad)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))||(t<e?-1:t>e?1:0)}const $ee=Math.sqrt(50),Xee=Math.sqrt(10),qee=Math.sqrt(2);function F1(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),s=r/Math.pow(10,i),a=s>=$ee?10:s>=Xee?5:s>=qee?2:1;let o,l,c;return i<0?(c=Math.pow(10,-i)/a,o=Math.round(t*c),l=Math.round(e*c),o/c<t&&++o,l/c>e&&--l,c=-c):(c=Math.pow(10,i)*a,o=Math.round(t/c),l=Math.round(e/c),o*c<t&&++o,l*c>e&&--l),l<o&&.5<=n&&n<2?F1(t,e,n*2):[o,l,c]}function TC(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];const r=e<t,[i,s,a]=r?F1(e,t,n):F1(t,e,n);if(!(s>=i))return[];const o=s-i+1,l=new Array(o);if(r)if(a<0)for(let c=0;c<o;++c)l[c]=(s-c)/-a;else for(let c=0;c<o;++c)l[c]=(s-c)*a;else if(a<0)for(let c=0;c<o;++c)l[c]=(i+c)/-a;else for(let c=0;c<o;++c)l[c]=(i+c)*a;return l}function CC(t,e,n){return e=+e,t=+t,n=+n,F1(t,e,n)[2]}function PC(t,e,n){e=+e,t=+t,n=+n;const r=e<t,i=r?CC(e,t,n):CC(t,e,n);return(r?-1:1)*(i<0?1/-i:i)}function DL(t,e){let n;for(const r of t)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);return n}function jL(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function Pz(t,e,n=0,r=1/0,i){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(i=i===void 0?Cz:Wee(i);r>n;){if(r-n>600){const l=r-n+1,c=e-n+1,d=Math.log(l),f=.5*Math.exp(2*d/3),p=.5*Math.sqrt(d*f*(l-f)/l)*(c-l/2<0?-1:1),y=Math.max(n,Math.floor(e-c*f/l+p)),x=Math.min(r,Math.floor(e+(l-c)*f/l+p));Pz(t,e,y,x,i)}const s=t[e];let a=n,o=r;for(m0(t,n,e),i(t[r],s)>0&&m0(t,n,r);a<o;){for(m0(t,a,o),++a,--o;i(t[a],s)<0;)++a;for(;i(t[o],s)>0;)--o}i(t[n],s)===0?m0(t,n,o):(++o,m0(t,o,r)),o<=e&&(n=o+1),e<=o&&(r=o-1)}return t}function m0(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function Kee(t,e,n){if(t=Float64Array.from(zee(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return jL(t);if(e>=1)return DL(t);var r,i=(r-1)*e,s=Math.floor(i),a=DL(Pz(t,s).subarray(0,s+1)),o=jL(t.subarray(s+1));return a+(o-a)*(i-s)}}function Yee(t,e,n=Tz){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,s=Math.floor(i),a=+n(t[s],s,t),o=+n(t[s+1],s+1,t);return a+(o-a)*(i-s)}}function Zee(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<i;)s[r]=t+r*n;return s}function eo(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function su(t,e){switch(arguments.length){case 0:break;case 1:{typeof t=="function"?this.interpolator(t):this.range(t);break}default:{this.domain(t),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}const RC=Symbol("implicit");function g2(){var t=new LL,e=[],n=[],r=RC;function i(s){let a=t.get(s);if(a===void 0){if(r!==RC)return r;t.set(s,a=e.push(s)-1)}return n[a%n.length]}return i.domain=function(s){if(!arguments.length)return e.slice();e=[],t=new LL;for(const a of s)t.has(a)||t.set(a,e.push(a)-1);return i},i.range=function(s){return arguments.length?(n=Array.from(s),i):n.slice()},i.unknown=function(s){return arguments.length?(r=s,i):r},i.copy=function(){return g2(e,n).unknown(r)},eo.apply(i,arguments),i}function v2(){var t=g2().unknown(void 0),e=t.domain,n=t.range,r=0,i=1,s,a,o=!1,l=0,c=0,d=.5;delete t.unknown;function f(){var p=e().length,y=i<r,x=y?i:r,S=y?r:i;s=(S-x)/Math.max(1,p-l+c*2),o&&(s=Math.floor(s)),x+=(S-x-s*(p-l))*d,a=s*(1-l),o&&(x=Math.round(x),a=Math.round(a));var w=Zee(p).map(function(b){return x+s*b});return n(y?w.reverse():w)}return t.domain=function(p){return arguments.length?(e(p),f()):e()},t.range=function(p){return arguments.length?([r,i]=p,r=+r,i=+i,f()):[r,i]},t.rangeRound=function(p){return[r,i]=p,r=+r,i=+i,o=!0,f()},t.bandwidth=function(){return a},t.step=function(){return s},t.round=function(p){return arguments.length?(o=!!p,f()):o},t.padding=function(p){return arguments.length?(l=Math.min(1,c=+p),f()):l},t.paddingInner=function(p){return arguments.length?(l=Math.min(1,p),f()):l},t.paddingOuter=function(p){return arguments.length?(c=+p,f()):c},t.align=function(p){return arguments.length?(d=Math.max(0,Math.min(1,p)),f()):d},t.copy=function(){return v2(e(),[r,i]).round(o).paddingInner(l).paddingOuter(c).align(d)},eo.apply(f(),arguments)}function Rz(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return Rz(e())},t}function Qee(){return Rz(v2.apply(null,arguments).paddingInner(1))}function y2(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Nz(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function ax(){}var Ey=.7,z1=1/Ey,og="\\s*([+-]?\\d+)\\s*",Ay="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Tl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Jee=/^#([0-9a-f]{3,8})$/,ete=new RegExp(`^rgb\\(${og},${og},${og}\\)$`),tte=new RegExp(`^rgb\\(${Tl},${Tl},${Tl}\\)$`),nte=new RegExp(`^rgba\\(${og},${og},${og},${Ay}\\)$`),rte=new RegExp(`^rgba\\(${Tl},${Tl},${Tl},${Ay}\\)$`),ite=new RegExp(`^hsl\\(${Ay},${Tl},${Tl}\\)$`),ste=new RegExp(`^hsla\\(${Ay},${Tl},${Tl},${Ay}\\)$`),UL={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};y2(ax,Ty,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:FL,formatHex:FL,formatHex8:ate,formatHsl:ote,formatRgb:zL,toString:zL});function FL(){return this.rgb().formatHex()}function ate(){return this.rgb().formatHex8()}function ote(){return kz(this).formatHsl()}function zL(){return this.rgb().formatRgb()}function Ty(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Jee.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?BL(e):n===3?new Js(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Db(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Db(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=ete.exec(t))?new Js(e[1],e[2],e[3],1):(e=tte.exec(t))?new Js(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=nte.exec(t))?Db(e[1],e[2],e[3],e[4]):(e=rte.exec(t))?Db(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=ite.exec(t))?GL(e[1],e[2]/100,e[3]/100,1):(e=ste.exec(t))?GL(e[1],e[2]/100,e[3]/100,e[4]):UL.hasOwnProperty(t)?BL(UL[t]):t==="transparent"?new Js(NaN,NaN,NaN,0):null}function BL(t){return new Js(t>>16&255,t>>8&255,t&255,1)}function Db(t,e,n,r){return r<=0&&(t=e=n=NaN),new Js(t,e,n,r)}function lte(t){return t instanceof ax||(t=Ty(t)),t?(t=t.rgb(),new Js(t.r,t.g,t.b,t.opacity)):new Js}function NC(t,e,n,r){return arguments.length===1?lte(t):new Js(t,e,n,r??1)}function Js(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}y2(Js,NC,Nz(ax,{brighter(t){return t=t==null?z1:Math.pow(z1,t),new Js(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Ey:Math.pow(Ey,t),new Js(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Js(Nh(this.r),Nh(this.g),Nh(this.b),B1(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:HL,formatHex:HL,formatHex8:cte,formatRgb:VL,toString:VL}));function HL(){return`#${uh(this.r)}${uh(this.g)}${uh(this.b)}`}function cte(){return`#${uh(this.r)}${uh(this.g)}${uh(this.b)}${uh((isNaN(this.opacity)?1:this.opacity)*255)}`}function VL(){const t=B1(this.opacity);return`${t===1?"rgb(":"rgba("}${Nh(this.r)}, ${Nh(this.g)}, ${Nh(this.b)}${t===1?")":`, ${t})`}`}function B1(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Nh(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function uh(t){return t=Nh(t),(t<16?"0":"")+t.toString(16)}function GL(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new zo(t,e,n,r)}function kz(t){if(t instanceof zo)return new zo(t.h,t.s,t.l,t.opacity);if(t instanceof ax||(t=Ty(t)),!t)return new zo;if(t instanceof zo)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),s=Math.max(e,n,r),a=NaN,o=s-i,l=(s+i)/2;return o?(e===s?a=(n-r)/o+(n<r)*6:n===s?a=(r-e)/o+2:a=(e-n)/o+4,o/=l<.5?s+i:2-s-i,a*=60):o=l>0&&l<1?0:a,new zo(a,o,l,t.opacity)}function ute(t,e,n,r){return arguments.length===1?kz(t):new zo(t,e,n,r??1)}function zo(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}y2(zo,ute,Nz(ax,{brighter(t){return t=t==null?z1:Math.pow(z1,t),new zo(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Ey:Math.pow(Ey,t),new zo(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Js(FE(t>=240?t-240:t+120,i,r),FE(t,i,r),FE(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new zo(WL(this.h),jb(this.s),jb(this.l),B1(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=B1(this.opacity);return`${t===1?"hsl(":"hsla("}${WL(this.h)}, ${jb(this.s)*100}%, ${jb(this.l)*100}%${t===1?")":`, ${t})`}`}}));function WL(t){return t=(t||0)%360,t<0?t+360:t}function jb(t){return Math.max(0,Math.min(1,t||0))}function FE(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 x2=t=>()=>t;function dte(t,e){return function(n){return t+n*e}}function fte(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 hte(t){return(t=+t)==1?Iz:function(e,n){return n-e?fte(e,n,t):x2(isNaN(e)?n:e)}}function Iz(t,e){var n=e-t;return n?dte(t,n):x2(isNaN(t)?e:t)}const $L=(function t(e){var n=hte(e);function r(i,s){var a=n((i=NC(i)).r,(s=NC(s)).r),o=n(i.g,s.g),l=n(i.b,s.b),c=Iz(i.opacity,s.opacity);return function(d){return i.r=a(d),i.g=o(d),i.b=l(d),i.opacity=c(d),i+""}}return r.gamma=t,r})(1);function pte(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(s){for(i=0;i<n;++i)r[i]=t[i]*(1-s)+e[i]*s;return r}}function mte(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function gte(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,i=new Array(r),s=new Array(n),a;for(a=0;a<r;++a)i[a]=ev(t[a],e[a]);for(;a<n;++a)s[a]=e[a];return function(o){for(a=0;a<r;++a)s[a]=i[a](o);return s}}function vte(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function H1(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function yte(t,e){var n={},r={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?n[i]=ev(t[i],e[i]):r[i]=e[i];return function(s){for(i in n)r[i]=n[i](s);return r}}var kC=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,zE=new RegExp(kC.source,"g");function xte(t){return function(){return t}}function bte(t){return function(e){return t(e)+""}}function _te(t,e){var n=kC.lastIndex=zE.lastIndex=0,r,i,s,a=-1,o=[],l=[];for(t=t+"",e=e+"";(r=kC.exec(t))&&(i=zE.exec(e));)(s=i.index)>n&&(s=e.slice(n,s),o[a]?o[a]+=s:o[++a]=s),(r=r[0])===(i=i[0])?o[a]?o[a]+=i:o[++a]=i:(o[++a]=null,l.push({i:a,x:H1(r,i)})),n=zE.lastIndex;return n<e.length&&(s=e.slice(n),o[a]?o[a]+=s:o[++a]=s),o.length<2?l[0]?bte(l[0].x):xte(e):(e=l.length,function(c){for(var d=0,f;d<e;++d)o[(f=l[d]).i]=f.x(c);return o.join("")})}function ev(t,e){var n=typeof e,r;return e==null||n==="boolean"?x2(e):(n==="number"?H1:n==="string"?(r=Ty(e))?(e=r,$L):_te:e instanceof Ty?$L:e instanceof Date?vte:mte(e)?pte:Array.isArray(e)?gte:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?yte:H1)(t,e)}function b2(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function wte(t,e){e===void 0&&(e=t,t=ev);for(var n=0,r=e.length-1,i=e[0],s=new Array(r<0?0:r);n<r;)s[n]=t(i,i=e[++n]);return function(a){var o=Math.max(0,Math.min(r-1,Math.floor(a*=r)));return s[o](a-o)}}function Ste(t){return function(){return t}}function V1(t){return+t}var XL=[0,1];function As(t){return t}function IC(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:Ste(isNaN(e)?NaN:.5)}function Mte(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function Ete(t,e,n){var r=t[0],i=t[1],s=e[0],a=e[1];return i<r?(r=IC(i,r),s=n(a,s)):(r=IC(r,i),s=n(s,a)),function(o){return s(r(o))}}function Ate(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),s=new Array(r),a=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<r;)i[a]=IC(t[a],t[a+1]),s[a]=n(e[a],e[a+1]);return function(o){var l=sx(t,o,1,r)-1;return s[l](i[l](o))}}function ox(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function jS(){var t=XL,e=XL,n=ev,r,i,s,a=As,o,l,c;function d(){var p=Math.min(t.length,e.length);return a!==As&&(a=Mte(t[0],t[p-1])),o=p>2?Ate:Ete,l=c=null,f}function f(p){return p==null||isNaN(p=+p)?s:(l||(l=o(t.map(r),e,n)))(r(a(p)))}return f.invert=function(p){return a(i((c||(c=o(e,t.map(r),H1)))(p)))},f.domain=function(p){return arguments.length?(t=Array.from(p,V1),d()):t.slice()},f.range=function(p){return arguments.length?(e=Array.from(p),d()):e.slice()},f.rangeRound=function(p){return e=Array.from(p),n=b2,d()},f.clamp=function(p){return arguments.length?(a=p?!0:As,d()):a!==As},f.interpolate=function(p){return arguments.length?(n=p,d()):n},f.unknown=function(p){return arguments.length?(s=p,f):s},function(p,y){return r=p,i=y,d()}}function _2(){return jS()(As,As)}function Tte(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function G1(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 kg(t){return t=G1(Math.abs(t)),t?t[1]:NaN}function Cte(t,e){return function(n,r){for(var i=n.length,s=[],a=0,o=t[0],l=0;i>0&&o>0&&(l+o+1>r&&(o=Math.max(1,r-l)),s.push(n.substring(i-=o,i+o)),!((l+=o+1)>r));)o=t[a=(a+1)%t.length];return s.reverse().join(e)}}function Pte(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var Rte=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Cy(t){if(!(e=Rte.exec(t)))throw new Error("invalid format: "+t);var e;return new w2({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]})}Cy.prototype=w2.prototype;function w2(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+""}w2.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 Nte(t){e:for(var e=t.length,n=1,r=-1,i;n<e;++n)switch(t[n]){case".":r=i=n;break;case"0":r===0&&(r=n),i=n;break;default:if(!+t[n])break e;r>0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var W1;function kte(t,e){var n=G1(t,e);if(!n)return W1=void 0,t.toPrecision(e);var r=n[0],i=n[1],s=i-(W1=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,a=r.length;return s===a?r:s>a?r+new Array(s-a+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+G1(t,Math.max(0,e+s-1))[0]}function qL(t,e){var n=G1(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 KL={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:Tte,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)=>qL(t*100,e),r:qL,s:kte,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function YL(t){return t}var ZL=Array.prototype.map,QL=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ite(t){var e=t.grouping===void 0||t.thousands===void 0?YL:Cte(ZL.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?YL:Pte(ZL.call(t.numerals,String)),a=t.percent===void 0?"%":t.percent+"",o=t.minus===void 0?"−":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function c(f,p){f=Cy(f);var y=f.fill,x=f.align,S=f.sign,w=f.symbol,b=f.zero,M=f.width,T=f.comma,C=f.precision,L=f.trim,N=f.type;N==="n"?(T=!0,N="g"):KL[N]||(C===void 0&&(C=12),L=!0,N="g"),(b||y==="0"&&x==="=")&&(b=!0,y="0",x="=");var D=(p&&p.prefix!==void 0?p.prefix:"")+(w==="$"?n:w==="#"&&/[boxX]/.test(N)?"0"+N.toLowerCase():""),F=(w==="$"?r:/[%p]/.test(N)?a:"")+(p&&p.suffix!==void 0?p.suffix:""),V=KL[N],I=/[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(X){var te=D,re=F,pe,ee,ce;if(N==="c")re=V(X)+re,X="";else{X=+X;var B=X<0||1/X<0;if(X=isNaN(X)?l:V(Math.abs(X),C),L&&(X=Nte(X)),B&&+X==0&&S!=="+"&&(B=!1),te=(B?S==="("?S:o:S==="-"||S==="("?"":S)+te,re=(N==="s"&&!isNaN(X)&&W1!==void 0?QL[8+W1/3]:"")+re+(B&&S==="("?")":""),I){for(pe=-1,ee=X.length;++pe<ee;)if(ce=X.charCodeAt(pe),48>ce||ce>57){re=(ce===46?i+X.slice(pe+1):X.slice(pe))+re,X=X.slice(0,pe);break}}}T&&!b&&(X=e(X,1/0));var J=te.length+X.length+re.length,Z=J<M?new Array(M-J+1).join(y):"";switch(T&&b&&(X=e(Z+X,Z.length?M-re.length:1/0),Z=""),x){case"<":X=te+X+re+Z;break;case"=":X=te+Z+X+re;break;case"^":X=Z.slice(0,J=Z.length>>1)+te+X+re+Z.slice(J);break;default:X=Z+te+X+re;break}return s(X)}return U.toString=function(){return f+""},U}function d(f,p){var y=Math.max(-8,Math.min(8,Math.floor(kg(p)/3)))*3,x=Math.pow(10,-y),S=c((f=Cy(f),f.type="f",f),{suffix:QL[8+y/3]});return function(w){return S(x*w)}}return{format:c,formatPrefix:d}}var Ub,S2,Lz;Lte({thousands:",",grouping:[3],currency:["$",""]});function Lte(t){return Ub=Ite(t),S2=Ub.format,Lz=Ub.formatPrefix,Ub}function Ote(t){return Math.max(0,-kg(Math.abs(t)))}function Dte(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(kg(e)/3)))*3-kg(Math.abs(t)))}function jte(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,kg(e)-kg(t))+1}function Oz(t,e,n,r){var i=PC(t,e,n),s;switch(r=Cy(r??",f"),r.type){case"s":{var a=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(s=Dte(i,a))&&(r.precision=s),Lz(r,a)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=jte(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=Ote(i))&&(r.precision=s-(r.type==="%")*2);break}}return S2(r)}function Dd(t){var e=t.domain;return t.ticks=function(n){var r=e();return TC(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return Oz(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,s=r.length-1,a=r[i],o=r[s],l,c,d=10;for(o<a&&(c=a,a=o,o=c,c=i,i=s,s=c);d-- >0;){if(c=CC(a,o,n),c===l)return r[i]=a,r[s]=o,e(r);if(c>0)a=Math.floor(a/c)*c,o=Math.ceil(o/c)*c;else if(c<0)a=Math.ceil(a*c)/c,o=Math.floor(o*c)/c;else break;l=c}return t},t}function Dz(){var t=_2();return t.copy=function(){return ox(t,Dz())},eo.apply(t,arguments),Dd(t)}function jz(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,V1),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return jz(t).unknown(e)},t=arguments.length?Array.from(t,V1):[0,1],Dd(n)}function Uz(t,e){t=t.slice();var n=0,r=t.length-1,i=t[n],s=t[r],a;return s<i&&(a=n,n=r,r=a,a=i,i=s,s=a),t[n]=e.floor(i),t[r]=e.ceil(s),t}function JL(t){return Math.log(t)}function eO(t){return Math.exp(t)}function Ute(t){return-Math.log(-t)}function Fte(t){return-Math.exp(-t)}function zte(t){return isFinite(t)?+("1e"+t):t<0?0:t}function Bte(t){return t===10?zte:t===Math.E?Math.exp:e=>Math.pow(t,e)}function Hte(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 tO(t){return(e,n)=>-t(-e,n)}function M2(t){const e=t(JL,eO),n=e.domain;let r=10,i,s;function a(){return i=Hte(r),s=Bte(r),n()[0]<0?(i=tO(i),s=tO(s),t(Ute,Fte)):t(JL,eO),e}return e.base=function(o){return arguments.length?(r=+o,a()):r},e.domain=function(o){return arguments.length?(n(o),a()):n()},e.ticks=o=>{const l=n();let c=l[0],d=l[l.length-1];const f=d<c;f&&([c,d]=[d,c]);let p=i(c),y=i(d),x,S;const w=o==null?10:+o;let b=[];if(!(r%1)&&y-p<w){if(p=Math.floor(p),y=Math.ceil(y),c>0){for(;p<=y;++p)for(x=1;x<r;++x)if(S=p<0?x/s(-p):x*s(p),!(S<c)){if(S>d)break;b.push(S)}}else for(;p<=y;++p)for(x=r-1;x>=1;--x)if(S=p>0?x/s(-p):x*s(p),!(S<c)){if(S>d)break;b.push(S)}b.length*2<w&&(b=TC(c,d,w))}else b=TC(p,y,Math.min(y-p,w)).map(s);return f?b.reverse():b},e.tickFormat=(o,l)=>{if(o==null&&(o=10),l==null&&(l=r===10?"s":","),typeof l!="function"&&(!(r%1)&&(l=Cy(l)).precision==null&&(l.trim=!0),l=S2(l)),o===1/0)return l;const c=Math.max(1,r*o/e.ticks().length);return d=>{let f=d/s(Math.round(i(d)));return f*r<r-.5&&(f*=r),f<=c?l(d):""}},e.nice=()=>n(Uz(n(),{floor:o=>s(Math.floor(i(o))),ceil:o=>s(Math.ceil(i(o)))})),e}function Fz(){const t=M2(jS()).domain([1,10]);return t.copy=()=>ox(t,Fz()).base(t.base()),eo.apply(t,arguments),t}function nO(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function rO(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function E2(t){var e=1,n=t(nO(e),rO(e));return n.constant=function(r){return arguments.length?t(nO(e=+r),rO(e)):e},Dd(n)}function zz(){var t=E2(jS());return t.copy=function(){return ox(t,zz()).constant(t.constant())},eo.apply(t,arguments)}function iO(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function Vte(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function Gte(t){return t<0?-t*t:t*t}function A2(t){var e=t(As,As),n=1;function r(){return n===1?t(As,As):n===.5?t(Vte,Gte):t(iO(n),iO(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},Dd(e)}function T2(){var t=A2(jS());return t.copy=function(){return ox(t,T2()).exponent(t.exponent())},eo.apply(t,arguments),t}function Wte(){return T2.apply(null,arguments).exponent(.5)}function sO(t){return Math.sign(t)*t*t}function $te(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function Bz(){var t=_2(),e=[0,1],n=!1,r;function i(s){var a=$te(t(s));return isNaN(a)?r:n?Math.round(a):a}return i.invert=function(s){return t.invert(sO(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,V1)).map(sO)),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 Bz(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},eo.apply(i,arguments),Dd(i)}function Hz(){var t=[],e=[],n=[],r;function i(){var a=0,o=Math.max(1,e.length);for(n=new Array(o-1);++a<o;)n[a-1]=Yee(t,a/o);return s}function s(a){return a==null||isNaN(a=+a)?r:e[sx(n,a)]}return s.invertExtent=function(a){var o=e.indexOf(a);return o<0?[NaN,NaN]:[o>0?n[o-1]:t[0],o<n.length?n[o]:t[t.length-1]]},s.domain=function(a){if(!arguments.length)return t.slice();t=[];for(let o of a)o!=null&&!isNaN(o=+o)&&t.push(o);return t.sort(Ad),i()},s.range=function(a){return arguments.length?(e=Array.from(a),i()):e.slice()},s.unknown=function(a){return arguments.length?(r=a,s):r},s.quantiles=function(){return n.slice()},s.copy=function(){return Hz().domain(t).range(e).unknown(r)},eo.apply(s,arguments)}function Vz(){var t=0,e=1,n=1,r=[.5],i=[0,1],s;function a(l){return l!=null&&l<=l?i[sx(r,l,0,n)]:s}function o(){var l=-1;for(r=new Array(n);++l<n;)r[l]=((l+1)*e-(l-n)*t)/(n+1);return a}return a.domain=function(l){return arguments.length?([t,e]=l,t=+t,e=+e,o()):[t,e]},a.range=function(l){return arguments.length?(n=(i=Array.from(l)).length-1,o()):i.slice()},a.invertExtent=function(l){var c=i.indexOf(l);return c<0?[NaN,NaN]:c<1?[t,r[0]]:c>=n?[r[n-1],e]:[r[c-1],r[c]]},a.unknown=function(l){return arguments.length&&(s=l),a},a.thresholds=function(){return r.slice()},a.copy=function(){return Vz().domain([t,e]).range(i).unknown(s)},eo.apply(Dd(a),arguments)}function Gz(){var t=[.5],e=[0,1],n,r=1;function i(s){return s!=null&&s<=s?e[sx(t,s,0,r)]:n}return i.domain=function(s){return arguments.length?(t=Array.from(s),r=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(s){return arguments.length?(e=Array.from(s),r=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(s){var a=e.indexOf(s);return[t[a-1],t[a]]},i.unknown=function(s){return arguments.length?(n=s,i):n},i.copy=function(){return Gz().domain(t).range(e).unknown(n)},eo.apply(i,arguments)}const BE=new Date,HE=new Date;function ai(t,e,n,r){function i(s){return t(s=arguments.length===0?new Date:new Date(+s)),s}return i.floor=s=>(t(s=new Date(+s)),s),i.ceil=s=>(t(s=new Date(s-1)),e(s,1),t(s),s),i.round=s=>{const a=i(s),o=i.ceil(s);return s-a<o-s?a:o},i.offset=(s,a)=>(e(s=new Date(+s),a==null?1:Math.floor(a)),s),i.range=(s,a,o)=>{const l=[];if(s=i.ceil(s),o=o==null?1:Math.floor(o),!(s<a)||!(o>0))return l;let c;do l.push(c=new Date(+s)),e(s,o),t(s);while(c<s&&s<a);return l},i.filter=s=>ai(a=>{if(a>=a)for(;t(a),!s(a);)a.setTime(a-1)},(a,o)=>{if(a>=a)if(o<0)for(;++o<=0;)for(;e(a,-1),!s(a););else for(;--o>=0;)for(;e(a,1),!s(a););}),n&&(i.count=(s,a)=>(BE.setTime(+s),HE.setTime(+a),t(BE),t(HE),Math.floor(n(BE,HE))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?a=>r(a)%s===0:a=>i.count(0,a)%s===0):i)),i}const $1=ai(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);$1.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?ai(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):$1);$1.range;const Bc=1e3,Xa=Bc*60,Hc=Xa*60,Qc=Hc*24,C2=Qc*7,aO=Qc*30,VE=Qc*365,dh=ai(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Bc)},(t,e)=>(e-t)/Bc,t=>t.getUTCSeconds());dh.range;const P2=ai(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Bc)},(t,e)=>{t.setTime(+t+e*Xa)},(t,e)=>(e-t)/Xa,t=>t.getMinutes());P2.range;const R2=ai(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Xa)},(t,e)=>(e-t)/Xa,t=>t.getUTCMinutes());R2.range;const N2=ai(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Bc-t.getMinutes()*Xa)},(t,e)=>{t.setTime(+t+e*Hc)},(t,e)=>(e-t)/Hc,t=>t.getHours());N2.range;const k2=ai(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Hc)},(t,e)=>(e-t)/Hc,t=>t.getUTCHours());k2.range;const lx=ai(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Xa)/Qc,t=>t.getDate()-1);lx.range;const US=ai(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Qc,t=>t.getUTCDate()-1);US.range;const Wz=ai(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Qc,t=>Math.floor(t/Qc));Wz.range;function sp(t){return ai(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*Xa)/C2)}const FS=sp(0),X1=sp(1),Xte=sp(2),qte=sp(3),Ig=sp(4),Kte=sp(5),Yte=sp(6);FS.range;X1.range;Xte.range;qte.range;Ig.range;Kte.range;Yte.range;function ap(t){return ai(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/C2)}const zS=ap(0),q1=ap(1),Zte=ap(2),Qte=ap(3),Lg=ap(4),Jte=ap(5),ene=ap(6);zS.range;q1.range;Zte.range;Qte.range;Lg.range;Jte.range;ene.range;const I2=ai(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());I2.range;const L2=ai(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());L2.range;const Jc=ai(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Jc.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:ai(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});Jc.range;const eu=ai(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());eu.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:ai(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});eu.range;function $z(t,e,n,r,i,s){const a=[[dh,1,Bc],[dh,5,5*Bc],[dh,15,15*Bc],[dh,30,30*Bc],[s,1,Xa],[s,5,5*Xa],[s,15,15*Xa],[s,30,30*Xa],[i,1,Hc],[i,3,3*Hc],[i,6,6*Hc],[i,12,12*Hc],[r,1,Qc],[r,2,2*Qc],[n,1,C2],[e,1,aO],[e,3,3*aO],[t,1,VE]];function o(c,d,f){const p=d<c;p&&([c,d]=[d,c]);const y=f&&typeof f.range=="function"?f:l(c,d,f),x=y?y.range(c,+d+1):[];return p?x.reverse():x}function l(c,d,f){const p=Math.abs(d-c)/f,y=m2(([,,w])=>w).right(a,p);if(y===a.length)return t.every(PC(c/VE,d/VE,f));if(y===0)return $1.every(Math.max(PC(c,d,f),1));const[x,S]=a[p/a[y-1][2]<a[y][2]/p?y-1:y];return x.every(S)}return[o,l]}const[tne,nne]=$z(eu,L2,zS,Wz,k2,R2),[rne,ine]=$z(Jc,I2,FS,lx,N2,P2);function GE(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function WE(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function g0(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function sne(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,s=t.days,a=t.shortDays,o=t.months,l=t.shortMonths,c=v0(i),d=y0(i),f=v0(s),p=y0(s),y=v0(a),x=y0(a),S=v0(o),w=y0(o),b=v0(l),M=y0(l),T={a:ce,A:B,b:J,B:Z,c:null,d:fO,e:fO,f:Cne,g:Une,G:zne,H:Ene,I:Ane,j:Tne,L:Xz,m:Pne,M:Rne,p:G,q:W,Q:mO,s:gO,S:Nne,u:kne,U:Ine,V:Lne,w:One,W:Dne,x:null,X:null,y:jne,Y:Fne,Z:Bne,"%":pO},C={a:oe,A:se,b:le,B:Me,c:null,d:hO,e:hO,f:Wne,g:tre,G:rre,H:Hne,I:Vne,j:Gne,L:Kz,m:$ne,M:Xne,p:Se,q:$e,Q:mO,s:gO,S:qne,u:Kne,U:Yne,V:Zne,w:Qne,W:Jne,x:null,X:null,y:ere,Y:nre,Z:ire,"%":pO},L={a:I,A:U,b:X,B:te,c:re,d:uO,e:uO,f:_ne,g:cO,G:lO,H:dO,I:dO,j:vne,L:bne,m:gne,M:yne,p:V,q:mne,Q:Sne,s:Mne,S:xne,u:une,U:dne,V:fne,w:cne,W:hne,x:pe,X:ee,y:cO,Y:lO,Z:pne,"%":wne};T.x=N(n,T),T.X=N(r,T),T.c=N(e,T),C.x=N(n,C),C.X=N(r,C),C.c=N(e,C);function N(Ee,Ge){return function(Xe){var fe=[],Q=-1,Ve=0,Le=Ee.length,We,Je,de;for(Xe instanceof Date||(Xe=new Date(+Xe));++Q<Le;)Ee.charCodeAt(Q)===37&&(fe.push(Ee.slice(Ve,Q)),(Je=oO[We=Ee.charAt(++Q)])!=null?We=Ee.charAt(++Q):Je=We==="e"?" ":"0",(de=Ge[We])&&(We=de(Xe,Je)),fe.push(We),Ve=Q+1);return fe.push(Ee.slice(Ve,Q)),fe.join("")}}function D(Ee,Ge){return function(Xe){var fe=g0(1900,void 0,1),Q=F(fe,Ee,Xe+="",0),Ve,Le;if(Q!=Xe.length)return null;if("Q"in fe)return new Date(fe.Q);if("s"in fe)return new Date(fe.s*1e3+("L"in fe?fe.L:0));if(Ge&&!("Z"in fe)&&(fe.Z=0),"p"in fe&&(fe.H=fe.H%12+fe.p*12),fe.m===void 0&&(fe.m="q"in fe?fe.q:0),"V"in fe){if(fe.V<1||fe.V>53)return null;"w"in fe||(fe.w=1),"Z"in fe?(Ve=WE(g0(fe.y,0,1)),Le=Ve.getUTCDay(),Ve=Le>4||Le===0?q1.ceil(Ve):q1(Ve),Ve=US.offset(Ve,(fe.V-1)*7),fe.y=Ve.getUTCFullYear(),fe.m=Ve.getUTCMonth(),fe.d=Ve.getUTCDate()+(fe.w+6)%7):(Ve=GE(g0(fe.y,0,1)),Le=Ve.getDay(),Ve=Le>4||Le===0?X1.ceil(Ve):X1(Ve),Ve=lx.offset(Ve,(fe.V-1)*7),fe.y=Ve.getFullYear(),fe.m=Ve.getMonth(),fe.d=Ve.getDate()+(fe.w+6)%7)}else("W"in fe||"U"in fe)&&("w"in fe||(fe.w="u"in fe?fe.u%7:"W"in fe?1:0),Le="Z"in fe?WE(g0(fe.y,0,1)).getUTCDay():GE(g0(fe.y,0,1)).getDay(),fe.m=0,fe.d="W"in fe?(fe.w+6)%7+fe.W*7-(Le+5)%7:fe.w+fe.U*7-(Le+6)%7);return"Z"in fe?(fe.H+=fe.Z/100|0,fe.M+=fe.Z%100,WE(fe)):GE(fe)}}function F(Ee,Ge,Xe,fe){for(var Q=0,Ve=Ge.length,Le=Xe.length,We,Je;Q<Ve;){if(fe>=Le)return-1;if(We=Ge.charCodeAt(Q++),We===37){if(We=Ge.charAt(Q++),Je=L[We in oO?Ge.charAt(Q++):We],!Je||(fe=Je(Ee,Xe,fe))<0)return-1}else if(We!=Xe.charCodeAt(fe++))return-1}return fe}function V(Ee,Ge,Xe){var fe=c.exec(Ge.slice(Xe));return fe?(Ee.p=d.get(fe[0].toLowerCase()),Xe+fe[0].length):-1}function I(Ee,Ge,Xe){var fe=y.exec(Ge.slice(Xe));return fe?(Ee.w=x.get(fe[0].toLowerCase()),Xe+fe[0].length):-1}function U(Ee,Ge,Xe){var fe=f.exec(Ge.slice(Xe));return fe?(Ee.w=p.get(fe[0].toLowerCase()),Xe+fe[0].length):-1}function X(Ee,Ge,Xe){var fe=b.exec(Ge.slice(Xe));return fe?(Ee.m=M.get(fe[0].toLowerCase()),Xe+fe[0].length):-1}function te(Ee,Ge,Xe){var fe=S.exec(Ge.slice(Xe));return fe?(Ee.m=w.get(fe[0].toLowerCase()),Xe+fe[0].length):-1}function re(Ee,Ge,Xe){return F(Ee,e,Ge,Xe)}function pe(Ee,Ge,Xe){return F(Ee,n,Ge,Xe)}function ee(Ee,Ge,Xe){return F(Ee,r,Ge,Xe)}function ce(Ee){return a[Ee.getDay()]}function B(Ee){return s[Ee.getDay()]}function J(Ee){return l[Ee.getMonth()]}function Z(Ee){return o[Ee.getMonth()]}function G(Ee){return i[+(Ee.getHours()>=12)]}function W(Ee){return 1+~~(Ee.getMonth()/3)}function oe(Ee){return a[Ee.getUTCDay()]}function se(Ee){return s[Ee.getUTCDay()]}function le(Ee){return l[Ee.getUTCMonth()]}function Me(Ee){return o[Ee.getUTCMonth()]}function Se(Ee){return i[+(Ee.getUTCHours()>=12)]}function $e(Ee){return 1+~~(Ee.getUTCMonth()/3)}return{format:function(Ee){var Ge=N(Ee+="",T);return Ge.toString=function(){return Ee},Ge},parse:function(Ee){var Ge=D(Ee+="",!1);return Ge.toString=function(){return Ee},Ge},utcFormat:function(Ee){var Ge=N(Ee+="",C);return Ge.toString=function(){return Ee},Ge},utcParse:function(Ee){var Ge=D(Ee+="",!0);return Ge.toString=function(){return Ee},Ge}}}var oO={"-":"",_:" ",0:"0"},Si=/^\s*\d+/,ane=/^%/,one=/[\\^$*+?|[\]().{}]/g;function Un(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",s=i.length;return r+(s<n?new Array(n-s+1).join(e)+i:i)}function lne(t){return t.replace(one,"\\$&")}function v0(t){return new RegExp("^(?:"+t.map(lne).join("|")+")","i")}function y0(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function cne(t,e,n){var r=Si.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function une(t,e,n){var r=Si.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function dne(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function fne(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function hne(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function lO(t,e,n){var r=Si.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function cO(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function pne(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 mne(t,e,n){var r=Si.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function gne(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function uO(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function vne(t,e,n){var r=Si.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function dO(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function yne(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function xne(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function bne(t,e,n){var r=Si.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function _ne(t,e,n){var r=Si.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function wne(t,e,n){var r=ane.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Sne(t,e,n){var r=Si.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Mne(t,e,n){var r=Si.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function fO(t,e){return Un(t.getDate(),e,2)}function Ene(t,e){return Un(t.getHours(),e,2)}function Ane(t,e){return Un(t.getHours()%12||12,e,2)}function Tne(t,e){return Un(1+lx.count(Jc(t),t),e,3)}function Xz(t,e){return Un(t.getMilliseconds(),e,3)}function Cne(t,e){return Xz(t,e)+"000"}function Pne(t,e){return Un(t.getMonth()+1,e,2)}function Rne(t,e){return Un(t.getMinutes(),e,2)}function Nne(t,e){return Un(t.getSeconds(),e,2)}function kne(t){var e=t.getDay();return e===0?7:e}function Ine(t,e){return Un(FS.count(Jc(t)-1,t),e,2)}function qz(t){var e=t.getDay();return e>=4||e===0?Ig(t):Ig.ceil(t)}function Lne(t,e){return t=qz(t),Un(Ig.count(Jc(t),t)+(Jc(t).getDay()===4),e,2)}function One(t){return t.getDay()}function Dne(t,e){return Un(X1.count(Jc(t)-1,t),e,2)}function jne(t,e){return Un(t.getFullYear()%100,e,2)}function Une(t,e){return t=qz(t),Un(t.getFullYear()%100,e,2)}function Fne(t,e){return Un(t.getFullYear()%1e4,e,4)}function zne(t,e){var n=t.getDay();return t=n>=4||n===0?Ig(t):Ig.ceil(t),Un(t.getFullYear()%1e4,e,4)}function Bne(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Un(e/60|0,"0",2)+Un(e%60,"0",2)}function hO(t,e){return Un(t.getUTCDate(),e,2)}function Hne(t,e){return Un(t.getUTCHours(),e,2)}function Vne(t,e){return Un(t.getUTCHours()%12||12,e,2)}function Gne(t,e){return Un(1+US.count(eu(t),t),e,3)}function Kz(t,e){return Un(t.getUTCMilliseconds(),e,3)}function Wne(t,e){return Kz(t,e)+"000"}function $ne(t,e){return Un(t.getUTCMonth()+1,e,2)}function Xne(t,e){return Un(t.getUTCMinutes(),e,2)}function qne(t,e){return Un(t.getUTCSeconds(),e,2)}function Kne(t){var e=t.getUTCDay();return e===0?7:e}function Yne(t,e){return Un(zS.count(eu(t)-1,t),e,2)}function Yz(t){var e=t.getUTCDay();return e>=4||e===0?Lg(t):Lg.ceil(t)}function Zne(t,e){return t=Yz(t),Un(Lg.count(eu(t),t)+(eu(t).getUTCDay()===4),e,2)}function Qne(t){return t.getUTCDay()}function Jne(t,e){return Un(q1.count(eu(t)-1,t),e,2)}function ere(t,e){return Un(t.getUTCFullYear()%100,e,2)}function tre(t,e){return t=Yz(t),Un(t.getUTCFullYear()%100,e,2)}function nre(t,e){return Un(t.getUTCFullYear()%1e4,e,4)}function rre(t,e){var n=t.getUTCDay();return t=n>=4||n===0?Lg(t):Lg.ceil(t),Un(t.getUTCFullYear()%1e4,e,4)}function ire(){return"+0000"}function pO(){return"%"}function mO(t){return+t}function gO(t){return Math.floor(+t/1e3)}var gm,Zz,Qz;sre({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 sre(t){return gm=sne(t),Zz=gm.format,gm.parse,Qz=gm.utcFormat,gm.utcParse,gm}function are(t){return new Date(t)}function ore(t){return t instanceof Date?+t:+new Date(+t)}function O2(t,e,n,r,i,s,a,o,l,c){var d=_2(),f=d.invert,p=d.domain,y=c(".%L"),x=c(":%S"),S=c("%I:%M"),w=c("%I %p"),b=c("%a %d"),M=c("%b %d"),T=c("%B"),C=c("%Y");function L(N){return(l(N)<N?y:o(N)<N?x:a(N)<N?S:s(N)<N?w:r(N)<N?i(N)<N?b:M:n(N)<N?T:C)(N)}return d.invert=function(N){return new Date(f(N))},d.domain=function(N){return arguments.length?p(Array.from(N,ore)):p().map(are)},d.ticks=function(N){var D=p();return t(D[0],D[D.length-1],N??10)},d.tickFormat=function(N,D){return D==null?L:c(D)},d.nice=function(N){var D=p();return(!N||typeof N.range!="function")&&(N=e(D[0],D[D.length-1],N??10)),N?p(Uz(D,N)):d},d.copy=function(){return ox(d,O2(t,e,n,r,i,s,a,o,l,c))},d}function lre(){return eo.apply(O2(rne,ine,Jc,I2,FS,lx,N2,P2,dh,Zz).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function cre(){return eo.apply(O2(tne,nne,eu,L2,zS,US,k2,R2,dh,Qz).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function BS(){var t=0,e=1,n,r,i,s,a=As,o=!1,l;function c(f){return f==null||isNaN(f=+f)?l:a(i===0?.5:(f=(s(f)-n)*i,o?Math.max(0,Math.min(1,f)):f))}c.domain=function(f){return arguments.length?([t,e]=f,n=s(t=+t),r=s(e=+e),i=n===r?0:1/(r-n),c):[t,e]},c.clamp=function(f){return arguments.length?(o=!!f,c):o},c.interpolator=function(f){return arguments.length?(a=f,c):a};function d(f){return function(p){var y,x;return arguments.length?([y,x]=p,a=f(y,x),c):[a(0),a(1)]}}return c.range=d(ev),c.rangeRound=d(b2),c.unknown=function(f){return arguments.length?(l=f,c):l},function(f){return s=f,n=f(t),r=f(e),i=n===r?0:1/(r-n),c}}function jd(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function Jz(){var t=Dd(BS()(As));return t.copy=function(){return jd(t,Jz())},su.apply(t,arguments)}function eB(){var t=M2(BS()).domain([1,10]);return t.copy=function(){return jd(t,eB()).base(t.base())},su.apply(t,arguments)}function tB(){var t=E2(BS());return t.copy=function(){return jd(t,tB()).constant(t.constant())},su.apply(t,arguments)}function D2(){var t=A2(BS());return t.copy=function(){return jd(t,D2()).exponent(t.exponent())},su.apply(t,arguments)}function ure(){return D2.apply(null,arguments).exponent(.5)}function nB(){var t=[],e=As;function n(r){if(r!=null&&!isNaN(r=+r))return e((sx(t,r,1)-1)/(t.length-1))}return n.domain=function(r){if(!arguments.length)return t.slice();t=[];for(let i of r)i!=null&&!isNaN(i=+i)&&t.push(i);return t.sort(Ad),n},n.interpolator=function(r){return arguments.length?(e=r,n):e},n.range=function(){return t.map((r,i)=>e(i/(t.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,s)=>Kee(t,s/r))},n.copy=function(){return nB(e).domain(t)},su.apply(n,arguments)}function HS(){var t=0,e=.5,n=1,r=1,i,s,a,o,l,c=As,d,f=!1,p;function y(S){return isNaN(S=+S)?p:(S=.5+((S=+d(S))-s)*(r*S<r*s?o:l),c(f?Math.max(0,Math.min(1,S)):S))}y.domain=function(S){return arguments.length?([t,e,n]=S,i=d(t=+t),s=d(e=+e),a=d(n=+n),o=i===s?0:.5/(s-i),l=s===a?0:.5/(a-s),r=s<i?-1:1,y):[t,e,n]},y.clamp=function(S){return arguments.length?(f=!!S,y):f},y.interpolator=function(S){return arguments.length?(c=S,y):c};function x(S){return function(w){var b,M,T;return arguments.length?([b,M,T]=w,c=wte(S,[b,M,T]),y):[c(0),c(.5),c(1)]}}return y.range=x(ev),y.rangeRound=x(b2),y.unknown=function(S){return arguments.length?(p=S,y):p},function(S){return d=S,i=S(t),s=S(e),a=S(n),o=i===s?0:.5/(s-i),l=s===a?0:.5/(a-s),r=s<i?-1:1,y}}function rB(){var t=Dd(HS()(As));return t.copy=function(){return jd(t,rB())},su.apply(t,arguments)}function iB(){var t=M2(HS()).domain([.1,1,10]);return t.copy=function(){return jd(t,iB()).base(t.base())},su.apply(t,arguments)}function sB(){var t=E2(HS());return t.copy=function(){return jd(t,sB()).constant(t.constant())},su.apply(t,arguments)}function j2(){var t=A2(HS());return t.copy=function(){return jd(t,j2()).exponent(t.exponent())},su.apply(t,arguments)}function dre(){return j2.apply(null,arguments).exponent(.5)}const aB=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:v2,scaleDiverging:rB,scaleDivergingLog:iB,scaleDivergingPow:j2,scaleDivergingSqrt:dre,scaleDivergingSymlog:sB,scaleIdentity:jz,scaleImplicit:RC,scaleLinear:Dz,scaleLog:Fz,scaleOrdinal:g2,scalePoint:Qee,scalePow:T2,scaleQuantile:Hz,scaleQuantize:Vz,scaleRadial:Bz,scaleSequential:Jz,scaleSequentialLog:eB,scaleSequentialPow:D2,scaleSequentialQuantile:nB,scaleSequentialSqrt:ure,scaleSequentialSymlog:tB,scaleSqrt:Wte,scaleSymlog:zz,scaleThreshold:Gz,scaleTime:lre,scaleUtc:cre,tickFormat:Oz},Symbol.toStringTag,{value:"Module"}));function fre(t){var e=aB;if(t in e&&typeof e[t]=="function")return e[t]();var n="scale".concat(zP(t));if(n in e&&typeof e[n]=="function")return e[n]()}function vO(t,e,n){if(typeof t=="function")return t.copy().domain(e).range(n);if(t!=null){var r=fre(t);if(r!=null)return r.domain(e).range(n),r}}function U2(t,e,n,r){if(!(n==null||r==null))return typeof t.scale=="function"?vO(t.scale,n,r):vO(e,n,r)}function hre(t){return"scale".concat(zP(t))}function pre(t){return hre(t)in aB}var oB=(t,e,n)=>{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 pre(r)?r:"point"}};function mre(t,e){for(var n=0,r=t.length,i=t[0]<t[t.length-1];n<r;){var s=Math.floor((n+r)/2);(i?t[s]<e:t[s]>e)?n=s+1:r=s}return n}function lB(t,e){if(t){var n=e??t.domain(),r=n.map(s=>{var a;return(a=t(s))!==null&&a!==void 0?a:0}),i=t.range();if(!(n.length===0||i.length<2))return s=>{var a,o,l=mre(r,s);if(l<=0)return n[0];if(l>=n.length)return n[n.length-1];var c=(a=r[l-1])!==null&&a!==void 0?a:0,d=(o=r[l])!==null&&o!==void 0?o:0;return Math.abs(s-c)<=Math.abs(s-d)?n[l-1]:n[l]}}}function gre(t){if(t!=null)return"invert"in t&&typeof t.invert=="function"?t.invert.bind(t):lB(t,void 0)}function yO(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 K1(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?yO(Object(n),!0).forEach(function(r){vre(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):yO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function vre(t,e,n){return(e=yre(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function yre(t){var e=xre(t,"string");return typeof e=="symbol"?e:e+""}function xre(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)}function cB(t,e){return Sre(t)||wre(t,e)||_re(t,e)||bre()}function bre(){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 _re(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);n<e;n++)r[n]=t[n];return r}function wre(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function Sre(t){if(Array.isArray(t))return t}var LC=[0,"auto"],ti={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:void 0,height:30,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"bottom",padding:{left:0,right:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"category",unit:void 0,niceTicks:"auto"},uB=(t,e)=>t.cartesianAxis.xAxis[e],au=(t,e)=>{var n=uB(t,e);return n??ti},ni={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:LC,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:ex},dB=(t,e)=>t.cartesianAxis.yAxis[e],ou=(t,e)=>{var n=dB(t,e);return n??ni},Mre={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:""},F2=(t,e)=>{var n=t.cartesianAxis.zAxis[e];return n??Mre},Ns=(t,e,n)=>{switch(e){case"xAxis":return au(t,n);case"yAxis":return ou(t,n);case"zAxis":return F2(t,n);case"angleAxis":return c2(t,n);case"radiusAxis":return u2(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},Ere=(t,e,n)=>{switch(e){case"xAxis":return au(t,n);case"yAxis":return ou(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},cx=(t,e,n)=>{switch(e){case"xAxis":return au(t,n);case"yAxis":return ou(t,n);case"angleAxis":return c2(t,n);case"radiusAxis":return u2(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},fB=t=>t.graphicalItems.cartesianItems.some(e=>e.type==="bar")||t.graphicalItems.polarItems.some(e=>e.type==="radialBar");function hB(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 pB=t=>t.graphicalItems.cartesianItems,Are=ke([_i,LS],hB),mB=(t,e,n)=>t.filter(n).filter(r=>(e==null?void 0:e.includeHidden)===!0?!0:!r.hide),tv=ke([pB,Ns,Are],mB,{memoizeOptions:{resultEqualityCheck:DS}}),gB=ke([tv],t=>t.filter(e=>e.type==="area"||e.type==="bar").filter(h2)),vB=t=>t.filter(e=>!("stackId"in e)||e.stackId===void 0),Tre=ke([tv],vB),yB=t=>t.map(e=>e.data).filter(Boolean).flat(1),Cre=ke([tv],t=>t.some(e=>!e.data)),xB=ke([tv],yB,{memoizeOptions:{resultEqualityCheck:DS}}),bB=(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)},z2=ke([xB,PS],bB),Pre=(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})),_B=(t,e,n,r,i,s)=>{var a=r.chartData,o=a===void 0?[]:a,l=r.dataStartIndex,c=r.dataEndIndex,d=Pre(t,e,n);if(i&&(e==null?void 0:e.dataKey)!=null&&s.length>0){var f=o.slice(l,c+1),p=f.map(y=>({value:yi(y,e.dataKey)})).filter(y=>y.value!=null);return[...p,...d]}return d},ux=ke([z2,Ns,tv,PS,Cre,xB],_B);function lg(t){if(Ll(t)||t instanceof Date){var e=Number(t);if(wn(e))return e}}function bO(t){if(Array.isArray(t)){var e=[lg(t[0]),lg(t[1])];return Al(e)?e:void 0}var n=lg(t);if(n!=null)return[n,n]}function jl(t){return t.map(lg).filter(Qs)}function Rre(t,e){var n=lg(t),r=lg(e);return n==null&&r==null?0:n==null?-1:r==null?1:n-r}var Nre=ke([ux],t=>t==null?void 0:t.map(e=>e.value).sort(Rre));function wB(t,e){switch(t){case"xAxis":return e.direction==="x";case"yAxis":return e.direction==="y";default:return!1}}function kre(t,e,n){if(!n)return[];if(!n.length)return[];var r;if(typeof e=="number"&&!Il(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 a=yi(t,s.dataKey),o,l;if(Array.isArray(a)){var c=cB(a,2);o=c[0],l=c[1]}else o=l=a;if(!(!wn(o)||!wn(l)))return[r-o,r+l]}))}var oi=t=>{var e=wi(t),n=Jg(t);return cx(t,e,n)},Og=ke([oi],t=>t==null?void 0:t.dataKey),Ire=ke([gB,PS,oi],Az),SB=(t,e,n,r)=>{var i={},s=e.reduce((a,o)=>{if(o.stackId==null)return a;var l=a[o.stackId];return l==null&&(l=[]),l.push(o),a[o.stackId]=l,a},i);return Object.fromEntries(Object.entries(s).map(a=>{var o=cB(a,2),l=o[0],c=o[1],d=r?[...c].reverse():c,f=d.map(f2);return[l,{stackedData:ZY(t,f,n),graphicalItems:d}]}))},MB=ke([Ire,gB,RS,xz],SB),EB=(t,e,n,r)=>{var i=e.dataStartIndex,s=e.dataEndIndex;if(r==null&&n!=="zAxis")return tZ(t,i,s)},Lre=ke([Ns],t=>t.allowDataOverflow),B2=t=>{var e;if(t==null||!("domain"in t))return LC;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:LC},AB=ke([Ns],B2),TB=ke([AB,Lre],lz),Ore=ke([MB,Xo,_i,TB],EB,{memoizeOptions:{resultEqualityCheck:OS}}),H2=t=>t.errorBars,Dre=(t,e,n)=>t.flatMap(r=>e[r.id]).filter(Boolean).filter(r=>wB(n,r)),Y1=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=n.filter(Boolean);if(i.length!==0){var s=i.flat(),a=Math.min(...s),o=Math.max(...s);return[a,o]}},CB=function(e,n,r,i,s){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:[],o,l;if(r.length>0&&r.forEach(c=>{var d,f=c.data!=null?[...c.data]:a,p=(d=i[c.id])===null||d===void 0?void 0:d.filter(y=>wB(s,y));f.forEach(y=>{var x,S=yi(y,(x=n.dataKey)!==null&&x!==void 0?x:c.dataKey),w=kre(y,S,p);if(w.length>=2){var b=Math.min(...w),M=Math.max(...w);(o==null||b<o)&&(o=b),(l==null||M>l)&&(l=M)}var T=bO(S);T!=null&&(o=o==null?T[0]:Math.min(o,T[0]),l=l==null?T[1]:Math.max(l,T[1]))})}),(n==null?void 0:n.dataKey)!=null&&r.length===0&&e.forEach(c=>{var d=bO(yi(c,n.dataKey));d!=null&&(o=o==null?d[0]:Math.min(o,d[0]),l=l==null?d[1]:Math.max(l,d[1]))}),wn(o)&&wn(l))return[o,l]},jre=ke([z2,Ns,Tre,H2,_i,hee],CB,{memoizeOptions:{resultEqualityCheck:OS}});function Ure(t){var e=t.value;if(Ll(e)||e instanceof Date)return e}var Fre=(t,e,n)=>{var r=t.map(Ure).filter(i=>i!=null);return n&&(e.dataKey==null||e.allowDuplicatedCategory&&FF(r))?oz(0,t.length):e.allowDuplicatedCategory?r:Array.from(new Set(r))},PB=t=>t.referenceElements.dots,nv=(t,e,n)=>t.filter(r=>r.ifOverflow==="extendDomain").filter(r=>e==="xAxis"?r.xAxisId===n:r.yAxisId===n),zre=ke([PB,_i,LS],nv),RB=t=>t.referenceElements.areas,Bre=ke([RB,_i,LS],nv),NB=t=>t.referenceElements.lines,Hre=ke([NB,_i,LS],nv),kB=(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)]}},Vre=ke(zre,_i,kB),IB=(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([Bre,_i],IB);function Wre(t){var e;if(t.x!=null)return jl([t.x]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(r=>r.x);return n==null||n.length===0?[]:jl(n)}function $re(t){var e;if(t.y!=null)return jl([t.y]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(r=>r.y);return n==null||n.length===0?[]:jl(n)}var LB=(t,e)=>{if(t!=null){var n=t.flatMap(r=>e==="xAxis"?Wre(r):$re(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},Xre=ke([Hre,_i],LB),qre=ke(Vre,Xre,Gre,(t,e,n)=>Y1(t,n,e)),OB=(t,e,n,r,i,s,a,o)=>{if(n!=null)return n;var l=a==="vertical"&&o==="xAxis"||a==="horizontal"&&o==="yAxis",c=l?Y1(r,s,i):Y1(s,i);return xee(e,c,t.allowDataOverflow)},Kre=ke([Ns,AB,TB,Ore,jre,qre,hr,_i],OB,{memoizeOptions:{resultEqualityCheck:OS}}),Yre=[0,1],DB=(t,e,n,r,i,s,a)=>{if(!((t==null||n==null||n.length===0)&&a===void 0)){var o=t.dataKey,l=t.type,c=Hl(e,s);if(c&&o==null){var d;return oz(0,(d=n==null?void 0:n.length)!==null&&d!==void 0?d:0)}return l==="category"?Fre(r,t,c):i==="expand"&&!c?Yre:a}},V2=ke([Ns,hr,z2,ux,RS,_i,Kre],DB),rv=ke([Ns,fB,a2],oB),jB=(t,e,n)=>{var r=e.niceTicks;if(r!=="none"){var i=B2(e),s=Array.isArray(i)&&(i[0]==="auto"||i[1]==="auto");if((r==="snap125"||r==="adaptive")&&e!=null&&e.tickCount&&Al(t)){if(s)return PL(t,e.tickCount,e.allowDecimals,r);if(e.type==="number")return RL(t,e.tickCount,e.allowDecimals,r)}if(r==="auto"&&n==="linear"&&e!=null&&e.tickCount){if(s&&Al(t))return PL(t,e.tickCount,e.allowDecimals,"adaptive");if(e.type==="number"&&Al(t))return RL(t,e.tickCount,e.allowDecimals,"adaptive")}}},G2=ke([V2,cx,rv],jB),UB=(t,e,n,r)=>{if(r!=="angleAxis"&&(t==null?void 0:t.type)==="number"&&Al(e)&&Array.isArray(n)&&n.length>0){var i,s,a=e[0],o=(i=n[0])!==null&&i!==void 0?i:0,l=e[1],c=(s=n[n.length-1])!==null&&s!==void 0?s:0;return[Math.min(a,o),Math.max(l,c)]}return e},Zre=ke([Ns,V2,G2,_i],UB),Qre=ke(ux,Ns,(t,e)=>{if(!(!e||e.type!=="number")){var n=1/0,r=Array.from(jl(t.map(f=>f.value))).sort((f,p)=>f-p),i=r[0],s=r[r.length-1];if(i==null||s==null)return 1/0;var a=s-i;if(a===0)return 1/0;for(var o=0;o<r.length-1;o++){var l=r[o],c=r[o+1];if(!(l==null||c==null)){var d=c-l;n=Math.min(n,d)}}return n/a}}),FB=ke(Qre,hr,Cee,Wi,(t,e,n,r,i)=>i,(t,e,n,r,i)=>{if(!wn(t))return 0;var s=e==="vertical"?r.height:r.width;if(i==="gap")return t*s/2;if(i==="no-gap"){var a=Nd(n,t*s),o=t*s/2;return o-a-(o-a)/s*a}return 0}),Jre=(t,e,n)=>{var r=au(t,e);return r==null||typeof r.padding!="string"?0:FB(t,"xAxis",e,n,r.padding)},eie=(t,e,n)=>{var r=ou(t,e);return r==null||typeof r.padding!="string"?0:FB(t,"yAxis",e,n,r.padding)},tie=ke(au,Jre,(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}}),nie=ke(ou,eie,(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}}),zB=ke([Wi,tie,SS,wS,(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]}),BB=ke([Wi,hr,nie,SS,wS,(t,e,n)=>n],(t,e,n,r,i,s)=>{var a=i.padding;return s?[r.height-a.bottom,a.top]:e==="horizontal"?[t.top+t.height-n.bottom,t.top+n.top]:[t.top+n.top,t.top+t.height-n.bottom]}),dx=(t,e,n,r)=>{var i;switch(e){case"xAxis":return zB(t,n,r);case"yAxis":return BB(t,n,r);case"zAxis":return(i=F2(t,n))===null||i===void 0?void 0:i.range;case"angleAxis":return Sz(t);case"radiusAxis":return Mz(t,n);default:return}},HB=ke([Ns,dx],NS),rie=ke([rv,Zre],jee),W2=ke([Ns,rv,rie,HB],U2),VB=(t,e,n,r)=>{if(!(n==null||n.dataKey==null)){var i=n.type,s=n.scale,a=Hl(t,r);if(a&&(i==="number"||s!=="auto"))return e.map(o=>o.value)}},$2=ke([hr,ux,cx,_i],VB),VS=ke([W2],p2);ke([W2],gre);ke([W2,Nre],lB);ke([tv,H2,_i],Dre);function GB(t,e){return t.id<e.id?-1:t.id>e.id?1:0}var GS=(t,e)=>e,WS=(t,e,n)=>n,iie=ke(bS,GS,WS,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(GB)),sie=ke(_S,GS,WS,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(GB)),WB=(t,e)=>({width:t.width,height:e.height}),aie=(t,e)=>{var n=typeof e.width=="number"?e.width:ex;return{width:n,height:t.height}},oie=ke(Wi,au,WB),lie=(t,e,n)=>{switch(e){case"top":return t.top;case"bottom":return n-t.bottom;default:return 0}},cie=(t,e,n)=>{switch(e){case"left":return t.left;case"right":return n-t.right;default:return 0}},uie=ke(iu,Wi,iie,GS,WS,(t,e,n,r,i)=>{var s={},a;return n.forEach(o=>{var l=WB(e,o);a==null&&(a=lie(e,r,t));var c=r==="top"&&!i||r==="bottom"&&i;s[o.id]=a-Number(c)*l.height,a+=(c?-1:1)*l.height}),s}),die=ke(ru,Wi,sie,GS,WS,(t,e,n,r,i)=>{var s={},a;return n.forEach(o=>{var l=aie(e,o);a==null&&(a=cie(e,r,t));var c=r==="left"&&!i||r==="right"&&i;s[o.id]=a-Number(c)*l.width,a+=(c?-1:1)*l.width}),s}),fie=(t,e)=>{var n=au(t,e);if(n!=null)return uie(t,n.orientation,n.mirror)},hie=ke([Wi,au,fie,(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}}}),pie=(t,e)=>{var n=ou(t,e);if(n!=null)return die(t,n.orientation,n.mirror)},mie=ke([Wi,ou,pie,(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}}}),gie=ke(Wi,ou,(t,e)=>{var n=typeof e.width=="number"?e.width:ex;return{width:n,height:t.height}}),$B=(t,e,n,r)=>{if(n!=null){var i=n.allowDuplicatedCategory,s=n.type,a=n.dataKey,o=Hl(t,r),l=e.map(d=>d.value),c=l.filter(d=>d!=null);if(a&&o&&s==="category"&&i&&FF(c))return l}},X2=ke([hr,ux,Ns,_i],$B),_O=ke([hr,Ere,rv,VS,X2,$2,dx,G2,_i],(t,e,n,r,i,s,a,o,l)=>{if(e!=null){var c=Hl(t,l);return{angle:e.angle,interval:e.interval,minTickGap:e.minTickGap,orientation:e.orientation,tick:e.tick,tickCount:e.tickCount,tickFormatter:e.tickFormatter,ticks:e.ticks,type:e.type,unit:e.unit,axisType:l,categoricalDomain:s,duplicateDomain:i,isCategorical:c,niceTicks:o,range:a,realScaleType:n,scale:r}}}),vie=(t,e,n,r,i,s,a,o,l)=>{if(!(e==null||r==null)){var c=Hl(t,l),d=e.type,f=e.ticks,p=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?Wa(s[0]-s[1])*2*x:x;var S=f||i;return S?S.map((w,b)=>{var M=a?a.indexOf(w):w,T=r.map(M);return wn(T)?{index:b,coordinate:T+x,value:w,offset:x}:null}).filter(Qs):c&&o?o.map((w,b)=>{var M=r.map(w);return wn(M)?{coordinate:M+x,value:w,index:b,offset:x}:null}).filter(Qs):r.ticks?r.ticks(p).map((w,b)=>{var M=r.map(w);return wn(M)?{coordinate:M+x,value:w,index:b,offset:x}:null}).filter(Qs):r.domain().map((w,b)=>{var M=r.map(w);return wn(M)?{coordinate:M+x,value:a?a[w]:w,index:b,offset:x}:null}).filter(Qs)}},XB=ke([hr,cx,rv,VS,G2,dx,X2,$2,_i],vie),yie=(t,e,n,r,i,s,a)=>{if(!(e==null||n==null||r==null||r[0]===r[1])){var o=Hl(t,a),l=e.tickCount,c=0;return c=a==="angleAxis"&&(r==null?void 0:r.length)>=2?Wa(r[0]-r[1])*2*c:c,o&&s?s.map((d,f)=>{var p=n.map(d);return wn(p)?{coordinate:p+c,value:d,index:f,offset:c}:null}).filter(Qs):n.ticks?n.ticks(l).map((d,f)=>{var p=n.map(d);return wn(p)?{coordinate:p+c,value:d,index:f,offset:c}:null}).filter(Qs):n.domain().map((d,f)=>{var p=n.map(d);return wn(p)?{coordinate:p+c,value:i?i[d]:d,index:f,offset:c}:null}).filter(Qs)}},qB=ke([hr,cx,VS,dx,X2,$2,_i],yie),KB=ke(Ns,VS,(t,e)=>{if(!(t==null||e==null))return K1(K1({},t),{},{scale:e})}),xie=ke([Ns,rv,V2,HB],U2),bie=ke([xie],p2);ke((t,e,n)=>F2(t,n),bie,(t,e)=>{if(!(t==null||e==null))return K1(K1({},t),{},{scale:e})});var _ie=ke([hr,bS,_S],(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}}),wie=(t,e,n)=>{var r;return(r=t.renderedTicks[e])===null||r===void 0?void 0:r[n]};ke([wie],t=>{if(!(!t||t.length===0))return e=>{var n,r=1/0,i=t[0];for(var s of t){var a=Math.abs(s.coordinate-e);a<r&&(r=a,i=s)}return(n=i)===null||n===void 0?void 0:n.value}});var YB=t=>t.options.defaultTooltipEventType,ZB=t=>t.options.validateTooltipEventTypes;function QB(t,e,n){if(t==null)return e;var r=t?"axis":"item";return n==null?e:n.includes(r)?r:e}function fx(t,e){var n=YB(t),r=ZB(t);return QB(e,n,r)}function Sie(t){return Ft(e=>fx(e,t))}var JB=(t,e)=>{var n,r=Number(e);if(!(Il(r)||e==null))return r>=0?t==null||(n=t[r])===null||n===void 0?void 0:n.value:void 0},Mie=t=>t.tooltip.settings,fd={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},Eie={itemInteraction:{click:fd,hover:fd},axisInteraction:{click:fd,hover:fd},keyboardInteraction:fd,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}},eH=cs({name:"tooltip",initialState:Eie,reducers:{addTooltipEntrySettings:{reducer(t,e){t.tooltipItemPayloads.push(e.payload)},prepare:ar()},replaceTooltipEntrySettings:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=$a(t).tooltipItemPayloads.indexOf(r);s>-1&&(t.tooltipItemPayloads[s]=i)},prepare:ar()},removeTooltipEntrySettings:{reducer(t,e){var n=$a(t).tooltipItemPayloads.indexOf(e.payload);n>-1&&t.tooltipItemPayloads.splice(n,1)},prepare:ar()},setTooltipSettingsState(t,e){t.settings=e.payload},setActiveMouseOverItemIndex(t,e){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.keyboardInteraction.active=!1,t.itemInteraction.hover.active=!0,t.itemInteraction.hover.index=e.payload.activeIndex,t.itemInteraction.hover.dataKey=e.payload.activeDataKey,t.itemInteraction.hover.graphicalItemId=e.payload.activeGraphicalItemId,t.itemInteraction.hover.coordinate=e.payload.activeCoordinate},mouseLeaveChart(t){t.itemInteraction.hover.active=!1,t.axisInteraction.hover.active=!1},mouseLeaveItem(t){t.itemInteraction.hover.active=!1},setActiveClickItemIndex(t,e){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.itemInteraction.click.active=!0,t.keyboardInteraction.active=!1,t.itemInteraction.click.index=e.payload.activeIndex,t.itemInteraction.click.dataKey=e.payload.activeDataKey,t.itemInteraction.click.graphicalItemId=e.payload.activeGraphicalItemId,t.itemInteraction.click.coordinate=e.payload.activeCoordinate},setMouseOverAxisIndex(t,e){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.axisInteraction.hover.active=!0,t.keyboardInteraction.active=!1,t.axisInteraction.hover.index=e.payload.activeIndex,t.axisInteraction.hover.dataKey=e.payload.activeDataKey,t.axisInteraction.hover.coordinate=e.payload.activeCoordinate},setMouseClickAxisIndex(t,e){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.keyboardInteraction.active=!1,t.axisInteraction.click.active=!0,t.axisInteraction.click.index=e.payload.activeIndex,t.axisInteraction.click.dataKey=e.payload.activeDataKey,t.axisInteraction.click.coordinate=e.payload.activeCoordinate},setSyncInteraction(t,e){t.syncInteraction=e.payload},setKeyboardInteraction(t,e){t.keyboardInteraction.active=e.payload.active,t.keyboardInteraction.index=e.payload.activeIndex,t.keyboardInteraction.coordinate=e.payload.activeCoordinate}}}),to=eH.actions,Aie=to.addTooltipEntrySettings,Tie=to.replaceTooltipEntrySettings,Cie=to.removeTooltipEntrySettings,Pie=to.setTooltipSettingsState,Rie=to.setActiveMouseOverItemIndex;to.mouseLeaveItem;var tH=to.mouseLeaveChart;to.setActiveClickItemIndex;var nH=to.setMouseOverAxisIndex,Nie=to.setMouseClickAxisIndex,X0=to.setSyncInteraction,Z1=to.setKeyboardInteraction,kie=eH.reducer;function wO(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 Fb(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?wO(Object(n),!0).forEach(function(r){Iie(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Iie(t,e,n){return(e=Lie(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Lie(t){var e=Oie(t,"string");return typeof e=="symbol"?e:e+""}function Oie(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)}function Die(t,e,n){return e==="axis"?n==="click"?t.axisInteraction.click:t.axisInteraction.hover:n==="click"?t.itemInteraction.click:t.itemInteraction.hover}function jie(t){return t.index!=null}var rH=(t,e,n,r)=>{if(e==null)return fd;var i=Die(t,e,n);if(i==null)return fd;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(jie(i)){if(s)return Fb(Fb({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return Fb(Fb({},fd),{},{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 Fie(t,e){var n=Uie(t),r=e[0],i=e[1];if(n===void 0)return!1;var s=Math.min(r,i),a=Math.max(r,i);return n>=s&&n<=a}function zie(t,e,n){if(n==null||e==null)return!0;var r=yi(t,e);return r==null||!Al(n)?!0:Fie(r,n)}var J0=(t,e,n,r)=>{var i=t==null?void 0:t.index;if(i==null)return null;var s=Number(i);if(!wn(s))return i;var a=0,o=1/0;e.length>0&&(o=e.length-1);var l=Math.max(a,Math.min(s,o)),c=e[l];return c==null||zie(c,n,r)?String(l):null},iH=(t,e,n,r,i,s,a)=>{if(s!=null){var o=a[0],l=o==null?void 0:o.getPosition(s);if(l!=null)return l;var c=i==null?void 0:i[Number(s)];if(c)switch(n){case"horizontal":return{x:c.coordinate,y:(r.top+e)/2};default:return{x:(r.left+t)/2,y:c.coordinate}}}},sH=(t,e,n,r)=>{if(e==="axis")return t.tooltipItemPayloads;if(t.tooltipItemPayloads.length===0)return[];var i;if(n==="hover"?i=t.itemInteraction.hover.graphicalItemId:i=t.itemInteraction.click.graphicalItemId,t.syncInteraction.active&&i==null)return t.tooltipItemPayloads;if(i==null&&(r!=null||t.keyboardInteraction.active)){var s=t.tooltipItemPayloads[0];return s!=null?[s]:[]}return t.tooltipItemPayloads.filter(a=>{var o;return((o=a.settings)===null||o===void 0?void 0:o.graphicalItemId)===i})},aH=t=>t.options.tooltipPayloadSearcher,iv=t=>t.tooltip;function SO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function MO(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?SO(Object(n),!0).forEach(function(r){Bie(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):SO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Bie(t,e,n){return(e=Hie(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Hie(t){var e=Vie(t,"string");return typeof e=="symbol"?e:e+""}function Vie(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)}function Gie(t){if(typeof t=="string"||typeof t=="number")return t}function Wie(t){if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")return t}function $ie(t){if(typeof t=="string"||typeof t=="number")return t;if(typeof t=="function")return e=>t(e)}function EO(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?Wie(t.unit):void 0,r="dataKey"in t?$ie(t.dataKey):void 0,i="payload"in t?t.payload:void 0,s="color"in t?EO(t.color):void 0,a="fill"in t?EO(t.fill):void 0;return{name:e,unit:n,dataKey:r,payload:i,color:s,fill:a}}}function qie(t,e){return t??e}var oH=(t,e,n,r,i,s,a)=>{if(!(e==null||s==null)){var o=n.chartData,l=n.computedData,c=n.dataStartIndex,d=n.dataEndIndex,f=[];return t.reduce((p,y)=>{var x,S=y.dataDefinedOnItem,w=y.settings,b=qie(S,o),M=Array.isArray(b)?k4(b,c,d):b,T=(x=w==null?void 0:w.dataKey)!==null&&x!==void 0?x:r,C=w==null?void 0:w.nameKey,L;if(r&&Array.isArray(M)&&!Array.isArray(M[0])&&a==="axis"?L=zF(M,r,i):L=s(M,e,l,C),Array.isArray(L))L.forEach(D=>{var F,V,I=Xie(D),U=I==null?void 0:I.name,X=I==null?void 0:I.dataKey,te=I==null?void 0:I.payload,re=MO(MO({},w),{},{name:U,unit:I==null?void 0:I.unit,color:(F=I==null?void 0:I.color)!==null&&F!==void 0?F:w==null?void 0:w.color,fill:(V=I==null?void 0:I.fill)!==null&&V!==void 0?V:w==null?void 0:w.fill});p.push(xI({tooltipEntrySettings:re,dataKey:X,payload:te,value:yi(te,X),name:U==null?void 0:String(U)}))});else{var N;p.push(xI({tooltipEntrySettings:w,dataKey:T,payload:L,value:yi(L,T),name:(N=yi(L,C))!==null&&N!==void 0?N:w==null?void 0:w.name}))}return p},f)}},q2=ke([oi,fB,a2],oB),Kie=ke([t=>t.graphicalItems.cartesianItems,t=>t.graphicalItems.polarItems],(t,e)=>[...t,...e]),Yie=ke([wi,Jg],hB),op=ke([Kie,oi,Yie],mB,{memoizeOptions:{resultEqualityCheck:DS}}),Zie=ke([op],t=>t.filter(h2)),lH=ke([op],yB,{memoizeOptions:{resultEqualityCheck:DS}}),Qie=ke([op],t=>t.some(e=>!e.data)),Gh=ke([lH,Xo],bB),Jie=ke([Zie,Xo,oi],Az),K2=ke([Gh,oi,op,Xo,Qie,lH],_B),cH=ke([oi],B2),ese=ke([oi],t=>t.allowDataOverflow),uH=ke([cH,ese],lz),tse=ke([op],t=>t.filter(h2)),nse=ke([Jie,tse,RS,xz],SB),rse=ke([nse,Xo,wi,uH],EB),ise=ke([op],vB),sse=ke([Gh,oi,ise,H2,wi,pee],CB,{memoizeOptions:{resultEqualityCheck:OS}}),ase=ke([PB,wi,Jg],nv),ose=ke([ase,wi],kB),lse=ke([RB,wi,Jg],nv),cse=ke([lse,wi],IB),use=ke([NB,wi,Jg],nv),dse=ke([use,wi],LB),fse=ke([ose,dse,cse],Y1),hse=ke([oi,cH,uH,rse,sse,fse,hr,wi],OB),Dg=ke([oi,hr,Gh,K2,RS,wi,hse],DB),pse=ke([Dg,oi,q2],jB),mse=ke([oi,Dg,pse,wi],UB),dH=t=>{var e=wi(t),n=Jg(t),r=!1;return dx(t,e,n,r)},fH=ke([oi,dH],NS),gse=ke([oi,q2,mse,fH],U2),hH=ke([gse],p2),vse=ke([hr,K2,oi,wi],$B),yse=ke([hr,K2,oi,wi],VB),xse=(t,e,n,r,i,s,a,o)=>{if(e){var l=e.type,c=Hl(t,o);if(r){var d=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,f=l==="category"&&r.bandwidth?r.bandwidth()/d:0;return f=o==="angleAxis"&&i!=null&&(i==null?void 0:i.length)>=2?Wa(i[0]-i[1])*2*f:f,c&&a?a.map((p,y)=>{var x=r.map(p);return wn(x)?{coordinate:x+f,value:p,index:y,offset:f}:null}).filter(Qs):r.domain().map((p,y)=>{var x=r.map(p);return wn(x)?{coordinate:x+f,value:s?s[p]:p,index:y,offset:f}:null}).filter(Qs)}}},lu=ke([hr,oi,q2,hH,dH,vse,yse,wi],xse),Y2=ke([YB,ZB,Mie],(t,e,n)=>QB(n.shared,t,e)),pH=t=>t.tooltip.settings.trigger,Z2=t=>t.tooltip.settings.defaultIndex,hx=ke([iv,Y2,pH,Z2],rH),Py=ke([hx,Gh,Og,Dg],J0),mH=ke([lu,Py],JB),bse=ke([hx],t=>{if(t)return t.dataKey}),_se=ke([hx],t=>{if(t)return t.graphicalItemId}),gH=ke([iv,Y2,pH,Z2],sH),wse=ke([ru,iu,hr,Wi,lu,Z2,gH],iH),Sse=ke([hx,wse],(t,e)=>t!=null&&t.coordinate?t.coordinate:e),Mse=ke([hx],t=>{var e;return(e=t==null?void 0:t.active)!==null&&e!==void 0?e:!1}),Ese=ke([gH,Py,Xo,Og,mH,aH,Y2],oH),Ase=ke([Ese],t=>{if(t!=null){var e=t.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(e))}});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 TO(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?AO(Object(n),!0).forEach(function(r){Tse(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):AO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Tse(t,e,n){return(e=Cse(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Cse(t){var e=Pse(t,"string");return typeof e=="symbol"?e:e+""}function Pse(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 Rse=()=>Ft(oi),Nse=()=>{var t=Rse(),e=Ft(lu),n=Ft(hH);return T1(!t||!n?void 0:TO(TO({},t),{},{scale:n}),e)};function CO(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 vm(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?CO(Object(n),!0).forEach(function(r){kse(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):CO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function kse(t,e,n){return(e=Ise(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ise(t){var e=Lse(t,"string");return typeof e=="symbol"?e:e+""}function Lse(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 Ose=(t,e,n,r)=>{var i=e.find(s=>s&&s.index===n);if(i){if(t==="horizontal")return{x:i.coordinate,y:r.relativeY};if(t==="vertical")return{x:r.relativeX,y:i.coordinate}}return{x:0,y:0}},Dse=(t,e,n,r)=>{var i=e.find(c=>c&&c.index===n);if(i){if(t==="centric"){var s=i.coordinate,a=r.radius;return vm(vm(vm({},r),Bi(r.cx,r.cy,a,s)),{},{angle:s,radius:a})}var o=i.coordinate,l=r.angle;return vm(vm(vm({},r),Bi(r.cx,r.cy,o,l)),{},{angle:l,radius:o})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function jse(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 vH=(t,e,n,r,i)=>{var s,a=(s=e==null?void 0:e.length)!==null&&s!==void 0?s:0;if(a<=1||t==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var o=0;o<a;o++){var l,c,d,f,p,y=o>0?(l=n[o-1])===null||l===void 0?void 0:l.coordinate:(c=n[a-1])===null||c===void 0?void 0:c.coordinate,x=(d=n[o])===null||d===void 0?void 0:d.coordinate,S=o>=a-1?(f=n[0])===null||f===void 0?void 0:f.coordinate:(p=n[o+1])===null||p===void 0?void 0:p.coordinate,w=void 0;if(!(y==null||x==null||S==null))if(Wa(x-y)!==Wa(S-x)){var b=[];if(Wa(S-x)===Wa(i[1]-i[0])){w=S;var M=x+i[1]-i[0];b[0]=Math.min(M,(M+y)/2),b[1]=Math.max(M,(M+y)/2)}else{w=y;var T=S+i[1]-i[0];b[0]=Math.min(x,(T+x)/2),b[1]=Math.max(x,(T+x)/2)}var C=[Math.min(x,(w+x)/2),Math.max(x,(w+x)/2)];if(t>C[0]&&t<=C[1]||t>=b[0]&&t<=b[1]){var L;return(L=n[o])===null||L===void 0?void 0:L.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[o])===null||F===void 0?void 0:F.index}}}else if(e)for(var V=0;V<a;V++){var I=e[V];if(I!=null){var U=e[V+1],X=e[V-1];if(V===0&&U!=null&&t<=(I.coordinate+U.coordinate)/2||V===a-1&&X!=null&&t>(I.coordinate+X.coordinate)/2||V>0&&V<a-1&&X!=null&&U!=null&&t>(I.coordinate+X.coordinate)/2&&t<=(I.coordinate+U.coordinate)/2)return I.index}}return-1},yH=()=>Ft(a2),Q2=(t,e)=>e,xH=(t,e,n)=>n,J2=(t,e,n,r)=>r,Use=ke(lu,t=>cS(t,e=>e.coordinate)),eR=ke([iv,Q2,xH,J2],rH),tR=ke([eR,Gh,Og,Dg],J0),Fse=(t,e,n)=>{if(e!=null){var r=iv(t);return e==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},bH=ke([iv,Q2,xH,J2],sH),Q1=ke([ru,iu,hr,Wi,lu,J2,bH],iH),zse=ke([eR,Q1],(t,e)=>{var n;return(n=t.coordinate)!==null&&n!==void 0?n:e}),_H=ke([lu,tR],JB),Bse=ke([bH,tR,Xo,Og,_H,aH,Q2],oH),Hse=ke([eR,tR],(t,e)=>({isActive:t.active&&e!=null,activeIndex:e})),Vse=(t,e,n,r,i,s,a)=>{if(!(!t||!n||!r||!i)&&jse(t,a)){var o=nZ(t,e),l=vH(o,s,i,n,r),c=Ose(e,i,l,t);return{activeIndex:String(l),activeCoordinate:c}}},Gse=(t,e,n,r,i,s,a)=>{if(!(!t||!r||!i||!s||!n)){var o=see(t,n);if(o){var l=rZ(o,e),c=vH(l,a,s,r,i),d=Dse(e,s,c,o);return{activeIndex:String(c),activeCoordinate:d}}}},Wse=(t,e,n,r,i,s,a,o)=>{if(!(!t||!e||!r||!i||!s))return e==="horizontal"||e==="vertical"?Vse(t,e,r,i,s,a,o):Gse(t,e,n,r,i,s,a)},$se=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(Es)),n=Array.from(new Set(e));return n.sort((r,i)=>r-i)},{memoizeOptions:{resultEqualityCheck:Dee}});function PO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function RO(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?PO(Object(n),!0).forEach(function(r){qse(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):PO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function qse(t,e,n){return(e=Kse(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Kse(t){var e=Yse(t,"string");return typeof e=="symbol"?e:e+""}function Yse(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 Zse={},Qse={zIndexMap:Object.values(Es).reduce((t,e)=>RO(RO({},t),{},{[e]:{element:void 0,panoramaElement:void 0,consumers:0}}),Zse)},Jse=new Set(Object.values(Es));function eae(t){return Jse.has(t)}var wH=cs({name:"zIndex",initialState:Qse,reducers:{registerZIndexPortal:{reducer:(t,e)=>{var n=e.payload.zIndex;t.zIndexMap[n]?t.zIndexMap[n].consumers+=1:t.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:ar()},unregisterZIndexPortal:{reducer:(t,e)=>{var n=e.payload.zIndex;t.zIndexMap[n]&&(t.zIndexMap[n].consumers-=1,t.zIndexMap[n].consumers<=0&&!eae(n)&&delete t.zIndexMap[n])},prepare:ar()},registerZIndexPortalElement:{reducer:(t,e)=>{var n=e.payload,r=n.zIndex,i=n.element,s=n.isPanorama;t.zIndexMap[r]?s?t.zIndexMap[r].panoramaElement=i:t.zIndexMap[r].element=i:t.zIndexMap[r]={consumers:0,element:s?void 0:i,panoramaElement:s?i:void 0}},prepare:ar()},unregisterZIndexPortalElement:{reducer:(t,e)=>{var n=e.payload.zIndex;t.zIndexMap[n]&&(e.payload.isPanorama?t.zIndexMap[n].panoramaElement=void 0:t.zIndexMap[n].element=void 0)},prepare:ar()}}}),$S=wH.actions,tae=$S.registerZIndexPortal,$E=$S.unregisterZIndexPortal,nae=$S.registerZIndexPortalElement,rae=$S.unregisterZIndexPortalElement,iae=wH.reducer;function cu(t){var e=t.zIndex,n=t.children,r=BZ(),i=r&&e!==void 0&&e!==0,s=ta(),a=P.useRef(void 0),o=P.useRef(new Set),l=Wr(),c=Ft(f=>$se(f,e,s));if(P.useLayoutEffect(()=>{if(!i){var f=o.current;f.forEach(y=>{l($E({zIndex:y}))}),f.clear(),a.current=void 0;return}if(o.current.has(e)||(l(tae({zIndex:e})),o.current.add(e)),c){a.current=c;var p=o.current;p.forEach(y=>{y!==e&&(l($E({zIndex:y})),p.delete(y))})}},[l,e,i,c]),P.useLayoutEffect(()=>{var f=o.current;return()=>{f.forEach(p=>{l($E({zIndex:p}))}),f.clear()}},[l]),!i)return n;var d=c??a.current;return d?tS.createPortal(n,d):null}function OC(){return OC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},OC.apply(null,arguments)}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 zb(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?NO(Object(n),!0).forEach(function(r){sae(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):NO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function sae(t,e,n){return(e=aae(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function aae(t){var e=oae(t,"string");return typeof e=="symbol"?e:e+""}function oae(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)}function lae(t){var e=t.cursor,n=t.cursorComp,r=t.cursorProps;return P.isValidElement(e)?P.cloneElement(e,r):P.createElement(n,r)}function cae(t){var e,n=t.coordinate,r=t.payload,i=t.index,s=t.offset,a=t.tooltipAxisBandSize,o=t.layout,l=t.cursor,c=t.tooltipEventType,d=t.chartName,f=n,p=r,y=i;if(!l||!f||d!=="ScatterChart"&&c!=="axis")return null;var x,S,w;if(d==="ScatterChart")x=f,S=hJ,w=Es.cursorLine;else if(d==="BarChart")x=pJ(o,f,s,a),S=KJ,w=Es.cursorRectangle;else if(o==="radial"&&BF(f)){var b=sz(f),M=b.cx,T=b.cy,C=b.radius,L=b.startAngle,N=b.endAngle;x={cx:M,cy:T,startAngle:L,endAngle:N,innerRadius:C,outerRadius:C},S=cee,w=Es.cursorLine}else x={points:uee(o,f,s)},S=K_,w=Es.cursorLine;var D=typeof l=="object"&&"className"in l?l.className:void 0,F=zb(zb(zb(zb({stroke:"#ccc",pointerEvents:"none"},s),x),aS(l)),{},{payload:p,payloadIndex:y,className:tr("recharts-tooltip-cursor",D)});return P.createElement(cu,{zIndex:(e=t.zIndex)!==null&&e!==void 0?e:w},P.createElement(lae,{cursor:l,cursorComp:S,cursorProps:F}))}function uae(t){var e=Nse(),n=B4(),r=Yg(),i=yH();return e==null||n==null||r==null||i==null?null:P.createElement(cae,OC({},t,{offset:n,layout:r,tooltipAxisBandSize:e,chartName:i}))}var SH=P.createContext(null),dae=()=>P.useContext(SH),XE={exports:{}},kO;function fae(){return kO||(kO=1,(function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(l,c,d){this.fn=l,this.context=c,this.once=d||!1}function s(l,c,d,f,p){if(typeof d!="function")throw new TypeError("The listener must be a function");var y=new i(d,f||l,p),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 a(l,c){--l._eventsCount===0?l._events=new r:delete l._events[c]}function o(){this._events=new r,this._eventsCount=0}o.prototype.eventNames=function(){var c=[],d,f;if(this._eventsCount===0)return c;for(f in d=this._events)e.call(d,f)&&c.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(d)):c},o.prototype.listeners=function(c){var d=n?n+c:c,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var p=0,y=f.length,x=new Array(y);p<y;p++)x[p]=f[p].fn;return x},o.prototype.listenerCount=function(c){var d=n?n+c:c,f=this._events[d];return f?f.fn?1:f.length:0},o.prototype.emit=function(c,d,f,p,y,x){var S=n?n+c:c;if(!this._events[S])return!1;var w=this._events[S],b=arguments.length,M,T;if(w.fn){switch(w.once&&this.removeListener(c,w.fn,void 0,!0),b){case 1:return w.fn.call(w.context),!0;case 2:return w.fn.call(w.context,d),!0;case 3:return w.fn.call(w.context,d,f),!0;case 4:return w.fn.call(w.context,d,f,p),!0;case 5:return w.fn.call(w.context,d,f,p,y),!0;case 6:return w.fn.call(w.context,d,f,p,y,x),!0}for(T=1,M=new Array(b-1);T<b;T++)M[T-1]=arguments[T];w.fn.apply(w.context,M)}else{var C=w.length,L;for(T=0;T<C;T++)switch(w[T].once&&this.removeListener(c,w[T].fn,void 0,!0),b){case 1:w[T].fn.call(w[T].context);break;case 2:w[T].fn.call(w[T].context,d);break;case 3:w[T].fn.call(w[T].context,d,f);break;case 4:w[T].fn.call(w[T].context,d,f,p);break;default:if(!M)for(L=1,M=new Array(b-1);L<b;L++)M[L-1]=arguments[L];w[T].fn.apply(w[T].context,M)}}return!0},o.prototype.on=function(c,d,f){return s(this,c,d,f,!1)},o.prototype.once=function(c,d,f){return s(this,c,d,f,!0)},o.prototype.removeListener=function(c,d,f,p){var y=n?n+c:c;if(!this._events[y])return this;if(!d)return a(this,y),this;var x=this._events[y];if(x.fn)x.fn===d&&(!p||x.once)&&(!f||x.context===f)&&a(this,y);else{for(var S=0,w=[],b=x.length;S<b;S++)(x[S].fn!==d||p&&!x[S].once||f&&x[S].context!==f)&&w.push(x[S]);w.length?this._events[y]=w.length===1?w[0]:w:a(this,y)}return this},o.prototype.removeAllListeners=function(c){var d;return c?(d=n?n+c:c,this._events[d]&&a(this,d)):(this._events=new r,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=n,o.EventEmitter=o,t.exports=o})(XE)),XE.exports}var hae=fae();const pae=Qw(hae);var Ry=new pae,DC="recharts.syncEvent.tooltip",IO="recharts.syncEvent.brush",mae=(t,e)=>{if(e&&Array.isArray(t)){var n=Number.parseInt(e,10);if(!Il(n))return t[n]}},gae={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},MH=cs({name:"options",initialState:gae,reducers:{createEventEmitter:t=>{t.eventEmitter==null&&(t.eventEmitter=Symbol("rechartsEventEmitter"))}}}),vae=MH.reducer,yae=MH.actions.createEventEmitter;function xae(t){return t.tooltip.syncInteraction}var bae={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},EH=cs({name:"chartData",initialState:bae,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)}}}),nR=EH.actions,LO=nR.setChartData,_ae=nR.setDataStartEndIndexes;nR.setComputedData;var wae=EH.reducer,Sae=["x","y"];function OO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ym(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?OO(Object(n),!0).forEach(function(r){Mae(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):OO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Mae(t,e,n){return(e=Eae(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Eae(t){var e=Aae(t,"string");return typeof e=="symbol"?e:e+""}function Aae(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)}function Tae(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<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Cae(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function Pae(){var t=Ft(o2),e=Ft(l2),n=Wr(),r=Ft(bz),i=Ft(lu),s=Yg(),a=MS(),o=Ft(l=>l.rootProps.className);P.useEffect(()=>{if(t==null)return Kg;var l=(c,d,f)=>{if(e!==f&&t===c){if(d.payload.active===!1){n(X0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(r==="index"){var p;if(a&&d!==null&&d!==void 0&&(p=d.payload)!==null&&p!==void 0&&p.coordinate&&d.payload.sourceViewBox){var y=d.payload.coordinate,x=y.x,S=y.y,w=Tae(y,Sae),b=d.payload.sourceViewBox,M=b.x,T=b.y,C=b.width,L=b.height,N=ym(ym({},w),{},{x:a.x+(C?(x-M)/C:0)*a.width,y:a.y+(L?(S-T)/L:0)*a.height});n(ym(ym({},d),{},{payload:ym(ym({},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(ce=>String(ce.value)===d.payload.label));var I=d.payload.coordinate;if(I==null||a==null){n(X0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(D==null){n(X0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:void 0}));return}var U=I.x,X=I.y,te=Math.min(U,a.x+a.width),re=Math.min(X,a.y+a.height),pe={x:s==="horizontal"?D.coordinate:te,y:s==="horizontal"?re:D.coordinate},ee=X0({active:d.payload.active,coordinate:pe,dataKey:d.payload.dataKey,index:String(D.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n(ee)}}};return Ry.on(DC,l),()=>{Ry.off(DC,l)}},[o,n,e,t,r,i,s,a])}function Rae(){var t=Ft(o2),e=Ft(l2),n=Wr();P.useEffect(()=>{if(t==null)return Kg;var r=(i,s,a)=>{e!==a&&t===i&&n(_ae(s))};return Ry.on(IO,r),()=>{Ry.off(IO,r)}},[n,e,t])}function Nae(){var t=Wr();P.useEffect(()=>{t(yae())},[t]),Pae(),Rae()}function kae(t,e,n,r,i,s){var a=Ft(x=>Fse(x,t,e)),o=Ft(_se),l=Ft(l2),c=Ft(o2),d=Ft(bz),f=Ft(xae),p=(f==null?void 0:f.sourceViewBox)!=null,y=MS();P.useEffect(()=>{if(!p&&c!=null&&l!=null){var x=X0({active:s,coordinate:n,dataKey:a,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:y,graphicalItemId:o});Ry.emit(DC,c,x,l)}},[p,n,a,o,i,r,l,c,d,s,y])}function DO(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 jO(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?DO(Object(n),!0).forEach(function(r){Iae(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):DO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Iae(t,e,n){return(e=Lae(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Lae(t){var e=Oae(t,"string");return typeof e=="symbol"?e:e+""}function Oae(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)}function Dae(t,e){return zae(t)||Fae(t,e)||Uae(t,e)||jae()}function jae(){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 Uae(t,e){if(t){if(typeof t=="string")return UO(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)?UO(t,e):void 0}}function UO(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Fae(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function zae(t){if(Array.isArray(t))return t}function Bae(t){return t.dataKey}function Hae(t,e){return P.isValidElement(t)?P.cloneElement(t,e):typeof t=="function"?P.createElement(t,e):P.createElement(kQ,e)}var FO=[],Vae={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",axisId:0,contentStyle:{},cursor:!0,filterNull:!0,includeHidden:!1,isAnimationActive:"auto",itemSorter:"name",itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,wrapperStyle:{}};function Gae(t){var e,n,r=Ja(t,Vae),i=r.active,s=r.allowEscapeViewBox,a=r.animationDuration,o=r.animationEasing,l=r.content,c=r.filterNull,d=r.isAnimationActive,f=r.offset,p=r.payloadUniqBy,y=r.position,x=r.reverseDirection,S=r.useTranslate3d,w=r.wrapperStyle,b=r.cursor,M=r.shared,T=r.trigger,C=r.defaultIndex,L=r.portal,N=r.axisId,D=Wr(),F=typeof C=="number"?String(C):C;P.useEffect(()=>{D(Pie({shared:M,trigger:T,axisId:N,active:i,defaultIndex:F}))},[D,M,T,N,i,F]);var V=MS(),I=J4(),U=Sie(M),X=(e=Ft(Xe=>Hse(Xe,U,T,F)))!==null&&e!==void 0?e:{},te=X.activeIndex,re=X.isActive,pe=Ft(Xe=>Bse(Xe,U,T,F)),ee=Ft(Xe=>_H(Xe,U,T,F)),ce=Ft(Xe=>zse(Xe,U,T,F)),B=pe,J=dae(),Z=(n=i??re)!==null&&n!==void 0?n:!1,G=HK([B,Z]),W=Dae(G,2),oe=W[0],se=W[1],le=U==="axis"?ee:void 0;kae(U,T,ce,le,te,Z);var Me=L??J;if(Me==null||V==null||U==null)return null;var Se=B??FO;Z||(Se=FO),c&&Se.length&&(Se=dK(Se.filter(Xe=>Xe.value!=null&&(Xe.hide!==!0||r.includeHidden)),p,Bae));var $e=Se.length>0,Ee=jO(jO({},r),{},{payload:Se,label:le,active:Z,activeIndex:te,coordinate:ce,accessibilityLayer:I}),Ge=P.createElement(JQ,{allowEscapeViewBox:s,animationDuration:a,animationEasing:o,isAnimationActive:d,active:Z,coordinate:ce,hasPayload:$e,offset:f,position:y,reverseDirection:x,useTranslate3d:S,viewBox:V,wrapperStyle:w,lastBoundingBox:oe,innerRef:se,hasPortalFromProps:!!L},Hae(l,Ee));return P.createElement(P.Fragment,null,tS.createPortal(Ge,Me),Z&&P.createElement(uae,{cursor:b,tooltipEventType:U,coordinate:ce,payload:Se,index:te}))}function Wae(t,e,n){return(e=$ae(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function $ae(t){var e=Xae(t,"string");return typeof e=="symbol"?e:e+""}function Xae(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 qae{constructor(e){Wae(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 zO(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 Kae(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?zO(Object(n),!0).forEach(function(r){Yae(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):zO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Yae(t,e,n){return(e=Zae(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Zae(t){var e=Qae(t,"string");return typeof e=="symbol"?e:e+""}function Qae(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 Jae={cacheSize:2e3,enableCache:!0},AH=Kae({},Jae),BO=new qae(AH.cacheSize),eoe={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},HO="recharts_measurement_span";function toe(t,e){var n=e.fontSize||"",r=e.fontFamily||"",i=e.fontWeight||"",s=e.fontStyle||"",a=e.letterSpacing||"",o=e.textTransform||"";return"".concat(t,"|").concat(n,"|").concat(r,"|").concat(i,"|").concat(s,"|").concat(a,"|").concat(o)}var VO=(t,e)=>{try{var n=document.getElementById(HO);n||(n=document.createElement("span"),n.setAttribute("id",HO),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,eoe,e),n.textContent="".concat(t);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},ey=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||ix.isSsr)return{width:0,height:0};if(!AH.enableCache)return VO(e,n);var r=toe(e,n),i=BO.get(r);if(i)return i;var s=VO(e,n);return BO.set(r,s),s},TH;function J1(t,e){return soe(t)||ioe(t,e)||roe(t,e)||noe()}function noe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function roe(t,e){if(t){if(typeof t=="string")return GO(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?GO(t,e):void 0}}function GO(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ioe(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function soe(t){if(Array.isArray(t))return t}function aoe(t,e,n){return(e=ooe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ooe(t){var e=loe(t,"string");return typeof e=="symbol"?e:e+""}function loe(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 WO=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,$O=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,coe=/^(px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q)$/,uoe=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,doe={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},foe=["cm","mm","pt","pc","in","Q","px"];function hoe(t){return foe.includes(t)}var Qm="NaN";function poe(t,e){return t*doe[e]}class Ui{static parse(e){var n,r=(n=uoe.exec(e))!==null&&n!==void 0?n:[],i=J1(r,3),s=i[1],a=i[2];return s==null?Ui.NaN:new Ui(parseFloat(s),a??"")}constructor(e,n){this.num=e,this.unit=n,this.num=e,this.unit=n,Il(e)&&(this.unit=""),n!==""&&!coe.test(n)&&(this.num=NaN,this.unit=""),hoe(n)&&(this.num=poe(e,n),this.unit="px")}add(e){return this.unit!==e.unit?new Ui(NaN,""):new Ui(this.num+e.num,this.unit)}subtract(e){return this.unit!==e.unit?new Ui(NaN,""):new Ui(this.num-e.num,this.unit)}multiply(e){return this.unit!==""&&e.unit!==""&&this.unit!==e.unit?new Ui(NaN,""):new Ui(this.num*e.num,this.unit||e.unit)}divide(e){return this.unit!==""&&e.unit!==""&&this.unit!==e.unit?new Ui(NaN,""):new Ui(this.num/e.num,this.unit||e.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return Il(this.num)}}TH=Ui;aoe(Ui,"NaN",new TH(NaN,""));function CH(t){if(t==null||t.includes(Qm))return Qm;for(var e=t;e.includes("*")||e.includes("/");){var n,r=(n=WO.exec(e))!==null&&n!==void 0?n:[],i=J1(r,4),s=i[1],a=i[2],o=i[3],l=Ui.parse(s??""),c=Ui.parse(o??""),d=a==="*"?l.multiply(c):l.divide(c);if(d.isNaN())return Qm;e=e.replace(WO,d.toString())}for(;e.includes("+")||/.-\d+(?:\.\d+)?/.test(e);){var f,p=(f=$O.exec(e))!==null&&f!==void 0?f:[],y=J1(p,4),x=y[1],S=y[2],w=y[3],b=Ui.parse(x??""),M=Ui.parse(w??""),T=S==="+"?b.add(M):b.subtract(M);if(T.isNaN())return Qm;e=e.replace($O,T.toString())}return e}var XO=/\(([^()]*)\)/;function moe(t){for(var e=t,n;(n=XO.exec(e))!=null;){var r=n,i=J1(r,2),s=i[1];e=e.replace(XO,CH(s))}return e}function goe(t){var e=t.replace(/\s+/g,"");return e=moe(e),e=CH(e),e}function voe(t){try{return goe(t)}catch{return Qm}}function qE(t){var e=voe(t.slice(5,-1));return e===Qm?"":e}var yoe=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],xoe=["dx","dy","angle","className","breakAll"];function jC(){return jC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},jC.apply(null,arguments)}function qO(t,e){if(t==null)return{};var n,r,i=boe(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function boe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function KO(t,e){return Moe(t)||Soe(t,e)||woe(t,e)||_oe()}function _oe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function woe(t,e){if(t){if(typeof t=="string")return YO(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)?YO(t,e):void 0}}function YO(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Soe(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function Moe(t){if(Array.isArray(t))return t}var PH=/[ \f\n\r\t\v\u2028\u2029]+/,RH=t=>{var e=t.children,n=t.breakAll,r=t.style;try{var i=[];Vi(e)||(n?i=e.toString().split(""):i=e.toString().split(PH));var s=i.map(o=>({word:o,width:ey(o,r).width})),a=n?0:ey(" ",r).width;return{wordsWithComputedWidth:s,spaceWidth:a}}catch{return null}};function NH(t){return t==="start"||t==="middle"||t==="end"||t==="inherit"}function Eoe(t){return Vi(t)||typeof t=="string"||typeof t=="number"||typeof t=="boolean"}var kH=(t,e,n,r)=>t.reduce((i,s)=>{var a=s.word,o=s.width,l=i[i.length-1];if(l&&o!=null&&(e==null||r||l.width+o+n<Number(e)))l.words.push(a),l.width+=o+n;else{var c={words:[a],width:o};i.push(c)}return i},[]),IH=t=>t.reduce((e,n)=>e.width>n.width?e:n),Aoe="…",ZO=(t,e,n,r,i,s,a,o)=>{var l=t.slice(0,e),c=RH({breakAll:n,style:r,children:l+Aoe});if(!c)return[!1,[]];var d=kH(c.wordsWithComputedWidth,s,a,o),f=d.length>i||IH(d).width>Number(s);return[f,d]},Toe=(t,e,n,r,i)=>{var s=t.maxLines,a=t.children,o=t.style,l=t.breakAll,c=It(s),d=String(a),f=kH(e,r,n,i);if(!c||i)return f;var p=f.length>s||IH(f).width>Number(r);if(!p)return f;for(var y=0,x=d.length-1,S=0,w;y<=x&&S<=d.length-1;){var b=Math.floor((y+x)/2),M=b-1,T=ZO(d,M,l,o,s,r,n,i),C=KO(T,2),L=C[0],N=C[1],D=ZO(d,b,l,o,s,r,n,i),F=KO(D,1),V=F[0];if(!L&&!V&&(y=b+1),L&&V&&(x=b-1),!L&&V){w=N;break}S++}return w||f},QO=t=>{var e=Vi(t)?[]:t.toString().split(PH);return[{words:e,width:void 0}]},Coe=t=>{var e=t.width,n=t.scaleToFit,r=t.children,i=t.style,s=t.breakAll,a=t.maxLines;if((e||n)&&!ix.isSsr){var o,l,c=RH({breakAll:s,children:r,style:i});if(c){var d=c.wordsWithComputedWidth,f=c.spaceWidth;o=d,l=f}else return QO(r);return Toe({breakAll:s,children:r,maxLines:a,style:i},o,l,e,!!n)}return QO(r)},LH="#808080",Poe={angle:0,breakAll:!1,capHeight:"0.71em",fill:LH,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},rR=P.forwardRef((t,e)=>{var n=Ja(t,Poe),r=n.x,i=n.y,s=n.lineHeight,a=n.capHeight,o=n.fill,l=n.scaleToFit,c=n.textAnchor,d=n.verticalAnchor,f=qO(n,yoe),p=P.useMemo(()=>Coe({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:l,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,l,f.style,f.width]),y=f.dx,x=f.dy,S=f.angle,w=f.className,b=f.breakAll,M=qO(f,xoe);if(!Ll(r)||!Ll(i)||p.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 L;switch(d){case"start":L=qE("calc(".concat(a,")"));break;case"middle":L=qE("calc(".concat((p.length-1)/2," * -").concat(s," + (").concat(a," / 2))"));break;default:L=qE("calc(".concat(p.length-1," * -").concat(s,")"));break}var N=[],D=p[0];if(l&&D!=null){var F=D.width,V=f.width;N.push("scale(".concat(It(V)&&It(F)?V/F:1,")"))}return S&&N.push("rotate(".concat(S,", ").concat(T,", ").concat(C,")")),N.length&&(M.transform=N.join(" ")),P.createElement("text",jC({},Ka(M),{ref:e,x:T,y:C,className:tr("recharts-text",w),textAnchor:c,fill:o.includes("url")?LH:o}),p.map((I,U)=>{var X=I.words.join(b?"":" ");return P.createElement("tspan",{x:T,dy:U===0?L:s,key:"".concat(X,"-").concat(U)},X)}))});rR.displayName="Text";function JO(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 ml(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?JO(Object(n),!0).forEach(function(r){Roe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):JO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Roe(t,e,n){return(e=Noe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Noe(t){var e=koe(t,"string");return typeof e=="symbol"?e:e+""}function koe(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 Ioe=t=>{var e=t.viewBox,n=t.position,r=t.offset,i=r===void 0?0:r,s=t.parentViewBox,a=ZP(e),o=a.x,l=a.y,c=a.height,d=a.upperWidth,f=a.lowerWidth,p=o,y=o+(d-f)/2,x=(p+y)/2,S=(d+f)/2,w=p+d/2,b=c>=0?1:-1,M=b*i,T=b>0?"end":"start",C=b>0?"start":"end",L=d>=0?1:-1,N=L*i,D=L>0?"end":"start",F=L>0?"start":"end",V=s;if(n==="top"){var I={x:p+d/2,y:l-M,horizontalAnchor:"middle",verticalAnchor:T};return V&&(I.height=Math.max(l-V.y,0),I.width=d),I}if(n==="bottom"){var U={x:y+f/2,y:l+c+M,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 X={x:x-N,y:l+c/2,horizontalAnchor:D,verticalAnchor:"middle"};return V&&(X.width=Math.max(X.x-V.x,0),X.height=c),X}if(n==="right"){var te={x:x+S+N,y:l+c/2,horizontalAnchor:F,verticalAnchor:"middle"};return V&&(te.width=Math.max(V.x+V.width-te.x,0),te.height=c),te}var re=V?{width:S,height:c}:{};return n==="insideLeft"?ml({x:x+N,y:l+c/2,horizontalAnchor:F,verticalAnchor:"middle"},re):n==="insideRight"?ml({x:x+S-N,y:l+c/2,horizontalAnchor:D,verticalAnchor:"middle"},re):n==="insideTop"?ml({x:p+d/2,y:l+M,horizontalAnchor:"middle",verticalAnchor:C},re):n==="insideBottom"?ml({x:y+f/2,y:l+c-M,horizontalAnchor:"middle",verticalAnchor:T},re):n==="insideTopLeft"?ml({x:p+N,y:l+M,horizontalAnchor:F,verticalAnchor:C},re):n==="insideTopRight"?ml({x:p+d-N,y:l+M,horizontalAnchor:D,verticalAnchor:C},re):n==="insideBottomLeft"?ml({x:y+N,y:l+c-M,horizontalAnchor:F,verticalAnchor:T},re):n==="insideBottomRight"?ml({x:y+f-N,y:l+c-M,horizontalAnchor:D,verticalAnchor:T},re):n&&typeof n=="object"&&(It(n.x)||Fh(n.x))&&(It(n.y)||Fh(n.y))?ml({x:o+Nd(n.x,S),y:l+Nd(n.y,c),horizontalAnchor:"end",verticalAnchor:"end"},re):ml({x:w,y:l+c/2,horizontalAnchor:"middle",verticalAnchor:"middle"},re)},Loe=["labelRef"],Ooe=["content"];function e3(t,e){if(t==null)return{};var n,r,i=Doe(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Doe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}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 q0(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?t3(Object(n),!0).forEach(function(r){joe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):t3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function joe(t,e,n){return(e=Uoe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Uoe(t){var e=Foe(t,"string");return typeof e=="symbol"?e:e+""}function Foe(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)}function jc(){return jc=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},jc.apply(null,arguments)}var OH=P.createContext(null),zoe=t=>{var e=t.x,n=t.y,r=t.upperWidth,i=t.lowerWidth,s=t.width,a=t.height,o=t.children,l=P.useMemo(()=>({x:e,y:n,upperWidth:r,lowerWidth:i,width:s,height:a}),[e,n,r,i,s,a]);return P.createElement(OH.Provider,{value:l},o)},DH=()=>{var t=P.useContext(OH),e=MS();return t||(e?ZP(e):void 0)},Boe=P.createContext(null),Hoe=()=>{var t=P.useContext(Boe),e=Ft(Ez);return t||e},Voe=t=>{var e=t.value,n=t.formatter,r=Vi(t.children)?e:t.children;return typeof n=="function"?n(r):r},iR=t=>t!=null&&typeof t=="function",Goe=(t,e)=>{var n=Wa(e-t),r=Math.min(Math.abs(e-t),360);return n*r},Woe=(t,e,n,r,i)=>{var s=t.offset,a=t.className,o=i.cx,l=i.cy,c=i.innerRadius,d=i.outerRadius,f=i.startAngle,p=i.endAngle,y=i.clockWise,x=(c+d)/2,S=Goe(f,p),w=S>=0?1:-1,b,M;switch(e){case"insideStart":b=f+w*s,M=y;break;case"insideEnd":b=p-w*s,M=!y;break;case"end":b=p+w*s,M=y;break;default:throw new Error("Unsupported position ".concat(e))}M=S<=0?M:!M;var T=Bi(o,l,x,b),C=Bi(o,l,x,b+(M?1:-1)*359),L="M".concat(T.x,",").concat(T.y,`
|
||
A`).concat(x,",").concat(x,",0,1,").concat(M?0:1,`,
|
||
`).concat(C.x,",").concat(C.y),N=Vi(t.id)?gy("recharts-radial-line-"):t.id;return P.createElement("text",jc({},r,{dominantBaseline:"central",className:tr("recharts-radial-bar-label",a)}),P.createElement("defs",null,P.createElement("path",{id:N,d:L})),P.createElement("textPath",{xlinkHref:"#".concat(N)},n))},$oe=(t,e,n)=>{var r=t.cx,i=t.cy,s=t.innerRadius,a=t.outerRadius,o=t.startAngle,l=t.endAngle,c=(o+l)/2;if(n==="outside"){var d=Bi(r,i,a+e,c),f=d.x,p=d.y;return{x:f,y:p,textAnchor:f>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var y=(s+a)/2,x=Bi(r,i,y,c),S=x.x,w=x.y;return{x:S,y:w,textAnchor:"middle",verticalAnchor:"middle"}},Y_=t=>t!=null&&"cx"in t&&It(t.cx),Xoe={angle:0,offset:5,zIndex:Es.label,position:"middle",textBreakAll:!1};function qoe(t){if(!Y_(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 dd(t){var e=Ja(t,Xoe),n=e.viewBox,r=e.parentViewBox,i=e.position,s=e.value,a=e.children,o=e.content,l=e.className,c=l===void 0?"":l,d=e.textBreakAll,f=e.labelRef,p=Hoe(),y=DH(),x=i==="center"?y:p??y,S,w,b;n==null?S=x:Y_(n)?S=n:S=ZP(n);var M=qoe(S);if(!S||Vi(s)&&Vi(a)&&!P.isValidElement(o)&&typeof o!="function")return null;var T=q0(q0({},e),{},{viewBox:S});if(P.isValidElement(o)){T.labelRef;var C=e3(T,Loe);return P.cloneElement(o,C)}if(typeof o=="function"){T.content;var L=e3(T,Ooe);if(w=P.createElement(o,L),P.isValidElement(w))return w}else w=Voe(e);var N=Ka(e);if(Y_(S)){if(i==="insideStart"||i==="insideEnd"||i==="end")return Woe(e,i,w,N,S);b=$oe(S,e.offset,e.position)}else{if(!M)return null;var D=Ioe({viewBox:M,position:i,offset:e.offset,parentViewBox:Y_(r)?void 0:r});b=q0(q0({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 P.createElement(cu,{zIndex:e.zIndex},P.createElement(rR,jc({ref:f,className:tr("recharts-label",c)},N,b,{textAnchor:NH(N.textAnchor)?N.textAnchor:b.textAnchor,breakAll:d}),w))}dd.displayName="Label";var Koe=(t,e,n)=>{if(!t)return null;var r={viewBox:e,labelRef:n};return t===!0?P.createElement(dd,jc({key:"label-implicit"},r)):Ll(t)?P.createElement(dd,jc({key:"label-implicit",value:t},r)):P.isValidElement(t)?t.type===dd?P.cloneElement(t,q0({key:"label-implicit"},r)):P.createElement(dd,jc({key:"label-implicit",content:t},r)):iR(t)?P.createElement(dd,jc({key:"label-implicit",content:t},r)):t&&typeof t=="object"?P.createElement(dd,jc({},t,{key:"label-implicit"},r)):null};function Yoe(t){var e=t.label,n=t.labelRef,r=DH();return Koe(e,r,n)||null}var Zoe=["valueAccessor"],Qoe=["dataKey","clockWise","id","textBreakAll","zIndex"];function ew(){return ew=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ew.apply(null,arguments)}function n3(t,e){if(t==null)return{};var n,r,i=Joe(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Joe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var ele=t=>{var e=Array.isArray(t.value)?t.value[t.value.length-1]:t.value;if(Eoe(e))return e},jH=P.createContext(void 0),tle=jH.Provider,UH=P.createContext(void 0);UH.Provider;function nle(){return P.useContext(jH)}function rle(){return P.useContext(UH)}function Z_(t){var e=t.valueAccessor,n=e===void 0?ele:e,r=n3(t,Zoe),i=r.dataKey;r.clockWise;var s=r.id,a=r.textBreakAll,o=r.zIndex,l=n3(r,Qoe),c=nle(),d=rle(),f=c||d;return!f||!f.length?null:P.createElement(cu,{zIndex:o??Es.label},P.createElement(Ya,{className:"recharts-label-list"},f.map((p,y)=>{var x,S=Vi(i)?n(p,y):yi(p.payload,i),w=Vi(s)?{}:{id:"".concat(s,"-").concat(y)};return P.createElement(dd,ew({key:"label-".concat(y)},Ka(p),l,w,{fill:(x=r.fill)!==null&&x!==void 0?x:p.fill,parentViewBox:p.parentViewBox,value:S,textBreakAll:a,viewBox:p.viewBox,index:y,zIndex:0}))})))}Z_.displayName="LabelList";function ile(t){var e=t.label;return e?e===!0?P.createElement(Z_,{key:"labelList-implicit"}):P.isValidElement(e)||iR(e)?P.createElement(Z_,{key:"labelList-implicit",content:e}):typeof e=="object"?P.createElement(Z_,ew({key:"labelList-implicit"},e,{type:String(e.type)})):null:null}function UC(){return UC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},UC.apply(null,arguments)}var FH=t=>{var e=t.cx,n=t.cy,r=t.r,i=t.className,s=tr("recharts-dot",i);return It(e)&&It(n)&&It(r)?P.createElement("circle",UC({},Bo(t),BP(t),{className:s,cx:e,cy:n,r})):null},sle={radiusAxis:{},angleAxis:{}},zH=cs({name:"polarAxis",initialState:sle,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]}}}),XS=zH.actions;XS.addRadiusAxis;XS.removeRadiusAxis;XS.addAngleAxis;XS.removeAngleAxis;var ale=zH.reducer;function ole(t){return t&&typeof t=="object"&&"className"in t&&typeof t.className=="string"?t.className:""}var BH=t=>t&&typeof t=="object"&&"clipDot"in t?!!t.clipDot:!0;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 i3(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?r3(Object(n),!0).forEach(function(r){lle(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function lle(t,e,n){return(e=cle(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function cle(t){var e=ule(t,"string");return typeof e=="symbol"?e:e+""}function ule(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)}function HH(t,e){return i3(i3({},e),t)}function dle(t){return P.isValidElement(t)?t.props:t}function fle(t,e){return P.cloneElement(t,HH(dle(t),e))}function hle(t){if("index"in t){var e=t.index;return typeof e=="number"||typeof e=="string"?e:void 0}}function ple(t){return"isActive"in t&&t.isActive===!0}function mle(t){var e=t.option,n=t.DefaultShape,r=t.shapeProps,i=t.activeClassName,s=i===void 0?"recharts-active-shape":i,a=t.inActiveClassName,o=a===void 0?"recharts-shape":a,l=hle(r),c;return P.isValidElement(e)?c=fle(e,r):e===n?c=P.createElement(n,r):typeof e=="function"?c=e(r,l):typeof e=="object"?c=P.createElement(n,HH(e,r)):c=P.createElement(n,r),ple(r)?P.createElement(Ya,{className:s},c):P.createElement(Ya,{className:o},c)}function gle(t){var e=t.tooltipEntrySettings,n=Wr(),r=ta(),i=P.useRef(null);return P.useLayoutEffect(()=>{r||(i.current===null?n(Aie(e)):i.current!==e&&n(Tie({prev:i.current,next:e})),i.current=e)},[e,n,r]),P.useLayoutEffect(()=>()=>{i.current&&(n(Cie(i.current)),i.current=null)},[n]),null}function vle(t){var e=t.legendPayload,n=Wr(),r=ta(),i=P.useRef(null);return P.useLayoutEffect(()=>{r||(i.current===null?n(eQ(e)):i.current!==e&&n(tQ({prev:i.current,next:e})),i.current=e)},[n,r,e]),P.useLayoutEffect(()=>()=>{i.current&&(n(nQ(i.current)),i.current=null)},[n]),null}function yle(t,e){return wle(t)||_le(t,e)||ble(t,e)||xle()}function xle(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ble(t,e){if(t){if(typeof t=="string")return s3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s3(t,e):void 0}}function s3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function _le(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function wle(t){if(Array.isArray(t))return t}var sR="index",Sle="append";function aR(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],r=[];for(var i of n)r.push({status:"removed",prev:i});for(var s=0;s<e.length;s++){var a=t[s],o=e[s];a!=null?r.push({status:"matched",prev:a,next:o}):r.push({status:"added",next:o})}return r}function Mle(t,e){var n=t.length/e.length,r=e.map((i,s)=>t[Math.floor(s*n)]);return aR(r,e)}function Ele(t,e){var n=e.map((r,i)=>t[i]);return aR(n,e)}function Ale(t,e){for(var n=new Map,r=0;r<t.length;r++){var i=t[r];if(i!=null){var s=e(i,r);s!=null&&!n.has(s)&&n.set(s,i)}}return n}function Tle(t,e,n){var r=Ale(t,n),i=new Set,s=e.map((f,p)=>{var y=n(f,p);if(y!=null){var x=r.get(y);if(x!==void 0)return i.add(y),x}}),a=[];for(var o of r){var l=yle(o,2),c=l[0],d=l[1];i.has(c)||a.push(d)}return aR(s,e,a)}function FC(t,e,n){return e==null?null:t==null?e.map(r=>({status:"added",next:r})):n===sR?Mle(t,e):n===Sle?Ele(t,e):Tle(t,e,n)}function VH(t,e){var n=P.useRef(t),r=P.useRef(e.current),i=P.useRef(!0);n.current!==t&&(n.current=t,r.current=e.current,i.current=!1);var s=P.useCallback(function(a,o){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(o===0){i.current=!0;return}o===1&&(r.current=a),o>0&&i.current&&l&&(e.current=a)},[e]);return{startValue:r.current,syncStepValue:s}}function Cle(t,e){return kle(t)||Nle(t,e)||Rle(t,e)||Ple()}function Ple(){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 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<e;n++)r[n]=t[n];return r}function Nle(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function kle(t){if(Array.isArray(t))return t}function Ile(t,e){var n=P.useState(!1),r=Cle(n,2),i=r[0],s=r[1],a=P.useCallback(()=>{typeof t=="function"&&t(),s(!0)},[t]),o=P.useCallback(()=>{typeof e=="function"&&e(),s(!1)},[e]);return{isAnimating:i,handleAnimationStart:a,handleAnimationEnd:o}}function Lle(t){var e,n=t.animationInput,r=t.animationIdPrefix,i=t.items,s=t.previousItemsRef,a=t.isAnimationActive,o=t.animationBegin,l=t.animationDuration,c=t.animationEasing,d=t.onAnimationStart,f=t.onAnimationEnd,p=t.animationInterpolateFn,y=t.animationMatchBy,x=t.shouldUpdatePreviousRef,S=t.children,w=t.layout,b=iz(n,r),M=VH(b,s),T=(e=M.startValue)!==null&&e!==void 0?e:null,C=FC(T,i,y??sR);return P.createElement(rz,{animationId:b,begin:o,duration:l,isActive:a,easing:c,onAnimationEnd:f,onAnimationStart:d,key:b},L=>{var N=T==null,D=i==null?i:p(C,L,w),F=x?x(L):L>0;return M.syncStepValue(D,L,F),D==null?null:S(D,L,N)})}var KE;function Ole(t,e){return Fle(t)||Ule(t,e)||jle(t,e)||Dle()}function Dle(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jle(t,e){if(t){if(typeof t=="string")return o3(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)?o3(t,e):void 0}}function o3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ule(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function Fle(t){if(Array.isArray(t))return t}var zle=()=>{var t=P.useState(()=>gy("uid-")),e=Ole(t,1),n=e[0];return n},GH=(KE=Jw.useId)!==null&&KE!==void 0?KE:zle;function Ble(t,e){var n=GH();return e||(t?"".concat(t,"-").concat(n):n)}var Hle=P.createContext(void 0),Vle=t=>{var e=t.id,n=t.type,r=t.children,i=Ble("recharts-".concat(n),e);return P.createElement(Hle.Provider,{value:i},r(i))},Gle={cartesianItems:[],polarItems:[]},WH=cs({name:"graphicalItems",initialState:Gle,reducers:{addCartesianGraphicalItem:{reducer(t,e){t.cartesianItems.push(e.payload)},prepare:ar()},replaceCartesianGraphicalItem:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=$a(t).cartesianItems.indexOf(r);s>-1&&(t.cartesianItems[s]=i)},prepare:ar()},removeCartesianGraphicalItem:{reducer(t,e){var n=$a(t).cartesianItems.indexOf(e.payload);n>-1&&t.cartesianItems.splice(n,1)},prepare:ar()},addPolarGraphicalItem:{reducer(t,e){t.polarItems.push(e.payload)},prepare:ar()},removePolarGraphicalItem:{reducer(t,e){var n=$a(t).polarItems.indexOf(e.payload);n>-1&&t.polarItems.splice(n,1)},prepare:ar()},replacePolarGraphicalItem:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=$a(t).polarItems.indexOf(r);s>-1&&(t.polarItems[s]=i)},prepare:ar()}}}),sv=WH.actions,Wle=sv.addCartesianGraphicalItem,$le=sv.replaceCartesianGraphicalItem,Xle=sv.removeCartesianGraphicalItem;sv.addPolarGraphicalItem;sv.removePolarGraphicalItem;sv.replacePolarGraphicalItem;var qle=WH.reducer,Kle=t=>{var e=Wr(),n=P.useRef(null);return P.useLayoutEffect(()=>{n.current===null?e(Wle(t)):n.current!==t&&e($le({prev:n.current,next:t})),n.current=t},[e,t]),P.useLayoutEffect(()=>()=>{n.current&&(e(Xle(n.current)),n.current=null)},[e]),null},Yle=P.memo(Kle),Zle=["points"];function l3(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 YE(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?l3(Object(n),!0).forEach(function(r){Qle(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):l3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Qle(t,e,n){return(e=Jle(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Jle(t){var e=ece(t,"string");return typeof e=="symbol"?e:e+""}function ece(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)}function tw(){return tw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},tw.apply(null,arguments)}function tce(t,e){if(t==null)return{};var n,r,i=nce(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function nce(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function rce(t){var e=t.option,n=t.dotProps,r=t.className;if(P.isValidElement(e))return P.cloneElement(e,n);if(typeof e=="function")return e(n);var i=tr(r,typeof e!="boolean"?e.className:""),s=n??{};s.points;var a=tce(s,Zle);return P.createElement(FH,tw({},a,{className:i}))}function ice(t,e){return t==null?!1:e?!0:t.length===1}function sce(t){var e=t.points,n=t.dot,r=t.className,i=t.dotClassName,s=t.dataKey,a=t.baseProps,o=t.needClip,l=t.clipPathId,c=t.zIndex,d=c===void 0?Es.scatter:c;if(!ice(e,n))return null;var f=BH(n),p=zX(n),y=e.map((S,w)=>{var b,M,T=YE(YE(YE({r:3},a),p),{},{index:w,cx:(b=S.x)!==null&&b!==void 0?b:void 0,cy:(M=S.y)!==null&&M!==void 0?M:void 0,dataKey:s,value:S.value,payload:S.payload,points:e});return P.createElement(rce,{key:"dot-".concat(w),option:n,dotProps:T,className:i})}),x={};return o&&l!=null&&(x.clipPath="url(#clipPath-".concat(f?"":"dots-").concat(l,")")),P.createElement(cu,{zIndex:d},P.createElement(Ya,tw({className:r},x),y))}function c3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function u3(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?c3(Object(n),!0).forEach(function(r){ace(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):c3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ace(t,e,n){return(e=oce(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function oce(t){var e=lce(t,"string");return typeof e=="symbol"?e:e+""}function lce(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 $H=0,cce={xAxis:{},yAxis:{},zAxis:{}},XH=cs({name:"cartesianAxis",initialState:cce,reducers:{addXAxis:{reducer(t,e){t.xAxis[e.payload.id]=e.payload},prepare:ar()},replaceXAxis:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next;t.xAxis[r.id]!==void 0&&(r.id!==i.id&&delete t.xAxis[r.id],t.xAxis[i.id]=i)},prepare:ar()},removeXAxis:{reducer(t,e){delete t.xAxis[e.payload.id]},prepare:ar()},addYAxis:{reducer(t,e){t.yAxis[e.payload.id]=e.payload},prepare:ar()},replaceYAxis:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next;t.yAxis[r.id]!==void 0&&(r.id!==i.id&&delete t.yAxis[r.id],t.yAxis[i.id]=i)},prepare:ar()},removeYAxis:{reducer(t,e){delete t.yAxis[e.payload.id]},prepare:ar()},addZAxis:{reducer(t,e){t.zAxis[e.payload.id]=e.payload},prepare:ar()},replaceZAxis:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next;t.zAxis[r.id]!==void 0&&(r.id!==i.id&&delete t.zAxis[r.id],t.zAxis[i.id]=i)},prepare:ar()},removeZAxis:{reducer(t,e){delete t.zAxis[e.payload.id]},prepare:ar()},updateYAxisWidth(t,e){var n=e.payload,r=n.id,i=n.width,s=t.yAxis[r];if(s){var a,o=s.widthHistory||[];if(o.length===3&&o[0]===o[2]&&i===o[1]&&i!==s.width&&Math.abs(i-((a=o[0])!==null&&a!==void 0?a:0))<=1)return;var l=[...o,i].slice(-3);t.yAxis[r]=u3(u3({},s),{},{width:i,widthHistory:l})}}}}),Vl=XH.actions,uce=Vl.addXAxis,dce=Vl.replaceXAxis,fce=Vl.removeXAxis,hce=Vl.addYAxis,pce=Vl.replaceYAxis,mce=Vl.removeYAxis;Vl.addZAxis;Vl.replaceZAxis;Vl.removeZAxis;var gce=Vl.updateYAxisWidth,vce=XH.reducer,yce=ke([Wi],t=>({top:t.top,bottom:t.bottom,left:t.left,right:t.right})),xce=ke([yce,ru,iu],(t,e,n)=>{if(!(!t||e==null||n==null))return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}),oR=()=>Ft(xce),bce=()=>Ft(Ase);function d3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ZE(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?d3(Object(n),!0).forEach(function(r){_ce(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):d3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function _ce(t,e,n){return(e=wce(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function wce(t){var e=Sce(t,"string");return typeof e=="symbol"?e:e+""}function Sce(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 Mce=t=>{var e=t.point,n=t.childIndex,r=t.mainColor,i=t.activeDot,s=t.dataKey,a=t.clipPath;if(i===!1||e.x==null||e.y==null)return null;var o={index:n,dataKey:s,cx:e.x,cy:e.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:e.payload,value:e.value},l=ZE(ZE(ZE({},o),aS(i)),BP(i)),c;return P.isValidElement(i)?c=P.cloneElement(i,l):typeof i=="function"?c=i(l):c=P.createElement(FH,l),P.createElement(Ya,{className:"recharts-active-dot",clipPath:a},c)};function f3(t){var e=t.points,n=t.mainColor,r=t.activeDot,i=t.itemDataKey,s=t.clipPath,a=t.zIndex,o=a===void 0?Es.activeDot:a,l=Ft(Py),c=bce();if(e==null||c==null)return null;var d=e.find(f=>c.includes(f.payload));return Vi(d)?null:P.createElement(cu,{zIndex:o},P.createElement(Mce,{point:d,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r,clipPath:s}))}var Ece=t=>{var e=t.chartData,n=Wr(),r=ta();return P.useEffect(()=>r?()=>{}:(n(LO(e)),()=>{n(LO(void 0))}),[e,n,r]),null},h3={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},qH=cs({name:"brush",initialState:h3,reducers:{setBrushSettings(t,e){return e.payload==null?h3:e.payload}}});qH.actions.setBrushSettings;var Ace=qH.reducer;function Tce(t){return(t%180+180)%180}var Cce=function(e){var n=e.width,r=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=Tce(i),a=s*Math.PI/180,o=Math.atan(r/n),l=a>o&&a<Math.PI-o?r/Math.sin(a):n/Math.cos(a);return Math.abs(l)},Pce={dots:[],areas:[],lines:[]},KH=cs({name:"referenceElements",initialState:Pce,reducers:{addDot:(t,e)=>{t.dots.push(e.payload)},removeDot:(t,e)=>{var n=$a(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=$a(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=$a(t).lines.findIndex(r=>r===e.payload);n!==-1&&t.lines.splice(n,1)}}}),av=KH.actions;av.addDot;av.removeDot;av.addArea;av.removeArea;av.addLine;av.removeLine;var Rce=KH.reducer;function Nce(t,e){return Oce(t)||Lce(t,e)||Ice(t,e)||kce()}function kce(){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 Ice(t,e){if(t){if(typeof t=="string")return p3(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)?p3(t,e):void 0}}function p3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Lce(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function Oce(t){if(Array.isArray(t))return t}var Dce=P.createContext(void 0),jce=t=>{var e=t.children,n=P.useState("".concat(gy("recharts"),"-clip")),r=Nce(n,1),i=r[0],s=oR();if(s==null)return null;var a=s.x,o=s.y,l=s.width,c=s.height;return P.createElement(Dce.Provider,{value:i},P.createElement("defs",null,P.createElement("clipPath",{id:i},P.createElement("rect",{x:a,y:o,height:c,width:l}))),e)};function YH(t,e){if(e<1)return[];if(e===1)return t;for(var n=[],r=0;r<t.length;r+=e){var i=t[r];i!==void 0&&n.push(i)}return n}function Uce(t,e,n){var r={width:t.width+e.width,height:t.height+e.height};return Cce(r,n)}function Fce(t,e,n){var r=n==="width",i=t.x,s=t.y,a=t.width,o=t.height;return e===1?{start:r?i:s,end:r?i+a:s+o}:{start:r?i+a:s+o,end:r?i:s}}function Ny(t,e,n,r,i){if(t*e<t*r||t*e>t*i)return!1;var s=n();return t*(e-t*s/2-r)>=0&&t*(e+t*s/2-i)<=0}function zce(t,e){return YH(t,e+1)}function Bce(t,e,n,r,i){for(var s=(r||[]).slice(),a=e.start,o=e.end,l=0,c=1,d=a,f=function(){var x=r==null?void 0:r[l];if(x===void 0)return{v:YH(r,c)};var S=l,w,b=()=>(w===void 0&&(w=n(x,S)),w),M=x.coordinate,T=l===0||Ny(t,M,b,d,o);T||(l=0,d=a,c+=1),T&&(d=M+t*(b()/2+i),l+=c)},p;c<=s.length;)if(p=f(),p)return p.v;return[]}function Hce(t,e,n,r,i){var s=(r||[]).slice(),a=s.length;if(a===0)return[];for(var o=e.start,l=e.end,c=1;c<=a;c++){for(var d=(a-1)%c,f=o,p=!0,y=function(){var C=r[S];if(C==null)return 0;var L=S,N,D=()=>(N===void 0&&(N=n(C,L)),N),F=C.coordinate,V=S===d||Ny(t,F,D,f,l);if(!V)return p=!1,1;V&&(f=F+t*(D()/2+i))},x,S=d;S<a&&(x=y(),!(x!==0&&x===1));S+=c);if(p){for(var w=[],b=d;b<a;b+=c){var M=r[b];M!=null&&w.push(M)}return w}}return[]}function m3(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<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?m3(Object(n),!0).forEach(function(r){Vce(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):m3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Vce(t,e,n){return(e=Gce(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Gce(t){var e=Wce(t,"string");return typeof e=="symbol"?e:e+""}function Wce(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)}function $ce(t,e,n,r,i){for(var s=(r||[]).slice(),a=s.length,o=e.start,l=e.end,c=function(p){var y=s[p];if(y==null)return 1;var x=y,S,w=()=>(S===void 0&&(S=n(y,p)),S);if(p===a-1){var b=t*(x.coordinate+t*w()/2-l);s[p]=x=rs(rs({},x),{},{tickCoord:b>0?x.coordinate-b*t:x.coordinate})}else s[p]=x=rs(rs({},x),{},{tickCoord:x.coordinate});if(x.tickCoord!=null){var M=Ny(t,x.tickCoord,w,o,l);M&&(l=x.tickCoord-t*(w()/2+i),s[p]=rs(rs({},x),{},{isShow:!0}))}},d=a-1;d>=0;d--)c(d);return s}function Xce(t,e,n,r,i,s){var a=(r||[]).slice(),o=a.length,l=e.start,c=e.end;if(s){var d=r[o-1];if(d!=null){var f=n(d,o-1),p=t*(d.coordinate+t*f/2-c);if(a[o-1]=d=rs(rs({},d),{},{tickCoord:p>0?d.coordinate-p*t:d.coordinate}),d.tickCoord!=null){var y=Ny(t,d.tickCoord,()=>f,l,c);y&&(c=d.tickCoord-t*(f/2+i),a[o-1]=rs(rs({},d),{},{isShow:!0}))}}}for(var x=s?o-1:o,S=function(M){var T=a[M];if(T==null)return 1;var C=T,L,N=()=>(L===void 0&&(L=n(T,M)),L);if(M===0){var D=t*(C.coordinate-t*N()/2-l);a[M]=C=rs(rs({},C),{},{tickCoord:D<0?C.coordinate-D*t:C.coordinate})}else a[M]=C=rs(rs({},C),{},{tickCoord:C.coordinate});if(C.tickCoord!=null){var F=Ny(t,C.tickCoord,N,l,c);F&&(l=C.tickCoord+t*(N()/2+i),a[M]=rs(rs({},C),{},{isShow:!0}))}},w=0;w<x;w++)S(w);return a}function lR(t,e,n){var r=t.tick,i=t.ticks,s=t.viewBox,a=t.minTickGap,o=t.orientation,l=t.interval,c=t.tickFormatter,d=t.unit,f=t.angle;if(!i||!i.length||!r)return[];if(It(l)||ix.isSsr){var p;return(p=zce(i,It(l)?l:0))!==null&&p!==void 0?p:[]}var y=[],x=o==="top"||o==="bottom"?"width":"height",S=d&&x==="width"?ey(d,{fontSize:e,letterSpacing:n}):{width:0,height:0},w=(L,N)=>{var D=typeof c=="function"?c(L.value,N):L.value;return x==="width"?Uce(ey(D,{fontSize:e,letterSpacing:n}),S,f):ey(D,{fontSize:e,letterSpacing:n})[x]},b=i[0],M=i[1],T=i.length>=2&&b!=null&&M!=null?Wa(M.coordinate-b.coordinate):1,C=Fce(s,T,x);return l==="equidistantPreserveStart"?Bce(T,C,w,i,a):l==="equidistantPreserveEnd"?Hce(T,C,w,i,a):(l==="preserveStart"||l==="preserveStartEnd"?y=Xce(T,C,w,i,a,l==="preserveStartEnd"):y=$ce(T,C,w,i,a),y.filter(L=>L.isShow))}var qce=t=>{var e=t.ticks,n=t.label,r=t.labelGapWithTick,i=r,s=t.tickSize,a=s===void 0?0:s,o=t.tickMargin,l=o===void 0?0:o,c=0;if(e){Array.from(e).forEach(y=>{if(y){var x=y.getBoundingClientRect();x.width>c&&(c=x.width)}});var d=n?n.getBoundingClientRect().width:0,f=a+l,p=c+f+d+(n?i:0);return Math.round(p)}return 0},Kce={xAxis:{},yAxis:{}},ZH=cs({name:"renderedTicks",initialState:Kce,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]}}}),QH=ZH.actions,Yce=QH.setRenderedTicks,Zce=QH.removeRenderedTicks,Qce=ZH.reducer,Jce=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function g3(t,e){return rue(t)||nue(t,e)||tue(t,e)||eue()}function eue(){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 tue(t,e){if(t){if(typeof t=="string")return v3(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)?v3(t,e):void 0}}function v3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function nue(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function rue(t){if(Array.isArray(t))return t}function iue(t,e){if(t==null)return{};var n,r,i=sue(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function sue(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function Wh(){return Wh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Wh.apply(null,arguments)}function y3(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 Ar(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?y3(Object(n),!0).forEach(function(r){aue(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):y3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function aue(t,e,n){return(e=oue(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function oue(t){var e=lue(t,"string");return typeof e=="symbol"?e:e+""}function lue(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 $c={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:Es.axis};function cue(t){var e=t.x,n=t.y,r=t.width,i=t.height,s=t.orientation,a=t.mirror,o=t.axisLine,l=t.otherSvgProps;if(!o)return null;var c=Ar(Ar(Ar({},l),Bo(o)),{},{fill:"none"});if(s==="top"||s==="bottom"){var d=+(s==="top"&&!a||s==="bottom"&&a);c=Ar(Ar({},c),{},{x1:e,y1:n+d*i,x2:e+r,y2:n+d*i})}else{var f=+(s==="left"&&!a||s==="right"&&a);c=Ar(Ar({},c),{},{x1:e+f*r,y1:n,x2:e+f*r,y2:n+i})}return P.createElement("line",Wh({},c,{className:tr("recharts-cartesian-axis-line",ip(o,"className"))}))}function uue(t,e,n,r,i,s,a,o,l){var c,d,f,p,y,x,S=o?-1:1,w=t.tickSize||a,b=It(t.tickCoord)?t.tickCoord:t.coordinate;switch(s){case"top":c=d=t.coordinate,p=n+ +!o*i,f=p-S*w,x=f-S*l,y=b;break;case"left":f=p=t.coordinate,d=e+ +!o*r,c=d-S*w,y=c-S*l,x=b;break;case"right":f=p=t.coordinate,d=e+ +o*r,c=d+S*w,y=c+S*l,x=b;break;default:c=d=t.coordinate,p=n+ +o*i,f=p+S*w,x=f+S*l,y=b;break}return{line:{x1:c,y1:f,x2:d,y2:p},tick:{x:y,y:x}}}function due(t,e){switch(t){case"left":return e?"start":"end";case"right":return e?"end":"start";default:return"middle"}}function fue(t,e){switch(t){case"left":case"right":return"middle";case"top":return e?"start":"end";default:return e?"end":"start"}}function hue(t){var e=t.option,n=t.tickProps,r=t.value,i,s=tr(n.className,"recharts-cartesian-axis-tick-value");if(P.isValidElement(e))i=P.cloneElement(e,Ar(Ar({},n),{},{className:s}));else if(typeof e=="function")i=e(Ar(Ar({},n),{},{className:s}));else{var a="recharts-cartesian-axis-tick-value";typeof e!="boolean"&&(a=tr(a,ole(e))),i=P.createElement(rR,Wh({},n,{className:a}),r)}return i}function pue(t){var e=t.ticks,n=t.axisType,r=t.axisId,i=Wr();return P.useEffect(()=>{if(r==null||n==null)return Kg;var s=e.map(a=>({value:a.value,coordinate:a.coordinate,offset:a.offset,index:a.index}));return i(Yce({ticks:s,axisId:r,axisType:n})),()=>{i(Zce({axisId:r,axisType:n}))}},[i,e,r,n]),null}var mue=P.forwardRef((t,e)=>{var n=t.ticks,r=n===void 0?[]:n,i=t.tick,s=t.tickLine,a=t.stroke,o=t.tickFormatter,l=t.unit,c=t.padding,d=t.tickTextProps,f=t.orientation,p=t.mirror,y=t.x,x=t.y,S=t.width,w=t.height,b=t.tickSize,M=t.tickMargin,T=t.fontSize,C=t.letterSpacing,L=t.getTicksConfig,N=t.events,D=t.axisType,F=t.axisId,V=lR(Ar(Ar({},L),{},{ticks:r}),T,C),I=Bo(L),U=aS(i),X=NH(I.textAnchor)?I.textAnchor:due(f,p),te=fue(f,p),re={};typeof s=="object"&&(re=s);var pe=Ar(Ar({},I),{},{fill:"none"},re),ee=V.map(J=>Ar({entry:J},uue(J,y,x,S,w,f,b,p,M))),ce=ee.map(J=>{var Z=J.entry,G=J.line;return P.createElement(Ya,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(Z.value,"-").concat(Z.coordinate,"-").concat(Z.tickCoord)},s&&P.createElement("line",Wh({},pe,G,{className:tr("recharts-cartesian-axis-tick-line",ip(s,"className"))})))}),B=ee.map((J,Z)=>{var G,W,oe=J.entry,se=J.tick,le=Ar(Ar(Ar(Ar({verticalAnchor:te},I),{},{textAnchor:X,stroke:"none",fill:a},se),{},{index:Z,payload:oe,visibleTicksCount:V.length,tickFormatter:o,padding:c},d),{},{angle:(G=(W=d==null?void 0:d.angle)!==null&&W!==void 0?W:I.angle)!==null&&G!==void 0?G:0}),Me=Ar(Ar({},le),U);return P.createElement(Ya,Wh({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(oe.value,"-").concat(oe.coordinate,"-").concat(oe.tickCoord)},xq(N,oe,Z)),i&&P.createElement(hue,{option:i,tickProps:Me,value:"".concat(typeof o=="function"?o(oe.value,Z):oe.value).concat(l||"")}))});return P.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(D,"-ticks")},P.createElement(pue,{ticks:V,axisId:F,axisType:D}),B.length>0&&P.createElement(cu,{zIndex:Es.label},P.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(D,"-tick-labels"),ref:e},B)),ce.length>0&&P.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(D,"-tick-lines")},ce))}),gue=P.forwardRef((t,e)=>{var n=t.axisLine,r=t.width,i=t.height,s=t.className,a=t.hide,o=t.ticks,l=t.axisType,c=t.axisId,d=iue(t,Jce),f=P.useState(""),p=g3(f,2),y=p[0],x=p[1],S=P.useState(""),w=g3(S,2),b=w[0],M=w[1],T=P.useRef(null);P.useImperativeHandle(e,()=>({getCalculatedWidth:()=>{var L;return qce({ticks:T.current,label:(L=t.labelRef)===null||L===void 0?void 0:L.current,labelGapWithTick:5,tickSize:t.tickSize,tickMargin:t.tickMargin})}}));var C=P.useCallback(L=>{if(L){var N=L.getElementsByClassName("recharts-cartesian-axis-tick-value");T.current=N;var D=N[0];if(D){var F=window.getComputedStyle(D),V=F.fontSize,I=F.letterSpacing;(V!==y||I!==b)&&(x(V),M(I))}}},[y,b]);return a||r!=null&&r<=0||i!=null&&i<=0?null:P.createElement(cu,{zIndex:t.zIndex},P.createElement(Ya,{className:tr("recharts-cartesian-axis",s)},P.createElement(cue,{x:t.x,y:t.y,width:r,height:i,orientation:t.orientation,mirror:t.mirror,axisLine:n,otherSvgProps:Bo(t)}),P.createElement(mue,{ref:C,axisType:l,events:d,fontSize:y,getTicksConfig:t,height:t.height,letterSpacing:b,mirror:t.mirror,orientation:t.orientation,padding:t.padding,stroke:t.stroke,tick:t.tick,tickFormatter:t.tickFormatter,tickLine:t.tickLine,tickMargin:t.tickMargin,tickSize:t.tickSize,tickTextProps:t.tickTextProps,ticks:o,unit:t.unit,width:t.width,x:t.x,y:t.y,axisId:c}),P.createElement(zoe,{x:t.x,y:t.y,width:t.width,height:t.height,lowerWidth:t.width,upperWidth:t.width},P.createElement(Yoe,{label:t.label,labelRef:t.labelRef}),t.children)))}),cR=P.forwardRef((t,e)=>{var n=Ja(t,$c);return P.createElement(gue,Wh({},n,{ref:e}))});cR.displayName="CartesianAxis";var vue=["x1","y1","x2","y2","key"],yue=["offset"],xue=["xAxisId","yAxisId"],bue=["xAxisId","yAxisId"];function x3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function is(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?x3(Object(n),!0).forEach(function(r){_ue(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):x3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function _ue(t,e,n){return(e=wue(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function wue(t){var e=Sue(t,"string");return typeof e=="symbol"?e:e+""}function Sue(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)}function fh(){return fh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},fh.apply(null,arguments)}function nw(t,e){if(t==null)return{};var n,r,i=Mue(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Mue(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var Eue=t=>{var e=t.fill;if(!e||e==="none")return null;var n=t.fillOpacity,r=t.x,i=t.y,s=t.width,a=t.height,o=t.ry;return P.createElement("rect",{x:r,y:i,ry:o,width:s,height:a,stroke:"none",fill:e,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function JH(t){var e=t.option,n=t.lineItemProps,r;if(P.isValidElement(e))r=P.cloneElement(e,n);else if(typeof e=="function")r=e(n);else{var i,s=n.x1,a=n.y1,o=n.x2,l=n.y2,c=n.key,d=nw(n,vue),f=(i=Bo(d))!==null&&i!==void 0?i:{};f.offset;var p=nw(f,yue);r=P.createElement("line",fh({},p,{x1:s,y1:a,x2:o,y2:l,fill:"none",key:c}))}return r}function Aue(t){var e=t.x,n=t.width,r=t.horizontal,i=r===void 0?!0:r,s=t.horizontalPoints;if(!i||!s||!s.length)return null;t.xAxisId,t.yAxisId;var a=nw(t,xue),o=s.map((l,c)=>{var d=is(is({},a),{},{x1:e,y1:l,x2:e+n,y2:l,key:"line-".concat(c),index:c});return P.createElement(JH,{key:"line-".concat(c),option:i,lineItemProps:d})});return P.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function Tue(t){var e=t.y,n=t.height,r=t.vertical,i=r===void 0?!0:r,s=t.verticalPoints;if(!i||!s||!s.length)return null;t.xAxisId,t.yAxisId;var a=nw(t,bue),o=s.map((l,c)=>{var d=is(is({},a),{},{x1:l,y1:e,x2:l,y2:e+n,key:"line-".concat(c),index:c});return P.createElement(JH,{option:i,lineItemProps:d,key:"line-".concat(c)})});return P.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function Cue(t){var e=t.horizontalFill,n=t.fillOpacity,r=t.x,i=t.y,s=t.width,a=t.height,o=t.horizontalPoints,l=t.horizontal,c=l===void 0?!0:l;if(!c||!e||!e.length||o==null)return null;var d=o.map(p=>Math.round(p+i-i)).sort((p,y)=>p-y);i!==d[0]&&d.unshift(0);var f=d.map((p,y)=>{var x=d[y+1],S=x==null,w=S?i+a-p:x-p;if(w<=0)return null;var b=y%e.length;return P.createElement("rect",{key:"react-".concat(y),y:p,x:r,height:w,width:s,stroke:"none",fill:e[b],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return P.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function Pue(t){var e=t.vertical,n=e===void 0?!0:e,r=t.verticalFill,i=t.fillOpacity,s=t.x,a=t.y,o=t.width,l=t.height,c=t.verticalPoints;if(!n||!r||!r.length)return null;var d=c.map(p=>Math.round(p+s-s)).sort((p,y)=>p-y);s!==d[0]&&d.unshift(0);var f=d.map((p,y)=>{var x=d[y+1],S=x==null,w=S?s+o-p:x-p;if(w<=0)return null;var b=y%r.length;return P.createElement("rect",{key:"react-".concat(y),x:p,y:a,width:w,height:l,stroke:"none",fill:r[b],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return P.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var Rue=(t,e)=>{var n=t.xAxis,r=t.width,i=t.height,s=t.offset;return I4(lR(is(is(is({},$c),n),{},{ticks:L4(n),viewBox:{x:0,y:0,width:r,height:i}})),s.left,s.left+s.width,e)},Nue=(t,e)=>{var n=t.yAxis,r=t.width,i=t.height,s=t.offset;return I4(lR(is(is(is({},$c),n),{},{ticks:L4(n),viewBox:{x:0,y:0,width:r,height:i}})),s.top,s.top+s.height,e)},kue={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Es.grid};function eV(t){var e=H4(),n=V4(),r=B4(),i=is(is({},Ja(t,kue)),{},{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,a=i.yAxisId,o=i.x,l=i.y,c=i.width,d=i.height,f=i.syncWithTicks,p=i.horizontalValues,y=i.verticalValues,x=ta(),S=Ft(V=>_O(V,"xAxis",s,x)),w=Ft(V=>_O(V,"yAxis",a,x));if(!Ol(c)||!Ol(d)||!It(o)||!It(l))return null;var b=i.verticalCoordinatesGenerator||Rue,M=i.horizontalCoordinatesGenerator||Nue,T=i.horizontalPoints,C=i.verticalPoints;if((!T||!T.length)&&typeof M=="function"){var L=p&&p.length,N=M({yAxis:w?is(is({},w),{},{ticks:L?p:w.ticks}):void 0,width:e??c,height:n??d,offset:r},L?!0:f);C1(Array.isArray(N),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof N,"]")),Array.isArray(N)&&(T=N)}if((!C||!C.length)&&typeof b=="function"){var D=y&&y.length,F=b({xAxis:S?is(is({},S),{},{ticks:D?y:S.ticks}):void 0,width:e??c,height:n??d,offset:r},D?!0:f);C1(Array.isArray(F),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof F,"]")),Array.isArray(F)&&(C=F)}return P.createElement(cu,{zIndex:i.zIndex},P.createElement("g",{className:"recharts-cartesian-grid"},P.createElement(Eue,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),P.createElement(Cue,fh({},i,{horizontalPoints:T})),P.createElement(Pue,fh({},i,{verticalPoints:C})),P.createElement(Aue,fh({},i,{offset:r,horizontalPoints:T,xAxis:S,yAxis:w})),P.createElement(Tue,fh({},i,{offset:r,verticalPoints:C,xAxis:S,yAxis:w}))))}eV.displayName="CartesianGrid";var Iue={},tV=cs({name:"errorBars",initialState:Iue,reducers:{addErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,i=n.errorBar;t[r]||(t[r]=[]),t[r].push(i)},replaceErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,i=n.prev,s=n.next;t[r]&&(t[r]=t[r].map(a=>a.dataKey===i.dataKey&&a.direction===i.direction?s:a))},removeErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,i=n.errorBar;t[r]&&(t[r]=t[r].filter(s=>s.dataKey!==i.dataKey||s.direction!==i.direction))}}}),uR=tV.actions;uR.addErrorBar;uR.replaceErrorBar;uR.removeErrorBar;var Lue=tV.reducer;function nV(t,e){var n,r,i=Ft(c=>au(c,t)),s=Ft(c=>ou(c,e)),a=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:ti.allowDataOverflow,o=(r=s==null?void 0:s.allowDataOverflow)!==null&&r!==void 0?r:ni.allowDataOverflow,l=a||o;return{needClip:l,needClipX:a,needClipY:o}}function Oue(t){var e=t.xAxisId,n=t.yAxisId,r=t.clipPathId,i=oR(),s=nV(e,n),a=s.needClipX,o=s.needClipY,l=s.needClip,c=Ft(T=>zB(T,e,!1)),d=Ft(T=>BB(T,n,!1));if(!l||!i)return null;var f=i.x,p=i.y,y=i.width,x=i.height,S=a&&c?Math.min(c[0],c[1]):f-y/2,w=o&&d?Math.min(d[0],d[1]):p-x/2,b=a&&c?Math.abs(c[1]-c[0]):y*2,M=o&&d?Math.abs(d[1]-d[0]):x*2;return P.createElement("clipPath",{id:"clipPath-".concat(r)},P.createElement("rect",{x:S,y:w,width:b,height:M}))}function Due(t){var e=aS(t),n=3,r=2;if(e!=null){var i=e.r,s=e.strokeWidth,a=Number(i),o=Number(s);return(Number.isNaN(a)||a<0)&&(a=n),(Number.isNaN(o)||o<0)&&(o=r),{r:a,strokeWidth:o}}return{r:n,strokeWidth:r}}function dR(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:$H}function fR(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:$H}var rV=(t,e,n)=>KB(t,"xAxis",dR(t,e),n),iV=(t,e,n)=>qB(t,"xAxis",dR(t,e),n),sV=(t,e,n)=>KB(t,"yAxis",fR(t,e),n),aV=(t,e,n)=>qB(t,"yAxis",fR(t,e),n),jue=ke([hr,rV,sV,iV,aV],(t,e,n,r,i)=>Hl(t,"xAxis")?T1(e,r,!1):T1(n,i,!1)),Uue=(t,e)=>e,oV=ke([pB,Uue],(t,e)=>t.filter(n=>n.type==="area").find(n=>n.id===e)),lV=t=>{var e=hr(t),n=Hl(e,"xAxis");return n?"yAxis":"xAxis"},Fue=(t,e)=>{var n=lV(t);return n==="yAxis"?fR(t,e):dR(t,e)},zue=(t,e,n)=>MB(t,lV(t),Fue(t,e),n),Bue=ke([oV,zue],(t,e)=>{var n;if(!(t==null||e==null)){var r=t.stackId,i=f2(t);if(!(r==null||i==null)){var s=(n=e[r])===null||n===void 0?void 0:n.stackedData,a=s==null?void 0:s.find(o=>o.key===i);if(a!=null)return a.map(o=>[o[0],o[1]])}}}),Hue=ke([hr,rV,sV,iV,aV,Bue,fee,jue,oV,Pee],(t,e,n,r,i,s,a,o,l,c)=>{var d=a.chartData,f=a.dataStartIndex,p=a.dataEndIndex;if(!(l==null||t!=="horizontal"&&t!=="vertical"||e==null||n==null||r==null||i==null||r.length===0||i.length===0||o==null)){var y=l.data,x;if(y&&y.length>0?x=y:x=d==null?void 0:d.slice(f,p+1),x!=null)return pde({layout:t,xAxis:e,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:l,stackedData:s,displayedData:x,chartBaseValue:c,bandSize:o})}}),Vue=["animationElapsedTime","isAnimating","isEntrance","layout","isRange","stroke","connectNulls"],Gue=["id","baseLine"];function ty(){return ty=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ty.apply(null,arguments)}function b3(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<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Wue(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function $ue(t){var e,n,r=t.alpha,i=t.baseLine,s=t.points,a=t.strokeWidth,o=(e=s[0])===null||e===void 0?void 0:e.x,l=(n=s[s.length-1])===null||n===void 0?void 0:n.x;if(!wn(o)||!wn(l))return null;var c=r*Math.abs(o-l),d=Math.max(...s.map(f=>f.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)?P.createElement("rect",{x:o<l?o:o-c,y:0,width:c,height:Math.floor(d+(a?parseInt("".concat(a),10):1))}):null}function Xue(t){var e,n,r=t.alpha,i=t.baseLine,s=t.points,a=t.strokeWidth,o=(e=s[0])===null||e===void 0?void 0:e.y,l=(n=s[s.length-1])===null||n===void 0?void 0:n.y;if(!wn(o)||!wn(l))return null;var c=r*Math.abs(o-l),d=Math.max(...s.map(f=>f.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)?P.createElement("rect",{x:0,y:o<l?o:o-c,width:d+(a?parseInt("".concat(a),10):1),height:Math.floor(c)}):null}function que(t){var e=t.alpha,n=t.layout,r=t.points,i=t.baseLine,s=t.strokeWidth;return n==="vertical"?P.createElement(Xue,{alpha:e,points:r,baseLine:i,strokeWidth:s}):P.createElement($ue,{alpha:e,points:r,baseLine:i,strokeWidth:s})}function Kue(t){var e=t.animationElapsedTime,n=e===void 0?1:e,r=t.isAnimating,i=r===void 0?!1:r,s=t.isEntrance,a=s===void 0?!1:s,o=t.layout,l=t.isRange,c=t.stroke,d=t.connectNulls,f=b3(t,Vue),p=o==="vertical"?"vertical":"horizontal",y=d??!1,x=GH(),S=f.id,w=f.baseLine,b=b3(f,Gue),M=Bo(b),T=P.createElement(K_,ty({},f,{id:S,baseLine:w,connectNulls:y,stroke:"none",className:"recharts-area-area",layout:p})),C=c!=="none"&&P.createElement(K_,ty({},M,{className:"recharts-area-curve",layout:p,type:f.type,connectNulls:y,fill:"none",stroke:c,points:f.points})),L=c!=="none"&&l&&Array.isArray(w)&&P.createElement(K_,ty({},M,{className:"recharts-area-curve",layout:p,type:f.type,connectNulls:y,fill:"none",stroke:c,points:w}));if(a&&(i||n<1)){var N;return P.createElement(Ya,null,P.createElement("defs",null,P.createElement("clipPath",{id:x},P.createElement(que,{alpha:n,points:(N=f.points)!==null&&N!==void 0?N:[],baseLine:w,layout:p,strokeWidth:f.strokeWidth}))),P.createElement(Ya,{clipPath:"url(#".concat(x,")")},T,C,L))}return P.createElement(P.Fragment,null,T,C,L)}var Yue=["id"],Zue=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function rw(){return rw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},rw.apply(null,arguments)}function cV(t,e){if(t==null)return{};var n,r,i=Que(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Que(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function _3(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 jg(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?_3(Object(n),!0).forEach(function(r){Jue(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):_3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Jue(t,e,n){return(e=ede(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ede(t){var e=tde(t,"string");return typeof e=="symbol"?e:e+""}function tde(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 nde=(t,e)=>t==null?[]:e===1?t.flatMap(n=>n.status==="removed"?[]:[n.next]):t.flatMap(n=>n.status==="matched"?[jg(jg({},n.next),{},{x:zc(n.prev.x,n.next.x,e),y:zc(n.prev.y,n.next.y,e)})]:n.status==="added"?[n.next]:[]),uV={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",animationMatchBy:sR,animationInterpolateFn:nde,connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,shape:Kue,xAxisId:0,yAxisId:0,zIndex:Es.area};function iw(t,e){return t&&t!=="none"?t:e}var rde=t=>{var e=t.dataKey,n=t.name,r=t.stroke,i=t.fill,s=t.legendType,a=t.hide;return[{inactive:a,dataKey:e,type:s,color:iw(r,i),value:O4(n,e),payload:t}]},ide=P.memo(t=>{var e=t.dataKey,n=t.data,r=t.stroke,i=t.strokeWidth,s=t.fill,a=t.name,o=t.hide,l=t.unit,c=t.tooltipType,d=t.id,f={dataDefinedOnItem:n,getPosition:Kg,settings:{stroke:r,strokeWidth:i,fill:s,dataKey:e,nameKey:void 0,name:O4(a,e),hide:o,type:c,color:iw(r,s),unit:l,graphicalItemId:d}};return P.createElement(gle,{tooltipEntrySettings:f})});function sde(t){var e=t.clipPathId,n=t.points,r=t.props,i=r.needClip,s=r.dot,a=r.dataKey,o=Bo(r);return P.createElement(sce,{points:n,dot:s,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:a,baseProps:o,needClip:i,clipPathId:e})}function ade(t){var e=t.showLabels,n=t.children,r=t.points,i=r.map(s=>{var a,o,l={x:(a=s.x)!==null&&a!==void 0?a:0,y:(o=s.y)!==null&&o!==void 0?o:0,width:0,lowerWidth:0,upperWidth:0,height:0};return jg(jg({},l),{},{value:s.value,payload:s.payload,parentViewBox:void 0,viewBox:l,fill:void 0})});return P.createElement(tle,{value:e?i:void 0},n)}function ode(t){var e=t.points,n=t.baseLine,r=t.needClip,i=t.clipPathId,s=t.props,a=t.animationElapsedTime,o=t.isAnimating,l=t.isEntrance,c=s.layout,d=s.type,f=s.stroke,p=s.connectNulls,y=s.isRange,x=s.shape,S=s.id,w=cV(s,Yue),b=Ka(w),M=jg(jg({},b),{},{id:S,points:e,connectNulls:p,type:d,baseLine:n,layout:c,stroke:f,isRange:y,animationElapsedTime:a,isAnimating:o,isEntrance:l});return P.createElement(P.Fragment,null,(e==null?void 0:e.length)>1&&P.createElement(Ya,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},P.createElement(mle,{option:x,DefaultShape:uV.shape,shapeProps:M})),P.createElement(sde,{points:e,props:w,clipPathId:i}))}function lde(t,e,n){if(It(t)){var r=It(e)?e:void 0;return zc(r,t,n)}if(Vi(t)||Il(t)){var i=It(e)?e:void 0;return zc(i,0,n)}return t}function cde(t){var e=t.needClip,n=t.clipPathId,r=t.props,i=t.previousPointsRef,s=t.previousBaselineRef,a=r.points,o=r.baseLine,l=r.isAnimationActive,c=r.animationBegin,d=r.animationDuration,f=r.animationEasing,p=r.animationMatchBy,y=r.animationInterpolateFn,x=P.useMemo(()=>({points:a,baseLine:o}),[a,o]),S=VH(x,s),w=QP(),b=Ile(r.onAnimationStart,r.onAnimationEnd),M=b.isAnimating,T=b.handleAnimationStart,C=b.handleAnimationEnd,L=S.startValue;if(w==null)return null;var N;return Array.isArray(o)&&Array.isArray(L)?N=FC(L,o,p):Array.isArray(o)?N=FC(null,o,p):N=null,P.createElement(Lle,{animationInput:x,animationIdPrefix:"recharts-area-",items:a,previousItemsRef:i,isAnimationActive:l,animationBegin:c,animationDuration:d,animationEasing:f,onAnimationStart:T,onAnimationEnd:C,animationInterpolateFn:y,animationMatchBy:p,layout:w},(D,F,V)=>{var I;return F===1?I=o:Array.isArray(o)?I=y(N,F,w):I=V?o:lde(o,L,F),S.syncStepValue(I,F),P.createElement(ade,{showLabels:!M,points:a},r.children,P.createElement(ode,{points:D,baseLine:I,needClip:e,clipPathId:n,props:r,animationElapsedTime:F,isAnimating:M||F<1,isEntrance:V}),P.createElement(ile,{label:r.label}))})}function ude(t){var e=t.needClip,n=t.clipPathId,r=t.props,i=P.useRef(null),s=P.useRef();return P.createElement(cde,{needClip:e,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:s})}class dde extends P.PureComponent{render(){var e=this.props,n=e.hide,r=e.dot,i=e.points,s=e.className,a=e.top,o=e.left,l=e.needClip,c=e.xAxisId,d=e.yAxisId,f=e.width,p=e.height,y=e.id,x=e.baseLine,S=e.zIndex;if(n)return null;var w=tr("recharts-area",s),b=y,M=Due(r),T=M.r,C=M.strokeWidth,L=BH(r),N=T*2+C,D=l?"url(#clipPath-".concat(L?"":"dots-").concat(b,")"):void 0;return P.createElement(cu,{zIndex:S},P.createElement(Ya,{className:w},l&&P.createElement("defs",null,P.createElement(Oue,{clipPathId:b,xAxisId:c,yAxisId:d}),!L&&P.createElement("clipPath",{id:"clipPath-dots-".concat(b)},P.createElement("rect",{x:o-N/2,y:a-N/2,width:f+N,height:p+N}))),P.createElement(ude,{needClip:l,clipPathId:b,props:this.props})),P.createElement(f3,{points:i,mainColor:iw(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:D}),this.props.isRange&&Array.isArray(x)&&P.createElement(f3,{points:x,mainColor:iw(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:D}))}}function fde(t){var e,n=t.activeDot,r=t.animationBegin,i=t.animationDuration,s=t.animationEasing,a=t.connectNulls,o=t.dot,l=t.fill,c=t.fillOpacity,d=t.hide,f=t.isAnimationActive,p=t.legendType,y=t.stroke,x=t.xAxisId,S=t.yAxisId,w=cV(t,Zue),b=Yg(),M=yH(),T=nV(x,S),C=T.needClip,L=ta(),N=(e=Ft(pe=>Hue(pe,t.id,L)))!==null&&e!==void 0?e:{},D=N.points,F=N.isRange,V=N.baseLine,I=oR();if(b!=="horizontal"&&b!=="vertical"||I==null||M!=="AreaChart"&&M!=="ComposedChart")return null;var U=I.height,X=I.width,te=I.x,re=I.y;return!D||!D.length?null:P.createElement(dde,rw({},w,{activeDot:n,animationBegin:r,animationDuration:i,animationEasing:s,baseLine:V,connectNulls:a,dot:o,fill:l,fillOpacity:c,height:U,hide:d,layout:b,isAnimationActive:f,isRange:F,legendType:p,needClip:C,points:D,stroke:y,width:X,left:te,top:re,xAxisId:x,yAxisId:S}))}var hde=(t,e,n,r,i)=>{var s=n??e;if(It(s))return s;var a=t==="horizontal"?i:r,o=a.scale.domain();if(a.type==="number"){var l=Math.max(o[0],o[1]),c=Math.min(o[0],o[1]);return s==="dataMin"?c:s==="dataMax"||l<0?l:Math.max(Math.min(o[0],o[1]),0)}return s==="dataMin"?o[0]:s==="dataMax"?o[1]:o[0]};function pde(t){var e=t.areaSettings,n=e.connectNulls,r=e.baseValue,i=e.dataKey,s=t.stackedData,a=t.layout,o=t.chartBaseValue,l=t.xAxis,c=t.yAxis,d=t.displayedData,f=t.dataStartIndex,p=t.xAxisTicks,y=t.yAxisTicks,x=t.bandSize,S=s&&s.length,w=hde(a,o,r,l,c),b=a==="horizontal",M=!1,T=d.map((L,N)=>{var D,F,V,I;if(S)I=s[f+N];else{var U=yi(L,i);Array.isArray(U)?(I=U,M=!0):I=[w,U]}var X=(D=(F=I)===null||F===void 0?void 0:F[1])!==null&&D!==void 0?D:null,te=X==null||S&&!n&&yi(L,i)==null;if(b){var re;return{x:gI({axis:l,ticks:p,bandSize:x,entry:L,index:N}),y:te?null:(re=c.scale.map(X))!==null&&re!==void 0?re:null,value:I,payload:L}}return{x:te?null:(V=l.scale.map(X))!==null&&V!==void 0?V:null,y:gI({axis:c,ticks:y,bandSize:x,entry:L,index:N}),value:I,payload:L}}),C;return S||M?C=T.map(L=>{var N,D=Array.isArray(L.value)?L.value[0]:null;if(b){var F;return{x:L.x,y:D!=null&&L.y!=null&&(F=c.scale.map(D))!==null&&F!==void 0?F:null,payload:L.payload}}return{x:D!=null&&(N=l.scale.map(D))!==null&&N!==void 0?N:null,y:L.y,payload:L.payload}}):C=b?c.scale.map(w):l.scale.map(w),{points:T,baseLine:C??0,isRange:M}}function mde(t){var e=Ja(t,uV),n=ta();return P.createElement(Vle,{id:e.id,type:"area"},r=>P.createElement(P.Fragment,null,P.createElement(vle,{legendPayload:rde(e)}),P.createElement(ide,{dataKey:e.dataKey,data:e.data,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,unit:e.unit,tooltipType:e.tooltipType,id:r}),P.createElement(Yle,{type:"area",id:r,data:e.data,dataKey:e.dataKey,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,stackId:QY(e.stackId),hide:e.hide,barSize:void 0,baseValue:e.baseValue,isPanorama:n,connectNulls:e.connectNulls}),P.createElement(fde,rw({},e,{id:r}))))}var dV=P.memo(mde,CS);dV.displayName="Area";var gde=["domain","range"],vde=["domain","range"];function w3(t,e){if(t==null)return{};var n,r,i=yde(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function yde(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function S3(t,e){return t===e?!0:Array.isArray(t)&&t.length===2&&Array.isArray(e)&&e.length===2?t[0]===e[0]&&t[1]===e[1]:!1}function fV(t,e){if(t===e)return!0;var n=t.domain,r=t.range,i=w3(t,gde),s=e.domain,a=e.range,o=w3(e,vde);return!S3(n,s)||!S3(r,a)?!1:CS(i,o)}var xde=["type"],bde=["dangerouslySetInnerHTML","ticks","scale"],_de=["id","scale"];function zC(){return zC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},zC.apply(null,arguments)}function M3(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 E3(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?M3(Object(n),!0).forEach(function(r){wde(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):M3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function wde(t,e,n){return(e=Sde(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Sde(t){var e=Mde(t,"string");return typeof e=="symbol"?e:e+""}function Mde(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)}function BC(t,e){if(t==null)return{};var n,r,i=Ede(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Ede(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function Ade(t){var e=Wr(),n=P.useRef(null),r=QP(),i=t.type,s=BC(t,xde),a=kS(r,"xAxis",i),o=P.useMemo(()=>{if(a!=null)return E3(E3({},s),{},{type:a})},[s,a]);return P.useLayoutEffect(()=>{o!=null&&(n.current===null?e(uce(o)):n.current!==o&&e(dce({prev:n.current,next:o})),n.current=o)},[o,e]),P.useLayoutEffect(()=>()=>{n.current&&(e(fce(n.current)),n.current=null)},[e]),null}var Tde=t=>{var e=t.xAxisId,n=t.className,r=Ft(j4),i=ta(),s="xAxis",a=Ft(p=>XB(p,s,e,i)),o=Ft(p=>oie(p,e)),l=Ft(p=>hie(p,e)),c=Ft(p=>uB(p,e));if(o==null||l==null||c==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var d=BC(t,bde);c.id,c.scale;var f=BC(c,_de);return P.createElement(cR,zC({},d,f,{x:l.x,y:l.y,width:o.width,height:o.height,className:tr("recharts-".concat(s," ").concat(s),n),viewBox:r,ticks:a,axisType:s,axisId:e}))},Cde={allowDataOverflow:ti.allowDataOverflow,allowDecimals:ti.allowDecimals,allowDuplicatedCategory:ti.allowDuplicatedCategory,angle:ti.angle,axisLine:$c.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:$c.tickLine,tickSize:$c.tickSize,type:ti.type,niceTicks:ti.niceTicks,xAxisId:0},Pde=t=>{var e=Ja(t,Cde);return P.createElement(P.Fragment,null,P.createElement(Ade,{allowDataOverflow:e.allowDataOverflow,allowDecimals:e.allowDecimals,allowDuplicatedCategory:e.allowDuplicatedCategory,angle:e.angle,dataKey:e.dataKey,domain:e.domain,height:e.height,hide:e.hide,id:e.xAxisId,includeHidden:e.includeHidden,interval:e.interval,minTickGap:e.minTickGap,mirror:e.mirror,name:e.name,orientation:e.orientation,padding:e.padding,reversed:e.reversed,scale:e.scale,tick:e.tick,tickCount:e.tickCount,tickFormatter:e.tickFormatter,ticks:e.ticks,type:e.type,unit:e.unit,niceTicks:e.niceTicks}),P.createElement(Tde,e))},hV=P.memo(Pde,fV);hV.displayName="XAxis";var Rde=["type"],Nde=["dangerouslySetInnerHTML","ticks","scale"],kde=["id","scale"];function HC(){return HC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},HC.apply(null,arguments)}function A3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function T3(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?A3(Object(n),!0).forEach(function(r){Ide(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):A3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ide(t,e,n){return(e=Lde(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Lde(t){var e=Ode(t,"string");return typeof e=="symbol"?e:e+""}function Ode(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)}function VC(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<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Dde(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function jde(t){var e=Wr(),n=P.useRef(null),r=QP(),i=t.type,s=VC(t,Rde),a=kS(r,"yAxis",i),o=P.useMemo(()=>{if(a!=null)return T3(T3({},s),{},{type:a})},[a,s]);return P.useLayoutEffect(()=>{o!=null&&(n.current===null?e(hce(o)):n.current!==o&&e(pce({prev:n.current,next:o})),n.current=o)},[o,e]),P.useLayoutEffect(()=>()=>{n.current&&(e(mce(n.current)),n.current=null)},[e]),null}function Ude(t){var e=t.yAxisId,n=t.className,r=t.width,i=t.label,s=P.useRef(null),a=P.useRef(null),o=Ft(j4),l=ta(),c=Wr(),d="yAxis",f=Ft(b=>gie(b,e)),p=Ft(b=>mie(b,e)),y=Ft(b=>XB(b,d,e,l)),x=Ft(b=>dB(b,e));if(P.useLayoutEffect(()=>{if(!(r!=="auto"||!f||iR(i)||P.isValidElement(i)||x==null)){var b=s.current;if(b){var M=b.getCalculatedWidth();Math.round(f.width)!==Math.round(M)&&c(gce({id:e,width:M}))}}},[y,f,c,i,e,r,x]),f==null||p==null||x==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var S=VC(t,Nde);x.id,x.scale;var w=VC(x,kde);return P.createElement(cR,HC({},S,w,{ref:s,labelRef:a,x:p.x,y:p.y,tickTextProps:r==="auto"?{width:void 0}:{width:r},width:f.width,height:f.height,className:tr("recharts-".concat(d," ").concat(d),n),viewBox:o,ticks:y,axisType:d,axisId:e}))}var Fde={allowDataOverflow:ni.allowDataOverflow,allowDecimals:ni.allowDecimals,allowDuplicatedCategory:ni.allowDuplicatedCategory,angle:ni.angle,axisLine:$c.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:$c.tickLine,tickSize:$c.tickSize,type:ni.type,niceTicks:ni.niceTicks,width:ni.width,yAxisId:0},zde=t=>{var e=Ja(t,Fde);return P.createElement(P.Fragment,null,P.createElement(jde,{interval:e.interval,id:e.yAxisId,scale:e.scale,type:e.type,domain:e.domain,allowDataOverflow:e.allowDataOverflow,dataKey:e.dataKey,allowDuplicatedCategory:e.allowDuplicatedCategory,allowDecimals:e.allowDecimals,tickCount:e.tickCount,padding:e.padding,includeHidden:e.includeHidden,reversed:e.reversed,ticks:e.ticks,width:e.width,orientation:e.orientation,mirror:e.mirror,hide:e.hide,unit:e.unit,name:e.name,angle:e.angle,minTickGap:e.minTickGap,tick:e.tick,tickFormatter:e.tickFormatter,niceTicks:e.niceTicks}),P.createElement(Ude,e))},pV=P.memo(zde,fV);pV.displayName="YAxis";var Bde=(t,e)=>e,hR=ke([Bde,hr,Ez,wi,fH,lu,Use,Wi],Wse);function Hde(t){return"getBBox"in t.currentTarget&&typeof t.currentTarget.getBBox=="function"}function pR(t){var e=t.currentTarget.getBoundingClientRect(),n,r;if(Hde(t)){var i=t.currentTarget.getBBox();n=i.width>0?e.width/i.width:1,r=i.height>0?e.height/i.height:1}else{var s=t.currentTarget;n=s.offsetWidth>0?e.width/s.offsetWidth:1,r=s.offsetHeight>0?e.height/s.offsetHeight:1}var a=(o,l)=>({relativeX:Math.round((o-e.left)/n),relativeY:Math.round((l-e.top)/r)});return"touches"in t?Array.from(t.touches).map(o=>a(o.clientX,o.clientY)):a(t.clientX,t.clientY)}var mV=Aa("mouseClick"),gV=Jy();gV.startListening({actionCreator:mV,effect:(t,e)=>{var n=t.payload,r=hR(e.getState(),pR(n));(r==null?void 0:r.activeIndex)!=null&&e.dispatch(Nie({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var GC=Aa("mouseMove"),vV=Jy(),xm=null,Rf=null,QE=null;vV.startListening({actionCreator:GC,effect:(t,e)=>{var n=t.payload,r=e.getState(),i=r.eventSettings,s=i.throttleDelay,a=i.throttledEvents,o=a==="all"||(a==null?void 0:a.includes("mousemove"));xm!==null&&(cancelAnimationFrame(xm),xm=null),Rf!==null&&(typeof s!="number"||!o)&&(clearTimeout(Rf),Rf=null),QE=pR(n);var l=()=>{var c=e.getState(),d=fx(c,c.tooltip.settings.shared);if(!QE){xm=null,Rf=null;return}if(d==="axis"){var f=hR(c,QE);(f==null?void 0:f.activeIndex)!=null?e.dispatch(nH({activeIndex:f.activeIndex,activeDataKey:void 0,activeCoordinate:f.activeCoordinate})):e.dispatch(tH())}xm=null,Rf=null};if(!o){l();return}s==="raf"?xm=requestAnimationFrame(l):typeof s=="number"&&Rf===null&&(Rf=setTimeout(l,s))}});function Vde(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?"<<CHILDREN>>":e}var C3={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},yV=cs({name:"rootProps",initialState:C3,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:C3.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=yV.reducer,Wde=yV.actions.updateOptions,$de=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)},xV=cs({name:"polarOptions",initialState:$de,reducers:Xde});xV.actions.updatePolarOptions;var qde=xV.reducer,bV=Aa("keyDown"),_V=Aa("focus"),wV=Aa("blur"),qS=Jy(),bm=null,Nf=null,Bb=null;qS.startListening({actionCreator:bV,effect:(t,e)=>{Bb=t.payload,bm!==null&&(cancelAnimationFrame(bm),bm=null);var n=e.getState(),r=n.eventSettings,i=r.throttleDelay,s=r.throttledEvents,a=s==="all"||s.includes("keydown");Nf!==null&&(typeof i!="number"||!a)&&(clearTimeout(Nf),Nf=null);var o=()=>{try{var l=e.getState(),c=l.rootProps.accessibilityLayer!==!1;if(!c)return;var d=l.tooltip.keyboardInteraction,f=Bb;if(f!=="ArrowRight"&&f!=="ArrowLeft"&&f!=="Enter")return;var p=J0(d,Gh(l),Og(l),Dg(l)),y=p==null?-1:Number(p),x=!Number.isFinite(y)||y<0,S=lu(l),w=Gh(l),b=fx(l,l.tooltip.settings.shared);if(f==="Enter"){if(x)return;var M=Q1(l,b,"hover",String(d.index));e.dispatch(Z1({active:!d.active,activeIndex:d.index,activeCoordinate:M}));return}var T=_ie(l),C=T==="left-to-right"?1:-1,L=f==="ArrowRight"?1:-1,N;if(x){var D=Og(l),F=Dg(l),V=L*C,I=pe=>({active:!1,index:String(pe),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(N=-1,V>0){for(var U=0;U<w.length;U++)if(J0(I(U),w,D,F)!=null){N=U;break}}else for(var X=w.length-1;X>=0;X--)if(J0(I(X),w,D,F)!=null){N=X;break}if(N<0)return}else{N=y+L*C;var te=(S==null?void 0:S.length)||w.length;if(te===0||N>=te||N<0)return}var re=Q1(l,b,"hover",String(N));e.dispatch(Z1({active:!0,activeIndex:N.toString(),activeCoordinate:re}))}finally{bm=null,Nf=null}};if(!a){o();return}i==="raf"?bm=requestAnimationFrame(o):typeof i=="number"&&Nf===null&&(o(),Bb=null,Nf=setTimeout(()=>{Bb?o():(Nf=null,bm=null)},i))}});qS.startListening({actionCreator:_V,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var i=n.tooltip.keyboardInteraction;if(!i.active&&i.index==null){var s="0",a=fx(n,n.tooltip.settings.shared),o=Q1(n,a,"hover",String(s));e.dispatch(Z1({active:!0,activeIndex:s,activeCoordinate:o}))}}}});qS.startListening({actionCreator:wV,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var i=n.tooltip.keyboardInteraction;i.active&&e.dispatch(Z1({active:!1,activeIndex:i.index,activeCoordinate:i.coordinate}))}}});function SV(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 Ha=Aa("externalEvent"),MV=Jy(),Hb=new Map,x0=new Map,JE=new Map;MV.startListening({actionCreator:Ha,effect:(t,e)=>{var n=t.payload,r=n.handler,i=n.reactEvent;if(r!=null){var s=i.type,a=SV(i);JE.set(s,{handler:r,reactEvent:a});var o=Hb.get(s);o!==void 0&&(cancelAnimationFrame(o),Hb.delete(s));var l=e.getState(),c=l.eventSettings,d=c.throttleDelay,f=c.throttledEvents,p=f,y=p==="all"||(p==null?void 0:p.includes(s)),x=x0.get(s);x!==void 0&&(typeof d!="number"||!y)&&(clearTimeout(x),x0.delete(s));var S=()=>{var M=JE.get(s);try{if(!M)return;var T=M.handler,C=M.reactEvent,L=e.getState(),N={activeCoordinate:Sse(L),activeDataKey:bse(L),activeIndex:Py(L),activeLabel:mH(L),activeTooltipIndex:Py(L),isTooltipActive:Mse(L)};T&&T(N,C)}finally{Hb.delete(s),x0.delete(s),JE.delete(s)}};if(!y){S();return}if(d==="raf"){var w=requestAnimationFrame(S);Hb.set(s,w)}else if(typeof d=="number"){if(!x0.has(s)){S();var b=setTimeout(S,d);x0.set(s,b)}}else S()}}});var Kde=ke([iv],t=>t.tooltipItemPayloads),Yde=ke([Kde,(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)}}}),EV=Aa("touchMove"),AV=Jy(),kf=null,qu=null,P3=null,b0=null;AV.startListening({actionCreator:EV,effect:(t,e)=>{var n=t.payload;if(!(n.touches==null||n.touches.length===0)){b0=SV(n);var r=e.getState(),i=r.eventSettings,s=i.throttleDelay,a=i.throttledEvents,o=a==="all"||a.includes("touchmove");kf!==null&&(cancelAnimationFrame(kf),kf=null),qu!==null&&(typeof s!="number"||!o)&&(clearTimeout(qu),qu=null),P3=Array.from(n.touches).map(c=>pR({clientX:c.clientX,clientY:c.clientY,currentTarget:n.currentTarget}));var l=()=>{if(b0!=null){var c=e.getState(),d=fx(c,c.tooltip.settings.shared);if(d==="axis"){var f,p=(f=P3)===null||f===void 0?void 0:f[0];if(p==null){kf=null,qu=null;return}var y=hR(c,p);(y==null?void 0:y.activeIndex)!=null&&e.dispatch(nH({activeIndex:y.activeIndex,activeDataKey:void 0,activeCoordinate:y.activeCoordinate}))}else if(d==="item"){var x,S=b0.touches[0];if(document.elementFromPoint==null||S==null)return;var w=document.elementFromPoint(S.clientX,S.clientY);if(!w||!w.getAttribute)return;var b=w.getAttribute(sZ),M=(x=w.getAttribute(aZ))!==null&&x!==void 0?x:void 0,T=op(c).find(N=>N.id===M);if(b==null||T==null||M==null)return;var C=T.dataKey,L=Yde(c,b,M);e.dispatch(Rie({activeDataKey:C,activeIndex:b,activeCoordinate:L,activeGraphicalItemId:M}))}kf=null,qu=null}};if(!o){l();return}s==="raf"?kf=requestAnimationFrame(l):typeof s=="number"&&qu===null&&(l(),b0=null,qu=setTimeout(()=>{b0?l():(qu=null,kf=null)},s))}}});var TV={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},CV=cs({name:"eventSettings",initialState:TV,reducers:{setEventSettings:(t,e)=>{e.payload.throttleDelay!=null&&(t.throttleDelay=e.payload.throttleDelay),e.payload.throttledEvents!=null&&(t.throttledEvents=e.payload.throttledEvents)}}}),Zde=CV.actions.setEventSettings,Qde=CV.reducer,Jde=i4({brush:Ace,cartesianAxis:vce,chartData:wae,errorBars:Lue,eventSettings:Qde,graphicalItems:qle,layout:VY,legend:rQ,options:vae,polarAxis:ale,polarOptions:qde,referenceElements:Rce,renderedTicks:Qce,rootProps:Gde,tooltip:kie,zIndex:iae}),efe=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return pY({reducer:Jde,preloadedState:e,middleware:r=>{var i;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([gV.middleware,vV.middleware,qS.middleware,MV.middleware,AV.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(x4({type:"raf"}))},devTools:{serialize:{replacer:Vde},name:"recharts-".concat(n)}})};function tfe(t){var e=t.preloadedState,n=t.children,r=t.reduxStoreName,i=ta(),s=P.useRef(null);if(i)return n;s.current==null&&(s.current=efe(e,r));var a=VP;return P.createElement(xQ,{context:a,store:s.current},n)}function nfe(t){var e=t.layout,n=t.margin,r=Wr(),i=ta();return P.useEffect(()=>{i||(r(zY(e)),r(FY(n)))},[r,i,e,n]),null}var rfe=P.memo(nfe,CS);function ife(t){var e=Wr();return P.useEffect(()=>{e(Wde(t))},[e,t]),null}var sfe=t=>{var e=Wr();return P.useEffect(()=>{e(Zde(t))},[e,t]),null},afe=P.memo(sfe,CS);function R3(t){var e=t.zIndex,n=t.isPanorama,r=P.useRef(null),i=Wr();return P.useLayoutEffect(()=>(r.current&&i(nae({zIndex:e,element:r.current,isPanorama:n})),()=>{i(rae({zIndex:e,isPanorama:n}))}),[i,e,n]),P.createElement("g",{tabIndex:-1,ref:r,className:"recharts-zIndex-layer_".concat(e)})}function N3(t){var e=t.children,n=t.isPanorama,r=Ft(Xse);if(!r||r.length===0)return e;var i=r.filter(a=>a<0),s=r.filter(a=>a>0);return P.createElement(P.Fragment,null,i.map(a=>P.createElement(R3,{key:a,zIndex:a,isPanorama:n})),e,s.map(a=>P.createElement(R3,{key:a,zIndex:a,isPanorama:n})))}var ofe=["children"];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<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function cfe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function sw(){return sw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},sw.apply(null,arguments)}var ufe={width:"100%",height:"100%",display:"block"},dfe=P.forwardRef((t,e)=>{var n=H4(),r=V4(),i=J4();if(!Ol(n)||!Ol(r))return null;var s=t.children,a=t.otherAttributes,o=t.title,l=t.desc,c,d;return a!=null&&(typeof a.tabIndex=="number"?c=a.tabIndex:c=i?0:void 0,typeof a.role=="string"?d=a.role:d=i?"application":void 0),P.createElement(wF,sw({},a,{title:o,desc:l,role:d,tabIndex:c,width:n,height:r,style:ufe,ref:e}),s)}),ffe=t=>{var e=t.children,n=Ft(SS);if(!n)return null;var r=n.width,i=n.height,s=n.y,a=n.x;return P.createElement(wF,{width:r,height:i,x:a,y:s},e)},k3=P.forwardRef((t,e)=>{var n=t.children,r=lfe(t,ofe),i=ta();return i?P.createElement(ffe,null,P.createElement(N3,{isPanorama:!0},n)):P.createElement(dfe,sw({ref:e},r),P.createElement(N3,{isPanorama:!1},n))});function hfe(t,e){return vfe(t)||gfe(t,e)||mfe(t,e)||pfe()}function pfe(){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 mfe(t,e){if(t){if(typeof t=="string")return I3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?I3(t,e):void 0}}function I3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function gfe(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function vfe(t){if(Array.isArray(t))return t}function yfe(){var t=Wr(),e=P.useState(null),n=hfe(e,2),r=n[0],i=n[1],s=Ft(iZ);return P.useEffect(()=>{if(r!=null){var a=r.getBoundingClientRect(),o=a.width/r.offsetWidth;wn(o)&&o!==s&&t(HY(o))}},[r,t,s]),i}function L3(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 xfe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?L3(Object(n),!0).forEach(function(r){bfe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):L3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function bfe(t,e,n){return(e=_fe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _fe(t){var e=wfe(t,"string");return typeof e=="symbol"?e:e+""}function wfe(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)}function Td(){return Td=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Td.apply(null,arguments)}function aw(t,e){return Afe(t)||Efe(t,e)||Mfe(t,e)||Sfe()}function Sfe(){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 Mfe(t,e){if(t){if(typeof t=="string")return O3(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)?O3(t,e):void 0}}function O3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Efe(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function Afe(t){if(Array.isArray(t))return t}var Tfe=()=>(Nae(),null);function ow(t){if(typeof t=="number")return t;if(typeof t=="string"){var e=parseFloat(t);if(!Number.isNaN(e))return e}return 0}var Cfe=P.forwardRef((t,e)=>{var n,r,i=P.useRef(null),s=P.useState({containerWidth:ow((n=t.style)===null||n===void 0?void 0:n.width),containerHeight:ow((r=t.style)===null||r===void 0?void 0:r.height)}),a=aw(s,2),o=a[0],l=a[1],c=P.useCallback((f,p)=>{l(y=>{var x=Math.round(f),S=Math.round(p);return y.containerWidth===x&&y.containerHeight===S?y:{containerWidth:x,containerHeight:S}})},[]),d=P.useCallback(f=>{if(typeof e=="function"&&e(f),i.current!=null&&(i.current.disconnect(),i.current=null),f!=null&&typeof ResizeObserver<"u"){var p=f.getBoundingClientRect(),y=p.width,x=p.height;c(y,x);var S=b=>{var M=b[0];if(M!=null){var T=M.contentRect,C=T.width,L=T.height;c(C,L)}},w=new ResizeObserver(S);w.observe(f),i.current=w}},[e,c]);return P.useEffect(()=>()=>{var f=i.current;f!=null&&f.disconnect()},[c]),P.createElement(P.Fragment,null,P.createElement(tx,{width:o.containerWidth,height:o.containerHeight}),P.createElement("div",Td({ref:d},t)))}),Pfe=P.forwardRef((t,e)=>{var n=t.width,r=t.height,i=P.useState({containerWidth:ow(n),containerHeight:ow(r)}),s=aw(i,2),a=s[0],o=s[1],l=P.useCallback((d,f)=>{o(p=>{var y=Math.round(d),x=Math.round(f);return p.containerWidth===y&&p.containerHeight===x?p:{containerWidth:y,containerHeight:x}})},[]),c=P.useCallback(d=>{if(typeof e=="function"&&e(d),d!=null){var f=d.getBoundingClientRect(),p=f.width,y=f.height;l(p,y)}},[e,l]);return P.createElement(P.Fragment,null,P.createElement(tx,{width:a.containerWidth,height:a.containerHeight}),P.createElement("div",Td({ref:c},t)))}),Rfe=P.forwardRef((t,e)=>{var n=t.width,r=t.height;return P.createElement(P.Fragment,null,P.createElement(tx,{width:n,height:r}),P.createElement("div",Td({ref:e},t)))}),Nfe=P.forwardRef((t,e)=>{var n=t.width,r=t.height;return typeof n=="string"||typeof r=="string"?P.createElement(Pfe,Td({},t,{ref:e})):typeof n=="number"&&typeof r=="number"?P.createElement(Rfe,Td({},t,{width:n,height:r,ref:e})):P.createElement(P.Fragment,null,P.createElement(tx,{width:n,height:r}),P.createElement("div",Td({ref:e},t)))});function kfe(t){return t?Cfe:Nfe}var Ife=P.forwardRef((t,e)=>{var n=t.children,r=t.className,i=t.height,s=t.onClick,a=t.onContextMenu,o=t.onDoubleClick,l=t.onMouseDown,c=t.onMouseEnter,d=t.onMouseLeave,f=t.onMouseMove,p=t.onMouseUp,y=t.onTouchEnd,x=t.onTouchMove,S=t.onTouchStart,w=t.style,b=t.width,M=t.responsive,T=t.dispatchTouchEvents,C=T===void 0?!0:T,L=P.useRef(null),N=Wr(),D=P.useState(null),F=aw(D,2),V=F[0],I=F[1],U=P.useState(null),X=aw(U,2),te=X[0],re=X[1],pe=yfe(),ee=YP(),ce=(ee==null?void 0:ee.width)>0?ee.width:b,B=(ee==null?void 0:ee.height)>0?ee.height:i,J=P.useCallback(Le=>{pe(Le),typeof e=="function"&&e(Le),I(Le),re(Le),Le!=null&&(L.current=Le)},[pe,e,I,re]),Z=P.useCallback(Le=>{N(mV(Le)),N(Ha({handler:s,reactEvent:Le}))},[N,s]),G=P.useCallback(Le=>{N(GC(Le)),N(Ha({handler:c,reactEvent:Le}))},[N,c]),W=P.useCallback(Le=>{N(tH()),N(Ha({handler:d,reactEvent:Le}))},[N,d]),oe=P.useCallback(Le=>{N(GC(Le)),N(Ha({handler:f,reactEvent:Le}))},[N,f]),se=P.useCallback(()=>{N(_V())},[N]),le=P.useCallback(()=>{N(wV())},[N]),Me=P.useCallback(Le=>{N(bV(Le.key))},[N]),Se=P.useCallback(Le=>{N(Ha({handler:a,reactEvent:Le}))},[N,a]),$e=P.useCallback(Le=>{N(Ha({handler:o,reactEvent:Le}))},[N,o]),Ee=P.useCallback(Le=>{N(Ha({handler:l,reactEvent:Le}))},[N,l]),Ge=P.useCallback(Le=>{N(Ha({handler:p,reactEvent:Le}))},[N,p]),Xe=P.useCallback(Le=>{N(Ha({handler:S,reactEvent:Le}))},[N,S]),fe=P.useCallback(Le=>{C&&N(EV(Le)),N(Ha({handler:x,reactEvent:Le}))},[N,C,x]),Q=P.useCallback(Le=>{N(Ha({handler:y,reactEvent:Le}))},[N,y]),Ve=kfe(M);return P.createElement(SH.Provider,{value:V},P.createElement(XX.Provider,{value:te},P.createElement(Ve,{width:ce??(w==null?void 0:w.width),height:B??(w==null?void 0:w.height),className:tr("recharts-wrapper",r),style:xfe({position:"relative",cursor:"default",width:ce,height:B},w),onClick:Z,onContextMenu:Se,onDoubleClick:$e,onFocus:se,onBlur:le,onKeyDown:Me,onMouseDown:Ee,onMouseEnter:G,onMouseLeave:W,onMouseMove:oe,onMouseUp:Ge,onTouchEnd:Q,onTouchMove:fe,onTouchStart:Xe,ref:J},P.createElement(Tfe,null),n)))}),Lfe=["width","height","responsive","children","className","style","compact","title","desc"];function Ofe(t,e){if(t==null)return{};var n,r,i=Dfe(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Dfe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var jfe=P.forwardRef((t,e)=>{var n=t.width,r=t.height,i=t.responsive,s=t.children,a=t.className,o=t.style,l=t.compact,c=t.title,d=t.desc,f=Ofe(t,Lfe),p=Bo(f);return l?P.createElement(P.Fragment,null,P.createElement(tx,{width:n,height:r}),P.createElement(k3,{otherAttributes:p,title:c,desc:d},s)):P.createElement(Ife,{className:a,style:o,width:n,height:r,responsive:i??!1,onClick:t.onClick,onMouseLeave:t.onMouseLeave,onMouseEnter:t.onMouseEnter,onMouseMove:t.onMouseMove,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onContextMenu:t.onContextMenu,onDoubleClick:t.onDoubleClick,onTouchStart:t.onTouchStart,onTouchMove:t.onTouchMove,onTouchEnd:t.onTouchEnd},P.createElement(k3,{otherAttributes:p,title:c,desc:d,ref:e},P.createElement(jce,null,s)))});function WC(){return WC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},WC.apply(null,arguments)}function D3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ufe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?D3(Object(n),!0).forEach(function(r){Ffe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):D3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ffe(t,e,n){return(e=zfe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function zfe(t){var e=Bfe(t,"string");return typeof e=="symbol"?e:e+""}function Bfe(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 Hfe={top:5,right:5,bottom:5,left:5},Vfe=Ufe({accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:Hfe,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},TV),Gfe=P.forwardRef(function(e,n){var r,i=Ja(e.categoricalChartProps,Vfe),s=e.chartName,a=e.defaultTooltipEventType,o=e.validateTooltipEventTypes,l=e.tooltipPayloadSearcher,c=e.categoricalChartProps,d={chartName:s,defaultTooltipEventType:a,validateTooltipEventTypes:o,tooltipPayloadSearcher:l,eventEmitter:void 0};return P.createElement(tfe,{preloadedState:{options:d},reduxStoreName:(r=c.id)!==null&&r!==void 0?r:s},P.createElement(Ece,{chartData:c.data}),P.createElement(rfe,{layout:i.layout,margin:i.margin}),P.createElement(afe,{throttleDelay:i.throttleDelay,throttledEvents:i.throttledEvents}),P.createElement(ife,{baseValue:i.baseValue,accessibilityLayer:i.accessibilityLayer,barCategoryGap:i.barCategoryGap,maxBarSize:i.maxBarSize,stackOffset:i.stackOffset,barGap:i.barGap,barSize:i.barSize,syncId:i.syncId,syncMethod:i.syncMethod,className:i.className,reverseStackOrder:i.reverseStackOrder}),P.createElement(jfe,WC({},i,{ref:n})))}),Wfe=["axis"],$fe=P.forwardRef((t,e)=>P.createElement(Gfe,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Wfe,tooltipPayloadSearcher:mae,categoricalChartProps:t,ref:e}));const Xfe="rgba(130,130,150,0.14)",j3="rgba(130,130,150,0.85)";function qfe(t){if(t<=0)return 10;const e=Math.pow(10,Math.floor(Math.log10(t))),n=t/e;return(n<=1?1:n<=2?2:n<=5?5:10)*e}function PV(t,e){return`${e==="%"?Math.round(t):t>=1e3?`${(t/1e3).toFixed(1)}k`:Math.round(t).toString()}${e}`}function Kfe({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:PV(r.value,n)})]},r.dataKey))})})}function RV({data:t,series:e,unit:n="%",yMode:r="percent",height:i=176}){const s=t.reduce((o,l)=>e.reduce((c,d)=>Math.max(c,Number(l[d.key])||0),o),0),a=r==="percent"?Math.min(100,Math.max(25,Math.ceil(s*1.2/25)*25)):Math.max(qfe(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($fe,{data:t,margin:{top:8,right:6,bottom:0,left:-12},children:[g.jsx("defs",{children:e.map(o=>g.jsxs("linearGradient",{id:`grad-${o.key}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[g.jsx("stop",{offset:"0%",stopColor:o.color,stopOpacity:.22}),g.jsx("stop",{offset:"100%",stopColor:o.color,stopOpacity:0})]},o.key))}),g.jsx(eV,{vertical:!1,stroke:Xfe}),g.jsx(hV,{dataKey:"t",hide:!0}),g.jsx(pV,{domain:[0,a],ticks:[0,a/2,a],tickFormatter:o=>PV(o,n),width:42,axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:j3}}),g.jsx(Gae,{content:g.jsx(Kfe,{unit:n}),cursor:{stroke:j3,strokeOpacity:.4,strokeDasharray:"3 3"}}),e.map(o=>g.jsx(dV,{type:"monotone",dataKey:o.key,name:o.label,stroke:o.color,strokeWidth:2,fill:`url(#grad-${o.key})`,dot:!1,activeDot:{r:3,strokeWidth:0},isAnimationActive:!1,connectNulls:!0},o.key))]})})})}const Yfe=[{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 Zfe(){var a,o,l,c;const{sys:t,hist:e}=OX(),n=!!(t!=null&&t.gpu&&t.gpu.busy_percent!=null&&t.gpu.gtt_used!=null&&t.gpu.gtt_total!=null),r=Yfe.filter(d=>d.key!=="gpu"||n),i={cpu:(a=t==null?void 0:t.cpu)==null?void 0:a.percent,ram:(o=t==null?void 0:t.ram)==null?void 0:o.percent,gpu:n?t.gpu.busy_percent:null,disk:(l=t==null?void 0:t.disk)==null?void 0:l.percent},s={cpu:(c=t==null?void 0:t.cpu)!=null&&c.cores?`${t.cpu.cores} Cores`:"",ram:t?`${cd(t.ram.used)}/${cd(t.ram.total)} GB`:"",gpu:n?`${cd(t.gpu.gtt_used)}/${cd(t.gpu.gtt_total)} GB`:"",disk:t!=null&&t.disk?`${cd(t.disk.used)}/${cd(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(Pd,{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(RV,{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 _0({label:t,value:e,tone:n}){return g.jsxs("div",{className:qe("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 Qfe(){var n;const{data:t}=OP(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(E9,{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(_0,{label:"OS-Pakete",tone:t.os>0?"alert":"muted",value:t.os>0?`${t.os} verfügbar`:"aktuell"}),g.jsx(_0,{label:"Inferenz-Engine (llama.cpp)",tone:t.engine>0?"alert":"muted",value:t.engine>0?"Update verfügbar":"aktuell"}),g.jsx(_0,{label:"Router (llama-swap)",tone:t.swap>0?"alert":"muted",value:t.swap>0?"Update verfügbar":"aktuell"}),g.jsx(_0,{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(_0,{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(y5,{className:"h-3.5 w-3.5"})]})]})}function NV({type:t,title:e,message:n,defaultValue:r,autoValue:i,autoLabel:s,onConfirm:a,onCancel:o}){const l=P.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 overscroll-contain",role:"dialog","aria-modal":"true","aria-label":e,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:o||(()=>a()),"aria-label":"Schließen",className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(kl,{className:"h-4 w-4","aria-hidden":"true"})})]}),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,"aria-label":e,className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground",autoFocus:!0,onKeyDown:c=>{var d;c.key==="Enter"&&a((d=l.current)==null?void 0:d.value)}}),i!==void 0&&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:o,className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Abbrechen"}),g.jsx("button",{onClick:()=>{var d;const c=t==="prompt"?(d=l.current)==null?void 0:d.value:void 0;a(c)},className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-lg transition-colors cursor-pointer",children:t==="confirm"?"Ja, fortfahren":t==="prompt"?"Übernehmen":"OK"})]})]})})}function Ud(){const[t,e]=P.useState(null),n=P.useCallback(()=>e(null),[]),r=P.useCallback((o,l,c)=>{e({type:"alert",title:o,message:l,onConfirm:()=>{e(null),c==null||c()}})},[]),i=P.useCallback((o,l,c,d)=>{e({type:"confirm",title:o,message:l,onConfirm:()=>{e(null),c()},onCancel:()=>{e(null),d==null||d()}})},[]),s=P.useCallback((o,l,c,d,f,p)=>{e({type:"prompt",title:o,message:l,defaultValue:c,autoValue:p==null?void 0:p.autoValue,autoLabel:p==null?void 0:p.autoLabel,onConfirm:y=>{e(null),d(y)},onCancel:()=>{e(null),f==null||f()}})},[]),a=t?g.jsx(NV,{...t}):null;return{showAlert:r,showConfirm:i,showPrompt:s,close:n,dialogElement:a}}function Jfe(){const t=Bl(),{data:e}=LP(3e3),{data:n}=Od(),{showAlert:r,dialogElement:i}=Ud(),[s,a]=P.useState(!1),o=(n==null?void 0:n.models)??[];async function l(c){try{await Pt("/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:kn.agentStatus}),a(!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(Nl,{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:Pg(e.terminal_url),target:"_blank",rel:"noopener",className:qe("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(Ag,{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:qe("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:qe("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:()=>a(!0),className:"p-3 bg-background/20 rounded-xl border border-border/40 hover:border-primary/45 hover:bg-background/30 transition-all duration-300 cursor-pointer",children:[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(Pd,{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(AP,{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(eS,{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:qe("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:qe("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(Pd,{className:"h-4 w-4"}),g.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),g.jsx("button",{onClick:()=>a(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(kl,{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",...o.map(c=>{var d;return((d=c.name.split("/").pop())==null?void 0:d.replace(".gguf",""))||c.name})].map(c=>{const d=["auto","fast","heavy"].includes(c);return g.jsxs("button",{onClick:()=>l(c),className:qe("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(Ps,{className:"h-4 w-4 shrink-0 text-primary"})]},c)})})]})}),i]})}function ehe(){const t=Bl(),{data:e=[]}=XT({limit:3}),[n,r]=P.useState(""),[i,s]=P.useState("stable"),[a,o]=P.useState(!1);async function l(){if(!(!n.trim()||a)){o(!0);try{await Pt("/api/memory",{method:"POST",body:JSON.stringify({content:n,category:i,source:"dashboard"})}),r(""),t.invalidateQueries({queryKey:["memory"]})}catch(c){console.error(c)}finally{o(!1)}}}return 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(tp,{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),"aria-label":"Fakt oder Regel im Gedächtnis speichern",placeholder:"Fakt / Regel im Pool speichern…",rows:2,className:"w-full resize-none rounded-xl border border-border/50 bg-background/30 p-2 text-[10px] outline-none focus:ring-1 focus:ring-primary transition-all leading-normal"}),g.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[g.jsxs("select",{value:i,onChange:c=>s(c.target.value),"aria-label":"Kategorie",className:"h-7 rounded-lg border border-border/50 bg-background/50 px-2 text-[10px] outline-none cursor-pointer",children:[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()||a,className:"flex h-7 items-center gap-1 rounded-lg bg-primary px-3 text-[10px] font-semibold text-primary-foreground hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[g.jsx(d1,{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 U3=[{key:"prompt",label:"Prompt",color:"#f59e0b"},{key:"completion",label:"Antwort",color:"#2dd4bf"}];function the(){const{data:t}=IP(3e3),e=IX(),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(EP,{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:U3.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(RV,{data:e,series:U3,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 nhe(){const{data:t}=mF(3e3),{showAlert:e,dialogElement:n}=Ud(),[r,i]=P.useState({});async function s(a){i(o=>({...o,[a]:!0}));try{const o=await Pt("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:a})});o.ok||e("Fehler",`Neustart fehlgeschlagen: ${o.err||"Unbekannt"}`)}catch(o){e("Fehler",`Fehler: ${o.message}`)}finally{i(o=>({...o,[a]:!1}))}}return 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(f1,{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(a=>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:qe("h-2.5 w-2.5 shrink-0 rounded-full ring-2 ring-black/40",a.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:a.name}),g.jsx("div",{className:"truncate font-mono text-[9px] text-muted-foreground/60",children:a.url})]})]}),g.jsx("button",{onClick:()=>s(a.name),disabled:r[a.name],className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border border-border/40 text-muted-foreground opacity-0 transition-all hover:bg-primary/5 hover:text-primary group-hover:opacity-100",title:"Dienst neu starten",children:g.jsx(ih,{className:qe("h-3.5 w-3.5",r[a.name]&&"animate-spin")})})]},a.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:Pg(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(Ag,{className:"h-3 w-3"})," Engine"]}),g.jsxs("a",{href:Pg(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(Ag,{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]})}const eA=[{key:"stt",label:"STT",hint:"Sprache → Text"},{key:"vision",label:"Bildschirm-Sicht",hint:"Vision-Beschreibung"},{key:"chat_ttfb",label:"Chat-TTFB",hint:"Zeit bis 1. Token"},{key:"tts",label:"TTS",hint:"Text → Sprache"}];function Vb(t){return t==null?"—":t>=1e3?`${(t/1e3).toFixed(2)} s`:`${Math.round(t)} ms`}function rhe({stat:t,label:e,hint:n,maxP95:r}){const i=!!t&&t.count>0,s=i&&t.p95_ms&&r>0?Math.max(4,Math.min(100,t.p95_ms/r*100)):0;return g.jsxs("div",{className:"space-y-1.5",children:[g.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[g.jsxs("div",{className:"flex items-baseline gap-2 min-w-0",children:[g.jsx("span",{className:"text-xs font-semibold text-foreground",children:e}),g.jsx("span",{className:"truncate text-[10px] text-muted-foreground/60",children:n})]}),i?g.jsx("span",{className:"shrink-0 font-mono text-sm font-bold tabular-nums text-foreground",children:Vb(t.p50_ms)}):g.jsx("span",{className:"shrink-0 text-[10px] italic text-muted-foreground/50",children:"noch keine Messungen"})]}),g.jsx("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-background/50 border border-border/30",children:g.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-teal-500 to-indigo-500 transition-all duration-500",style:{width:`${s}%`}})}),i&&g.jsxs("div",{className:"flex items-center gap-3 font-mono text-[10px] text-muted-foreground/65",children:[g.jsxs("span",{children:["p50 ",Vb(t.p50_ms)]}),g.jsxs("span",{children:["p95 ",Vb(t.p95_ms)]}),g.jsxs("span",{children:["zuletzt ",Vb(t.last_ms)]}),g.jsxs("span",{className:"text-muted-foreground/45",children:["· n=",t.count]})]})]})}function ihe(){const{data:t}=SX(5e3),e=Math.max(1,...eA.map(r=>{var i;return((i=t==null?void 0:t[r.key])==null?void 0:i.p95_ms)??0})),n=eA.some(r=>{var i;return(((i=t==null?void 0:t[r.key])==null?void 0:i.count)??0)>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-4 flex items-center gap-2",children:[g.jsx(b5,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Sprach-Latenz"}),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"]})]}),g.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:eA.map(r=>g.jsx(rhe,{stat:t==null?void 0:t[r.key],label:r.label,hint:r.hint,maxP95:e},r.key))}),g.jsx("div",{className:"mt-4 border-t border-border/30 pt-2 text-[10px] text-muted-foreground/70",children:n?"Server-seitige Dauer je Pipeline-Stufe (p50 prominent). Rollender Schnitt über die letzten Turns; Reset bei Neustart.":"Noch keine Voice-Turns gemessen — sprich einmal über den „Sprechen“-Tab, dann erscheinen hier STT/Vision/Chat/TTS."})]})}const kV=[{role:"hermes",label:"Lucys Hirn",short:"Hirn",icon:tp,desc:"Lucys Alltags-Verstand — denkt und redet mit dir. Immer bereit.",tone:"bg-indigo-500/15 text-indigo-400 border-indigo-500/25",protected:!0},{role:"embed",label:"Lucys Gedächtnis",short:"Gedächtnis",icon:g5,desc:"Merkt sich Wichtiges und findet es später wieder.",tone:"bg-emerald-500/15 text-emerald-400 border-emerald-500/25",protected:!0},{role:"vision",label:"Lucys Augen",short:"Augen",icon:c1,desc:"Sieht Bilder und Screenshots und beschreibt, was drauf ist.",tone:"bg-pink-500/15 text-pink-400 border-pink-500/25"},{role:"heavy",label:"Großes Hirn",short:"Groß",icon:VW,desc:"Das schwere Geschütz — wird für besonders knifflige Fragen dazugeholt.",tone:"bg-amber-500/15 text-amber-400 border-amber-500/25"},{role:"coder-lite",label:"Programmierer (schnell)",short:"Code schnell",icon:l1,desc:"Schnelles Programmieren im Alltag.",tone:"bg-violet-500/15 text-violet-400 border-violet-500/25"},{role:"coder",label:"Programmierer (gründlich)",short:"Code gründlich",icon:l1,desc:"Schreibt und prüft Code besonders sorgfältig — für schwere Coding-Aufgaben.",tone:"bg-fuchsia-500/15 text-fuchsia-400 border-fuchsia-500/25"},{role:"scout",label:"Späher",short:"Späher",icon:R9,desc:"Schneller erster Blick und grobe Einschätzung.",tone:"bg-teal-500/15 text-teal-400 border-teal-500/25"}],IV=kV.map(t=>t.role),F3=Object.fromEntries(kV.map(t=>[t.role,t])),z3=t=>({role:t||"?",label:t||"unbekannt",short:t||"?",icon:tp,desc:"Rolle ohne hinterlegten Klartext-Namen.",tone:"bg-slate-500/15 text-slate-300 border-slate-500/25"}),she={fast:"hermes",coder_lite:"coder-lite"};function Ss(t){return t&&(F3[t]||F3[she[t]])||z3(t)}function hh({role:t,dense:e=!1,className:n}){const r=Ss(t),i=r.icon;return g.jsxs("span",{className:qe("inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-semibold border tracking-wide",r.tone,n),title:`${r.desc} (${r.role})`,children:[g.jsx(i,{className:"h-3 w-3 shrink-0","aria-hidden":"true"}),e?r.short:r.label]})}function ahe({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:qe("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 B3(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 ohe(){var y,x,S;const{data:t}=Od(2e3),{data:e}=IP(2e3),{data:n}=rp(),r=(t==null?void 0:t.models)??[],i=(t==null?void 0:t.running)??[],s=((y=n==null?void 0:n.gpu)==null?void 0:y.gtt_total)||((x=n==null?void 0:n.gpu)==null?void 0:x.vram_total)||0,a=((S=n==null?void 0:n.gpu)==null?void 0:S.gtt_used)||0,o=s>0?Math.min(100,a/s*100):0,l=o>=88?"bg-red-500":o>=70?"bg-amber-500":"bg-teal-500",c=o>=88?"text-red-400":o>=70?"text-amber-400":"text-foreground",d=P.useRef(null),[f,p]=P.useState(!1);return P.useEffect(()=>{if(!e)return;const w=e.total_tokens;if(d.current!==null&&w>d.current){p(!0);const b=setTimeout(()=>p(!1),4e3);return d.current=w,()=>clearTimeout(b)}d.current=w},[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 flex flex-col",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(o1,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Modelle"})]}),g.jsxs("span",{className:qe("flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-wider font-mono px-2 py-0.5 rounded-full border transition-colors",f?"bg-emerald-500/10 text-emerald-400 border-emerald-500/30":"bg-background/30 text-muted-foreground/70 border-border/40"),children:[f?g.jsx(Md,{className:"h-3 w-3 animate-pulse"}):g.jsx(g9,{className:"h-3 w-3"}),f?"Inferenz aktiv":"Idle"]})]}),s>0&&g.jsxs("div",{className:"mb-4",children:[g.jsxs("div",{className:"flex items-center justify-between text-[10px] font-mono text-muted-foreground/80 mb-1",children:[g.jsx("span",{className:"uppercase tracking-wider font-semibold",children:"Speicher-Pool"}),g.jsxs("span",{children:[g.jsx("span",{className:qe("font-bold",c),children:cd(a)})," / ",cd(s)," GB belegt"]})]}),g.jsx("div",{className:"h-1.5 w-full rounded-full bg-background/50 border border-border/30 overflow-hidden",children:g.jsx("div",{className:qe("h-full rounded-full transition-all duration-500",l),style:{width:`${o}%`}})})]}),g.jsx("div",{className:"space-y-2 flex-1",children:IV.map(w=>{var T;const b=r.find(C=>C.role===w),M=b?i.includes(b.name):!1;return g.jsxs("div",{className:qe("flex items-center justify-between gap-2 p-2 rounded-xl border transition-all duration-300",M?"border-emerald-500/30 bg-emerald-500/5 shadow-sm shadow-emerald-500/5":b?"border-primary/20 bg-primary/5":"border-border/30 bg-background/10 opacity-60"),children:[g.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[g.jsx(hh,{role:w,className:"shrink-0"}),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:b?(T=b.name.split("/").pop())==null?void 0:T.replace(/\.gguf$/i,""):"nicht zugewiesen"}),b&&g.jsxs("div",{className:"flex gap-1 items-center mt-0.5 flex-wrap text-muted-foreground/70",children:[g.jsx("span",{className:"text-[9px] font-mono",children:va(b.size_bytes)}),b.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"}),b.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: ${b.spec_draft_model})`,children:"SPEC"}),b.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:`${b.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",b.parallel_slots]}),b.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("span",{className:"shrink-0",children:b?M?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:qe("h-1.5 w-1.5 rounded-full bg-emerald-500",f&&"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:"—"})})]},w)})}),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. Details & Routing im Modell-Manager."})]})}function lhe(){var C,L,N,D,F,V;const{data:t}=pF(),{data:e}=mF(),{data:n}=Od(),{data:r}=rp(),i=!!t&&!!e,s=I=>{var U;return(U=e==null?void 0:e.services.find(X=>X.name.toLowerCase().includes(I)))==null?void 0:U.ok},a=t==null?void 0:t.engine_reachable,o=(C=t==null?void 0:t.brain)==null?void 0:C.ready,l=((L=t==null?void 0:t.brain)==null?void 0:L.model)||((N=n==null?void 0:n.models.find(I=>I.role==="hermes"))==null?void 0:N.name)||"",c=[];c.push((()=>{const I={id:"brain",label:"Lucys Hirn",icon:tp,critical:!0};return i?a===!1?{...I,status:"down",detail:"Die Motor-Maschine (Engine) läuft nicht — Lucy kann gerade gar nicht denken.",repair:{kind:"restart",service:"llama-swap",label:"Motor neu starten",needsSudo:!0}}:o===!1?{...I,status:"down",detail:"Lucys Hirn ist gerade eingeschlafen — einmal aufwecken.",repair:l?{kind:"loadModel",model:l,label:"Hirn aufwecken"}:void 0}:{...I,status:"ok",detail:"Wach und ansprechbar."}:{...I,status:"loading",detail:"Wird geprüft …"}})()),c.push((()=>{const I={id:"memory",label:"Lucys Gedächtnis",icon:g5,critical:!0},U=s("mem0");return!i||U===void 0?{...I,status:"loading",detail:"Wird geprüft …"}:U?{...I,status:"ok",detail:"Merkt sich Neues und findet Altes wieder."}:{...I,status:"down",detail:"Lucy kann sich gerade nichts merken — das Gedächtnis antwortet nicht.",repair:{kind:"restart",service:"mem0-service",label:"Gedächtnis neu starten"}}})()),c.push((()=>{const I={id:"gateway",label:"Verbindung (Gateway)",icon:u1,critical:!0},U=t?t.gateway_reachable:s("integriert");return!i||U===void 0?{...I,status:"loading",detail:"Wird geprüft …"}:U?{...I,status:"ok",detail:"Apps und IDEs können Lucy erreichen."}:{...I,status:"down",detail:"Die Verbindungs-Zentrale antwortet nicht — Apps erreichen Lucy nicht.",repair:{kind:"restart",service:"mission-control-2",label:"Zentrale neu starten"}}})()),c.push((()=>{const I={id:"agent",label:"Lucys Agent (Hermes)",icon:Nl,critical:!0},U=s("hermes-gateway");return!i||U===void 0?{...I,status:"loading",detail:"Wird geprüft …"}:U?{...I,status:"ok",detail:"Lucy ist bereit zu reden und zu handeln."}:{...I,status:"down",detail:"Lucys Agent ist offline — sie reagiert gerade nicht.",repair:{kind:"restart",service:"hermes-gateway",label:"Agent neu starten"}}})()),c.push((()=>{const I={id:"voice",label:"Lucys Stimme",icon:TP,critical:!1},U=s("voice");return!i||U===void 0?{...I,status:"loading",detail:"Wird geprüft …"}:U?{...I,status:"ok",detail:"Lucy kann hören und sprechen."}:{...I,status:"warn",detail:"Sprechen ist gerade aus — Tippen geht weiter normal.",repair:{kind:"restart",service:"voice-service",label:"Stimme neu starten"}}})());const d=((D=r==null?void 0:r.gpu)==null?void 0:D.gtt_total)||((F=r==null?void 0:r.gpu)==null?void 0:F.vram_total)||0,f=((V=r==null?void 0:r.gpu)==null?void 0:V.gtt_used)||0,p=d>0?Math.min(100,f/d*100):0,y=1024**3,x=d?p>=90?{status:"full",usedGb:f/y,totalGb:d/y,pct:p,text:"Speicher fast voll — Lucy könnte langsamer werden."}:p>=72?{status:"warn",usedGb:f/y,totalGb:d/y,pct:p,text:"Speicher gut gefüllt — noch okay."}:{status:"ok",usedGb:f/y,totalGb:d/y,pct:p,text:"Genug Speicher frei."}:{status:"unknown",usedGb:0,totalGb:0,pct:0,text:"Speicher-Auslastung unbekannt."},S=c.some(I=>I.status==="loading"),w=c.filter(I=>I.critical&&I.status==="down"),b=c.filter(I=>I.status==="warn"||!I.critical&&I.status==="down"),M=x.status==="full";return{verdict:S&&!w.length?"loading":w.length?"problem":b.length||M?"warn":"gut",checks:c,memory:x,problems:w}}const che={ok:"bg-emerald-500",warn:"bg-amber-500",down:"bg-red-500",loading:"bg-muted-foreground/40"};function uhe(){const{verdict:t,checks:e,memory:n,problems:r}=lhe(),{showAlert:i,dialogElement:s}=Ud(),a=Bl(),[o,l]=P.useState({});async function c(x,S){l(w=>({...w,[x]:!0}));try{if(S.kind==="loadModel")await Pt(`/api/models/${encodeURIComponent(S.model)}/load`,{method:"POST"});else{const w=await Pt("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:S.service})});w.ok||i("Reparatur nicht ganz geklappt",(w.err||"Unbekannter Fehler")+(S.needsSudo?`
|
||
|
||
Tipp: Dafür wird evtl. das Box-Passwort gebraucht (oben rechts hinterlegen).`:""))}a.invalidateQueries({queryKey:kn.health}),a.invalidateQueries({queryKey:kn.services}),a.invalidateQueries({queryKey:kn.models})}catch(w){i("Reparatur fehlgeschlagen",String((w==null?void 0:w.message)||w))}finally{l(w=>({...w,[x]:!1}))}}const d={loading:{ring:"border-border/60 bg-card/45",icon:Xg,iconCls:"text-muted-foreground animate-spin",title:"Lucy wird geprüft …",sub:"Einen Moment, ich schaue nach dem Rechten."},gut:{ring:"border-emerald-500/40 bg-emerald-500/5",icon:s9,iconCls:"text-emerald-400",title:"Lucy geht's gut 💚",sub:"Alle wichtigen Fähigkeiten laufen."},warn:{ring:"border-amber-500/40 bg-amber-500/5",icon:Yc,iconCls:"text-amber-400",title:"Kleinigkeit bei Lucy",sub:"Nichts Schlimmes — nur ein Hinweis."},problem:{ring:"border-red-500/50 bg-red-500/5",icon:Yc,iconCls:"text-red-400",title:"Lucy braucht Hilfe",sub:`${r.length} wichtige${r.length===1?"s":""} Problem${r.length===1?"":"e"} gefunden.`}}[t],f=d.icon,p={ok:"bg-emerald-500",warn:"bg-amber-500",full:"bg-red-500",unknown:"bg-muted-foreground/40"}[n.status],y={ok:"text-emerald-400",warn:"text-amber-400",full:"text-red-400",unknown:"text-muted-foreground"}[n.status];return g.jsxs("div",{className:qe("rounded-2xl border p-5 shadow-lg shadow-black/15 backdrop-blur-md transition-colors",d.ring),children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("div",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-xl border border-border/40 bg-background/30",children:g.jsx(f,{className:qe("h-6 w-6",d.iconCls)})}),g.jsxs("div",{className:"min-w-0",children:[g.jsx("h2",{className:"text-base font-bold tracking-tight text-foreground",children:d.title}),g.jsx("p",{className:"text-xs text-muted-foreground",children:d.sub})]})]}),g.jsxs("div",{className:"mt-4 rounded-xl border border-border/30 bg-background/20 p-3",children:[g.jsxs("div",{className:"mb-1.5 flex items-center justify-between text-[11px]",children:[g.jsxs("span",{className:"flex items-center gap-1.5 font-semibold uppercase tracking-wider text-muted-foreground",children:[g.jsx(Q0,{className:"h-3.5 w-3.5"})," Speicher"]}),g.jsx("span",{className:qe("font-mono font-bold",y),children:n.status==="unknown"?"—":`${n.usedGb.toFixed(0)} / ${n.totalGb.toFixed(0)} GB`})]}),g.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full border border-border/30 bg-background/50",children:g.jsx("div",{className:qe("h-full rounded-full transition-all duration-500",p),style:{width:`${n.pct}%`}})}),g.jsx("p",{className:qe("mt-1.5 text-[11px]",y),children:n.text})]}),g.jsx("div",{className:"mt-4 space-y-1.5",children:e.map(x=>g.jsx(dhe,{c:x,busy:!!o[x.id],onRepair:()=>x.repair&&c(x.id,x.repair)},x.id))}),s]})}function dhe({c:t,busy:e,onRepair:n}){const r=t.icon,i=t.status==="down"||t.status==="warn";return g.jsxs("div",{className:qe("flex items-center justify-between gap-3 rounded-xl border p-2.5 transition-colors",t.status==="down"?"border-red-500/25 bg-red-500/5":t.status==="warn"?"border-amber-500/20 bg-amber-500/5":"border-border/30 bg-background/15"),children:[g.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[g.jsxs("span",{className:"relative flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-border/40 bg-background/30 text-foreground/80",children:[g.jsx(r,{className:"h-4 w-4"}),g.jsx("span",{className:qe("absolute -right-0.5 -top-0.5 h-2.5 w-2.5 rounded-full ring-2 ring-black/40",che[t.status],t.status==="down"&&"animate-pulse")})]}),g.jsxs("div",{className:"min-w-0",children:[g.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-bold text-foreground",children:[t.label,t.status==="ok"&&g.jsx(Ps,{className:"h-3 w-3 text-emerald-400"}),!t.critical&&g.jsx("span",{className:"rounded bg-background/40 px-1 py-0.5 text-[8px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:"optional"})]}),g.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:t.detail})]})]}),i&&t.repair&&g.jsxs("button",{onClick:n,disabled:e,className:qe("flex h-8 shrink-0 items-center gap-1.5 rounded-lg border px-2.5 text-[10px] font-bold uppercase tracking-wide transition-all cursor-pointer disabled:opacity-60",t.status==="down"?"border-red-500/40 bg-red-500/10 text-red-300 hover:bg-red-500/20":"border-amber-500/40 bg-amber-500/10 text-amber-300 hover:bg-amber-500/20"),title:t.repair.label,children:[e?g.jsx(Xg,{className:"h-3.5 w-3.5 animate-spin"}):g.jsx(eS,{className:"h-3.5 w-3.5"}),t.repair.label]}),i&&!t.repair&&g.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-[10px] font-semibold text-muted-foreground",title:"Keine Auto-Reparatur bekannt",children:[g.jsx(A9,{className:"h-3.5 w-3.5"})," manuell"]})]})}function H3({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 fhe(){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.jsx(uhe,{}),g.jsxs("div",{className:"grid items-stretch gap-6 lg:grid-cols-3",children:[g.jsx(Zfe,{}),g.jsx(the,{}),g.jsx(ohe,{})]}),g.jsxs("section",{children:[g.jsx(H3,{children:"Stack & Telemetrie"}),g.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[g.jsx(nhe,{}),g.jsx(ihe,{})]})]}),g.jsxs("section",{children:[g.jsx(H3,{children:"Betrieb & Wissen"}),g.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[g.jsx(Qfe,{}),g.jsx(Jfe,{}),g.jsx(ehe,{})]})]})]})}function hhe(){const t=Bl(),{data:e=[]}=EX(2e3),{showAlert:n,dialogElement:r}=Ud();async function i(o){try{await Pt(`/api/jobs/${o}/cancel`,{method:"POST"}),t.invalidateQueries({queryKey:kn.jobs})}catch(l){n("Fehler",l.message)}}const s=e.filter(o=>o.state==="running"||o.state==="queued"),a=e.filter(o=>o.state!=="running"&&o.state!=="queued").slice(-3);return s.length===0&&a.length===0?null: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(o=>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:o.label}),g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsxs("span",{className:"text-muted-foreground font-mono",children:[o.progress??0,"% • ",ZT(o.done_bytes),"/",ZT(o.total_bytes),o.eta_s?` • ETA ${DX(o.eta_s)}`:""]}),g.jsx("button",{onClick:()=>i(o.id),className:"text-[10px] text-red-400 hover:text-red-300 font-semibold border border-red-500/25 bg-red-500/5 px-2 py-0.5 rounded transition-all cursor-pointer",children:"Abbrechen"})]})]}),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:`${o.progress??0}%`}})})]},o.id)),a.map(o=>g.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[g.jsx("span",{className:"truncate",children:o.label}),g.jsx("span",{className:qe("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",o.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:o.state})]},o.id)),r]})}function If({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 V3({caps:t}){return t?g.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[t.coder&&g.jsx(If,{children:"💻 Code"}),t.vision&&g.jsx(If,{children:"👁 Bild"}),t.reasoning&&g.jsx(If,{children:"🧠 Reason"}),t.moe&&g.jsxs(If,{tone:"primary",children:["🧩 MoE",t.active_b?`·${t.active_b}b`:""]}),t.tools==="yes"&&g.jsx(If,{tone:"primary",children:"🛠 Tools"}),t.tools==="likely"&&g.jsx(If,{tone:"warn",children:"🛠 Tools?"}),t.embedding&&g.jsx(If,{children:"🔢 Embed"})]}):null}function phe({model:t,onClose:e,onChanged:n}){var S,w;const{data:r,isLoading:i}=TX(t.gguf_path),[s,a]=P.useState(null),[o,l]=P.useState(""),c=r==null?void 0:r.target_vocab,d=(r==null?void 0:r.drafts)??[],f=d.filter(b=>b.compatible===!0),p=t.spec_draft_model;async function y(b){a(b??"__clear__"),l("");try{await Pt(`/api/models/${encodeURIComponent(t.name)}/draft`,{method:"POST",body:JSON.stringify({draft_path:b})}),n(),e()}catch(M){l(String((M==null?void 0:M.message)||M)),a(null)}}const x=b=>{var M;return b?`${b.pre??"?"} · ${((M=b.n_vocab)==null?void 0:M.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(Md,{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(kl,{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&&p&&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(Ps,{className:"h-3.5 w-3.5 shrink-0"})," Aktiv: ",p]}),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(Yc,{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(b=>{var C,L;const M=b.filename===p,T=b.compatible===!0;return g.jsxs("div",{className:qe("rounded-lg border px-3 py-2 flex items-center justify-between gap-2 text-left",T?"border-border/40 bg-background/20":"border-border/20 bg-background/10 opacity-60",M&&"border-primary/40 bg-primary/10"),children:[g.jsxs("div",{className:"min-w-0",children:[g.jsxs("div",{className:"text-[11px] font-mono font-semibold text-foreground truncate flex items-center gap-1.5",children:[b.filename,b.mtp&&g.jsx("span",{className:"shrink-0 rounded bg-indigo-500/15 px-1.5 py-0.5 text-[8px] font-bold uppercase tracking-wider text-indigo-400 border border-indigo-500/25",title:"MTP-Kopf (Multi-Token-Prediction) — by-construction vocab-identisch, höchste Akzeptanzrate",children:"MTP"})]}),g.jsxs("div",{className:"text-[9px] text-muted-foreground font-mono",children:[va(b.size_bytes)," · Vocab: ",x(b.vocab)]})]}),T?M?g.jsxs("span",{className:"text-[9px] font-bold uppercase text-primary flex items-center gap-1 shrink-0",children:[g.jsx(Ps,{className:"h-3.5 w-3.5"})," Aktiv"]}):g.jsx("button",{onClick:()=>y(b.path),disabled:s!==null,className:"h-7 px-3 rounded-lg border border-emerald-500/30 bg-emerald-500/5 hover:bg-emerald-500/15 text-emerald-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Aktivieren"}):g.jsxs("span",{className:"text-[9px] font-bold uppercase text-amber-400/80 flex items-center gap-1 shrink-0",title:b.compatible===!1?`Inkompatibel: Tokenizer/Vocab weicht ab (Draft ${(C=b.vocab)==null?void 0:C.pre}/${(L=b.vocab)==null?void 0:L.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(Yc,{className:"h-3.5 w-3.5"})," ",b.compatible===!1?"Vocab ≠":"n/a"]})]},b.path)})}),!i&&(r==null?void 0:r.target_exists)&&d.length>0&&f.length===0&&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()}),")."]}),o&&g.jsx("div",{className:"text-[10px] text-red-400 font-mono",children:o})]})})}const mhe=["fast","heavy","heavy_chars"],ghe=["coder_lite","coder","coding_escalate_chars"];function vhe(){const t=Bl(),{data:e,isLoading:n}=MX(),[r,i]=P.useState(null),[s,a]=P.useState(!1),[o,l]=P.useState(""),[c,d]=P.useState(0);if(P.useEffect(()=>{e!=null&&e.policy&&!r&&i({...e.policy})},[e,r]),n||!e||!r)return g.jsx("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 text-xs text-muted-foreground",children:"Lade Routing-Policy…"});const f=b=>e.fields.find(M=>M.key===b),p=Object.keys(r).some(b=>r[b]!==e.policy[b]),y=(b,M)=>{i(T=>T&&{...T,[b]:M}),l("")},x=b=>y(b,e.defaults[b]);async function S(){if(!r)return;const b={};for(const M of Object.keys(r))r[M]!==e.policy[M]&&(b[M]=r[M]);if(Object.keys(b).length!==0){a(!0),l("");try{const{policy:M}=await _X(b);i({...M}),t.invalidateQueries({queryKey:kn.routingPolicy}),t.invalidateQueries({queryKey:kn.routing}),d(Date.now()),setTimeout(()=>d(0),2e3)}catch(M){l(M.message||String(M))}finally{a(!1)}}}function w({k:b}){const M=f(b),T=r[b],C=r[b]===e.defaults[b];return g.jsxs("div",{className:"space-y-1",children:[g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsx("label",{className:"text-[10px] font-semibold text-muted-foreground",children:M.label}),!C&&g.jsxs("button",{onClick:()=>x(b),className:"flex items-center gap-0.5 text-[9px] text-muted-foreground/60 hover:text-foreground transition-colors cursor-pointer",title:`Auf Default zurücksetzen (${String(e.defaults[b])||"leer"})`,children:[g.jsx(_5,{className:"h-2.5 w-2.5"})," Default"]})]}),M.type==="bool"?g.jsxs("button",{onClick:()=>y(b,!T),className:qe("flex h-8 w-full items-center justify-between rounded-lg border px-3 text-[11px] font-semibold transition-all cursor-pointer",T?"border-emerald-500/40 bg-emerald-500/10 text-emerald-300":"border-border/40 bg-background/40 text-muted-foreground"),children:[g.jsx("span",{children:T?"An":"Aus"}),g.jsx("span",{className:qe("h-3.5 w-3.5 rounded-full transition-colors",T?"bg-emerald-400":"bg-muted-foreground/40")})]}):M.type==="int"?g.jsx("input",{type:"number",value:T,min:M.min,max:M.max,"aria-label":M.label,onChange:L=>y(b,Number(L.target.value)),className:"h-8 w-full rounded-lg border border-border/40 bg-background/40 px-3 font-mono text-[11px] text-foreground outline-none focus:border-primary/50"}):g.jsx("input",{type:"text",value:T,"aria-label":M.label,spellCheck:!1,placeholder:b==="coder_lite"?"(leer = aus)":"",onChange:L=>y(b,L.target.value),className:"h-8 w-full rounded-lg border border-border/40 bg-background/40 px-3 font-mono text-[11px] text-foreground outline-none focus:border-primary/50"})]})}return 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-4",children:[g.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(C9,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Lane-Routing & Policy"}),g.jsx("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded bg-emerald-500/10 text-emerald-300 border border-emerald-500/20",children:"hot-reload"})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[o&&g.jsx("span",{className:"text-[10px] text-red-400 max-w-[280px] truncate",title:o,children:o}),c>0&&g.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-emerald-400",children:[g.jsx(Ps,{className:"h-3.5 w-3.5"})," gespeichert"]}),g.jsxs("button",{onClick:S,disabled:!p||s,className:qe("h-8 px-4 rounded-lg text-[10px] font-bold uppercase tracking-wide transition-all flex items-center gap-1.5",p&&!s?"bg-primary text-primary-foreground hover:opacity-90 cursor-pointer shadow-md shadow-primary/10":"bg-background/40 text-muted-foreground/50 border border-border/40 cursor-not-allowed"),children:[s?g.jsx(Xg,{className:"h-3.5 w-3.5 animate-spin"}):null,"Speichern"]})]})]}),g.jsxs("p",{className:"text-[10px] text-muted-foreground/70 leading-relaxed -mt-1",children:["Welches echte Modell hinter den virtuellen Lanes ",g.jsx("code",{className:"text-cyan-300",children:"chat"})," und"," ",g.jsx("code",{className:"text-cyan-300",children:"coding"})," steckt. Änderungen greifen sofort (kein Neustart). Die Keyword-Heuristiken bleiben im Code."]}),g.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[g.jsxs("div",{className:"rounded-xl border border-border/40 bg-background/25 p-4 space-y-3",children:[g.jsxs("div",{className:"flex items-center gap-2 border-b border-border/30 pb-2",children:[g.jsx(p9,{className:"h-4 w-4 text-teal-400"}),g.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider text-foreground",children:"chat"}),g.jsx("span",{className:"text-[9px] text-muted-foreground/60 font-mono",children:"(= auto)"})]}),mhe.map(b=>g.jsx(w,{k:b},b))]}),g.jsxs("div",{className:"rounded-xl border border-border/40 bg-background/25 p-4 space-y-3",children:[g.jsxs("div",{className:"flex items-center gap-2 border-b border-border/30 pb-2",children:[g.jsx(YW,{className:"h-4 w-4 text-indigo-400"}),g.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider text-foreground",children:"coding"}),g.jsx("span",{className:"text-[9px] text-muted-foreground/60 font-mono",children:"(agentisch → immer Coder)"})]}),ghe.map(b=>g.jsx(w,{k:b},b))]})]}),g.jsx("div",{className:"rounded-xl border border-border/40 bg-background/25 p-4",children:g.jsx("div",{className:"max-w-xs",children:g.jsx(w,{k:"fast_no_think"})})})]})}function yhe(){var te,re,pe;const t=Bl(),{data:e}=Od(4e3),{data:n}=gF(),{data:r}=rp(),{data:i}=vF(),{showAlert:s,dialogElement:a}=Ud(),[o,l]=P.useState(!1),[c,d]=P.useState(!1),f=(e==null?void 0:e.models)??[],p=(e==null?void 0:e.running)??[],y=(te=n==null?void 0:n.groups)==null?void 0:te.brains,x=(y==null?void 0:y.members)??[],S=ee=>f.find(ce=>ce.name===ee),w=ee=>{var ce;return((ce=ee.split("/").pop())==null?void 0:ce.replace(/\.gguf$/i,""))||ee},b=x.map(S).filter(Boolean),M=1024**3,T=i==null?void 0:i.budget,C=b.reduce((ee,ce)=>ee+(ce.size_bytes||0),0)/M,L=((re=r==null?void 0:r.gpu)==null?void 0:re.gtt_total)||((pe=r==null?void 0:r.gpu)==null?void 0:pe.vram_total)||0,N=(T==null?void 0:T.gtt_gb)||(L?L/M:0),D=(T==null?void 0:T.warm_projected_gb)??C,F=N>0?Math.min(100,D/N*100):0,V=f.filter(ee=>!x.includes(ee.name)&&!ee.incomplete);async function I(ee){d(!0);try{await hF("brains",ee,(y==null?void 0:y.swap)??!1,(y==null?void 0:y.persist)??!0),t.invalidateQueries({queryKey:kn.groups}),t.invalidateQueries({queryKey:kn.models}),t.invalidateQueries({queryKey:kn.hermesBrain})}catch(ce){s("Fehler",`Immer-bereit-Set konnte nicht geändert werden: ${(ce==null?void 0:ce.message)||ce}`)}finally{d(!1)}}function U(ee){const ce=S(ee);if(ce&&Ss(ce.role).protected){s("Geschützt",`„${Ss(ce.role).label}" ist lebenswichtig und bleibt immer bereit.`);return}I(x.filter(B=>B!==ee))}function X(ee){l(!1),I([...x,ee])}return y?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-4",children:[g.jsx(G3,{}),g.jsxs("div",{className:"space-y-1.5",children:[b.length===0&&g.jsx("div",{className:"text-xs text-muted-foreground",children:"Noch keine Modelle im Set."}),b.map(ee=>{const ce=p.includes(ee.name),B=Ss(ee.role).protected;return g.jsxs("div",{className:"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.5",children:[g.jsx("span",{className:qe("h-2 w-2 shrink-0 rounded-full ring-2 ring-black/40",ce?"bg-emerald-500 animate-pulse":"bg-muted-foreground/40"),title:ce?"Gerade warm (bereit)":"Reserviert — lädt bei Bedarf sofort"}),ee.role&&g.jsx(hh,{role:ee.role,dense:!0,className:"shrink-0"}),g.jsx("span",{className:"truncate font-mono text-xs font-semibold text-foreground",title:ee.name,children:w(ee.name)}),g.jsx("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground/70",children:va(ee.size_bytes)})]}),B?g.jsx("span",{className:"shrink-0 text-[10px] font-semibold text-muted-foreground",title:"Lebenswichtig — bleibt immer im Set.",children:"🔒"}):g.jsx("button",{onClick:()=>U(ee.name),disabled:c,className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border border-border/40 text-muted-foreground transition-colors hover:bg-red-500/5 hover:text-red-400 cursor-pointer disabled:opacity-50",title:"Aus dem Immer-bereit-Set nehmen (lädt dann nur noch bei Bedarf)",children:g.jsx(kl,{className:"h-3.5 w-3.5"})})]},ee.name)})]}),g.jsxs("button",{onClick:()=>l(!0),disabled:c||V.length===0,className:"flex h-8 w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-border/50 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground transition-colors hover:border-primary/40 hover:text-primary cursor-pointer disabled:opacity-50",children:[g.jsx(d1,{className:"h-3.5 w-3.5"})," Modell dauerhaft bereithalten"]}),g.jsxs("div",{className:"rounded-xl border border-border/30 bg-background/20 p-3",children:[g.jsxs("div",{className:"mb-1.5 flex items-center justify-between text-[11px]",children:[g.jsxs("span",{className:"flex items-center gap-1.5 font-semibold uppercase tracking-wider text-muted-foreground",title:"Modellgewichte + Arbeitsspeicher (KV-Cache)",children:[g.jsx(Q0,{className:"h-3.5 w-3.5"})," Reserviert fürs Set"]}),g.jsxs("span",{className:"font-mono font-bold text-foreground",children:[D.toFixed(1),N>0?` / ${N.toFixed(0)}`:""," GB"]})]}),g.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full border border-border/30 bg-background/50",children:g.jsx("div",{className:qe("h-full rounded-full transition-all duration-500",F>=85?"bg-red-500":F>=65?"bg-amber-500":"bg-teal-500"),style:{width:`${F}%`}})}),T&&!T.fits&&g.jsxs("p",{className:"mt-2 flex items-start gap-1.5 text-[11px] text-amber-400",children:[g.jsx(Yc,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),g.jsxs("span",{children:["Zusammen mit dem größten Gelegenheits-Modell (~",T.largest_ondemand_gb," GB, z. B. das große Hirn) passt das Set nicht gleichzeitig in den Speicher. Beim Laden wird das Set kurz verdrängt und danach automatisch nachgeladen — kostet ein paar Sekunden."]})]}),T&&T.fits&&g.jsxs("p",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-emerald-400",children:[g.jsx(Ps,{className:"h-3.5 w-3.5 shrink-0"})," Passt auch neben dem größten Gelegenheits-Modell — nichts wird verdrängt."]})]}),o&&g.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",role:"dialog","aria-modal":"true","aria-label":"Modell zum Immer-bereit-Set hinzufügen",children:g.jsxs("div",{className:"w-full max-w-md space-y-3 rounded-2xl border border-border/80 bg-card p-6 shadow-2xl 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:"Dauerhaft bereithalten"}),g.jsx("button",{onClick:()=>l(!1),className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground cursor-pointer",children:g.jsx(kl,{className:"h-4 w-4"})})]}),g.jsx("p",{className:"text-xs text-muted-foreground",children:"Wähle ein Modell, das ohne Ladezeit bereitstehen soll:"}),g.jsx("div",{className:"max-h-60 space-y-1.5 overflow-y-auto pr-1",children:V.map(ee=>g.jsxs("button",{onClick:()=>X(ee.name),className:"flex w-full items-center justify-between gap-2 rounded-lg border border-border/30 bg-background/20 px-3 py-2.5 text-left transition-colors hover:bg-accent cursor-pointer",children:[g.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[ee.role&&g.jsx(hh,{role:ee.role,dense:!0,className:"shrink-0"}),g.jsx("span",{className:"truncate font-mono text-xs font-semibold text-foreground",children:w(ee.name)})]}),g.jsx("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground/70",children:va(ee.size_bytes)})]},ee.name))})]})}),a]}):g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10",children:[g.jsx(G3,{}),g.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"Es gibt noch kein Immer-bereit-Set. Es entsteht automatisch, sobald Lucys Hirn zugewiesen ist."}),a]})}function G3(){return g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Md,{className:"h-4.5 w-4.5 text-primary"}),g.jsxs("div",{children:[g.jsx("h2",{className:"text-sm font-bold uppercase tracking-wide text-foreground",children:"Immer-bereit-Set"}),g.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Diese Modelle hält Lucy immer bereit — sie antworten ohne Ladezeit."})]})]})}function xhe(){var Ve,Le,We,Je;const t=Bl(),{data:e,isLoading:n,error:r}=Od(4e3),{data:i}=OP(4e3),{data:s}=vF(),{data:a}=rp(),{data:o}=gF(),{showAlert:l,showConfirm:c,showPrompt:d,dialogElement:f}=Ud(),p=aF(),y=de=>!!Ss(de).protected,x=(e==null?void 0:e.models)??[],S=(e==null?void 0:e.running)??[],w=r?String(r):"",b=()=>{t.invalidateQueries({queryKey:kn.models}),t.invalidateQueries({queryKey:kn.routing})},M=(Ve=o==null?void 0:o.groups)==null?void 0:Ve.brains,T=(M==null?void 0:M.members)??[],C=de=>T.includes(de),L=T.some(de=>S.includes(de));async function N(de){if(!M){l("Keine brains-Gruppe","Es existiert noch keine Ko-Residenz-Gruppe „brains“ in der Engine-Konfiguration. Lege sie erst über die Gruppen-Verwaltung an.");return}const K=T.includes(de)?T.filter(H=>H!==de):[...T,de];try{await hF("brains",K,M.swap??!1,M.persist??!0),t.invalidateQueries({queryKey:kn.groups}),b()}catch(H){l("Fehler",`Ko-Residenz konnte nicht geändert werden: ${H.message||H}`)}}const[D,F]=P.useState(null),[V,I]=P.useState(null),[U,X]=P.useState(null),[te,re]=P.useState("grid"),[pe,ee]=P.useState("all"),ce=x.filter(de=>pe==="in_use"?!!de.role||S.includes(de.name):!0);async function B(de){try{await Pt(`/api/models/${encodeURIComponent(de)}/load`,{method:"POST"}),b()}catch(De){l("Fehler",`Fehler beim Laden des Modells: ${De.message}`)}}async function J(de){if(M&&L&&!C(de)){const De=T.filter(K=>S.includes(K)).map(K=>K.split("/").pop()).join(", ");c("Verdrängt das Hirn?",`„${de.split("/").pop()}“ ist nicht in der Ko-Residenz-Gruppe „brains“. Beim Laden wirft es das aktuell warme Hirn (${De}) raus — Lucy verliert Hirn bzw. Augen.
|
||
|
||
Trotzdem exklusiv laden? Tipp: Mit dem 🧠-Schalter machst du das Modell dauerhaft ko-resident, dann bleiben beide warm.`,()=>B(de));return}B(de)}async function Z(de){const De=x.find(K=>K.name===de);if(De&&y(De.role)){l("Geschützt",`„${Ss(De.role).label}" ist lebenswichtig für Lucy und bleibt geladen. Zum Entladen erst im Experten-Modus die Rolle einem anderen Modell geben.`);return}try{await Pt(`/api/models/${encodeURIComponent(de)}/unload`,{method:"POST"}),b()}catch(K){l("Fehler",`Fehler beim Entladen des Modells: ${K.message}`)}}async function G(){try{await Pt("/api/models/unload",{method:"POST"}),b()}catch(de){l("Fehler",`Fehler beim Entladen aller Modelle: ${de.message}`)}}async function W(de,De){try{const K=await Pt(`/api/models/${encodeURIComponent(De)}/role`,{method:"POST",body:JSON.stringify({role:de||null})});b(),K!=null&&K.warning&&l("Hirn gesetzt — Hinweis",K.warning)}catch(K){l("Fehler",`Fehler beim Zuweisen der Rolle: ${K.message||K}`)}}function oe(de){F(de),I(null),Pt(`/api/roles/${encodeURIComponent(de)}/recommend`).then(De=>I(De)).catch(()=>{})}async function se(de,De){let K=null;try{K=await Pt(`/api/models/${encodeURIComponent(de)}/ctx/auto`)}catch{}const H=K?`Optimal für dein Setup: ${(K.ctx/1024).toFixed(0)}k (${K.ctx}) — GTT ${K.gtt_gb} GB − reserviert ${K.reserved_gb} GB (${K.mode}) → ${K.budget_gb} GB frei. »Auto« trägt diesen Wert ein.`:"Gib die gewünschte Kontextlänge in Tokens an:";d("Kontextlänge anpassen",H,String(De||32768),async xe=>{if(xe)try{await Pt(`/api/models/${encodeURIComponent(de)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(xe,10)})}),b()}catch(je){l("Fehler",`Fehler beim Setzen des Kontexts: ${je.message||je}`)}},void 0,K?{autoValue:String(K.ctx),autoLabel:`Auto (${(K.ctx/1024).toFixed(0)}k)`}:void 0)}async function le(de){const De=x.find(K=>K.name===de);if(De&&y(De.role)){l("Geschützt",`„${Ss(De.role).label}" ist lebenswichtig für Lucy und kann nicht gelöscht werden. Weise die Rolle zuerst einem anderen Modell zu.`);return}c("Modell löschen?",`Modell '${de}' und alle zugehörigen GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await Pt(`/api/models/${encodeURIComponent(de)}`,{method:"DELETE"}),b()}catch(K){l("Fehler",`Fehler beim Löschen: ${K.message||K}`)}})}async function Me(de,De,K,H){try{await Pt("/api/models/install",{method:"POST",body:JSON.stringify({repo:de,role:De,quant:K,jinja:H})}),l("Herunterladen gestartet",`Download für '${de}' gestartet! Der Fortschritt wird oben angezeigt.`)}catch(xe){l("Fehler",`Fehler beim Starten des Upgrades: ${xe.message||xe}`)}}async function Se(de){const De=s==null?void 0:s.budget,K=De&&!De.fits?`
|
||
|
||
⚠ Speicher-Warnung: Dieses Brain (~${De.brain_gb} GB) muss immer resident sein. Zusammen mit dem größten on-demand-Modell (~${De.largest_ondemand_gb} GB) sprengt das das Budget (${De.gtt_gb} GB) → heavy/coder würden das Brain verdrängen. Erwäge ein kleineres Brain oder weniger Kontext.`:"";c("Agent-Hirn aktualisieren?",`Neues Hermes-Modell '${de.split("/").pop()}' herunterladen und als Agent-Hirn (Rolle hermes) setzen? Hermes nutzt danach automatisch das neue Modell.${K}`,async()=>{try{await Pt("/api/models/install",{method:"POST",body:JSON.stringify({repo:de,role:"hermes",quant:"Q4_K_M",jinja:!0})}),l("Download gestartet","Das neue Agent-Hirn wird geladen. Fortschritt oben."),b()}catch(H){l("Fehler",`Update fehlgeschlagen: ${H.message||H}`)}})}if(n)return g.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Initialisiere HUD Cockpit…"});if(w)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 (",w,")."]});const $e=x.filter(de=>S.includes(de.name)),Ee=$e.reduce((de,De)=>de+(De.size_bytes||0),0),Ge=((Le=a==null?void 0:a.gpu)==null?void 0:Le.gtt_total)||((We=a==null?void 0:a.gpu)==null?void 0:We.vram_total)||0,Xe=((Je=a==null?void 0:a.gpu)==null?void 0:Je.gtt_used)||0,fe=16*1024**3,Q=Ge>2*1024**3?Ge:Ee>fe?Ee*1.2:fe;return g.jsxs("div",{className:"space-y-8",children:[g.jsx("style",{children:`
|
||
@keyframes flow-dash {
|
||
to {
|
||
stroke-dashoffset: -20;
|
||
}
|
||
}
|
||
.svg-flow-path {
|
||
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(Q0,{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: ",va(Ee)," Gewichte",Xe>0?` · ${va(Xe)} real belegt (inkl. KV)`:""," / ",va(Q)]}),p&&S.length>0&&g.jsx("button",{onClick:G,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:$e.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"}):$e.map((de,De)=>{var xe;const K=(de.size_bytes||0)/Q*100,H=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][De%4];return g.jsxs("div",{style:{width:`${K}%`},className:qe("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",H),title:`${de.name} (${va(de.size_bytes)})`,children:[g.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[de.role?`[${Ss(de.role).short}] `:"",(xe=de.name.split("/").pop())==null?void 0:xe.replace(".gguf","")]}),g.jsx("span",{className:"text-[8px] font-mono opacity-80",children:va(de.size_bytes)})]},de.name)})})]}),g.jsx(yhe,{}),p&&g.jsx(vhe,{}),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:p?"Gateway Steckplatz-Belegung (Slot-Zuweisung)":"Wer macht was bei Lucy — zum Ändern antippen"}),g.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:IV.map(de=>{var H;const De=x.find(xe=>xe.role===de),K=De?S.includes(De.name):!1;return g.jsxs("div",{onClick:()=>oe(de),className:qe("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]",K?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":De?"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(hh,{role:de}),K&&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:De==null?void 0:De.name,children:De?(H=De.name.split("/").pop())==null?void 0:H.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)})})]}),(s==null?void 0:s.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(Nl,{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)"}),s.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",s.current.version]})]}),g.jsx("button",{onClick:()=>window.dispatchEvent(new CustomEvent("mc-navigate",{detail:{view:"agent"}})),className:"h-7 px-3 rounded-lg border border-indigo-500/30 bg-indigo-500/5 text-indigo-300 text-[9px] font-bold uppercase hover:bg-indigo-500/15 transition-all cursor-pointer",title:"Hirn-Wechsel passiert jetzt zentral im Hermes-Tab",children:"Im Hermes-Tab wechseln →"})]}),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:s.current.name,children:s.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:s.current.params_b?`${s.current.params_b}B`:"—"}),g.jsx("span",{children:"•"}),g.jsx("span",{children:s.current.quant||"GGUF"}),g.jsx("span",{children:"•"}),g.jsx("span",{children:va(s.current.size_bytes||0)})]})]}),s.update_available&&s.recommended?g.jsxs("button",{onClick:()=>Se(s.recommended.repo),className:qe("h-8 px-3 shrink-0 flex items-center justify-center gap-1.5 rounded-lg text-[10px] font-bold uppercase transition-all cursor-pointer shadow-md",s.budget&&!s.budget.fits?"bg-red-500 text-white hover:bg-red-400 shadow-red-500/10":"bg-amber-500 text-black hover:bg-amber-400 shadow-amber-500/10"),children:[g.jsx(Eg,{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(Ps,{className:"h-4 w-4"})," Neueste Generation"]})]}),s.update_available&&s.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:s.recommended.name.replace(/-GGUF$/i,"")}),"(v",s.recommended.version,", ",s.recommended.params_b,"B) — von NousResearch."]}),s.budget&&g.jsxs("div",{className:qe("text-[10px] flex items-start gap-1.5 leading-relaxed",s.budget.fits?"text-muted-foreground/80":"text-red-400 font-semibold"),children:[g.jsx(Q0,{className:"h-3 w-3 shrink-0 mt-0.5"}),g.jsxs("span",{children:["Always-On-Brain ~",s.budget.brain_gb," GB + größtes on-demand (~",s.budget.largest_ondemand_gb," GB) = ",(s.budget.brain_gb+s.budget.largest_ondemand_gb).toFixed(1)," / ",s.budget.gtt_gb," GB",s.budget.fits?" · passt gleichzeitig ✓":" · passt NICHT gleichzeitig ⚠ — heavy/coder würden das Brain verdrängen. Kleineres Brain oder weniger Kontext."]})]})]}),g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[g.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",ce.length," von ",x.length,")"]}),g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[g.jsx("button",{onClick:()=>ee("all"),className:qe("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",pe==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),g.jsx("button",{onClick:()=>ee("in_use"),className:qe("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",pe==="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:()=>re("grid"),className:qe("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",te==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),g.jsx("button",{onClick:()=>re("list"),className:qe("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",te==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),te==="grid"?g.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:ce.length===0?g.jsx("div",{className:"col-span-full text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:pe==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):ce.map(de=>{const De=S.includes(de.name),K=i==null?void 0:i.model_list.find(xe=>xe.role===de.role),H=B3(de.name);return g.jsxs("div",{className:qe("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",De?"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:qe("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",H.color),title:H.name,children:H.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"}),De&&g.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[g.jsx(EP,{className:"h-3 w-3 animate-pulse"})," Warm"]}),de.role&&g.jsx(hh,{role:de.role,dense:!0}),y(de.role)&&g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-background/40 border border-border/40 text-[9px] font-semibold text-muted-foreground",title:"Lebenswichtig für Lucy — geschützt vor Löschen/Entladen.",children:"🔒 geschützt"}),p&&C(de.name)&&g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-fuchsia-500/10 border border-fuchsia-500/30 text-[9px] font-mono text-fuchsia-300 font-bold uppercase",title:"Ko-resident in der brains-Gruppe — bleibt mit dem Hirn gemeinsam warm, verdrängt es nicht.",children:"🧠 Ko-resident"}),p&&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"}),p&&(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),p&&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(V3,{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(Q0,{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:va(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(x9,{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:Dk(de.ctx)})]})]})]}),K&&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: ",K.repo.split("/").pop()]})]}),g.jsxs("button",{onClick:()=>Me(K.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(Eg,{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:[(()=>{const xe=y(de.role),je=De&&xe,Oe=de.incomplete&&!De||je;return g.jsx("button",{onClick:()=>De?Z(de.name):J(de.name),disabled:Oe,title:je?`„${Ss(de.role).label}" bleibt geladen (geschützt).`:void 0,className:qe("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center justify-center gap-1",Oe?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":De?"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:je?"🔒 geladen":De?"Entladen":"Laden"})})(),p&&g.jsx("button",{onClick:()=>se(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"}),p&&M&&g.jsx("button",{onClick:()=>N(de.name),className:qe("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer",C(de.name)?"border-fuchsia-500/40 bg-fuchsia-500/10 text-fuchsia-300 hover:bg-fuchsia-500/20":"border-border/40 text-muted-foreground hover:bg-accent"),title:C(de.name)?"Ko-resident (brains): bleibt mit dem Hirn gemeinsam warm. Klick = aus der Gruppe nehmen.":"Zur brains-Gruppe hinzufügen — lädt dann ko-resident neben dem Hirn, statt es zu verdrängen.",children:"🧠"}),p&&g.jsxs("button",{onClick:()=>X(de),className:qe("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(Md,{className:"h-3 w-3"})," Spec"]}),g.jsx("button",{onClick:()=>le(de.name),disabled:y(de.role),className:qe("h-7 w-7 rounded-lg border border-border/40 flex items-center justify-center transition-colors",y(de.role)?"text-muted-foreground/40 cursor-not-allowed":"text-muted-foreground hover:text-red-400 hover:bg-red-500/5 cursor-pointer"),"aria-label":"Modell löschen",title:y(de.role)?`„${Ss(de.role).label}" ist geschützt und kann nicht gelöscht werden.`:"Modell löschen",children:g.jsx(FT,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]})]})]},de.name)})}):g.jsx("div",{className:"space-y-2",children:ce.length===0?g.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:pe==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):ce.map(de=>{const De=S.includes(de.name),K=B3(de.name);return g.jsxs("div",{className:qe("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",De?"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:qe("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",K.color),title:K.name,children:K.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(hh,{role:de.role,dense:!0,className:"shrink-0"}),y(de.role)&&g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-background/40 border border-border/40 text-[8px] font-semibold text-muted-foreground shrink-0",title:"Lebenswichtig für Lucy — geschützt vor Löschen/Entladen.",children:"🔒 geschützt"}),p&&C(de.name)&&g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-fuchsia-500/10 border border-fuchsia-500/30 text-[8px] font-mono text-fuchsia-300 font-bold uppercase shrink-0",title:"Ko-resident in der brains-Gruppe — bleibt mit dem Hirn gemeinsam warm.",children:"🧠 Ko-resident"}),p&&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"}),p&&(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),p&&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"}),De&&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: ",va(de.size_bytes)]}),g.jsx("span",{children:"•"}),g.jsxs("span",{children:["Kontext: ",Dk(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(V3,{caps:de.capabilities})}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[(()=>{const H=y(de.role),xe=De&&H,je=de.incomplete&&!De||xe;return g.jsx("button",{onClick:()=>De?Z(de.name):J(de.name),disabled:je,title:xe?`„${Ss(de.role).label}" bleibt geladen (geschützt).`:void 0,className:qe("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center gap-1",je?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":De?"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:xe?"🔒 geladen":De?"Entladen":"Laden"})})(),p&&g.jsx("button",{onClick:()=>se(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"}),p&&M&&g.jsx("button",{onClick:()=>N(de.name),className:qe("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer",C(de.name)?"border-fuchsia-500/40 bg-fuchsia-500/10 text-fuchsia-300 hover:bg-fuchsia-500/20":"border-border/40 text-muted-foreground hover:bg-accent"),title:C(de.name)?"Ko-resident (brains): bleibt mit dem Hirn gemeinsam warm. Klick = aus der Gruppe nehmen.":"Zur brains-Gruppe hinzufügen — lädt dann ko-resident neben dem Hirn, statt es zu verdrängen.",children:"🧠"}),p&&g.jsxs("button",{onClick:()=>X(de),className:qe("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(Md,{className:"h-3 w-3"})," Spec"]}),g.jsx("button",{onClick:()=>le(de.name),disabled:y(de.role),className:qe("h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 transition-all",y(de.role)?"text-muted-foreground/40 cursor-not-allowed":"text-muted-foreground hover:text-red-400 hover:bg-red-500/5 cursor-pointer"),"aria-label":"Modell löschen",title:y(de.role)?`„${Ss(de.role).label}" ist geschützt und kann nicht gelöscht werden.`:"Modell löschen",children:g.jsx(FT,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]})]})]},de.name)})})]}),D&&(()=>{var xe,je;const de=V&&V.role===D?V:null,De={};de==null||de.models.forEach(Oe=>{De[Oe.name]=Oe});const K=de?de.models.map(Oe=>x.find(Fe=>Fe.name===Oe.name)).filter(Boolean):x,H=Oe=>{W(D,Oe),F(null)};return g.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4 overscroll-contain",role:"dialog","aria-modal":"true","aria-label":`${Ss(D).label} konfigurieren`,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(hh,{role:D})," festlegen"]}),g.jsx("button",{onClick:()=>F(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(kl,{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 ",g.jsx("strong",{className:"text-foreground",children:Ss(D).label}),g.jsx("span",{className:"block text-[10px] text-muted-foreground/70 mt-0.5",children:Ss(D).desc})]}),(de==null?void 0:de.recommended)&&g.jsxs("button",{onClick:()=>H(de.recommended),title:(xe=De[de.recommended])==null?void 0:xe.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(Md,{className:"h-3 w-3"})," Auto: ",(je=de.recommended.split("/").pop())==null?void 0:je.replace(/\.gguf$/i,"")]})]}),g.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[y(D)?g.jsx("div",{className:"w-full px-3 py-2 rounded-lg text-[11px] text-muted-foreground border border-border/30 bg-background/20 flex items-center gap-1.5",children:"🔒 Diese Rolle ist lebenswichtig und kann nicht leer bleiben — wähle stattdessen ein anderes Modell."}):g.jsx("button",{onClick:()=>H(""),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"})}),K.map(Oe=>{var zt;const Fe=De[Oe.name],xt=Oe.role===D,rt=!!(Fe!=null&&Fe.recommended),ft=!!Fe&&!Fe.suitable;return g.jsxs("button",{onClick:()=>H(Oe.name),className:qe("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",rt?"border-primary/50 bg-primary/10":xt?"text-primary font-bold bg-primary/5 border-primary/30":ft?"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:[(zt=Oe.name.split("/").pop())==null?void 0:zt.replace(/\.gguf$/i,""),rt&&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:Fe?`${Fe.params_b}B · ${Oe.quant} · ${Fe.reason}`:`${va(Oe.size_bytes)} · ${Oe.quant}`})]}),xt&&g.jsx(Ps,{className:"h-4 w-4 shrink-0 text-primary"})]},Oe.name)})]})]})})})(),U&&g.jsx(phe,{model:U,onClose:()=>X(null),onChanged:b}),f]})}const bhe=[{key:"popular",label:"Beliebt",q:""},{key:"coder",label:"Coder",q:"coder"},{key:"vision",label:"Vision",q:"vision"},{key:"reasoning",label:"Reasoning",q:"reasoning"},{key:"small",label:"Klein (≤4B)",q:"3B"}],_he=["fast","heavy","coder","vision","hermes","scout"],whe=new Intl.NumberFormat(void 0,{notation:"compact",maximumFractionDigits:1});function W3(t){return whe.format(t)}function She(){const{data:t}=Od(),e=(t==null?void 0:t.models)??[],[n,r]=P.useState(""),[i,s]=P.useState([]),[a,o]=P.useState(!1),[l,c]=P.useState(""),[d,f]=P.useState("popular"),[p,y]=P.useState(""),[x,S]=P.useState(null),[w,b]=P.useState([]),[M,T]=P.useState("Q4_K_M"),[C,L]=P.useState(""),[N,D]=P.useState(null),[F,V]=P.useState(!1),[I,U]=P.useState({});async function X(W){o(!0),c("");try{const oe=await Pt(`/api/hf/search?q=${encodeURIComponent(W)}`);s(oe.results),oe.results.length||c("Keine Ergebnisse.")}catch(oe){c(`Suche fehlgeschlagen: ${oe}`)}finally{o(!1)}}P.useEffect(()=>{X("")},[]);function te(W){f(W.key),r(""),X(W.q)}function re(){f(""),X(n)}async function pe(W,oe,se){V(!1);try{const le=await Pt(`/api/fit?params_b=0&quant=${encodeURIComponent(oe)}&ctx=8192&name=${encodeURIComponent(W)}&role=${encodeURIComponent(se)}`);D(le)}catch{D(null)}}async function ee(W){if(x===W){S(null);return}S(W),b([]),D(null),L(""),V(!1),c("Analysiere Repository…");try{const oe=await Pt(`/api/hf/quants?repo=${encodeURIComponent(W)}`);b(oe.quants);const se=oe.quants.includes("Q4_K_M")?"Q4_K_M":oe.quants[0]||"Q4_K_M";T(se),c(oe.quants.length?"":"Keine GGUF-Dateien in diesem Repo gefunden."),oe.quants.length&&pe(oe.repo,se,"")}catch(oe){c(`Fehler: ${oe}`)}}function ce(){const W=p.trim();W&&(s(oe=>oe.some(se=>se.repo===W)?oe:[{repo:W,downloads:0,likes:0},...oe]),y(""),ee(W))}const B=C?e.find(W=>(W.role||"").toLowerCase()===C):void 0;async function J(W){if((N==null?void 0:N.fit.level)==="too_tight"&&!F){V(!0);return}U(oe=>({...oe,[W]:"Starte…"}));try{await Pt("/api/models/install",{method:"POST",body:JSON.stringify({repo:W,quant:M,role:C||void 0,jinja:!0})}),U(oe=>({...oe,[W]:"Download läuft"})),V(!1)}catch{U(se=>({...se,[W]:"Fehler"}))}}const Z=W=>{var se;const oe=((se=W.split("/").pop())==null?void 0:se.toLowerCase().replace(/-gguf$/i,""))||"";return oe.length>3&&e.some(le=>le.name.toLowerCase().includes(oe))},G=W=>W==="perfect"?"text-emerald-400 border-emerald-500/40 bg-emerald-500/10":W==="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-5",children:[g.jsxs("div",{className:"flex gap-2",children:[g.jsxs("div",{className:"relative flex-1",children:[g.jsx(w5,{className:"absolute left-3 top-2.5 h-4 w-4 text-muted-foreground"}),g.jsx("input",{value:n,onChange:W=>r(W.target.value),onKeyDown:W=>W.key==="Enter"&&re(),"aria-label":"HuggingFace durchsuchen",type:"search",spellCheck:!1,placeholder:"HuggingFace durchsuchen (z.B. Qwen Coder, Llama-3.1, gemma)…",className:"w-full h-10 pl-9 pr-3 rounded-xl border border-border/60 bg-background/40 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),g.jsx("button",{onClick:re,className:"h-10 px-5 rounded-xl bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all cursor-pointer",children:"Suchen"})]}),g.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:bhe.map(W=>g.jsxs("button",{onClick:()=>te(W),className:qe("flex items-center gap-1.5 rounded-full px-3 py-1.5 text-[11px] font-semibold transition-all cursor-pointer border",d===W.key?"bg-primary/15 text-primary border-primary/30":"border-border/50 text-muted-foreground hover:text-foreground hover:border-border"),children:[W.key==="popular"&&g.jsx(t9,{className:"h-3 w-3"}),W.label]},W.key))}),a?g.jsx("div",{className:"text-xs text-muted-foreground py-10 text-center",children:"Lade GGUF-Modelle von HuggingFace…"}):g.jsxs("div",{className:"space-y-2",children:[i.map(W=>{const oe=x===W.repo,se=Z(W.repo),le=W.repo.includes("/")?W.repo.split("/")[0]:"—",Me=W.repo.split("/").pop();return g.jsxs("div",{className:qe("rounded-xl border bg-card/45 backdrop-blur-md transition-all",oe?"border-primary/40 shadow-lg shadow-primary/5":"border-border/50 hover:border-primary/30"),children:[g.jsxs("button",{onClick:()=>ee(W.repo),className:"w-full flex items-center gap-3 p-3.5 text-left cursor-pointer",children:[g.jsxs("div",{className:"min-w-0 flex-1",children:[g.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[g.jsx("span",{className:"text-xs font-bold font-mono text-foreground truncate max-w-[280px]",title:W.repo,children:Me}),se&&g.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-1.5 py-0.5 rounded",children:[g.jsx(Ps,{className:"h-2.5 w-2.5"})," installiert"]})]}),g.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-3 mt-0.5 font-mono",children:[g.jsx("span",{children:le}),g.jsxs("span",{className:"flex items-center gap-1",children:[g.jsx(Eg,{className:"h-3 w-3"})," ",W3(W.downloads)]}),W.likes>0&&g.jsxs("span",{className:"flex items-center gap-1",children:[g.jsx(a9,{className:"h-3 w-3"})," ",W3(W.likes)]})]})]}),oe?g.jsx(x5,{className:"h-4 w-4 text-muted-foreground shrink-0"}):g.jsx(v5,{className:"h-4 w-4 text-muted-foreground shrink-0"})]}),oe&&g.jsx("div",{className:"border-t border-border/30 p-3.5 space-y-3",children:w.length===0?g.jsx("div",{className:"text-[11px] text-muted-foreground font-mono",children:l||"Lade Quants…"}):g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[g.jsx("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Quant"}),g.jsx("select",{value:M,onChange:Se=>{T(Se.target.value),pe(W.repo,Se.target.value,C)},"aria-label":"Quantisierung",className:"h-8 rounded-lg border border-border/60 bg-background/40 px-2 text-xs text-foreground font-semibold outline-none",children:w.map(Se=>g.jsx("option",{value:Se,className:"bg-popover text-foreground",children:Se},Se))}),g.jsx("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground ml-1",children:"Rolle"}),g.jsxs("select",{value:C,onChange:Se=>{L(Se.target.value),pe(W.repo,M,Se.target.value)},"aria-label":"Rolle",title:"Optional — bestimmt Auto-Konfiguration + setup-bewussten Kontext",className:"h-8 rounded-lg border border-border/60 bg-background/40 px-2 text-xs text-foreground font-semibold outline-none",children:[g.jsx("option",{value:"",className:"bg-popover text-foreground",children:"keine"}),_he.map(Se=>g.jsx("option",{value:Se,className:"bg-popover text-foreground",children:Se},Se))]}),g.jsx("button",{onClick:()=>J(W.repo),disabled:!!I[W.repo]&&I[W.repo]==="Download läuft",className:qe("h-8 px-3.5 ml-auto rounded-lg text-xs font-semibold transition-all cursor-pointer flex items-center gap-1.5",F?"bg-red-500 text-white hover:opacity-90":"bg-primary text-primary-foreground hover:opacity-90"),children:I[W.repo]?I[W.repo]:F?g.jsxs(g.Fragment,{children:[g.jsx(Yc,{className:"h-3.5 w-3.5"})," OOM — trotzdem laden"]}):g.jsxs(g.Fragment,{children:[g.jsx(Eg,{className:"h-3.5 w-3.5"})," Herunterladen"]})})]}),N&&g.jsxs("div",{className:qe("flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border px-3 py-2 text-[11px] font-medium",G(N.fit.level)),children:[g.jsx("span",{className:"font-bold uppercase tracking-wide",children:N.fit.text}),g.jsxs("span",{className:"font-mono opacity-90",children:["~",N.params_b,"B · ~",N.fit.req_gb," GB / ",N.sys_ram_gb," GB · ~",N.fit.tps," t/s"]}),N.fit.level!=="too_tight"?g.jsxs("span",{className:"font-mono opacity-80",children:["ctx → ",(N.assigned_ctx/1024).toFixed(0),"k"]}):g.jsx("span",{className:"opacity-90",children:"— passt nicht, würde beim Laden abstürzen (OOM)."})]}),B&&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] text-amber-400",children:[g.jsx(Yc,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),g.jsxs("span",{children:["Rolle ",g.jsxs("strong",{children:["„",C,'"']})," hält aktuell ",g.jsx("strong",{children:B.name.split("/").pop()})," — wird beim Download übernommen."]})]})]})})]},W.repo)}),!i.length&&!a&&g.jsx("div",{className:"text-xs text-muted-foreground py-10 text-center",children:l||"Keine Ergebnisse."})]}),g.jsxs("div",{className:"border-t border-border/30 pt-4 flex flex-col sm:flex-row gap-2 items-stretch sm:items-center",children:[g.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground shrink-0",children:"Direkt:"}),g.jsx("input",{value:p,onChange:W=>y(W.target.value),onKeyDown:W=>W.key==="Enter"&&ce(),"aria-label":"Repository oder URL direkt eingeben",spellCheck:!1,placeholder:"org/repo oder HF-URL (z.B. unsloth/Qwen2.5-Coder-7B-Instruct-GGUF)",className:"flex-1 h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground font-mono"}),g.jsx("button",{onClick:ce,className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer whitespace-nowrap",children:"Laden"})]})]})}const Mhe={fast:{title:"Schnelles Alltags-Hirn",desc:"Schnelle MoE-Antworten für Chat, Zusammenfassungen und alltägliche Aufgaben.",icon:Md},heavy:{title:"Schweres Reasoning",desc:"Große Modelle für komplexe Logik, Mathematik und tiefgründiges Planen.",icon:tp},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:l1},vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:c1},hermes:{title:"Lucys Hirn (Agent)",desc:"Lucys dauer-warmes Agent-Hirn mit Tool-Calling — bleibt ko-resident, lädt nie kalt nach.",icon:HW},scout:{title:"Multimodal-Allrounder",desc:"Multimodaler Allrounder für schnelle Antworten, Übersetzungen und Alltag.",icon:jT}};function Ehe(){const{data:t,isLoading:e,error:n}=AX(),{data:r}=Od(),{data:i}=OP(),s=(r==null?void 0:r.models)??[],a=n?String(n):"",[o,l]=P.useState({}),[c,d]=P.useState({}),[f,p]=P.useState("recommended");async function y(x,S,w,b){l(M=>({...M,[x]:"Starte..."}));try{await Pt("/api/models/install",{method:"POST",body:JSON.stringify({repo:x,role:S,quant:w,jinja:b})}),l(M=>({...M,[x]:"Download läuft"}))}catch{l(T=>({...T,[x]:"Fehler"}))}}return g.jsxs("div",{className:"space-y-6",children:[g.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 w-fit",children:[["recommended","Empfohlen"],["browse","Stöbern & Suchen"]].map(([x,S])=>g.jsx("button",{onClick:()=>p(x),className:qe("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide transition-all cursor-pointer",f===x?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:S},x))}),f==="browse"?g.jsx(She,{}):e?g.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):a||!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 (",a,")."]}):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(P9,{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=Mhe[x.role]||{title:x.title||x.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:AP},w=S.icon,b=s.find(D=>D.role===x.role),M=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=o[T.repo],L=x.models.filter(D=>D.repo!==x.recommended),N=!!c[x.role];return g.jsxs("div",{className:qe("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-5 transition-all duration-300 hover:border-primary/40",b?"border-border/60":"border-primary/20 shadow-primary/5"),children:[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]})]})]}),b?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:b?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:b.name,children:b.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: ",ZT(b.size_bytes||0)]}),g.jsx("span",{children:"•"}),g.jsxs("span",{children:["Quant: ",b.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(ahe,{fit:T.fit})})]})}),g.jsx("div",{className:"pt-1",children:b?M?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: ",M.repo.split("/").pop()]})]}),g.jsxs("button",{onClick:()=>y(M.repo,x.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!o[M.repo],className:"h-8 w-full flex items-center justify-center gap-1.5 rounded-lg bg-amber-500 text-black text-xs font-bold hover:bg-amber-400 disabled:opacity-50 transition-all cursor-pointer shadow-md shadow-amber-500/10",children:[g.jsx(Eg,{className:"h-3.5 w-3.5"}),o[M.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(Ps,{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:qe("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(Eg,{className:"h-3.5 w-3.5"}),C||"Optimales Modell einsetzen"]})})]}),L.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(x5,{className:"h-3 w-3"}):g.jsx(v5,{className:"h-3 w-3"}),g.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",L.length,")"]})]}),N&&g.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:L.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:!!o[D.repo],className:"h-6 px-2.5 rounded bg-background/40 hover:bg-background/80 border border-border/40 text-[9px] font-bold text-foreground transition-all cursor-pointer shrink-0 disabled:opacity-50",children:o[D.repo]||"Installieren"})]},D.repo))})]})]},x.role)})})]})]})}function Ahe(){const[t,e]=P.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:qe("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(hhe,{}),g.jsx("div",{className:"transition-all duration-300",children:t==="cockpit"?g.jsx(xhe,{}):g.jsx(Ehe,{})})]})}const The={cline:"cline_settings.json",cursor:"Settings → Models",opencode:"opencode.jsonc",zed:"settings.json",continue:"~/.continue/config.json",claude_code:"~/.zshrc / env"};function $3({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(Xg,{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($W,{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(qW,{className:"h-3 w-3"})," ",t.detail]})}function X3({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(Ps,{className:"h-3.5 w-3.5 text-emerald-400"}):g.jsx(UT,{className:"h-3.5 w-3.5"}),g.jsx("span",{children:r?"Kopiert":"Kopieren"})]})]}),g.jsx("pre",{className:qe("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 Che(){const[t,e]=P.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[n,r]=P.useState(localStorage.getItem("mc_mcp_path")||""),[i,s]=P.useState("cline"),[a,o]=P.useState(null),l=new URLSearchParams({host:t});n&&l.set("mcp_path",n);const{data:c,error:d}=CX(l.toString()),{data:f,isLoading:p}=PX(),y=d?String(d):"";function x(M){e(M),M&&localStorage.setItem("mc_host",M)}function S(M){r(M),localStorage.setItem("mc_mcp_path",M)}const w=c==null?void 0:c.tools[i];async function b(M,T){T&&(await navigator.clipboard.writeText(T),o(M),setTimeout(()=>o(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(l9,{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(a1,{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(Pd,{className:"h-3.5 w-3.5"})," Leitung 1 — Modell"]}),g.jsx($3,{line:f==null?void 0:f.gateway,loading:p})]}),g.jsx("div",{className:"mt-1 text-[11px] font-mono text-primary/80",children:"Gateway · :9001/v1 · Lanes chat / coding"})]})]}),g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx(a1,{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(tp,{className:"h-3.5 w-3.5"})," Leitung 2 — Gedächtnis"]}),g.jsx($3,{line:f==null?void 0:f.memory,loading:p})]}),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(i9,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),g.jsx("input",{value:t,onChange:M=>x(M.target.value),"aria-label":"Box LAN IP-Adresse",spellCheck:!1,placeholder:"z.B. 192.168.178.151",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),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(n9,{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:M=>S(M.target.value),"aria-label":"Lokaler MCP-Scriptpfad",spellCheck:!1,placeholder:"z.B. F:\\Coding Stuff\\mission-control-2\\mcp\\mcp_memory.py",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-violet-500/50 text-foreground"})]})]}),y&&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(([M,T])=>g.jsx("button",{onClick:()=>s(M),className:qe("rounded-lg px-3 py-1.5 text-[11px] font-semibold tracking-wide transition-all cursor-pointer",i===M?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"border border-border/50 text-muted-foreground hover:text-foreground"),children:T.label},M))}),w&&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(fk,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),g.jsx("span",{children:w.note})]}),g.jsx(X3,{tool:w,fileName:The[i]||"config.json",accent:"teal",copied:a==="model",onCopy:()=>b("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(fk,{className:"h-4 w-4 text-violet-400 shrink-0 mt-0.5"}),g.jsx("span",{children:c.memory.note})]}),g.jsx(X3,{tool:c.memory,fileName:"mcp.json",accent:"violet",copied:a==="memory",onCopy:()=>b("memory",c.memory.snippet)})]})]})]})}const Phe="modulepreload",Rhe=function(t){return"/"+t},q3={},Nhe=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let a=function(c){return Promise.all(c.map(d=>Promise.resolve(d).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=a(n.map(c=>{if(c=Rhe(c),c in q3)return;q3[c]=!0;const d=c.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":Phe,d||(p.as="script"),p.crossOrigin="",p.href=c,l&&p.setAttribute("nonce",l),document.head.appendChild(p),d)return new Promise((y,x)=>{p.addEventListener("load",y),p.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return i.then(a=>{for(const o of a||[])o.status==="rejected"&&s(o.reason);return e().catch(s)})};class khe extends P.Component{constructor(){super(...arguments);$s(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 Ihe=P.lazy(()=>Nhe(()=>import("./GraphView-BCeEWWkY.js"),[]).then(t=>({default:t.GraphView}))),Gb=["identity","knowledge","rules","events"],K3=new Set(["auto","agent","hermes"]),tA={identity:{label:"Identität",icon:N9,bg:"bg-cyan-500/10",text:"text-cyan-400"},knowledge:{label:"Wissen",icon:rg,bg:"bg-indigo-500/10",text:"text-indigo-400"},rules:{label:"Regeln",icon:w9,bg:"bg-violet-500/10",text:"text-violet-400"},events:{label:"Ereignisse",icon:KW,bg:"bg-amber-500/10",text:"text-amber-400"}},Y3={label:"Gedächtnis",icon:DT,text:"text-muted-foreground"},Lhe={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:
|
||
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 Ohe(){const[t,e]=P.useState(""),[n,r]=P.useState(""),[i,s]=P.useState(""),[a,o]=P.useState("knowledge"),[l,c]=P.useState(!1),[d,f]=P.useState(!1),[p,y]=P.useState("liste"),[x,S]=P.useState(!1),w=Bl(),{showAlert:b,showConfirm:M,dialogElement:T}=Ud(),{data:C=[]}=XT({}),{data:L=[],error:N}=XT({q:n,category:t}),{data:D}=wX(p==="graph"),F=N?String(N):"",V=()=>{w.invalidateQueries({queryKey:["memory"]}),w.invalidateQueries({queryKey:["memory-graph"]})},I=P.useMemo(()=>{const G=C.length,W=C.filter(oe=>K3.has(oe.source)).length;return{total:G,auto:W,manual:G-W,cats:new Set(C.map(oe=>oe.category)).size}},[C]),U=C.length===0,X=P.useMemo(()=>{const G=D??{nodes:[],edges:[]};if(!n.trim())return G;const W=n.toLowerCase(),oe=G.nodes.filter(le=>le.content.toLowerCase().includes(W)),se=new Set(oe.map(le=>le.id));return{nodes:oe,edges:G.edges.filter(le=>se.has(le.source)&&se.has(le.target))}},[D,n]),te=P.useMemo(()=>{const G={};return L.forEach(W=>{var oe;(G[oe=W.category]??(G[oe]=[])).push(W)}),G},[L]),re=P.useMemo(()=>L.filter(G=>!Gb.includes(G.category)),[L]);async function pe(){i.trim()&&(await Pt("/api/memory",{method:"POST",body:JSON.stringify({content:i,category:a,source:"ui"})}),s(""),S(!1),V())}function ee(G){M("Eintrag löschen?","Diesen Gedächtnis-Eintrag dauerhaft entfernen?",async()=>{try{await Pt(`/api/memory/${G}`,{method:"DELETE"}),V()}catch(W){b("Fehler",`Löschen fehlgeschlagen: ${W.message||W}`)}})}async function ce(){try{await navigator.clipboard.writeText(Z3),f(!0),setTimeout(()=>f(!1),1800)}catch{b("Kopieren fehlgeschlagen","Markiere den Prompt und kopiere ihn manuell (Strg+C).")}}function B(){ce(),window.dispatchEvent(new CustomEvent("mc-navigate",{detail:{view:"terminal"}}))}async function J(){c(!0);try{const G=await Pt("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if(G.duplicate_count===0){b("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}M("Deduplizierung bestätigen",`${G.duplicate_count} Dublette(n) in ${G.groups.length} Gruppe(n) gefunden. Entfernen?`,async()=>{try{await Pt("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),V()}catch(W){b("Fehler",`Fehler beim Löschen: ${W.message}`)}})}catch(G){b("Fehler",`Fehler bei der Deduplizierung: ${G.message}`)}finally{c(!1)}}const Z=({value:G,label:W,accent:oe})=>g.jsxs("span",{className:qe("flex items-center gap-1.5 text-[11px] rounded-lg px-2.5 py-1 border",oe==="auto"?"text-emerald-400 bg-emerald-500/[0.07] border-emerald-500/20":"text-muted-foreground bg-card/40 border-border/50"),children:[oe==="auto"&&g.jsx(oh,{className:"h-3 w-3"}),g.jsx("b",{className:qe("font-semibold",oe==="auto"?"":"text-foreground"),children:G})," ",W]});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:G=>r(G.target.value),"aria-label":"Gedächtnis durchsuchen",type:"search",placeholder:"Semantisch suchen…",className:"w-52 h-9 pl-8 pr-3 rounded-lg border border-border/60 bg-card/45 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),g.jsx(w5,{className:"absolute left-2.5 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),g.jsxs("button",{onClick:()=>S(G=>!G),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(d1,{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",f9,"Liste"],["graph",M9,"Graph"]].map(([G,W,oe])=>g.jsxs("button",{onClick:()=>y(G),className:qe("flex h-7 px-2.5 items-center gap-1.5 text-[11px] font-semibold rounded-md transition-all cursor-pointer",p===G?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[g.jsx(W,{className:"h-3.5 w-3.5"})," ",oe]},G))}),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","aria-label":"Duplikate bereinigen",title:"Deduplizieren",children:g.jsx(oh,{className:"h-4 w-4 text-primary","aria-hidden":"true"})})]})]}),!U&&g.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[g.jsx(Z,{value:I.total,label:"Fakten"}),g.jsx(Z,{value:I.auto,label:"auto gelernt",accent:"auto"}),g.jsx(Z,{value:I.manual,label:"manuell"}),g.jsx(Z,{value:I.cats,label:"Kategorien"}),g.jsxs("span",{className:"ml-auto text-[11px] text-muted-foreground/70 flex items-center gap-1.5",children:[g.jsx(oh,{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),"aria-label":"Schließen",className:"text-muted-foreground hover:text-foreground",children:g.jsx(kl,{className:"h-4 w-4","aria-hidden":"true"})})]}),g.jsx("textarea",{value:i,onChange:G=>s(G.target.value),rows:2,"aria-label":"Eintragstext",placeholder:"Eine Regel, Vorliebe oder einen stabilen Fakt über dich oder das Projekt…",className:"w-full resize-none rounded-xl border border-border/60 bg-background/30 p-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground leading-relaxed"}),g.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[g.jsx("select",{value:a,onChange:G=>o(G.target.value),"aria-label":"Kategorie",className:"h-8 rounded-lg border border-border/60 bg-background/50 px-2 text-xs outline-none font-semibold text-foreground cursor-pointer",children:Gb.map(G=>{var W;return g.jsx("option",{value:G,className:"bg-popover text-foreground",children:((W=tA[G])==null?void 0:W.label)||G},G)})}),g.jsxs("button",{onClick:pe,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer",children:[g.jsx(d1,{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(m9,{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:ce,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(Ps,{className:"h-3 w-3 text-emerald-400"})," Kopiert"]}):g.jsxs(g.Fragment,{children:[g.jsx(UT,{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: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(M5,{className:"h-4 w-4"})," Im Terminal starten"]}),g.jsxs("button",{onClick:ce,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(Ps,{className:"h-4 w-4 text-emerald-400"}):g.jsx(UT,{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(S9,{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"}),"."]})]}):p==="graph"?g.jsx(khe,{children:g.jsx(P.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(Ihe,{data:X,onDelete:ee})})}):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:qe("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"}),Gb.map(G=>{const W=tA[G]||Y3,oe=W.icon;return g.jsxs("button",{onClick:()=>e(G),className:qe("h-7 px-2.5 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer flex items-center gap-1",t===G?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[g.jsx(oe,{className:"h-3 w-3"})," ",W.label]},G)})]}),L.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:[...Gb,"__other"].map(G=>{const W=G==="__other"?re:te[G]||[];if(!W.length)return null;const oe=tA[G]||Y3,se=oe.icon;return g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-2 px-1",children:[g.jsx(se,{className:qe("h-3.5 w-3.5",oe.text)}),g.jsx("span",{className:qe("text-[11px] font-bold uppercase tracking-wider",oe.text),children:oe.label}),g.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/60 bg-card/50 rounded px-1.5 py-0.5",children:W.length}),g.jsx("div",{className:"ml-1 h-px flex-1 bg-border/30"})]}),g.jsx("div",{className:"space-y-2",children:W.map(le=>{const Me=K3.has(le.source);return g.jsxs("div",{className:qe("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",Lhe[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:qe("flex items-center gap-1 text-[9px] font-mono px-1.5 py-0.5 rounded",Me?"text-emerald-400 bg-emerald-500/10":"text-muted-foreground/60 bg-background/20"),title:Me?"Automatisch gelernt":"Manuell angelegt",children:[Me&&g.jsx(oh,{className:"h-2.5 w-2.5"}),le.source]}),g.jsx("button",{onClick:()=>ee(le.id),"aria-label":"Eintrag löschen",title:"Eintrag löschen",className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all opacity-0 group-hover:opacity-100",children:g.jsx(FT,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]})]},le.id)})})]},G)})})]}),T]})}const Dhe=["chat","coding","fast","heavy"];function jhe(){const{data:t,error:e}=LP(5e3),{data:n}=Od(),{showAlert:r,dialogElement:i}=Ud(),s=Bl(),a=e?String(e):"",[o,l]=P.useState(!1),c=(n==null?void 0:n.models)??[];async function d(p){try{await Pt("/api/agent/brain",{method:"POST",body:JSON.stringify({model:p})}),r("Erledigt",`Hermes-Hirn zeigt jetzt auf das Alias '${p}'. Der Gateway-Dienst wurde neu gestartet.`),s.invalidateQueries({queryKey:kn.agentStatus}),l(!1)}catch(y){r("Fehler",`Wechsel fehlgeschlagen: ${y.message||y}`)}}async function f(p){try{await Pt("/api/agent/brain/set",{method:"POST",body:JSON.stringify({model_id:p})}),r("Erledigt","Agent-Hirn gewechselt (warm gehalten). Gateway wurde neugestartet."),s.invalidateQueries({queryKey:kn.agentStatus}),s.invalidateQueries({queryKey:kn.models}),l(!1)}catch(y){r("Fehler",`Wechsel fehlgeschlagen: ${y.message||y}`)}}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:"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:Pg(t.terminal_url),target:"_blank",rel:"noopener",className:qe("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(Ag,{className:"h-4 w-4"}),g.jsx("span",{children:"Terminal öffnen"})]})]}),a&&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 (",a,")."]}),t&&g.jsxs("div",{className:"space-y-6",children:[g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10",children:[g.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[g.jsx(Nl,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Agent-Fluss"})]}),g.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-stretch gap-3",children:[g.jsxs("button",{onClick:()=>t.terminal_reachable&&window.open(Pg(t.terminal_url),"_blank"),title:t.terminal_reachable?"Hermes-Terminal öffnen":"Terminal offline",className:"lg:w-40 shrink-0 rounded-xl border border-border/60 bg-background/30 p-3 text-left hover:border-primary/40 transition-all cursor-pointer flex flex-col justify-center",children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx(EP,{className:qe("h-3.5 w-3.5",t.terminal_reachable?"text-emerald-400":"text-amber-500")}),g.jsx("span",{className:"text-xs font-semibold text-foreground",children:"Terminal"}),g.jsx("span",{className:qe("ml-auto h-1.5 w-1.5 rounded-full animate-pulse",t.terminal_reachable?"bg-emerald-500":"bg-amber-500")})]}),g.jsx("span",{className:"text-[10px] text-muted-foreground font-mono mt-0.5",children:"hermes chat · Clients"})]}),g.jsx("div",{className:"hidden lg:flex items-center text-muted-foreground text-lg select-none",children:"→"}),g.jsxs("div",{className:"flex-1 flex flex-col gap-2.5",children:[g.jsxs("div",{className:"rounded-xl border border-primary/40 bg-primary/5 px-3.5 py-2.5 flex items-center gap-2",children:[g.jsx(Nl,{className:"h-3.5 w-3.5 text-primary"}),g.jsx("span",{className:"text-xs font-semibold text-primary",children:"Agent Gateway"}),g.jsx("span",{className:"text-[11px] font-mono text-muted-foreground",children:":8642"}),g.jsxs("span",{className:qe("ml-auto inline-flex items-center gap-1.5 text-[10px] font-bold uppercase font-mono px-2 py-0.5 rounded-full border",t.gateway_reachable?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-red-500/10 text-red-400 border-red-500/20"),children:[g.jsx("span",{className:qe("h-1.5 w-1.5 rounded-full",t.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-red-500")}),t.gateway_reachable?"online":"offline"]})]}),g.jsxs("div",{className:"grid gap-2.5 sm:grid-cols-3",children:[g.jsxs("button",{onClick:()=>l(!0),className:"rounded-xl border border-border/60 bg-background/30 p-3 text-left hover:border-primary/45 transition-all cursor-pointer",children:[g.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[g.jsx(Pd,{className:"h-3.5 w-3.5 text-primary"}),g.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Hirn"}),g.jsx("span",{className:"ml-auto text-[9px] text-primary/70 font-bold uppercase",children:"wechseln →"})]}),g.jsx("div",{className:"text-[11px] font-mono font-medium text-foreground truncate mt-1",title:t.brain_model,children:t.brain_model||"chat"})]}),g.jsxs("div",{className:"rounded-xl border border-border/60 bg-background/30 p-3",children:[g.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[g.jsx(eS,{className:"h-3.5 w-3.5 text-primary"}),g.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Verdrahtung"})]}),g.jsxs("div",{className:"text-[10px] font-mono mt-1 flex flex-wrap gap-x-2 text-muted-foreground",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:"rounded-xl border border-border/60 bg-background/30 p-3",children:[g.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[g.jsx(hk,{className:"h-3.5 w-3.5 text-primary"}),g.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"PC"}),g.jsx("span",{className:qe("ml-auto h-1.5 w-1.5 rounded-full",t.pc_executor_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")})]}),g.jsxs("div",{className:qe("text-[11px] font-mono mt-1",t.pc_executor_reachable?"text-emerald-400":"text-muted-foreground"),children:[":7777 ",t.pc_executor_reachable?"verbunden":"offline"]})]})]})]})]})]}),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(hk,{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:qe("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(rg,{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&&o&&g.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4 overscroll-contain",role:"dialog","aria-modal":"true","aria-label":"Hermes-Hirn konfigurieren",children: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(Pd,{className:"h-4 w-4"}),g.jsx("span",{children:"Hermes-Hirn konfigurieren"})]}),g.jsx("button",{onClick:()=>l(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(kl,{className:"h-4 w-4"})})]}),g.jsxs("div",{className:"space-y-1.5",children:[g.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Lane / Gateway-Alias"}),g.jsx("div",{className:"flex flex-wrap gap-1.5",children:Dhe.map(p=>{const y=t.brain_model===p;return g.jsxs("button",{onClick:()=>d(p),className:qe("px-3 py-1.5 rounded-lg text-xs font-mono font-semibold border transition-all cursor-pointer flex items-center gap-1.5",y?"border-primary/40 bg-primary/10 text-primary":"border-border/30 bg-background/20 text-foreground hover:bg-accent"),children:[p,y&&g.jsx(Ps,{className:"h-3.5 w-3.5"})]},p)})}),g.jsxs("p",{className:"text-[10px] text-muted-foreground/70",children:["Schlank & flexibel: das Hirn folgt dem Lane-Routing (z.B. ",g.jsx("code",{className:"text-primary",children:"chat"})," = fast↔heavy)."]})]}),g.jsxs("div",{className:"space-y-1.5",children:[g.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Installiertes Modell (warm gehalten)"}),g.jsx("div",{className:"space-y-1.5 max-h-56 overflow-y-auto pr-1",children:c.map(p=>{var x;const y=p.role==="hermes";return g.jsxs("button",{onClick:()=>!y&&f(p.name),disabled:y||p.incomplete,className:qe("w-full text-left px-3 py-2.5 rounded-lg text-xs flex items-center justify-between font-mono border transition-all",y?"border-indigo-500/40 bg-indigo-500/10 text-indigo-300":p.incomplete?"border-border/20 bg-background/10 text-muted-foreground/50 cursor-not-allowed":"border-border/30 bg-background/20 text-foreground hover:bg-accent cursor-pointer"),children:[g.jsxs("div",{className:"flex flex-col min-w-0",children:[g.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:(x=p.name.split("/").pop())==null?void 0:x.replace(/\.gguf$/i,"")}),g.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[p.capabilities.params_b?`${p.capabilities.params_b}B`:"?"," · ",p.capabilities.tools!=="no"?"Tools ✓":"ohne Tools",p.role&&` · Rolle: ${p.role}`]})]}),y?g.jsxs("span",{className:"text-[9px] font-bold uppercase text-indigo-300 shrink-0 flex items-center gap-1",children:[g.jsx(Ps,{className:"h-3.5 w-3.5"})," Aktiv"]}):g.jsx("span",{className:"text-[9px] font-bold uppercase text-primary/70 shrink-0",children:"Warm setzen →"})]},p.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. Neues Modell? Erst über „Modell-Manager → Modelle finden" laden.']})]})]})}),i]})}function Uhe(){const{data:t}=LP(5e3),e=t!=null&&t.terminal_url?Pg(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(Ag,{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(Yc,{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(S5,{className:"mr-2 h-4 w-4"})," Lade Terminal…"]})]})}/**
|
||
* @license
|
||
* Copyright 2010-2024 Three.js Authors
|
||
* SPDX-License-Identifier: MIT
|
||
*/const kd="169",eh={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},th={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},LV=0,$C=1,OV=2,Fhe=3,DV=0,KS=1,ny=2,Oo=3,Ul=0,as=1,_a=2,Xc=0,kh=1,XC=2,qC=3,KC=4,jV=5,hd=100,UV=101,FV=102,zV=103,BV=104,HV=200,VV=201,GV=202,WV=203,lw=204,cw=205,$V=206,XV=207,qV=208,KV=209,YV=210,ZV=211,QV=212,JV=213,e6=214,uw=0,dw=1,fw=2,$h=3,hw=4,pw=5,mw=6,gw=7,px=0,t6=1,n6=2,Cl=0,r6=1,i6=2,s6=3,mR=4,a6=5,o6=6,l6=7,YC="attached",c6="detached",YS=300,tu=301,Id=302,ky=303,Iy=304,ov=306,Ld=1e3,Sa=1001,Ug=1002,ri=1003,ZS=1004,zhe=1004,ph=1005,Bhe=1005,Pr=1006,cg=1007,Hhe=1007,qa=1008,Vhe=1008,Vo=1009,gR=1010,vR=1011,Fg=1012,QS=1013,nu=1014,ea=1015,lv=1016,JS=1017,eM=1018,Xh=1020,yR=35902,xR=1021,bR=1022,ss=1023,_R=1024,wR=1025,Ih=1026,qh=1027,tM=1028,mx=1029,SR=1030,nM=1031,Ghe=1032,rM=1033,ry=33776,iy=33777,sy=33778,ay=33779,vw=35840,yw=35841,xw=35842,bw=35843,_w=36196,ww=37492,Sw=37496,Mw=37808,Ew=37809,Aw=37810,Tw=37811,Cw=37812,Pw=37813,Rw=37814,Nw=37815,kw=37816,Iw=37817,Lw=37818,Ow=37819,Dw=37820,jw=37821,oy=36492,Uw=36494,Fw=36495,MR=36283,zw=36284,Bw=36285,Hw=36286,u6=2200,d6=2201,f6=2202,zg=2300,Bg=2301,Q_=2302,mh=2400,gh=2401,Ly=2402,iM=2500,ER=2501,h6=0,AR=1,Vw=2,p6=3200,m6=3201,Whe=3202,$he=3203,uu=0,g6=1,Uc="",Fi="srgb",xi="srgb-linear",sM="display-p3",gx="display-p3-linear",Oy="linear",er="srgb",Dy="rec709",jy="p3",Xhe=0,nh=7680,qhe=7681,Khe=7682,Yhe=7683,Zhe=34055,Qhe=34056,Jhe=5386,epe=512,tpe=513,npe=514,rpe=515,ipe=516,spe=517,ape=518,ZC=519,v6=512,y6=513,x6=514,TR=515,b6=516,_6=517,w6=518,S6=519,Uy=35044,M6=35048,ope=35040,lpe=35045,cpe=35049,upe=35041,dpe=35046,fpe=35050,hpe=35042,ppe="100",QC="300 es",El=2e3,Fy=2001;let Gl=class{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(n);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}};const Ji=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let Q3=1234567;const Lh=Math.PI/180,Hg=180/Math.PI;function Ea(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(Ji[t&255]+Ji[t>>8&255]+Ji[t>>16&255]+Ji[t>>24&255]+"-"+Ji[e&255]+Ji[e>>8&255]+"-"+Ji[e>>16&15|64]+Ji[e>>24&255]+"-"+Ji[n&63|128]+Ji[n>>8&255]+"-"+Ji[n>>16&255]+Ji[n>>24&255]+Ji[r&255]+Ji[r>>8&255]+Ji[r>>16&255]+Ji[r>>24&255]).toLowerCase()}function Tr(t,e,n){return Math.max(e,Math.min(n,t))}function CR(t,e){return(t%e+e)%e}function mpe(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)}function gpe(t,e,n){return t!==e?(n-t)/(e-t):0}function ly(t,e,n){return(1-n)*t+n*e}function vpe(t,e,n,r){return ly(t,e,1-Math.exp(-n*r))}function ype(t,e=1){return e-Math.abs(CR(t,e*2)-e)}function xpe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function bpe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function _pe(t,e){return t+Math.floor(Math.random()*(e-t+1))}function wpe(t,e){return t+Math.random()*(e-t)}function Spe(t){return t*(.5-Math.random())}function Mpe(t){t!==void 0&&(Q3=t);let e=Q3+=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 Epe(t){return t*Lh}function Ape(t){return t*Hg}function Tpe(t){return(t&t-1)===0&&t!==0}function Cpe(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Ppe(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function Rpe(t,e,n,r,i){const s=Math.cos,a=Math.sin,o=s(n/2),l=a(n/2),c=s((e+r)/2),d=a((e+r)/2),f=s((e-r)/2),p=a((e-r)/2),y=s((r-e)/2),x=a((r-e)/2);switch(i){case"XYX":t.set(o*d,l*f,l*p,o*c);break;case"YZY":t.set(l*p,o*d,l*f,o*c);break;case"ZXZ":t.set(l*f,l*p,o*d,o*c);break;case"XZX":t.set(o*d,l*x,l*y,o*c);break;case"YXY":t.set(l*y,o*d,l*x,o*c);break;case"ZYZ":t.set(l*x,l*y,o*d,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Ms(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function cn(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}const vr={DEG2RAD:Lh,RAD2DEG:Hg,generateUUID:Ea,clamp:Tr,euclideanModulo:CR,mapLinear:mpe,inverseLerp:gpe,lerp:ly,damp:vpe,pingpong:ype,smoothstep:xpe,smootherstep:bpe,randInt:_pe,randFloat:wpe,randFloatSpread:Spe,seededRandom:Mpe,degToRad:Epe,radToDeg:Ape,isPowerOfTwo:Tpe,ceilPowerOfTwo:Cpe,floorPowerOfTwo:Ppe,setQuaternionFromProperEuler:Rpe,normalize:cn,denormalize:Ms};class He{constructor(e=0,n=0){He.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const n=this.x,r=this.y,i=e.elements;return this.x=i[0]*n+i[3]*r+i[6],this.y=i[1]*n+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(Tr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y;return n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const r=Math.cos(n),i=Math.sin(n),s=this.x-e.x,a=this.y-e.y;return this.x=s*r-a*i+e.x,this.y=s*i+a*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Xt{constructor(e,n,r,i,s,a,o,l,c){Xt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,a,o,l,c)}set(e,n,r,i,s,a,o,l,c){const d=this.elements;return d[0]=e,d[1]=i,d[2]=o,d[3]=n,d[4]=s,d[5]=l,d[6]=r,d[7]=a,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],this}extractBasis(e,n,r){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,a=r[0],o=r[3],l=r[6],c=r[1],d=r[4],f=r[7],p=r[2],y=r[5],x=r[8],S=i[0],w=i[3],b=i[6],M=i[1],T=i[4],C=i[7],L=i[2],N=i[5],D=i[8];return s[0]=a*S+o*M+l*L,s[3]=a*w+o*T+l*N,s[6]=a*b+o*C+l*D,s[1]=c*S+d*M+f*L,s[4]=c*w+d*T+f*N,s[7]=c*b+d*C+f*D,s[2]=p*S+y*M+x*L,s[5]=p*w+y*T+x*N,s[8]=p*b+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],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8];return n*a*d-n*o*c-r*s*d+r*o*l+i*s*c-i*a*l}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],f=d*a-o*c,p=o*l-d*s,y=c*s-a*l,x=n*f+r*p+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]=(o*r-i*a)*S,e[3]=p*S,e[4]=(d*n-i*l)*S,e[5]=(i*s-o*n)*S,e[6]=y*S,e[7]=(r*l-c*n)*S,e[8]=(a*n-r*s)*S,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,r,i,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*a+c*o)+a+e,-i*c,i*l,-i*(-c*a+l*o)+o+n,0,0,1),this}scale(e,n){return this.premultiply(nA.makeScale(e,n)),this}rotate(e){return this.premultiply(nA.makeRotation(-e)),this}translate(e,n){return this.premultiply(nA.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 nA=new Xt;function E6(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const Npe={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Jm(t,e){return new Npe[t](e)}function zy(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function A6(){const t=zy("canvas");return t.style.display="block",t}const J3={};function J_(t){t in J3||(J3[t]=!0,console.warn(t))}function kpe(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 Ipe(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 Lpe(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 eD=new Xt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),tD=new Xt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),w0={[xi]:{transfer:Oy,primaries:Dy,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t,fromReference:t=>t},[Fi]:{transfer:er,primaries:Dy,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[gx]:{transfer:Oy,primaries:jy,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.applyMatrix3(tD),fromReference:t=>t.applyMatrix3(eD)},[sM]:{transfer:er,primaries:jy,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.convertSRGBToLinear().applyMatrix3(tD),fromReference:t=>t.applyMatrix3(eD).convertLinearToSRGB()}},Ope=new Set([xi,gx]),Nn={enabled:!0,_workingColorSpace:xi,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!Ope.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=w0[e].toReference,i=w0[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 w0[t].primaries},getTransfer:function(t){return t===Uc?Oy:w0[t].transfer},getLuminanceCoefficients:function(t,e=this._workingColorSpace){return t.fromArray(w0[e].luminanceCoefficients)}};function ug(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function rA(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let _m;class T6{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{_m===void 0&&(_m=zy("canvas")),_m.width=e.width,_m.height=e.height;const r=_m.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=_m}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=zy("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),s=i.data;for(let a=0;a<s.length;a++)s[a]=ug(s[a]/255)*255;return r.putImageData(i,0,0),n}else if(e.data){const n=e.data.slice(0);for(let r=0;r<n.length;r++)n instanceof Uint8Array||n instanceof Uint8ClampedArray?n[r]=Math.floor(ug(n[r]/255)*255):n[r]=ug(n[r]);return{data:n,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Dpe=0;class vh{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Dpe++}),this.uuid=Ea(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const r={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?s.push(iA(i[a].image)):s.push(iA(i[a]))}else s=iA(i);r.url=s}return n||(e.images[this.uuid]=r),r}}function iA(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?T6.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let jpe=0;class fr extends Gl{constructor(e=fr.DEFAULT_IMAGE,n=fr.DEFAULT_MAPPING,r=Sa,i=Sa,s=Pr,a=qa,o=ss,l=Vo,c=fr.DEFAULT_ANISOTROPY,d=Uc){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:jpe++}),this.uuid=Ea(),this.name="",this.source=new vh(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new He(0,0),this.repeat=new He(1,1),this.center=new He(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Xt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const r={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(r.userData=this.userData),n||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==YS)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ld:e.x=e.x-Math.floor(e.x);break;case Sa:e.x=e.x<0?0:1;break;case Ug: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 Ld:e.y=e.y-Math.floor(e.y);break;case Sa:e.y=e.y<0?0:1;break;case Ug:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}fr.DEFAULT_IMAGE=null;fr.DEFAULT_MAPPING=YS;fr.DEFAULT_ANISOTROPY=1;class On{constructor(e=0,n=0,r=0,i=1){On.prototype.isVector4=!0,this.x=e,this.y=n,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,r,i){return this.x=e,this.y=n,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,s=this.w,a=e.elements;return this.x=a[0]*n+a[4]*r+a[8]*i+a[12]*s,this.y=a[1]*n+a[5]*r+a[9]*i+a[13]*s,this.z=a[2]*n+a[6]*r+a[10]*i+a[14]*s,this.w=a[3]*n+a[7]*r+a[11]*i+a[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,r,i,s;const l=e.elements,c=l[0],d=l[4],f=l[8],p=l[1],y=l[5],x=l[9],S=l[2],w=l[6],b=l[10];if(Math.abs(d-p)<.01&&Math.abs(f-S)<.01&&Math.abs(x-w)<.01){if(Math.abs(d+p)<.1&&Math.abs(f+S)<.1&&Math.abs(x+w)<.1&&Math.abs(c+y+b-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const T=(c+1)/2,C=(y+1)/2,L=(b+1)/2,N=(d+p)/4,D=(f+S)/4,F=(x+w)/4;return T>C&&T>L?T<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(T),i=N/r,s=D/r):C>L?C<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(C),r=N/i,s=F/i):L<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(L),r=D/s,i=F/s),this.set(r,i,s,n),this}let M=Math.sqrt((w-x)*(w-x)+(f-S)*(f-S)+(p-d)*(p-d));return Math.abs(M)<.001&&(M=1),this.x=(w-x)/M,this.y=(f-S)/M,this.z=(p-d)/M,this.w=Math.acos((c+y+b-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this.w=Math.max(e.w,Math.min(n.w,this.w)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this.w=Math.max(e,Math.min(n,this.w)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this.w=e.w+(n.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class C6 extends Gl{constructor(e=1,n=1,r={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new On(0,0,e,n),this.scissorTest=!1,this.viewport=new On(0,0,e,n);const i={width:e,height:n,depth:1};r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Pr,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},r);const s=new fr(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace);s.flipY=!1,s.generateMipmaps=r.generateMipmaps,s.internalFormat=r.internalFormat,this.textures=[];const a=r.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0;this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.resolveDepthBuffer=r.resolveDepthBuffer,this.resolveStencilBuffer=r.resolveStencilBuffer,this.depthTexture=r.depthTexture,this.samples=r.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,n,r=1){if(this.width!==e||this.height!==n||this.depth!==r){this.width=e,this.height=n,this.depth=r;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=e,this.textures[i].image.height=n,this.textures[i].image.depth=r;this.dispose()}this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}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.textures.length=0;for(let r=0,i=e.textures.length;r<i;r++)this.textures[r]=e.textures[r].clone(),this.textures[r].isRenderTargetTexture=!0;const n=Object.assign({},e.texture.image);return this.texture.source=new vh(n),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Go extends C6{constructor(e=1,n=1,r={}){super(e,n,r),this.isWebGLRenderTarget=!0}}class aM extends fr{constructor(e=null,n=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:r,depth:i},this.magFilter=ri,this.minFilter=ri,this.wrapR=Sa,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Upe extends Go{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isWebGLArrayRenderTarget=!0,this.depth=r,this.texture=new aM(null,e,n,r),this.texture.isRenderTargetTexture=!0}}class PR extends fr{constructor(e=null,n=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:r,depth:i},this.magFilter=ri,this.minFilter=ri,this.wrapR=Sa,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Fpe extends Go{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isWebGL3DRenderTarget=!0,this.depth=r,this.texture=new PR(null,e,n,r),this.texture.isRenderTargetTexture=!0}}class qt{constructor(e=0,n=0,r=0,i=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=r,this._w=i}static slerpFlat(e,n,r,i,s,a,o){let l=r[i+0],c=r[i+1],d=r[i+2],f=r[i+3];const p=s[a+0],y=s[a+1],x=s[a+2],S=s[a+3];if(o===0){e[n+0]=l,e[n+1]=c,e[n+2]=d,e[n+3]=f;return}if(o===1){e[n+0]=p,e[n+1]=y,e[n+2]=x,e[n+3]=S;return}if(f!==S||l!==p||c!==y||d!==x){let w=1-o;const b=l*p+c*y+d*x+f*S,M=b>=0?1:-1,T=1-b*b;if(T>Number.EPSILON){const L=Math.sqrt(T),N=Math.atan2(L,b*M);w=Math.sin(w*N)/L,o=Math.sin(o*N)/L}const C=o*M;if(l=l*w+p*C,c=c*w+y*C,d=d*w+x*C,f=f*w+S*C,w===1-o){const L=1/Math.sqrt(l*l+c*c+d*d+f*f);l*=L,c*=L,d*=L,f*=L}}e[n]=l,e[n+1]=c,e[n+2]=d,e[n+3]=f}static multiplyQuaternionsFlat(e,n,r,i,s,a){const o=r[i],l=r[i+1],c=r[i+2],d=r[i+3],f=s[a],p=s[a+1],y=s[a+2],x=s[a+3];return e[n]=o*x+d*f+l*y-c*p,e[n+1]=l*x+d*p+c*f-o*y,e[n+2]=c*x+d*y+o*p-l*f,e[n+3]=d*x-o*f-l*p-c*y,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,r,i){return this._x=e,this._y=n,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,n=!0){const r=e._x,i=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(r/2),d=o(i/2),f=o(s/2),p=l(r/2),y=l(i/2),x=l(s/2);switch(a){case"XYZ":this._x=p*d*f+c*y*x,this._y=c*y*f-p*d*x,this._z=c*d*x+p*y*f,this._w=c*d*f-p*y*x;break;case"YXZ":this._x=p*d*f+c*y*x,this._y=c*y*f-p*d*x,this._z=c*d*x-p*y*f,this._w=c*d*f+p*y*x;break;case"ZXY":this._x=p*d*f-c*y*x,this._y=c*y*f+p*d*x,this._z=c*d*x+p*y*f,this._w=c*d*f-p*y*x;break;case"ZYX":this._x=p*d*f-c*y*x,this._y=c*y*f+p*d*x,this._z=c*d*x-p*y*f,this._w=c*d*f+p*y*x;break;case"YZX":this._x=p*d*f+c*y*x,this._y=c*y*f+p*d*x,this._z=c*d*x-p*y*f,this._w=c*d*f-p*y*x;break;case"XZY":this._x=p*d*f-c*y*x,this._y=c*y*f-p*d*x,this._z=c*d*x+p*y*f,this._w=c*d*f+p*y*x;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const r=n/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,r=n[0],i=n[4],s=n[8],a=n[1],o=n[5],l=n[9],c=n[2],d=n[6],f=n[10],p=r+o+f;if(p>0){const y=.5/Math.sqrt(p+1);this._w=.25/y,this._x=(d-l)*y,this._y=(s-c)*y,this._z=(a-i)*y}else if(r>o&&r>f){const y=2*Math.sqrt(1+r-o-f);this._w=(d-l)/y,this._x=.25*y,this._y=(i+a)/y,this._z=(s+c)/y}else if(o>f){const y=2*Math.sqrt(1+o-r-f);this._w=(s-c)/y,this._x=(i+a)/y,this._y=.25*y,this._z=(l+d)/y}else{const y=2*Math.sqrt(1+f-r-o);this._w=(a-i)/y,this._x=(s+c)/y,this._y=(l+d)/y,this._z=.25*y}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let r=e.dot(n)+1;return r<Number.EPSILON?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Tr(this.dot(e),-1,1)))}rotateTowards(e,n){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,n/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,n){const r=e._x,i=e._y,s=e._z,a=e._w,o=n._x,l=n._y,c=n._z,d=n._w;return this._x=r*d+a*o+i*c-s*l,this._y=i*d+a*l+s*o-r*c,this._z=s*d+a*c+r*l-i*o,this._w=a*d-r*o-i*l-s*c,this._onChangeCallback(),this}slerp(e,n){if(n===0)return this;if(n===1)return this.copy(e);const r=this._x,i=this._y,s=this._z,a=this._w;let o=a*e._w+r*e._x+i*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=r,this._y=i,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const y=1-n;return this._w=y*a+n*this._w,this._x=y*r+n*this._x,this._y=y*i+n*this._y,this._z=y*s+n*this._z,this.normalize(),this}const c=Math.sqrt(l),d=Math.atan2(c,o),f=Math.sin((1-n)*d)/c,p=Math.sin(n*d)/c;return this._w=a*f+this._w*p,this._x=r*f+this._x*p,this._y=i*f+this._y*p,this._z=s*f+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,n,r){return this.copy(e).slerp(n,r)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),s=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(n),s*Math.cos(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class q{constructor(e=0,n=0,r=0){q.prototype.isVector3=!0,this.x=e,this.y=n,this.z=r}set(e,n,r){return r===void 0&&(r=this.z),this.x=e,this.y=n,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(nD.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(nD.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[3]*r+s[6]*i,this.y=s[1]*n+s[4]*r+s[7]*i,this.z=s[2]*n+s[5]*r+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,s=e.elements,a=1/(s[3]*n+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*n+s[4]*r+s[8]*i+s[12])*a,this.y=(s[1]*n+s[5]*r+s[9]*i+s[13])*a,this.z=(s[2]*n+s[6]*r+s[10]*i+s[14])*a,this}applyQuaternion(e){const n=this.x,r=this.y,i=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*i-o*r),d=2*(o*n-s*i),f=2*(s*r-a*n);return this.x=n+l*c+a*f-o*d,this.y=r+l*d+o*c-s*f,this.z=i+l*f+s*d-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[4]*r+s[8]*i,this.y=s[1]*n+s[5]*r+s[9]*i,this.z=s[2]*n+s[6]*r+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const r=e.x,i=e.y,s=e.z,a=n.x,o=n.y,l=n.z;return this.x=i*l-s*o,this.y=s*a-r*l,this.z=r*o-i*a,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const r=e.dot(this)/n;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return sA.copy(this).projectOnVector(e),this.sub(sA)}reflect(e){return this.sub(sA.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(Tr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return n*n+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,n,r){const i=Math.sin(n)*e;return this.x=i*Math.sin(r),this.y=Math.cos(n)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,r){return this.x=e*Math.sin(n),this.y=r,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=r,this.z=i,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,n=Math.random()*2-1,r=Math.sqrt(1-n*n);return this.x=r*Math.cos(e),this.y=n,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const sA=new q,nD=new qt;class os{constructor(e=new q(1/0,1/0,1/0),n=new q(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,r=e.length;n<r;n+=3)this.expandByPoint(Ro.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,r=e.count;n<r;n++)this.expandByPoint(Ro.fromBufferAttribute(e,n));return this}setFromPoints(e){this.makeEmpty();for(let n=0,r=e.length;n<r;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const r=Ro.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e,n=!1){return this.makeEmpty(),this.expandByObject(e,n)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,n=!1){e.updateWorldMatrix(!1,!1);const r=e.geometry;if(r!==void 0){const s=r.getAttribute("position");if(n===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Ro):Ro.fromBufferAttribute(s,a),Ro.applyMatrix4(e.matrixWorld),this.expandByPoint(Ro);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Wb.copy(e.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),Wb.copy(r.boundingBox)),Wb.applyMatrix4(e.matrixWorld),this.union(Wb)}const i=e.children;for(let s=0,a=i.length;s<a;s++)this.expandByObject(i[s],n);return this}containsPoint(e){return e.x>=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,Ro),Ro.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(S0),$b.subVectors(this.max,S0),wm.subVectors(e.a,S0),Sm.subVectors(e.b,S0),Mm.subVectors(e.c,S0),Ku.subVectors(Sm,wm),Yu.subVectors(Mm,Sm),Lf.subVectors(wm,Mm);let n=[0,-Ku.z,Ku.y,0,-Yu.z,Yu.y,0,-Lf.z,Lf.y,Ku.z,0,-Ku.x,Yu.z,0,-Yu.x,Lf.z,0,-Lf.x,-Ku.y,Ku.x,0,-Yu.y,Yu.x,0,-Lf.y,Lf.x,0];return!aA(n,wm,Sm,Mm,$b)||(n=[1,0,0,0,1,0,0,0,1],!aA(n,wm,Sm,Mm,$b))?!1:(Xb.crossVectors(Ku,Yu),n=[Xb.x,Xb.y,Xb.z],aA(n,wm,Sm,Mm,$b))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ro).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ro).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:(Ec[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ec[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ec[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ec[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ec[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ec[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ec[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ec[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ec),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 Ec=[new q,new q,new q,new q,new q,new q,new q,new q],Ro=new q,Wb=new os,wm=new q,Sm=new q,Mm=new q,Ku=new q,Yu=new q,Lf=new q,S0=new q,$b=new q,Xb=new q,Of=new q;function aA(t,e,n,r,i){for(let s=0,a=t.length-3;s<=a;s+=3){Of.fromArray(t,s);const o=i.x*Math.abs(Of.x)+i.y*Math.abs(Of.y)+i.z*Math.abs(Of.z),l=e.dot(Of),c=n.dot(Of),d=r.dot(Of);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>o)return!1}return!0}const zpe=new os,M0=new q,oA=new q;class Hi{constructor(e=new q,n=-1){this.isSphere=!0,this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const r=this.center;n!==void 0?r.copy(n):zpe.setFromPoints(e).getCenter(r);let i=0;for(let s=0,a=e.length;s<a;s++)i=Math.max(i,r.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const n=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=n*n}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,n){const r=this.center.distanceToSquared(e);return n.copy(e),r>this.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;M0.subVectors(e,this.center);const n=M0.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),i=(r-this.radius)*.5;this.center.addScaledVector(M0,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):(oA.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(M0.copy(e.center).add(oA)),this.expandByPoint(M0.copy(e.center).sub(oA))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ac=new q,lA=new q,qb=new q,Zu=new q,cA=new q,Kb=new q,uA=new q;class lp{constructor(e=new q,n=new q(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Ac)),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=Ac.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(Ac.copy(this.origin).addScaledVector(this.direction,n),Ac.distanceToSquared(e))}distanceSqToSegment(e,n,r,i){lA.copy(e).add(n).multiplyScalar(.5),qb.copy(n).sub(e).normalize(),Zu.copy(this.origin).sub(lA);const s=e.distanceTo(n)*.5,a=-this.direction.dot(qb),o=Zu.dot(this.direction),l=-Zu.dot(qb),c=Zu.lengthSq(),d=Math.abs(1-a*a);let f,p,y,x;if(d>0)if(f=a*l-o,p=a*o-l,x=s*d,f>=0)if(p>=-x)if(p<=x){const S=1/d;f*=S,p*=S,y=f*(f+a*p+2*o)+p*(a*f+p+2*l)+c}else p=s,f=Math.max(0,-(a*p+o)),y=-f*f+p*(p+2*l)+c;else p=-s,f=Math.max(0,-(a*p+o)),y=-f*f+p*(p+2*l)+c;else p<=-x?(f=Math.max(0,-(-a*s+o)),p=f>0?-s:Math.min(Math.max(-s,-l),s),y=-f*f+p*(p+2*l)+c):p<=x?(f=0,p=Math.min(Math.max(-s,-l),s),y=p*(p+2*l)+c):(f=Math.max(0,-(a*s+o)),p=f>0?s:Math.min(Math.max(-s,-l),s),y=-f*f+p*(p+2*l)+c);else p=a>0?-s:s,f=Math.max(0,-(a*p+o)),y=-f*f+p*(p+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,f),i&&i.copy(lA).addScaledVector(qb,p),y}intersectSphere(e,n){Ac.subVectors(e.center,this.origin);const r=Ac.dot(this.direction),i=Ac.dot(Ac)-r*r,s=e.radius*e.radius;if(i>s)return null;const a=Math.sqrt(s-i),o=r-a,l=r+a;return l<0?null:o<0?this.at(l,n):this.at(o,n)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/n;return r>=0?r:null}intersectPlane(e,n){const r=this.distanceToPlane(e);return r===null?null:this.at(r,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let r,i,s,a,o,l;const c=1/this.direction.x,d=1/this.direction.y,f=1/this.direction.z,p=this.origin;return c>=0?(r=(e.min.x-p.x)*c,i=(e.max.x-p.x)*c):(r=(e.max.x-p.x)*c,i=(e.min.x-p.x)*c),d>=0?(s=(e.min.y-p.y)*d,a=(e.max.y-p.y)*d):(s=(e.max.y-p.y)*d,a=(e.min.y-p.y)*d),r>a||s>i||((s>r||isNaN(r))&&(r=s),(a<i||isNaN(i))&&(i=a),f>=0?(o=(e.min.z-p.z)*f,l=(e.max.z-p.z)*f):(o=(e.max.z-p.z)*f,l=(e.min.z-p.z)*f),r>l||o>i)||((o>r||r!==r)&&(r=o),(l<i||i!==i)&&(i=l),i<0)?null:this.at(r>=0?r:i,n)}intersectsBox(e){return this.intersectBox(e,Ac)!==null}intersectTriangle(e,n,r,i,s){cA.subVectors(n,e),Kb.subVectors(r,e),uA.crossVectors(cA,Kb);let a=this.direction.dot(uA),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Zu.subVectors(this.origin,e);const l=o*this.direction.dot(Kb.crossVectors(Zu,Kb));if(l<0)return null;const c=o*this.direction.dot(cA.cross(Zu));if(c<0||l+c>a)return null;const d=-o*Zu.dot(uA);return d<0?null:this.at(d/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Rt{constructor(e,n,r,i,s,a,o,l,c,d,f,p,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,a,o,l,c,d,f,p,y,x,S,w)}set(e,n,r,i,s,a,o,l,c,d,f,p,y,x,S,w){const b=this.elements;return b[0]=e,b[4]=n,b[8]=r,b[12]=i,b[1]=s,b[5]=a,b[9]=o,b[13]=l,b[2]=c,b[6]=d,b[10]=f,b[14]=p,b[3]=y,b[7]=x,b[11]=S,b[15]=w,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new 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/Em.setFromMatrixColumn(e,0).length(),s=1/Em.setFromMatrixColumn(e,1).length(),a=1/Em.setFromMatrixColumn(e,2).length();return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[3]=0,n[4]=r[4]*s,n[5]=r[5]*s,n[6]=r[6]*s,n[7]=0,n[8]=r[8]*a,n[9]=r[9]*a,n[10]=r[10]*a,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,r=e.x,i=e.y,s=e.z,a=Math.cos(r),o=Math.sin(r),l=Math.cos(i),c=Math.sin(i),d=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const p=a*d,y=a*f,x=o*d,S=o*f;n[0]=l*d,n[4]=-l*f,n[8]=c,n[1]=y+x*c,n[5]=p-S*c,n[9]=-o*l,n[2]=S-p*c,n[6]=x+y*c,n[10]=a*l}else if(e.order==="YXZ"){const p=l*d,y=l*f,x=c*d,S=c*f;n[0]=p+S*o,n[4]=x*o-y,n[8]=a*c,n[1]=a*f,n[5]=a*d,n[9]=-o,n[2]=y*o-x,n[6]=S+p*o,n[10]=a*l}else if(e.order==="ZXY"){const p=l*d,y=l*f,x=c*d,S=c*f;n[0]=p-S*o,n[4]=-a*f,n[8]=x+y*o,n[1]=y+x*o,n[5]=a*d,n[9]=S-p*o,n[2]=-a*c,n[6]=o,n[10]=a*l}else if(e.order==="ZYX"){const p=a*d,y=a*f,x=o*d,S=o*f;n[0]=l*d,n[4]=x*c-y,n[8]=p*c+S,n[1]=l*f,n[5]=S*c+p,n[9]=y*c-x,n[2]=-c,n[6]=o*l,n[10]=a*l}else if(e.order==="YZX"){const p=a*l,y=a*c,x=o*l,S=o*c;n[0]=l*d,n[4]=S-p*f,n[8]=x*f+y,n[1]=f,n[5]=a*d,n[9]=-o*d,n[2]=-c*d,n[6]=y*f+x,n[10]=p-S*f}else if(e.order==="XZY"){const p=a*l,y=a*c,x=o*l,S=o*c;n[0]=l*d,n[4]=-f,n[8]=c*d,n[1]=p*f+S,n[5]=a*d,n[9]=y*f-x,n[2]=x*f-y,n[6]=o*d,n[10]=S*f+p}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Bpe,e,Hpe)}lookAt(e,n,r){const i=this.elements;return pa.subVectors(e,n),pa.lengthSq()===0&&(pa.z=1),pa.normalize(),Qu.crossVectors(r,pa),Qu.lengthSq()===0&&(Math.abs(r.z)===1?pa.x+=1e-4:pa.z+=1e-4,pa.normalize(),Qu.crossVectors(r,pa)),Qu.normalize(),Yb.crossVectors(pa,Qu),i[0]=Qu.x,i[4]=Yb.x,i[8]=pa.x,i[1]=Qu.y,i[5]=Yb.y,i[9]=pa.y,i[2]=Qu.z,i[6]=Yb.z,i[10]=pa.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,a=r[0],o=r[4],l=r[8],c=r[12],d=r[1],f=r[5],p=r[9],y=r[13],x=r[2],S=r[6],w=r[10],b=r[14],M=r[3],T=r[7],C=r[11],L=r[15],N=i[0],D=i[4],F=i[8],V=i[12],I=i[1],U=i[5],X=i[9],te=i[13],re=i[2],pe=i[6],ee=i[10],ce=i[14],B=i[3],J=i[7],Z=i[11],G=i[15];return s[0]=a*N+o*I+l*re+c*B,s[4]=a*D+o*U+l*pe+c*J,s[8]=a*F+o*X+l*ee+c*Z,s[12]=a*V+o*te+l*ce+c*G,s[1]=d*N+f*I+p*re+y*B,s[5]=d*D+f*U+p*pe+y*J,s[9]=d*F+f*X+p*ee+y*Z,s[13]=d*V+f*te+p*ce+y*G,s[2]=x*N+S*I+w*re+b*B,s[6]=x*D+S*U+w*pe+b*J,s[10]=x*F+S*X+w*ee+b*Z,s[14]=x*V+S*te+w*ce+b*G,s[3]=M*N+T*I+C*re+L*B,s[7]=M*D+T*U+C*pe+L*J,s[11]=M*F+T*X+C*ee+L*Z,s[15]=M*V+T*te+C*ce+L*G,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[4],i=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],d=e[2],f=e[6],p=e[10],y=e[14],x=e[3],S=e[7],w=e[11],b=e[15];return x*(+s*l*f-i*c*f-s*o*p+r*c*p+i*o*y-r*l*y)+S*(+n*l*y-n*c*p+s*a*p-i*a*y+i*c*d-s*l*d)+w*(+n*c*f-n*o*y-s*a*f+r*a*y+s*o*d-r*c*d)+b*(-i*o*d-n*l*f+n*o*p+i*a*f-r*a*p+r*l*d)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=n,i[14]=r),this}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],f=e[9],p=e[10],y=e[11],x=e[12],S=e[13],w=e[14],b=e[15],M=f*w*c-S*p*c+S*l*y-o*w*y-f*l*b+o*p*b,T=x*p*c-d*w*c-x*l*y+a*w*y+d*l*b-a*p*b,C=d*S*c-x*f*c+x*o*y-a*S*y-d*o*b+a*f*b,L=x*f*l-d*S*l-x*o*p+a*S*p+d*o*w-a*f*w,N=n*M+r*T+i*C+s*L;if(N===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const D=1/N;return e[0]=M*D,e[1]=(S*p*s-f*w*s-S*i*y+r*w*y+f*i*b-r*p*b)*D,e[2]=(o*w*s-S*l*s+S*i*c-r*w*c-o*i*b+r*l*b)*D,e[3]=(f*l*s-o*p*s-f*i*c+r*p*c+o*i*y-r*l*y)*D,e[4]=T*D,e[5]=(d*w*s-x*p*s+x*i*y-n*w*y-d*i*b+n*p*b)*D,e[6]=(x*l*s-a*w*s-x*i*c+n*w*c+a*i*b-n*l*b)*D,e[7]=(a*p*s-d*l*s+d*i*c-n*p*c-a*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*b-n*f*b)*D,e[10]=(a*S*s-x*o*s+x*r*c-n*S*c-a*r*b+n*o*b)*D,e[11]=(d*o*s-a*f*s-d*r*c+n*f*c+a*r*y-n*o*y)*D,e[12]=L*D,e[13]=(d*S*i-x*f*i+x*r*p-n*S*p-d*r*w+n*f*w)*D,e[14]=(x*o*i-a*S*i-x*r*l+n*S*l+a*r*w-n*o*w)*D,e[15]=(a*f*i-d*o*i+d*r*l-n*f*l-a*r*p+n*o*p)*D,this}scale(e){const n=this.elements,r=e.x,i=e.y,s=e.z;return n[0]*=r,n[4]*=i,n[8]*=s,n[1]*=r,n[5]*=i,n[9]*=s,n[2]*=r,n[6]*=i,n[10]*=s,n[3]*=r,n[7]*=i,n[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(n,r,i))}makeTranslation(e,n,r){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,n,0,0,1,r,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,n,-r,0,0,r,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,0,r,0,0,1,0,0,-r,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,0,r,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const r=Math.cos(n),i=Math.sin(n),s=1-r,a=e.x,o=e.y,l=e.z,c=s*a,d=s*o;return this.set(c*a+r,c*o-i*l,c*l+i*o,0,c*o+i*l,d*o+r,d*l-i*a,0,c*l-i*o,d*l+i*a,s*l*l+r,0,0,0,0,1),this}makeScale(e,n,r){return this.set(e,0,0,0,0,n,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,n,r,i,s,a){return this.set(1,r,s,0,e,1,a,0,n,i,1,0,0,0,0,1),this}compose(e,n,r){const i=this.elements,s=n._x,a=n._y,o=n._z,l=n._w,c=s+s,d=a+a,f=o+o,p=s*c,y=s*d,x=s*f,S=a*d,w=a*f,b=o*f,M=l*c,T=l*d,C=l*f,L=r.x,N=r.y,D=r.z;return i[0]=(1-(S+b))*L,i[1]=(y+C)*L,i[2]=(x-T)*L,i[3]=0,i[4]=(y-C)*N,i[5]=(1-(p+b))*N,i[6]=(w+M)*N,i[7]=0,i[8]=(x+T)*D,i[9]=(w-M)*D,i[10]=(1-(p+S))*D,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,n,r){const i=this.elements;let s=Em.set(i[0],i[1],i[2]).length();const a=Em.set(i[4],i[5],i[6]).length(),o=Em.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],No.copy(this);const c=1/s,d=1/a,f=1/o;return No.elements[0]*=c,No.elements[1]*=c,No.elements[2]*=c,No.elements[4]*=d,No.elements[5]*=d,No.elements[6]*=d,No.elements[8]*=f,No.elements[9]*=f,No.elements[10]*=f,n.setFromRotationMatrix(No),r.x=s,r.y=a,r.z=o,this}makePerspective(e,n,r,i,s,a,o=El){const l=this.elements,c=2*s/(n-e),d=2*s/(r-i),f=(n+e)/(n-e),p=(r+i)/(r-i);let y,x;if(o===El)y=-(a+s)/(a-s),x=-2*a*s/(a-s);else if(o===Fy)y=-a/(a-s),x=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=d,l[9]=p,l[13]=0,l[2]=0,l[6]=0,l[10]=y,l[14]=x,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,n,r,i,s,a,o=El){const l=this.elements,c=1/(n-e),d=1/(r-i),f=1/(a-s),p=(n+e)*c,y=(r+i)*d;let x,S;if(o===El)x=(a+s)*f,S=-2*f;else if(o===Fy)x=s*f,S=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-p,l[1]=0,l[5]=2*d,l[9]=0,l[13]=-y,l[2]=0,l[6]=0,l[10]=S,l[14]=-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 Em=new q,No=new Rt,Bpe=new q(0,0,0),Hpe=new q(1,1,1),Qu=new q,Yb=new q,pa=new q,rD=new Rt,iD=new qt;class ls{constructor(e=0,n=0,r=0,i=ls.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,n,r,i=this._order){return this._x=e,this._y=n,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,n=this._order,r=!0){const i=e.elements,s=i[0],a=i[4],o=i[8],l=i[1],c=i[5],d=i[9],f=i[2],p=i[6],y=i[10];switch(n){case"XYZ":this._y=Math.asin(Tr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,y),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Tr(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,y),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Tr(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-f,y),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Tr(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(p,y),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(Tr(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(o,y));break;case"XZY":this._z=Math.asin(-Tr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-d,y),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,r){return rD.makeRotationFromQuaternion(e),this.setFromRotationMatrix(rD,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return iD.setFromEuler(this),this.setFromQuaternion(iD,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}ls.DEFAULT_ORDER="XYZ";class Oh{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Vpe=0;const sD=new q,Am=new qt,Tc=new Rt,Zb=new q,E0=new q,Gpe=new q,Wpe=new qt,aD=new q(1,0,0),oD=new q(0,1,0),lD=new q(0,0,1),cD={type:"added"},$pe={type:"removed"},Tm={type:"childadded",child:null},dA={type:"childremoved",child:null};class mn extends Gl{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Vpe++}),this.uuid=Ea(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=mn.DEFAULT_UP.clone();const e=new q,n=new ls,r=new qt,i=new q(1,1,1);function s(){r.setFromEuler(n,!1)}function a(){n.setFromQuaternion(r,void 0,!1)}n._onChange(s),r._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Rt},normalMatrix:{value:new Xt}}),this.matrix=new Rt,this.matrixWorld=new Rt,this.matrixAutoUpdate=mn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=mn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Oh,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,n){this.quaternion.setFromAxisAngle(e,n)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,n){return Am.setFromAxisAngle(e,n),this.quaternion.multiply(Am),this}rotateOnWorldAxis(e,n){return Am.setFromAxisAngle(e,n),this.quaternion.premultiply(Am),this}rotateX(e){return this.rotateOnAxis(aD,e)}rotateY(e){return this.rotateOnAxis(oD,e)}rotateZ(e){return this.rotateOnAxis(lD,e)}translateOnAxis(e,n){return sD.copy(e).applyQuaternion(this.quaternion),this.position.add(sD.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(aD,e)}translateY(e){return this.translateOnAxis(oD,e)}translateZ(e){return this.translateOnAxis(lD,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Tc.copy(this.matrixWorld).invert())}lookAt(e,n,r){e.isVector3?Zb.copy(e):Zb.set(e,n,r);const i=this.parent;this.updateWorldMatrix(!0,!1),E0.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Tc.lookAt(E0,Zb,this.up):Tc.lookAt(Zb,E0,this.up),this.quaternion.setFromRotationMatrix(Tc),i&&(Tc.extractRotation(i.matrixWorld),Am.setFromRotationMatrix(Tc),this.quaternion.premultiply(Am.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(cD),Tm.child=e,this.dispatchEvent(Tm),Tm.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.remove(arguments[r]);return this}const n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent($pe),dA.child=e,this.dispatchEvent(dA),dA.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Tc.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Tc.multiply(e.parent.matrixWorld)),e.applyMatrix4(Tc),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(cD),Tm.child=e,this.dispatchEvent(Tm),Tm.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,n){if(this[e]===n)return this;for(let r=0,i=this.children.length;r<i;r++){const a=this.children[r].getObjectByProperty(e,n);if(a!==void 0)return a}}getObjectsByProperty(e,n,r=[]){this[e]===n&&r.push(this);const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].getObjectsByProperty(e,n,r);return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(E0,e,Gpe),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(E0,Wpe,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(e){e(this);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].traverseVisible(e)}traverseAncestors(e){const n=this.parent;n!==null&&(e(n),n.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].updateMatrixWorld(e)}updateWorldMatrix(e,n){const r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),n===!0){const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const n=e===void 0||typeof e=="string",r={};n&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c<d;c++){const f=l[c];s(e.shapes,f)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));i.material=o}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];i.animations.push(s(e.animations,l))}}if(n){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),d=a(e.images),f=a(e.shapes),p=a(e.skeletons),y=a(e.animations),x=a(e.nodes);o.length>0&&(r.geometries=o),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),d.length>0&&(r.images=d),f.length>0&&(r.shapes=f),p.length>0&&(r.skeletons=p),y.length>0&&(r.animations=y),x.length>0&&(r.nodes=x)}return r.object=i,r;function a(o){const l=[];for(const c in o){const d=o[c];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let r=0;r<e.children.length;r++){const i=e.children[r];this.add(i.clone())}return this}}mn.DEFAULT_UP=new q(0,1,0);mn.DEFAULT_MATRIX_AUTO_UPDATE=!0;mn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const ko=new q,Cc=new q,fA=new q,Pc=new q,Cm=new q,Pm=new q,uD=new q,hA=new q,pA=new q,mA=new q,gA=new On,vA=new On,yA=new On;class Zs{constructor(e=new q,n=new q,r=new q){this.a=e,this.b=n,this.c=r}static getNormal(e,n,r,i){i.subVectors(r,n),ko.subVectors(e,n),i.cross(ko);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,n,r,i,s){ko.subVectors(i,n),Cc.subVectors(r,n),fA.subVectors(e,n);const a=ko.dot(ko),o=ko.dot(Cc),l=ko.dot(fA),c=Cc.dot(Cc),d=Cc.dot(fA),f=a*c-o*o;if(f===0)return s.set(0,0,0),null;const p=1/f,y=(c*l-o*d)*p,x=(a*d-o*l)*p;return s.set(1-y-x,x,y)}static containsPoint(e,n,r,i){return this.getBarycoord(e,n,r,i,Pc)===null?!1:Pc.x>=0&&Pc.y>=0&&Pc.x+Pc.y<=1}static getInterpolation(e,n,r,i,s,a,o,l){return this.getBarycoord(e,n,r,i,Pc)===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,Pc.x),l.addScaledVector(a,Pc.y),l.addScaledVector(o,Pc.z),l)}static getInterpolatedAttribute(e,n,r,i,s,a){return gA.setScalar(0),vA.setScalar(0),yA.setScalar(0),gA.fromBufferAttribute(e,n),vA.fromBufferAttribute(e,r),yA.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(gA,s.x),a.addScaledVector(vA,s.y),a.addScaledVector(yA,s.z),a}static isFrontFacing(e,n,r,i){return ko.subVectors(r,n),Cc.subVectors(e,n),ko.cross(Cc).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 ko.subVectors(this.c,this.b),Cc.subVectors(this.a,this.b),ko.cross(Cc).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Zs.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Zs.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,r,i,s){return Zs.getInterpolation(e,this.a,this.b,this.c,n,r,i,s)}containsPoint(e){return Zs.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Zs.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const r=this.a,i=this.b,s=this.c;let a,o;Cm.subVectors(i,r),Pm.subVectors(s,r),hA.subVectors(e,r);const l=Cm.dot(hA),c=Pm.dot(hA);if(l<=0&&c<=0)return n.copy(r);pA.subVectors(e,i);const d=Cm.dot(pA),f=Pm.dot(pA);if(d>=0&&f<=d)return n.copy(i);const p=l*f-d*c;if(p<=0&&l>=0&&d<=0)return a=l/(l-d),n.copy(r).addScaledVector(Cm,a);mA.subVectors(e,s);const y=Cm.dot(mA),x=Pm.dot(mA);if(x>=0&&y<=x)return n.copy(s);const S=y*c-l*x;if(S<=0&&c>=0&&x<=0)return o=c/(c-x),n.copy(r).addScaledVector(Pm,o);const w=d*x-y*f;if(w<=0&&f-d>=0&&y-x>=0)return uD.subVectors(s,i),o=(f-d)/(f-d+(y-x)),n.copy(i).addScaledVector(uD,o);const b=1/(w+S+p);return a=S*b,o=p*b,n.copy(r).addScaledVector(Cm,a).addScaledVector(Pm,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const P6={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Ju={h:0,s:0,l:0},Qb={h:0,s:0,l:0};function xA(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}class ut{constructor(e,n,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,r)}set(e,n,r){if(n===void 0&&r===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,n,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=Fi){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Nn.toWorkingColorSpace(this,n),this}setRGB(e,n,r,i=Nn.workingColorSpace){return this.r=e,this.g=n,this.b=r,Nn.toWorkingColorSpace(this,i),this}setHSL(e,n,r,i=Nn.workingColorSpace){if(e=CR(e,1),n=Tr(n,0,1),r=Tr(r,0,1),n===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+n):r+n-r*n,a=2*r-s;this.r=xA(a,s,e+1/3),this.g=xA(a,s,e),this.b=xA(a,s,e-1/3)}return Nn.toWorkingColorSpace(this,i),this}setStyle(e,n=Fi){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,n);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,n);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(a===6)return this.setHex(parseInt(s,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=Fi){const r=P6[e.toLowerCase()];return r!==void 0?this.setHex(r,n):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=ug(e.r),this.g=ug(e.g),this.b=ug(e.b),this}copyLinearToSRGB(e){return this.r=rA(e.r),this.g=rA(e.g),this.b=rA(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Fi){return Nn.fromWorkingColorSpace(es.copy(this),e),Math.round(Tr(es.r*255,0,255))*65536+Math.round(Tr(es.g*255,0,255))*256+Math.round(Tr(es.b*255,0,255))}getHexString(e=Fi){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=Nn.workingColorSpace){Nn.fromWorkingColorSpace(es.copy(this),n);const r=es.r,i=es.g,s=es.b,a=Math.max(r,i,s),o=Math.min(r,i,s);let l,c;const d=(o+a)/2;if(o===a)l=0,c=0;else{const f=a-o;switch(c=d<=.5?f/(a+o):f/(2-a-o),a){case r:l=(i-s)/f+(i<s?6:0);break;case i:l=(s-r)/f+2;break;case s:l=(r-i)/f+4;break}l/=6}return e.h=l,e.s=c,e.l=d,e}getRGB(e,n=Nn.workingColorSpace){return Nn.fromWorkingColorSpace(es.copy(this),n),e.r=es.r,e.g=es.g,e.b=es.b,e}getStyle(e=Fi){Nn.fromWorkingColorSpace(es.copy(this),e);const n=es.r,r=es.g,i=es.b;return e!==Fi?`color(${e} ${n.toFixed(3)} ${r.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(r*255)},${Math.round(i*255)})`}offsetHSL(e,n,r){return this.getHSL(Ju),this.setHSL(Ju.h+e,Ju.s+n,Ju.l+r)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,n){return this.r=e.r+n.r,this.g=e.g+n.g,this.b=e.b+n.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,n){return this.r+=(e.r-this.r)*n,this.g+=(e.g-this.g)*n,this.b+=(e.b-this.b)*n,this}lerpColors(e,n,r){return this.r=e.r+(n.r-e.r)*r,this.g=e.g+(n.g-e.g)*r,this.b=e.b+(n.b-e.b)*r,this}lerpHSL(e,n){this.getHSL(Ju),e.getHSL(Qb);const r=ly(Ju.h,Qb.h,n),i=ly(Ju.s,Qb.s,n),s=ly(Ju.l,Qb.l,n);return this.setHSL(r,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const n=this.r,r=this.g,i=this.b,s=e.elements;return this.r=s[0]*n+s[3]*r+s[6]*i,this.g=s[1]*n+s[4]*r+s[7]*i,this.b=s[2]*n+s[5]*r+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,n=0){return this.r=e[n],this.g=e[n+1],this.b=e[n+2],this}toArray(e=[],n=0){return e[n]=this.r,e[n+1]=this.g,e[n+2]=this.b,e}fromBufferAttribute(e,n){return this.r=e.getX(n),this.g=e.getY(n),this.b=e.getZ(n),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const es=new ut;ut.NAMES=P6;let Xpe=0;class Gr extends Gl{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Xpe++}),this.uuid=Ea(),this.name="",this.type="Material",this.blending=kh,this.side=Ul,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=lw,this.blendDst=cw,this.blendEquation=hd,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ut(0,0,0),this.blendAlpha=0,this.depthFunc=$h,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ZC,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=nh,this.stencilZFail=nh,this.stencilZPass=nh,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}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!==kh&&(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!==lw&&(r.blendSrc=this.blendSrc),this.blendDst!==cw&&(r.blendDst=this.blendDst),this.blendEquation!==hd&&(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!==$h&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==ZC&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==nh&&(r.stencilFail=this.stencilFail),this.stencilZFail!==nh&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==nh&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(n){const s=i(e.textures),a=i(e.images);s.length>0&&(r.textures=s),a.length>0&&(r.images=a)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const n=e.clippingPlanes;let r=null;if(n!==null){const i=n.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=n[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class Ts extends Gr{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ut(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ls,this.combine=px,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 Fc=qpe();function qpe(){const t=new ArrayBuffer(4),e=new Float32Array(t),n=new Uint32Array(t),r=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(r[l]=0,r[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(r[l]=1024>>-c-14,r[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(r[l]=c+15<<10,r[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(r[l]=31744,r[l|256]=64512,i[l]=24,i[l|256]=24):(r[l]=31744,r[l|256]=64512,i[l]=13,i[l|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,d=0;for(;(c&8388608)===0;)c<<=1,d-=8388608;c&=-8388609,d+=947912704,s[l]=c|d}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:a,offsetTable:o}}function qs(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=Tr(t,-65504,65504),Fc.floatView[0]=t;const e=Fc.uint32View[0],n=e>>23&511;return Fc.baseTable[n]+((e&8388607)>>Fc.shiftTable[n])}function K0(t){const e=t>>10;return Fc.uint32View[0]=Fc.mantissaTable[Fc.offsetTable[e]+(t&1023)]+Fc.exponentTable[e],Fc.floatView[0]}const Kpe={toHalfFloat:qs,fromHalfFloat:K0},Hr=new q,Jb=new He;class Qt{constructor(e,n,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=r,this.usage=Uy,this.updateRanges=[],this.gpuType=ea,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;i<s;i++)this.array[e+i]=n.array[r+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let n=0,r=this.count;n<r;n++)Jb.fromBufferAttribute(this,n),Jb.applyMatrix3(e),this.setXY(n,Jb.x,Jb.y);else if(this.itemSize===3)for(let n=0,r=this.count;n<r;n++)Hr.fromBufferAttribute(this,n),Hr.applyMatrix3(e),this.setXYZ(n,Hr.x,Hr.y,Hr.z);return this}applyMatrix4(e){for(let n=0,r=this.count;n<r;n++)Hr.fromBufferAttribute(this,n),Hr.applyMatrix4(e),this.setXYZ(n,Hr.x,Hr.y,Hr.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)Hr.fromBufferAttribute(this,n),Hr.applyNormalMatrix(e),this.setXYZ(n,Hr.x,Hr.y,Hr.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)Hr.fromBufferAttribute(this,n),Hr.transformDirection(e),this.setXYZ(n,Hr.x,Hr.y,Hr.z);return this}set(e,n=0){return this.array.set(e,n),this}getComponent(e,n){let r=this.array[e*this.itemSize+n];return this.normalized&&(r=Ms(r,this.array)),r}setComponent(e,n,r){return this.normalized&&(r=cn(r,this.array)),this.array[e*this.itemSize+n]=r,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=Ms(n,this.array)),n}setX(e,n){return this.normalized&&(n=cn(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=Ms(n,this.array)),n}setY(e,n){return this.normalized&&(n=cn(n,this.array)),this.array[e*this.itemSize+1]=n,this}getZ(e){let n=this.array[e*this.itemSize+2];return this.normalized&&(n=Ms(n,this.array)),n}setZ(e,n){return this.normalized&&(n=cn(n,this.array)),this.array[e*this.itemSize+2]=n,this}getW(e){let n=this.array[e*this.itemSize+3];return this.normalized&&(n=Ms(n,this.array)),n}setW(e,n){return this.normalized&&(n=cn(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,r){return e*=this.itemSize,this.normalized&&(n=cn(n,this.array),r=cn(r,this.array)),this.array[e+0]=n,this.array[e+1]=r,this}setXYZ(e,n,r,i){return e*=this.itemSize,this.normalized&&(n=cn(n,this.array),r=cn(r,this.array),i=cn(i,this.array)),this.array[e+0]=n,this.array[e+1]=r,this.array[e+2]=i,this}setXYZW(e,n,r,i,s){return e*=this.itemSize,this.normalized&&(n=cn(n,this.array),r=cn(r,this.array),i=cn(i,this.array),s=cn(s,this.array)),this.array[e+0]=n,this.array[e+1]=r,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Uy&&(e.usage=this.usage),e}}class Ype extends Qt{constructor(e,n,r){super(new Int8Array(e),n,r)}}class Zpe extends Qt{constructor(e,n,r){super(new Uint8Array(e),n,r)}}class Qpe extends Qt{constructor(e,n,r){super(new Uint8ClampedArray(e),n,r)}}class Jpe extends Qt{constructor(e,n,r){super(new Int16Array(e),n,r)}}class RR extends Qt{constructor(e,n,r){super(new Uint16Array(e),n,r)}}class eme extends Qt{constructor(e,n,r){super(new Int32Array(e),n,r)}}class NR extends Qt{constructor(e,n,r){super(new Uint32Array(e),n,r)}}class tme extends Qt{constructor(e,n,r){super(new Uint16Array(e),n,r),this.isFloat16BufferAttribute=!0}getX(e){let n=K0(this.array[e*this.itemSize]);return this.normalized&&(n=Ms(n,this.array)),n}setX(e,n){return this.normalized&&(n=cn(n,this.array)),this.array[e*this.itemSize]=qs(n),this}getY(e){let n=K0(this.array[e*this.itemSize+1]);return this.normalized&&(n=Ms(n,this.array)),n}setY(e,n){return this.normalized&&(n=cn(n,this.array)),this.array[e*this.itemSize+1]=qs(n),this}getZ(e){let n=K0(this.array[e*this.itemSize+2]);return this.normalized&&(n=Ms(n,this.array)),n}setZ(e,n){return this.normalized&&(n=cn(n,this.array)),this.array[e*this.itemSize+2]=qs(n),this}getW(e){let n=K0(this.array[e*this.itemSize+3]);return this.normalized&&(n=Ms(n,this.array)),n}setW(e,n){return this.normalized&&(n=cn(n,this.array)),this.array[e*this.itemSize+3]=qs(n),this}setXY(e,n,r){return e*=this.itemSize,this.normalized&&(n=cn(n,this.array),r=cn(r,this.array)),this.array[e+0]=qs(n),this.array[e+1]=qs(r),this}setXYZ(e,n,r,i){return e*=this.itemSize,this.normalized&&(n=cn(n,this.array),r=cn(r,this.array),i=cn(i,this.array)),this.array[e+0]=qs(n),this.array[e+1]=qs(r),this.array[e+2]=qs(i),this}setXYZW(e,n,r,i,s){return e*=this.itemSize,this.normalized&&(n=cn(n,this.array),r=cn(r,this.array),i=cn(i,this.array),s=cn(s,this.array)),this.array[e+0]=qs(n),this.array[e+1]=qs(r),this.array[e+2]=qs(i),this.array[e+3]=qs(s),this}}class Ot extends Qt{constructor(e,n,r){super(new Float32Array(e),n,r)}}let nme=0;const za=new Rt,bA=new mn,Rm=new q,ma=new os,A0=new os,mi=new q;class Yt extends Gl{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:nme++}),this.uuid=Ea(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(E6(e)?NR:RR)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,n){return this.attributes[e]=n,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,n,r=0){this.groups.push({start:e,count:n,materialIndex:r})}clearGroups(){this.groups=[]}setDrawRange(e,n){this.drawRange.start=e,this.drawRange.count=n}applyMatrix4(e){const n=this.attributes.position;n!==void 0&&(n.applyMatrix4(e),n.needsUpdate=!0);const r=this.attributes.normal;if(r!==void 0){const s=new Xt().getNormalMatrix(e);r.applyNormalMatrix(s),r.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return za.makeRotationFromQuaternion(e),this.applyMatrix4(za),this}rotateX(e){return za.makeRotationX(e),this.applyMatrix4(za),this}rotateY(e){return za.makeRotationY(e),this.applyMatrix4(za),this}rotateZ(e){return za.makeRotationZ(e),this.applyMatrix4(za),this}translate(e,n,r){return za.makeTranslation(e,n,r),this.applyMatrix4(za),this}scale(e,n,r){return za.makeScale(e,n,r),this.applyMatrix4(za),this}lookAt(e){return bA.lookAt(e),bA.updateMatrix(),this.applyMatrix4(bA.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Rm).negate(),this.translate(Rm.x,Rm.y,Rm.z),this}setFromPoints(e){const n=[];for(let r=0,i=e.length;r<i;r++){const s=e[r];n.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new Ot(n,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new os);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new q(-1/0,-1/0,-1/0),new q(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let r=0,i=n.length;r<i;r++){const s=n[r];ma.setFromBufferAttribute(s),this.morphTargetsRelative?(mi.addVectors(this.boundingBox.min,ma.min),this.boundingBox.expandByPoint(mi),mi.addVectors(this.boundingBox.max,ma.max),this.boundingBox.expandByPoint(mi)):(this.boundingBox.expandByPoint(ma.min),this.boundingBox.expandByPoint(ma.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Hi);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new q,1/0);return}if(e){const r=this.boundingSphere.center;if(ma.setFromBufferAttribute(e),n)for(let s=0,a=n.length;s<a;s++){const o=n[s];A0.setFromBufferAttribute(o),this.morphTargetsRelative?(mi.addVectors(ma.min,A0.min),ma.expandByPoint(mi),mi.addVectors(ma.max,A0.max),ma.expandByPoint(mi)):(ma.expandByPoint(A0.min),ma.expandByPoint(A0.max))}ma.getCenter(r);let i=0;for(let s=0,a=e.count;s<a;s++)mi.fromBufferAttribute(e,s),i=Math.max(i,r.distanceToSquared(mi));if(n)for(let s=0,a=n.length;s<a;s++){const o=n[s],l=this.morphTargetsRelative;for(let c=0,d=o.count;c<d;c++)mi.fromBufferAttribute(o,c),l&&(Rm.fromBufferAttribute(e,c),mi.add(Rm)),i=Math.max(i,r.distanceToSquared(mi))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,n=this.attributes;if(e===null||n.position===void 0||n.normal===void 0||n.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const r=n.position,i=n.normal,s=n.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Qt(new Float32Array(4*r.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let F=0;F<r.count;F++)o[F]=new q,l[F]=new q;const c=new q,d=new q,f=new q,p=new He,y=new He,x=new He,S=new q,w=new q;function b(F,V,I){c.fromBufferAttribute(r,F),d.fromBufferAttribute(r,V),f.fromBufferAttribute(r,I),p.fromBufferAttribute(s,F),y.fromBufferAttribute(s,V),x.fromBufferAttribute(s,I),d.sub(c),f.sub(c),y.sub(p),x.sub(p);const U=1/(y.x*x.y-x.x*y.y);isFinite(U)&&(S.copy(d).multiplyScalar(x.y).addScaledVector(f,-y.y).multiplyScalar(U),w.copy(f).multiplyScalar(y.x).addScaledVector(d,-x.x).multiplyScalar(U),o[F].add(S),o[V].add(S),o[I].add(S),l[F].add(w),l[V].add(w),l[I].add(w))}let M=this.groups;M.length===0&&(M=[{start:0,count:e.count}]);for(let F=0,V=M.length;F<V;++F){const I=M[F],U=I.start,X=I.count;for(let te=U,re=U+X;te<re;te+=3)b(e.getX(te+0),e.getX(te+1),e.getX(te+2))}const T=new q,C=new q,L=new q,N=new q;function D(F){L.fromBufferAttribute(i,F),N.copy(L);const V=o[F];T.copy(V),T.sub(L.multiplyScalar(L.dot(V))).normalize(),C.crossVectors(N,V);const U=C.dot(l[F])<0?-1:1;a.setXYZW(F,T.x,T.y,T.z,U)}for(let F=0,V=M.length;F<V;++F){const I=M[F],U=I.start,X=I.count;for(let te=U,re=U+X;te<re;te+=3)D(e.getX(te+0)),D(e.getX(te+1)),D(e.getX(te+2))}}computeVertexNormals(){const e=this.index,n=this.getAttribute("position");if(n!==void 0){let r=this.getAttribute("normal");if(r===void 0)r=new Qt(new Float32Array(n.count*3),3),this.setAttribute("normal",r);else for(let p=0,y=r.count;p<y;p++)r.setXYZ(p,0,0,0);const i=new q,s=new q,a=new q,o=new q,l=new q,c=new q,d=new q,f=new q;if(e)for(let p=0,y=e.count;p<y;p+=3){const x=e.getX(p+0),S=e.getX(p+1),w=e.getX(p+2);i.fromBufferAttribute(n,x),s.fromBufferAttribute(n,S),a.fromBufferAttribute(n,w),d.subVectors(a,s),f.subVectors(i,s),d.cross(f),o.fromBufferAttribute(r,x),l.fromBufferAttribute(r,S),c.fromBufferAttribute(r,w),o.add(d),l.add(d),c.add(d),r.setXYZ(x,o.x,o.y,o.z),r.setXYZ(S,l.x,l.y,l.z),r.setXYZ(w,c.x,c.y,c.z)}else for(let p=0,y=n.count;p<y;p+=3)i.fromBufferAttribute(n,p+0),s.fromBufferAttribute(n,p+1),a.fromBufferAttribute(n,p+2),d.subVectors(a,s),f.subVectors(i,s),d.cross(f),r.setXYZ(p+0,d.x,d.y,d.z),r.setXYZ(p+1,d.x,d.y,d.z),r.setXYZ(p+2,d.x,d.y,d.z);this.normalizeNormals(),r.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,r=e.count;n<r;n++)mi.fromBufferAttribute(e,n),mi.normalize(),e.setXYZ(n,mi.x,mi.y,mi.z)}toNonIndexed(){function e(o,l){const c=o.array,d=o.itemSize,f=o.normalized,p=new c.constructor(l.length*d);let y=0,x=0;for(let S=0,w=l.length;S<w;S++){o.isInterleavedBufferAttribute?y=l[S]*o.data.stride+o.offset:y=l[S]*d;for(let b=0;b<d;b++)p[x++]=c[y++]}return new Qt(p,d,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new Yt,r=this.index.array,i=this.attributes;for(const o in i){const l=i[o],c=e(l,r);n.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let d=0,f=c.length;d<f;d++){const p=c[d],y=e(p,r);l.push(y)}n.morphAttributes[o]=l}n.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];n.addGroup(c.start,c.count,c.materialIndex)}return n}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const r=this.attributes;for(const l in r){const c=r[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let f=0,p=c.length;f<p;f++){const y=c[f];d.push(y.toJSON(e.data))}d.length>0&&(i[l]=d,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone(n));const i=e.attributes;for(const c in i){const d=i[c];this.setAttribute(c,d.clone(n))}const s=e.morphAttributes;for(const c in s){const d=[],f=s[c];for(let p=0,y=f.length;p<y;p++)d.push(f[p].clone(n));this.morphAttributes[c]=d}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,d=a.length;c<d;c++){const f=a[c];this.addGroup(f.start,f.count,f.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const dD=new Rt,Df=new lp,e_=new Hi,fD=new q,t_=new q,n_=new q,r_=new q,_A=new q,i_=new q,hD=new q,s_=new q;class xr extends mn{constructor(e=new Yt,n=new Ts){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=n,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const n=this.geometry.morphAttributes,r=Object.keys(n);if(r.length>0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,n){const r=this.geometry,i=r.attributes.position,s=r.morphAttributes.position,a=r.morphTargetsRelative;n.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(s&&o){i_.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const d=o[l],f=s[l];d!==0&&(_A.fromBufferAttribute(f,e),a?i_.addScaledVector(_A,d):i_.addScaledVector(_A.sub(n),d))}n.add(i_)}return n}raycast(e,n){const r=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),e_.copy(r.boundingSphere),e_.applyMatrix4(s),Df.copy(e.ray).recast(e.near),!(e_.containsPoint(Df.origin)===!1&&(Df.intersectSphere(e_,fD)===null||Df.origin.distanceToSquared(fD)>(e.far-e.near)**2))&&(dD.copy(s).invert(),Df.copy(e.ray).applyMatrix4(dD),!(r.boundingBox!==null&&Df.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,Df)))}_computeIntersections(e,n,r){let i;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,f=s.attributes.normal,p=s.groups,y=s.drawRange;if(o!==null)if(Array.isArray(a))for(let x=0,S=p.length;x<S;x++){const w=p[x],b=a[w.materialIndex],M=Math.max(w.start,y.start),T=Math.min(o.count,Math.min(w.start+w.count,y.start+y.count));for(let C=M,L=T;C<L;C+=3){const N=o.getX(C),D=o.getX(C+1),F=o.getX(C+2);i=a_(this,b,e,r,c,d,f,N,D,F),i&&(i.faceIndex=Math.floor(C/3),i.face.materialIndex=w.materialIndex,n.push(i))}}else{const x=Math.max(0,y.start),S=Math.min(o.count,y.start+y.count);for(let w=x,b=S;w<b;w+=3){const M=o.getX(w),T=o.getX(w+1),C=o.getX(w+2);i=a_(this,a,e,r,c,d,f,M,T,C),i&&(i.faceIndex=Math.floor(w/3),n.push(i))}}else if(l!==void 0)if(Array.isArray(a))for(let x=0,S=p.length;x<S;x++){const w=p[x],b=a[w.materialIndex],M=Math.max(w.start,y.start),T=Math.min(l.count,Math.min(w.start+w.count,y.start+y.count));for(let C=M,L=T;C<L;C+=3){const N=C,D=C+1,F=C+2;i=a_(this,b,e,r,c,d,f,N,D,F),i&&(i.faceIndex=Math.floor(C/3),i.face.materialIndex=w.materialIndex,n.push(i))}}else{const x=Math.max(0,y.start),S=Math.min(l.count,y.start+y.count);for(let w=x,b=S;w<b;w+=3){const M=w,T=w+1,C=w+2;i=a_(this,a,e,r,c,d,f,M,T,C),i&&(i.faceIndex=Math.floor(w/3),n.push(i))}}}}function rme(t,e,n,r,i,s,a,o){let l;if(e.side===as?l=r.intersectTriangle(a,s,i,!0,o):l=r.intersectTriangle(i,s,a,e.side===Ul,o),l===null)return null;s_.copy(o),s_.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(s_);return c<n.near||c>n.far?null:{distance:c,point:s_.clone(),object:t}}function a_(t,e,n,r,i,s,a,o,l,c){t.getVertexPosition(o,t_),t.getVertexPosition(l,n_),t.getVertexPosition(c,r_);const d=rme(t,e,n,r,t_,n_,r_,hD);if(d){const f=new q;Zs.getBarycoord(hD,t_,n_,r_,f),i&&(d.uv=Zs.getInterpolatedAttribute(i,o,l,c,f,new He)),s&&(d.uv1=Zs.getInterpolatedAttribute(s,o,l,c,f,new He)),a&&(d.normal=Zs.getInterpolatedAttribute(a,o,l,c,f,new q),d.normal.dot(r.direction)>0&&d.normal.multiplyScalar(-1));const p={a:o,b:l,c,normal:new q,materialIndex:0};Zs.getNormal(t_,n_,r_,p.normal),d.face=p,d.barycoord=f}return d}class cp extends Yt{constructor(e=1,n=1,r=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:r,widthSegments:i,heightSegments:s,depthSegments:a};const o=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],d=[],f=[];let p=0,y=0;x("z","y","x",-1,-1,r,n,e,a,s,0),x("z","y","x",1,-1,r,n,-e,a,s,1),x("x","z","y",1,1,e,r,n,i,a,2),x("x","z","y",1,-1,e,r,-n,i,a,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,b,M,T,C,L,N,D,F,V){const I=C/D,U=L/F,X=C/2,te=L/2,re=N/2,pe=D+1,ee=F+1;let ce=0,B=0;const J=new q;for(let Z=0;Z<ee;Z++){const G=Z*U-te;for(let W=0;W<pe;W++){const oe=W*I-X;J[S]=oe*M,J[w]=G*T,J[b]=re,c.push(J.x,J.y,J.z),J[S]=0,J[w]=0,J[b]=N>0?1:-1,d.push(J.x,J.y,J.z),f.push(W/D),f.push(1-Z/F),ce+=1}}for(let Z=0;Z<F;Z++)for(let G=0;G<D;G++){const W=p+G+pe*Z,oe=p+G+pe*(Z+1),se=p+(G+1)+pe*(Z+1),le=p+(G+1)+pe*Z;l.push(W,oe,le),l.push(oe,se,le),B+=6}o.addGroup(y,B,V),y+=B,p+=ce}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new cp(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Vg(t){const e={};for(const n in t){e[n]={};for(const r in t[n]){const i=t[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][r]=null):e[n][r]=i.clone():Array.isArray(i)?e[n][r]=i.slice():e[n][r]=i}}return e}function _s(t){const e={};for(let n=0;n<t.length;n++){const r=Vg(t[n]);for(const i in r)e[i]=r[i]}return e}function ime(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function R6(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Nn.workingColorSpace}const kR={clone:Vg,merge:_s};var sme=`void main() {
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
}`,ame=`void main() {
|
||
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
||
}`;class Qa extends Gr{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=sme,this.fragmentShader=ame,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=Vg(e.uniforms),this.uniformsGroups=ime(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const n=super.toJSON(e);n.glslVersion=this.glslVersion,n.uniforms={};for(const i in this.uniforms){const a=this.uniforms[i].value;a&&a.isTexture?n.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?n.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?n.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?n.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?n.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?n.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?n.uniforms[i]={type:"m4",value:a.toArray()}:n.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const r={};for(const i in this.extensions)this.extensions[i]===!0&&(r[i]=!0);return Object.keys(r).length>0&&(n.extensions=r),n}}class vx extends mn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Rt,this.projectionMatrix=new Rt,this.projectionMatrixInverse=new Rt,this.coordinateSystem=El}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 ed=new q,pD=new He,mD=new He;class Cr extends vx{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=Hg*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Lh*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Hg*2*Math.atan(Math.tan(Lh*.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){ed.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(ed.x,ed.y).multiplyScalar(-e/ed.z),ed.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(ed.x,ed.y).multiplyScalar(-e/ed.z)}getViewSize(e,n){return this.getViewBounds(e,pD,mD),n.subVectors(mD,pD)}setViewOffset(e,n,r,i,s,a){this.aspect=e/n,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(Lh*.5*this.fov)/this.zoom,r=2*n,i=this.aspect*r,s=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*i/l,n-=a.offsetY*r/c,i*=a.width/l,r*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,n,n-r,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}const Nm=-90,km=1;class N6 extends mn{constructor(e,n,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Cr(Nm,km,e,n);i.layers=this.layers,this.add(i);const s=new Cr(Nm,km,e,n);s.layers=this.layers,this.add(s);const a=new Cr(Nm,km,e,n);a.layers=this.layers,this.add(a);const o=new Cr(Nm,km,e,n);o.layers=this.layers,this.add(o);const l=new Cr(Nm,km,e,n);l.layers=this.layers,this.add(l);const c=new Cr(Nm,km,e,n);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[r,i,s,a,o,l]=n;for(const c of n)this.remove(c);if(e===El)r.up.set(0,1,0),r.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Fy)r.up.set(0,-1,0),r.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of n)this.add(c),c.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:r,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,d]=this.children,f=e.getRenderTarget(),p=e.getActiveCubeFace(),y=e.getActiveMipmapLevel(),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,a),e.setRenderTarget(r,2,i),e.render(n,o),e.setRenderTarget(r,3,i),e.render(n,l),e.setRenderTarget(r,4,i),e.render(n,c),r.texture.generateMipmaps=S,e.setRenderTarget(r,5,i),e.render(n,d),e.setRenderTarget(f,p,y),e.xr.enabled=x,r.texture.needsPMREMUpdate=!0}}class yx extends fr{constructor(e,n,r,i,s,a,o,l,c,d){e=e!==void 0?e:[],n=n!==void 0?n:tu,super(e,n,r,i,s,a,o,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class k6 extends Go{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 yx(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:Pr}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;
|
||
|
||
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
||
|
||
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
||
|
||
}
|
||
|
||
void main() {
|
||
|
||
vWorldDirection = transformDirection( position, modelMatrix );
|
||
|
||
#include <begin_vertex>
|
||
#include <project_vertex>
|
||
|
||
}
|
||
`,fragmentShader:`
|
||
|
||
uniform sampler2D tEquirect;
|
||
|
||
varying vec3 vWorldDirection;
|
||
|
||
#include <common>
|
||
|
||
void main() {
|
||
|
||
vec3 direction = normalize( vWorldDirection );
|
||
|
||
vec2 sampleUV = equirectUv( direction );
|
||
|
||
gl_FragColor = texture2D( tEquirect, sampleUV );
|
||
|
||
}
|
||
`},i=new cp(5,5,5),s=new Qa({name:"CubemapFromEquirect",uniforms:Vg(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:as,blending:Xc});s.uniforms.tEquirect.value=n;const a=new xr(i,s),o=n.minFilter;return n.minFilter===qa&&(n.minFilter=Pr),new N6(1,10,this).update(e,a),n.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,n,r,i){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(n,r,i);e.setRenderTarget(s)}}const wA=new q,ome=new q,lme=new Xt;class Lc{constructor(e=new q(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,r,i){return this.normal.set(e,n,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,r){const i=wA.subVectors(r,n).cross(ome.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(wA),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||lme.getNormalMatrix(e),i=this.coplanarPoint(wA).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 jf=new Hi,o_=new q;class xx{constructor(e=new Lc,n=new Lc,r=new Lc,i=new Lc,s=new Lc,a=new Lc){this.planes=[e,n,r,i,s,a]}set(e,n,r,i,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(n),o[2].copy(r),o[3].copy(i),o[4].copy(s),o[5].copy(a),this}copy(e){const n=this.planes;for(let r=0;r<6;r++)n[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,n=El){const r=this.planes,i=e.elements,s=i[0],a=i[1],o=i[2],l=i[3],c=i[4],d=i[5],f=i[6],p=i[7],y=i[8],x=i[9],S=i[10],w=i[11],b=i[12],M=i[13],T=i[14],C=i[15];if(r[0].setComponents(l-s,p-c,w-y,C-b).normalize(),r[1].setComponents(l+s,p+c,w+y,C+b).normalize(),r[2].setComponents(l+a,p+d,w+x,C+M).normalize(),r[3].setComponents(l-a,p-d,w-x,C-M).normalize(),r[4].setComponents(l-o,p-f,w-S,C-T).normalize(),n===El)r[5].setComponents(l+o,p+f,w+S,C+T).normalize();else if(n===Fy)r[5].setComponents(o,f,S,T).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),jf.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),jf.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(jf)}intersectsSprite(e){return jf.center.set(0,0,0),jf.radius=.7071067811865476,jf.applyMatrix4(e.matrixWorld),this.intersectsSphere(jf)}intersectsSphere(e){const n=this.planes,r=e.center,i=-e.radius;for(let s=0;s<6;s++)if(n[s].distanceToPoint(r)<i)return!1;return!0}intersectsBox(e){const n=this.planes;for(let r=0;r<6;r++){const i=n[r];if(o_.x=i.normal.x>0?e.max.x:e.min.x,o_.y=i.normal.y>0?e.max.y:e.min.y,o_.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(o_)<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 I6(){let t=null,e=!1,n=null,r=null;function i(s,a){n(s,a),r=t.requestAnimationFrame(i)}return{start:function(){e!==!0&&n!==null&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(s){n=s},setContext:function(s){t=s}}}function cme(t){const e=new WeakMap;function n(o,l){const c=o.array,d=o.usage,f=c.byteLength,p=t.createBuffer();t.bindBuffer(l,p),t.bufferData(l,c,d),o.onUploadCallback();let y;if(c instanceof Float32Array)y=t.FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?y=t.HALF_FLOAT:y=t.UNSIGNED_SHORT;else if(c instanceof Int16Array)y=t.SHORT;else if(c instanceof Uint32Array)y=t.UNSIGNED_INT;else if(c instanceof Int32Array)y=t.INT;else if(c instanceof Int8Array)y=t.BYTE;else if(c instanceof Uint8Array)y=t.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)y=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:p,type:y,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:f}}function r(o,l,c){const d=l.array,f=l.updateRanges;if(t.bindBuffer(c,o),f.length===0)t.bufferSubData(c,0,d);else{f.sort((y,x)=>y.start-x.start);let p=0;for(let y=1;y<f.length;y++){const x=f[p],S=f[y];S.start<=x.start+x.count+1?x.count=Math.max(x.count,S.start+S.count-x.start):(++p,f[p]=S)}f.length=p+1;for(let y=0,x=f.length;y<x;y++){const S=f[y];t.bufferSubData(c,S.start*d.BYTES_PER_ELEMENT,d,S.start,S.count)}l.clearUpdateRanges()}l.onUploadCallback()}function i(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(t.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const d=e.get(o);(!d||d.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,n(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");r(c.buffer,o,l),c.version=o.version}}return{get:i,remove:s,update:a}}class cv extends Yt{constructor(e=1,n=1,r=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:n,widthSegments:r,heightSegments:i};const s=e/2,a=n/2,o=Math.floor(r),l=Math.floor(i),c=o+1,d=l+1,f=e/o,p=n/l,y=[],x=[],S=[],w=[];for(let b=0;b<d;b++){const M=b*p-a;for(let T=0;T<c;T++){const C=T*f-s;x.push(C,-M,0),S.push(0,0,1),w.push(T/o),w.push(1-b/l)}}for(let b=0;b<l;b++)for(let M=0;M<o;M++){const T=M+c*b,C=M+c*(b+1),L=M+1+c*(b+1),N=M+1+c*b;y.push(T,C,N),y.push(C,L,N)}this.setIndex(y),this.setAttribute("position",new Ot(x,3)),this.setAttribute("normal",new Ot(S,3)),this.setAttribute("uv",new Ot(w,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new cv(e.width,e.height,e.widthSegments,e.heightSegments)}}var ume=`#ifdef USE_ALPHAHASH
|
||
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
||
#endif`,dme=`#ifdef USE_ALPHAHASH
|
||
const float ALPHA_HASH_SCALE = 0.05;
|
||
float hash2D( vec2 value ) {
|
||
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
|
||
}
|
||
float hash3D( vec3 value ) {
|
||
return hash2D( vec2( hash2D( value.xy ), value.z ) );
|
||
}
|
||
float getAlphaHashThreshold( vec3 position ) {
|
||
float maxDeriv = max(
|
||
length( dFdx( position.xyz ) ),
|
||
length( dFdy( position.xyz ) )
|
||
);
|
||
float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
|
||
vec2 pixScales = vec2(
|
||
exp2( floor( log2( pixScale ) ) ),
|
||
exp2( ceil( log2( pixScale ) ) )
|
||
);
|
||
vec2 alpha = vec2(
|
||
hash3D( floor( pixScales.x * position.xyz ) ),
|
||
hash3D( floor( pixScales.y * position.xyz ) )
|
||
);
|
||
float lerpFactor = fract( log2( pixScale ) );
|
||
float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
|
||
float a = min( lerpFactor, 1.0 - lerpFactor );
|
||
vec3 cases = vec3(
|
||
x * x / ( 2.0 * a * ( 1.0 - a ) ),
|
||
( x - 0.5 * a ) / ( 1.0 - a ),
|
||
1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
|
||
);
|
||
float threshold = ( x < ( 1.0 - a ) )
|
||
? ( ( x < a ) ? cases.x : cases.y )
|
||
: cases.z;
|
||
return clamp( threshold , 1.0e-6, 1.0 );
|
||
}
|
||
#endif`,fme=`#ifdef USE_ALPHAMAP
|
||
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
|
||
#endif`,hme=`#ifdef USE_ALPHAMAP
|
||
uniform sampler2D alphaMap;
|
||
#endif`,pme=`#ifdef USE_ALPHATEST
|
||
#ifdef ALPHA_TO_COVERAGE
|
||
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
|
||
if ( diffuseColor.a == 0.0 ) discard;
|
||
#else
|
||
if ( diffuseColor.a < alphaTest ) discard;
|
||
#endif
|
||
#endif`,mme=`#ifdef USE_ALPHATEST
|
||
uniform float alphaTest;
|
||
#endif`,gme=`#ifdef USE_AOMAP
|
||
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
|
||
reflectedLight.indirectDiffuse *= ambientOcclusion;
|
||
#if defined( USE_CLEARCOAT )
|
||
clearcoatSpecularIndirect *= ambientOcclusion;
|
||
#endif
|
||
#if defined( USE_SHEEN )
|
||
sheenSpecularIndirect *= ambientOcclusion;
|
||
#endif
|
||
#if defined( USE_ENVMAP ) && defined( STANDARD )
|
||
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
|
||
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
|
||
#endif
|
||
#endif`,vme=`#ifdef USE_AOMAP
|
||
uniform sampler2D aoMap;
|
||
uniform float aoMapIntensity;
|
||
#endif`,yme=`#ifdef USE_BATCHING
|
||
#if ! defined( GL_ANGLE_multi_draw )
|
||
#define gl_DrawID _gl_DrawID
|
||
uniform int _gl_DrawID;
|
||
#endif
|
||
uniform highp sampler2D batchingTexture;
|
||
uniform highp usampler2D batchingIdTexture;
|
||
mat4 getBatchingMatrix( const in float i ) {
|
||
int size = textureSize( batchingTexture, 0 ).x;
|
||
int j = int( i ) * 4;
|
||
int x = j % size;
|
||
int y = j / size;
|
||
vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
|
||
vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
|
||
vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
|
||
vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
|
||
return mat4( v1, v2, v3, v4 );
|
||
}
|
||
float getIndirectIndex( const in int i ) {
|
||
int size = textureSize( batchingIdTexture, 0 ).x;
|
||
int x = i % size;
|
||
int y = i / size;
|
||
return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
|
||
}
|
||
#endif
|
||
#ifdef USE_BATCHING_COLOR
|
||
uniform sampler2D batchingColorTexture;
|
||
vec3 getBatchingColor( const in float i ) {
|
||
int size = textureSize( batchingColorTexture, 0 ).x;
|
||
int j = int( i );
|
||
int x = j % size;
|
||
int y = j / size;
|
||
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
|
||
}
|
||
#endif`,xme=`#ifdef USE_BATCHING
|
||
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
|
||
#endif`,bme=`vec3 transformed = vec3( position );
|
||
#ifdef USE_ALPHAHASH
|
||
vPosition = vec3( position );
|
||
#endif`,_me=`vec3 objectNormal = vec3( normal );
|
||
#ifdef USE_TANGENT
|
||
vec3 objectTangent = vec3( tangent.xyz );
|
||
#endif`,wme=`float G_BlinnPhong_Implicit( ) {
|
||
return 0.25;
|
||
}
|
||
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
||
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
|
||
}
|
||
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
|
||
vec3 halfDir = normalize( lightDir + viewDir );
|
||
float dotNH = saturate( dot( normal, halfDir ) );
|
||
float dotVH = saturate( dot( viewDir, halfDir ) );
|
||
vec3 F = F_Schlick( specularColor, 1.0, dotVH );
|
||
float G = G_BlinnPhong_Implicit( );
|
||
float D = D_BlinnPhong( shininess, dotNH );
|
||
return F * ( G * D );
|
||
} // validated`,Sme=`#ifdef USE_IRIDESCENCE
|
||
const mat3 XYZ_TO_REC709 = mat3(
|
||
3.2404542, -0.9692660, 0.0556434,
|
||
-1.5371385, 1.8760108, -0.2040259,
|
||
-0.4985314, 0.0415560, 1.0572252
|
||
);
|
||
vec3 Fresnel0ToIor( vec3 fresnel0 ) {
|
||
vec3 sqrtF0 = sqrt( fresnel0 );
|
||
return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
|
||
}
|
||
vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
|
||
return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
|
||
}
|
||
float IorToFresnel0( float transmittedIor, float incidentIor ) {
|
||
return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
|
||
}
|
||
vec3 evalSensitivity( float OPD, vec3 shift ) {
|
||
float phase = 2.0 * PI * OPD * 1.0e-9;
|
||
vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
|
||
vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
|
||
vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
|
||
vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
|
||
xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
|
||
xyz /= 1.0685e-7;
|
||
vec3 rgb = XYZ_TO_REC709 * xyz;
|
||
return rgb;
|
||
}
|
||
vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
|
||
vec3 I;
|
||
float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
|
||
float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
|
||
float cosTheta2Sq = 1.0 - sinTheta2Sq;
|
||
if ( cosTheta2Sq < 0.0 ) {
|
||
return vec3( 1.0 );
|
||
}
|
||
float cosTheta2 = sqrt( cosTheta2Sq );
|
||
float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
|
||
float R12 = F_Schlick( R0, 1.0, cosTheta1 );
|
||
float T121 = 1.0 - R12;
|
||
float phi12 = 0.0;
|
||
if ( iridescenceIOR < outsideIOR ) phi12 = PI;
|
||
float phi21 = PI - phi12;
|
||
vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
|
||
vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
|
||
vec3 phi23 = vec3( 0.0 );
|
||
if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
|
||
if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
|
||
if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
|
||
float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
|
||
vec3 phi = vec3( phi21 ) + phi23;
|
||
vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
|
||
vec3 r123 = sqrt( R123 );
|
||
vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
|
||
vec3 C0 = R12 + Rs;
|
||
I = C0;
|
||
vec3 Cm = Rs - T121;
|
||
for ( int m = 1; m <= 2; ++ m ) {
|
||
Cm *= r123;
|
||
vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
|
||
I += Cm * Sm;
|
||
}
|
||
return max( I, vec3( 0.0 ) );
|
||
}
|
||
#endif`,Mme=`#ifdef USE_BUMPMAP
|
||
uniform sampler2D bumpMap;
|
||
uniform float bumpScale;
|
||
vec2 dHdxy_fwd() {
|
||
vec2 dSTdx = dFdx( vBumpMapUv );
|
||
vec2 dSTdy = dFdy( vBumpMapUv );
|
||
float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
|
||
float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
|
||
float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
|
||
return vec2( dBx, dBy );
|
||
}
|
||
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
|
||
vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
|
||
vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
|
||
vec3 vN = surf_norm;
|
||
vec3 R1 = cross( vSigmaY, vN );
|
||
vec3 R2 = cross( vN, vSigmaX );
|
||
float fDet = dot( vSigmaX, R1 ) * faceDirection;
|
||
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
|
||
return normalize( abs( fDet ) * surf_norm - vGrad );
|
||
}
|
||
#endif`,Eme=`#if NUM_CLIPPING_PLANES > 0
|
||
vec4 plane;
|
||
#ifdef ALPHA_TO_COVERAGE
|
||
float distanceToPlane, distanceGradient;
|
||
float clipOpacity = 1.0;
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
|
||
plane = clippingPlanes[ i ];
|
||
distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
|
||
distanceGradient = fwidth( distanceToPlane ) / 2.0;
|
||
clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
|
||
if ( clipOpacity == 0.0 ) discard;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
|
||
float unionClipOpacity = 1.0;
|
||
#pragma unroll_loop_start
|
||
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
|
||
plane = clippingPlanes[ i ];
|
||
distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
|
||
distanceGradient = fwidth( distanceToPlane ) / 2.0;
|
||
unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
|
||
}
|
||
#pragma unroll_loop_end
|
||
clipOpacity *= 1.0 - unionClipOpacity;
|
||
#endif
|
||
diffuseColor.a *= clipOpacity;
|
||
if ( diffuseColor.a == 0.0 ) discard;
|
||
#else
|
||
#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
|
||
#endif`,Ame=`#if NUM_CLIPPING_PLANES > 0
|
||
varying vec3 vClipPosition;
|
||
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
||
#endif`,Tme=`#if NUM_CLIPPING_PLANES > 0
|
||
varying vec3 vClipPosition;
|
||
#endif`,Cme=`#if NUM_CLIPPING_PLANES > 0
|
||
vClipPosition = - mvPosition.xyz;
|
||
#endif`,Pme=`#if defined( USE_COLOR_ALPHA )
|
||
diffuseColor *= vColor;
|
||
#elif defined( USE_COLOR )
|
||
diffuseColor.rgb *= vColor;
|
||
#endif`,Rme=`#if defined( USE_COLOR_ALPHA )
|
||
varying vec4 vColor;
|
||
#elif defined( USE_COLOR )
|
||
varying vec3 vColor;
|
||
#endif`,Nme=`#if defined( USE_COLOR_ALPHA )
|
||
varying vec4 vColor;
|
||
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
||
varying vec3 vColor;
|
||
#endif`,kme=`#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 );
|
||
#endif
|
||
#ifdef USE_COLOR
|
||
vColor *= color;
|
||
#endif
|
||
#ifdef USE_INSTANCING_COLOR
|
||
vColor.xyz *= instanceColor.xyz;
|
||
#endif
|
||
#ifdef USE_BATCHING_COLOR
|
||
vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
|
||
vColor.xyz *= batchingColor.xyz;
|
||
#endif`,Ime=`#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;
|
||
};
|
||
#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;
|
||
}
|
||
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`,Lme=`#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_m0 - 2.0
|
||
#define cubeUV_r1 0.8
|
||
#define cubeUV_m1 - 1.0
|
||
#define cubeUV_r4 0.4
|
||
#define cubeUV_m4 2.0
|
||
#define cubeUV_r5 0.305
|
||
#define cubeUV_m5 3.0
|
||
#define cubeUV_r6 0.21
|
||
#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`,Ome=`vec3 transformedNormal = objectNormal;
|
||
#ifdef USE_TANGENT
|
||
vec3 transformedTangent = objectTangent;
|
||
#endif
|
||
#ifdef USE_BATCHING
|
||
mat3 bm = mat3( batchingMatrix );
|
||
transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
|
||
transformedNormal = bm * transformedNormal;
|
||
#ifdef USE_TANGENT
|
||
transformedTangent = bm * transformedTangent;
|
||
#endif
|
||
#endif
|
||
#ifdef USE_INSTANCING
|
||
mat3 im = mat3( instanceMatrix );
|
||
transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
|
||
transformedNormal = im * transformedNormal;
|
||
#ifdef USE_TANGENT
|
||
transformedTangent = im * transformedTangent;
|
||
#endif
|
||
#endif
|
||
transformedNormal = normalMatrix * transformedNormal;
|
||
#ifdef FLIP_SIDED
|
||
transformedNormal = - transformedNormal;
|
||
#endif
|
||
#ifdef USE_TANGENT
|
||
transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
|
||
#ifdef FLIP_SIDED
|
||
transformedTangent = - transformedTangent;
|
||
#endif
|
||
#endif`,Dme=`#ifdef USE_DISPLACEMENTMAP
|
||
uniform sampler2D displacementMap;
|
||
uniform float displacementScale;
|
||
uniform float displacementBias;
|
||
#endif`,jme=`#ifdef USE_DISPLACEMENTMAP
|
||
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
|
||
#endif`,Ume=`#ifdef USE_EMISSIVEMAP
|
||
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
|
||
totalEmissiveRadiance *= emissiveColor.rgb;
|
||
#endif`,Fme=`#ifdef USE_EMISSIVEMAP
|
||
uniform sampler2D emissiveMap;
|
||
#endif`,zme="gl_FragColor = linearToOutputTexel( gl_FragColor );",Bme=`
|
||
const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
|
||
vec3( 0.8224621, 0.177538, 0.0 ),
|
||
vec3( 0.0331941, 0.9668058, 0.0 ),
|
||
vec3( 0.0170827, 0.0723974, 0.9105199 )
|
||
);
|
||
const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(
|
||
vec3( 1.2249401, - 0.2249404, 0.0 ),
|
||
vec3( - 0.0420569, 1.0420571, 0.0 ),
|
||
vec3( - 0.0196376, - 0.0786361, 1.0982735 )
|
||
);
|
||
vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {
|
||
return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );
|
||
}
|
||
vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {
|
||
return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );
|
||
}
|
||
vec4 LinearTransferOETF( in vec4 value ) {
|
||
return 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 );
|
||
}`,Hme=`#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, envMapRotation * 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`,Vme=`#ifdef USE_ENVMAP
|
||
uniform float envMapIntensity;
|
||
uniform float flipEnvMap;
|
||
uniform mat3 envMapRotation;
|
||
#ifdef ENVMAP_TYPE_CUBE
|
||
uniform samplerCube envMap;
|
||
#else
|
||
uniform sampler2D envMap;
|
||
#endif
|
||
|
||
#endif`,Gme=`#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`,Wme=`#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`,$me=`#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`,Xme=`#ifdef USE_FOG
|
||
vFogDepth = - mvPosition.z;
|
||
#endif`,qme=`#ifdef USE_FOG
|
||
varying float vFogDepth;
|
||
#endif`,Kme=`#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`,Yme=`#ifdef USE_FOG
|
||
uniform vec3 fogColor;
|
||
varying float vFogDepth;
|
||
#ifdef FOG_EXP2
|
||
uniform float fogDensity;
|
||
#else
|
||
uniform float fogNear;
|
||
uniform float fogFar;
|
||
#endif
|
||
#endif`,Zme=`#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
|
||
}`,Qme=`#ifdef USE_LIGHTMAP
|
||
uniform sampler2D lightMap;
|
||
uniform float lightMapIntensity;
|
||
#endif`,Jme=`LambertMaterial material;
|
||
material.diffuseColor = diffuseColor.rgb;
|
||
material.specularStrength = specularStrength;`,ege=`varying vec3 vViewPosition;
|
||
struct LambertMaterial {
|
||
vec3 diffuseColor;
|
||
float specularStrength;
|
||
};
|
||
void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
|
||
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
|
||
vec3 irradiance = dotNL * directLight.color;
|
||
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
}
|
||
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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`,tge=`uniform bool receiveShadow;
|
||
uniform vec3 ambientLightColor;
|
||
#if defined( USE_LIGHT_PROBES )
|
||
uniform vec3 lightProbe[ 9 ];
|
||
#endif
|
||
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 ) {
|
||
float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
|
||
if ( cutoffDistance > 0.0 ) {
|
||
distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
|
||
}
|
||
return distanceFalloff;
|
||
}
|
||
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, 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 vec3 geometryPosition, out IncidentLight light ) {
|
||
vec3 lVector = pointLight.position - geometryPosition;
|
||
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 vec3 geometryPosition, out IncidentLight light ) {
|
||
vec3 lVector = spotLight.position - geometryPosition;
|
||
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`,nge=`#ifdef USE_ENVMAP
|
||
vec3 getIBLIrradiance( const in vec3 normal ) {
|
||
#ifdef ENVMAP_TYPE_CUBE_UV
|
||
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
||
vec4 envMapColor = textureCubeUV( envMap, envMapRotation * 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, envMapRotation * 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`,rge=`ToonMaterial material;
|
||
material.diffuseColor = diffuseColor.rgb;`,ige=`varying vec3 vViewPosition;
|
||
struct ToonMaterial {
|
||
vec3 diffuseColor;
|
||
};
|
||
void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
||
vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
|
||
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
}
|
||
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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`,sge=`BlinnPhongMaterial material;
|
||
material.diffuseColor = diffuseColor.rgb;
|
||
material.specularColor = specular;
|
||
material.specularShininess = shininess;
|
||
material.specularStrength = specularStrength;`,age=`varying vec3 vViewPosition;
|
||
struct BlinnPhongMaterial {
|
||
vec3 diffuseColor;
|
||
vec3 specularColor;
|
||
float specularShininess;
|
||
float specularStrength;
|
||
};
|
||
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
||
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
|
||
vec3 irradiance = dotNL * directLight.color;
|
||
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
|
||
}
|
||
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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`,oge=`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 );
|
||
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_DISPERSION
|
||
material.dispersion = dispersion;
|
||
#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 );
|
||
if( material.anisotropy == 0.0 ) {
|
||
anisotropyV = vec2( 1.0, 0.0 );
|
||
} else {
|
||
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`,lge=`struct PhysicalMaterial {
|
||
vec3 diffuseColor;
|
||
float roughness;
|
||
vec3 specularColor;
|
||
float specularF90;
|
||
float dispersion;
|
||
#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 clearcoatSpecularDirect = vec3( 0.0 );
|
||
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
|
||
vec3 sheenSpecularDirect = vec3( 0.0 );
|
||
vec3 sheenSpecularIndirect = 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
||
vec3 normal = geometryNormal;
|
||
vec3 viewDir = geometryViewDir;
|
||
vec3 position = geometryPosition;
|
||
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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
||
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
|
||
vec3 irradiance = dotNL * directLight.color;
|
||
#ifdef USE_CLEARCOAT
|
||
float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
|
||
vec3 ccIrradiance = dotNLcc * directLight.color;
|
||
clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
|
||
#endif
|
||
#ifdef USE_SHEEN
|
||
sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
|
||
#endif
|
||
reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
|
||
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
}
|
||
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
|
||
#ifdef USE_CLEARCOAT
|
||
clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
|
||
#endif
|
||
#ifdef USE_SHEEN
|
||
sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
|
||
#endif
|
||
vec3 singleScattering = vec3( 0.0 );
|
||
vec3 multiScattering = vec3( 0.0 );
|
||
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
|
||
#ifdef USE_IRIDESCENCE
|
||
computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
|
||
#else
|
||
computeMultiscattering( geometryNormal, geometryViewDir, 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 );
|
||
}`,cge=`
|
||
vec3 geometryPosition = - vViewPosition;
|
||
vec3 geometryNormal = normal;
|
||
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
||
vec3 geometryClearcoatNormal = vec3( 0.0 );
|
||
#ifdef USE_CLEARCOAT
|
||
geometryClearcoatNormal = clearcoatNormal;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCE
|
||
float dotNVi = saturate( dot( normal, geometryViewDir ) );
|
||
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, geometryPosition, 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.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
|
||
#endif
|
||
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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, geometryPosition, 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.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
|
||
#endif
|
||
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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, 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.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
||
#endif
|
||
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if defined( RE_IndirectDiffuse )
|
||
vec3 iblIrradiance = vec3( 0.0 );
|
||
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
|
||
#if defined( USE_LIGHT_PROBES )
|
||
irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
|
||
#endif
|
||
#if ( NUM_HEMI_LIGHTS > 0 )
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
|
||
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#endif
|
||
#if defined( RE_IndirectSpecular )
|
||
vec3 radiance = vec3( 0.0 );
|
||
vec3 clearcoatRadiance = vec3( 0.0 );
|
||
#endif`,uge=`#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( geometryNormal );
|
||
#endif
|
||
#endif
|
||
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
|
||
#ifdef USE_ANISOTROPY
|
||
radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
|
||
#else
|
||
radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
|
||
#endif
|
||
#ifdef USE_CLEARCOAT
|
||
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
|
||
#endif
|
||
#endif`,dge=`#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`,fge=`#if defined( USE_LOGDEPTHBUF )
|
||
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
||
#endif`,hge=`#if defined( USE_LOGDEPTHBUF )
|
||
uniform float logDepthBufFC;
|
||
varying float vFragDepth;
|
||
varying float vIsPerspective;
|
||
#endif`,pge=`#ifdef USE_LOGDEPTHBUF
|
||
varying float vFragDepth;
|
||
varying float vIsPerspective;
|
||
#endif`,mge=`#ifdef USE_LOGDEPTHBUF
|
||
vFragDepth = 1.0 + gl_Position.w;
|
||
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
||
#endif`,gge=`#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`,vge=`#ifdef USE_MAP
|
||
uniform sampler2D map;
|
||
#endif`,yge=`#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`,xge=`#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`,bge=`float metalnessFactor = metalness;
|
||
#ifdef USE_METALNESSMAP
|
||
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
|
||
metalnessFactor *= texelMetalness.b;
|
||
#endif`,_ge=`#ifdef USE_METALNESSMAP
|
||
uniform sampler2D metalnessMap;
|
||
#endif`,wge=`#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`,Sge=`#if defined( USE_MORPHCOLORS )
|
||
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`,Mge=`#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`,Ege=`#ifdef USE_MORPHTARGETS
|
||
#ifndef USE_INSTANCING_MORPH
|
||
uniform float morphTargetBaseInfluence;
|
||
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
||
#endif
|
||
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 );
|
||
}
|
||
#endif`,Age=`#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`,Tge=`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 nonPerturbedNormal = normal;`,Cge=`#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`,Pge=`#ifndef FLAT_SHADED
|
||
varying vec3 vNormal;
|
||
#ifdef USE_TANGENT
|
||
varying vec3 vTangent;
|
||
varying vec3 vBitangent;
|
||
#endif
|
||
#endif`,Rge=`#ifndef FLAT_SHADED
|
||
varying vec3 vNormal;
|
||
#ifdef USE_TANGENT
|
||
varying vec3 vTangent;
|
||
varying vec3 vBitangent;
|
||
#endif
|
||
#endif`,Nge=`#ifndef FLAT_SHADED
|
||
vNormal = normalize( transformedNormal );
|
||
#ifdef USE_TANGENT
|
||
vTangent = normalize( transformedTangent );
|
||
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
||
#endif
|
||
#endif`,kge=`#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`,Ige=`#ifdef USE_CLEARCOAT
|
||
vec3 clearcoatNormal = nonPerturbedNormal;
|
||
#endif`,Lge=`#ifdef USE_CLEARCOAT_NORMALMAP
|
||
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
|
||
clearcoatMapN.xy *= clearcoatNormalScale;
|
||
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
|
||
#endif`,Oge=`#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`,Dge=`#ifdef USE_IRIDESCENCEMAP
|
||
uniform sampler2D iridescenceMap;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
||
uniform sampler2D iridescenceThicknessMap;
|
||
#endif`,jge=`#ifdef OPAQUE
|
||
diffuseColor.a = 1.0;
|
||
#endif
|
||
#ifdef USE_TRANSMISSION
|
||
diffuseColor.a *= material.transmissionAlpha;
|
||
#endif
|
||
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Uge=`vec3 packNormalToRGB( const in vec3 normal ) {
|
||
return normalize( normal ) * 0.5 + 0.5;
|
||
}
|
||
vec3 unpackRGBToNormal( const in vec3 rgb ) {
|
||
return 2.0 * rgb.xyz - 1.0;
|
||
}
|
||
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
|
||
const float Inv255 = 1. / 255.;
|
||
const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
|
||
const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
|
||
const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
|
||
const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
|
||
vec4 packDepthToRGBA( const in float v ) {
|
||
if( v <= 0.0 )
|
||
return vec4( 0., 0., 0., 0. );
|
||
if( v >= 1.0 )
|
||
return vec4( 1., 1., 1., 1. );
|
||
float vuf;
|
||
float af = modf( v * PackFactors.a, vuf );
|
||
float bf = modf( vuf * ShiftRight8, vuf );
|
||
float gf = modf( vuf * ShiftRight8, vuf );
|
||
return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
|
||
}
|
||
vec3 packDepthToRGB( const in float v ) {
|
||
if( v <= 0.0 )
|
||
return vec3( 0., 0., 0. );
|
||
if( v >= 1.0 )
|
||
return vec3( 1., 1., 1. );
|
||
float vuf;
|
||
float bf = modf( v * PackFactors.b, vuf );
|
||
float gf = modf( vuf * ShiftRight8, vuf );
|
||
return vec3( vuf * Inv255, gf * PackUpscale, bf );
|
||
}
|
||
vec2 packDepthToRG( const in float v ) {
|
||
if( v <= 0.0 )
|
||
return vec2( 0., 0. );
|
||
if( v >= 1.0 )
|
||
return vec2( 1., 1. );
|
||
float vuf;
|
||
float gf = modf( v * 256., vuf );
|
||
return vec2( vuf * Inv255, gf );
|
||
}
|
||
float unpackRGBAToDepth( const in vec4 v ) {
|
||
return dot( v, UnpackFactors4 );
|
||
}
|
||
float unpackRGBToDepth( const in vec3 v ) {
|
||
return dot( v, UnpackFactors3 );
|
||
}
|
||
float unpackRGToDepth( const in vec2 v ) {
|
||
return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
|
||
}
|
||
vec4 pack2HalfToRGBA( const in 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( const in 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 );
|
||
}`,Fge=`#ifdef PREMULTIPLIED_ALPHA
|
||
gl_FragColor.rgb *= gl_FragColor.a;
|
||
#endif`,zge=`vec4 mvPosition = vec4( transformed, 1.0 );
|
||
#ifdef USE_BATCHING
|
||
mvPosition = batchingMatrix * mvPosition;
|
||
#endif
|
||
#ifdef USE_INSTANCING
|
||
mvPosition = instanceMatrix * mvPosition;
|
||
#endif
|
||
mvPosition = modelViewMatrix * mvPosition;
|
||
gl_Position = projectionMatrix * mvPosition;`,Bge=`#ifdef DITHERING
|
||
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
||
#endif`,Hge=`#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`,Vge=`float roughnessFactor = roughness;
|
||
#ifdef USE_ROUGHNESSMAP
|
||
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
|
||
roughnessFactor *= texelRoughness.g;
|
||
#endif`,Gge=`#ifdef USE_ROUGHNESSMAP
|
||
uniform sampler2D roughnessMap;
|
||
#endif`,Wge=`#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 shadowIntensity;
|
||
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 shadowIntensity;
|
||
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 shadowIntensity;
|
||
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 shadowIntensity, 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 mix( 1.0, shadow, shadowIntensity );
|
||
}
|
||
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 shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
|
||
float shadow = 1.0;
|
||
vec3 lightToPosition = shadowCoord.xyz;
|
||
|
||
float lightToPositionLength = length( lightToPosition );
|
||
if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
|
||
float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
|
||
vec3 bd3D = normalize( lightToPosition );
|
||
vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
|
||
#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
|
||
vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
|
||
shadow = (
|
||
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
|
||
shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
|
||
#endif
|
||
}
|
||
return mix( 1.0, shadow, shadowIntensity );
|
||
}
|
||
#endif`,$ge=`#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 shadowIntensity;
|
||
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 shadowIntensity;
|
||
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 shadowIntensity;
|
||
float shadowBias;
|
||
float shadowNormalBias;
|
||
float shadowRadius;
|
||
vec2 shadowMapSize;
|
||
float shadowCameraNear;
|
||
float shadowCameraFar;
|
||
};
|
||
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
||
#endif
|
||
#endif`,Xge=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
|
||
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
||
vec4 shadowWorldPosition;
|
||
#endif
|
||
#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`,qge=`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.shadowIntensity, 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.shadowIntensity, 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.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#endif
|
||
return shadow;
|
||
}`,Kge=`#ifdef USE_SKINNING
|
||
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
||
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
||
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
||
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
||
#endif`,Yge=`#ifdef USE_SKINNING
|
||
uniform mat4 bindMatrix;
|
||
uniform mat4 bindMatrixInverse;
|
||
uniform highp sampler2D boneTexture;
|
||
mat4 getBoneMatrix( const in float i ) {
|
||
int size = textureSize( boneTexture, 0 ).x;
|
||
int j = int( i ) * 4;
|
||
int x = j % size;
|
||
int y = j / size;
|
||
vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
|
||
vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
|
||
vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
|
||
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
|
||
return mat4( v1, v2, v3, v4 );
|
||
}
|
||
#endif`,Zge=`#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`,Qge=`#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`,Jge=`float specularStrength;
|
||
#ifdef USE_SPECULARMAP
|
||
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
|
||
specularStrength = texelSpecular.r;
|
||
#else
|
||
specularStrength = 1.0;
|
||
#endif`,eve=`#ifdef USE_SPECULARMAP
|
||
uniform sampler2D specularMap;
|
||
#endif`,tve=`#if defined( TONE_MAPPING )
|
||
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
||
#endif`,nve=`#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 CineonToneMapping( 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 );
|
||
}
|
||
const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
|
||
vec3( 1.6605, - 0.1246, - 0.0182 ),
|
||
vec3( - 0.5876, 1.1329, - 0.1006 ),
|
||
vec3( - 0.0728, - 0.0083, 1.1187 )
|
||
);
|
||
const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
|
||
vec3( 0.6274, 0.0691, 0.0164 ),
|
||
vec3( 0.3293, 0.9195, 0.0880 ),
|
||
vec3( 0.0433, 0.0113, 0.8956 )
|
||
);
|
||
vec3 agxDefaultContrastApprox( vec3 x ) {
|
||
vec3 x2 = x * x;
|
||
vec3 x4 = x2 * x2;
|
||
return + 15.5 * x4 * x2
|
||
- 40.14 * x4 * x
|
||
+ 31.96 * x4
|
||
- 6.868 * x2 * x
|
||
+ 0.4298 * x2
|
||
+ 0.1191 * x
|
||
- 0.00232;
|
||
}
|
||
vec3 AgXToneMapping( vec3 color ) {
|
||
const mat3 AgXInsetMatrix = mat3(
|
||
vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
|
||
vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
|
||
vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
|
||
);
|
||
const mat3 AgXOutsetMatrix = mat3(
|
||
vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
|
||
vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
|
||
vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
|
||
);
|
||
const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;
|
||
color *= toneMappingExposure;
|
||
color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
|
||
color = AgXInsetMatrix * color;
|
||
color = max( color, 1e-10 ); color = log2( color );
|
||
color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
|
||
color = clamp( color, 0.0, 1.0 );
|
||
color = agxDefaultContrastApprox( color );
|
||
color = AgXOutsetMatrix * color;
|
||
color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
|
||
color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
|
||
color = clamp( color, 0.0, 1.0 );
|
||
return color;
|
||
}
|
||
vec3 NeutralToneMapping( vec3 color ) {
|
||
const float StartCompression = 0.8 - 0.04;
|
||
const float Desaturation = 0.15;
|
||
color *= toneMappingExposure;
|
||
float x = min( color.r, min( color.g, color.b ) );
|
||
float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
|
||
color -= offset;
|
||
float peak = max( color.r, max( color.g, color.b ) );
|
||
if ( peak < StartCompression ) return color;
|
||
float d = 1. - StartCompression;
|
||
float newPeak = 1. - d * d / ( peak + d - StartCompression );
|
||
color *= newPeak / peak;
|
||
float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
|
||
return mix( color, vec3( newPeak ), g );
|
||
}
|
||
vec3 CustomToneMapping( vec3 color ) { return color; }`,rve=`#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.dispersion, 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`,ive=`#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 dispersion, const in float ior, const in float thickness,
|
||
const in vec3 attenuationColor, const in float attenuationDistance ) {
|
||
vec4 transmittedLight;
|
||
vec3 transmittance;
|
||
#ifdef USE_DISPERSION
|
||
float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
|
||
vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
|
||
for ( int i = 0; i < 3; i ++ ) {
|
||
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], 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 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
|
||
transmittedLight[ i ] = transmissionSample[ i ];
|
||
transmittedLight.a += transmissionSample.a;
|
||
transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
|
||
}
|
||
transmittedLight.a /= 3.0;
|
||
|
||
#else
|
||
|
||
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;
|
||
transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
|
||
transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
|
||
|
||
#endif
|
||
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`,sve=`#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`,ave=`#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`,ove=`#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`,lve=`#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;
|
||
#endif
|
||
#ifdef USE_INSTANCING
|
||
worldPosition = instanceMatrix * worldPosition;
|
||
#endif
|
||
worldPosition = modelMatrix * worldPosition;
|
||
#endif`;const cve=`varying vec2 vUv;
|
||
uniform mat3 uvTransform;
|
||
void main() {
|
||
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
||
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
||
}`,uve=`uniform sampler2D t2D;
|
||
uniform float backgroundIntensity;
|
||
varying vec2 vUv;
|
||
void main() {
|
||
vec4 texColor = texture2D( t2D, vUv );
|
||
#ifdef DECODE_VIDEO_TEXTURE
|
||
texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
|
||
#endif
|
||
texColor.rgb *= backgroundIntensity;
|
||
gl_FragColor = texColor;
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
}`,dve=`varying vec3 vWorldDirection;
|
||
#include <common>
|
||
void main() {
|
||
vWorldDirection = transformDirection( position, modelMatrix );
|
||
#include <begin_vertex>
|
||
#include <project_vertex>
|
||
gl_Position.z = gl_Position.w;
|
||
}`,fve=`#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;
|
||
uniform mat3 backgroundRotation;
|
||
varying vec3 vWorldDirection;
|
||
#include <cube_uv_reflection_fragment>
|
||
void main() {
|
||
#ifdef ENVMAP_TYPE_CUBE
|
||
vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
|
||
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
||
vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
|
||
#else
|
||
vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
||
#endif
|
||
texColor.rgb *= backgroundIntensity;
|
||
gl_FragColor = texColor;
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
}`,hve=`varying vec3 vWorldDirection;
|
||
#include <common>
|
||
void main() {
|
||
vWorldDirection = transformDirection( position, modelMatrix );
|
||
#include <begin_vertex>
|
||
#include <project_vertex>
|
||
gl_Position.z = gl_Position.w;
|
||
}`,pve=`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 <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
}`,mve=`#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
varying vec2 vHighPrecisionZW;
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <batching_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <morphinstance_vertex>
|
||
#ifdef USE_DISPLACEMENTMAP
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinnormal_vertex>
|
||
#endif
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vHighPrecisionZW = gl_Position.zw;
|
||
}`,gve=`#if DEPTH_PACKING == 3200
|
||
uniform float opacity;
|
||
#endif
|
||
#include <common>
|
||
#include <packing>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
varying vec2 vHighPrecisionZW;
|
||
void main() {
|
||
vec4 diffuseColor = vec4( 1.0 );
|
||
#include <clipping_planes_fragment>
|
||
#if DEPTH_PACKING == 3200
|
||
diffuseColor.a = opacity;
|
||
#endif
|
||
#include <map_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <logdepthbuf_fragment>
|
||
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 );
|
||
#elif DEPTH_PACKING == 3202
|
||
gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
|
||
#elif DEPTH_PACKING == 3203
|
||
gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
|
||
#endif
|
||
}`,vve=`#define DISTANCE
|
||
varying vec3 vWorldPosition;
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <batching_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <morphinstance_vertex>
|
||
#ifdef USE_DISPLACEMENTMAP
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinnormal_vertex>
|
||
#endif
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <worldpos_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vWorldPosition = worldPosition.xyz;
|
||
}`,yve=`#define DISTANCE
|
||
uniform vec3 referencePosition;
|
||
uniform float nearDistance;
|
||
uniform float farDistance;
|
||
varying vec3 vWorldPosition;
|
||
#include <common>
|
||
#include <packing>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main () {
|
||
vec4 diffuseColor = vec4( 1.0 );
|
||
#include <clipping_planes_fragment>
|
||
#include <map_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
float dist = length( vWorldPosition - referencePosition );
|
||
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
|
||
dist = saturate( dist );
|
||
gl_FragColor = packDepthToRGBA( dist );
|
||
}`,xve=`varying vec3 vWorldDirection;
|
||
#include <common>
|
||
void main() {
|
||
vWorldDirection = transformDirection( position, modelMatrix );
|
||
#include <begin_vertex>
|
||
#include <project_vertex>
|
||
}`,bve=`uniform sampler2D tEquirect;
|
||
varying vec3 vWorldDirection;
|
||
#include <common>
|
||
void main() {
|
||
vec3 direction = normalize( vWorldDirection );
|
||
vec2 sampleUV = equirectUv( direction );
|
||
gl_FragColor = texture2D( tEquirect, sampleUV );
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
}`,_ve=`uniform float scale;
|
||
attribute float lineDistance;
|
||
varying float vLineDistance;
|
||
#include <common>
|
||
#include <uv_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
vLineDistance = scale * lineDistance;
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <fog_vertex>
|
||
}`,wve=`uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
uniform float dashSize;
|
||
uniform float totalSize;
|
||
varying float vLineDistance;
|
||
#include <common>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
if ( mod( vLineDistance, totalSize ) > dashSize ) {
|
||
discard;
|
||
}
|
||
vec3 outgoingLight = vec3( 0.0 );
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
outgoingLight = diffuseColor.rgb;
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
}`,Sve=`#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <envmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <batching_vertex>
|
||
#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#endif
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <worldpos_vertex>
|
||
#include <envmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,Mve=`uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
#ifndef FLAT_SHADED
|
||
varying vec3 vNormal;
|
||
#endif
|
||
#include <common>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <envmap_common_pars_fragment>
|
||
#include <envmap_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <specularmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <specularmap_fragment>
|
||
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 <aomap_fragment>
|
||
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
|
||
vec3 outgoingLight = reflectedLight.indirectDiffuse;
|
||
#include <envmap_fragment>
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,Eve=`#define LAMBERT
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <envmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vViewPosition = - mvPosition.xyz;
|
||
#include <worldpos_vertex>
|
||
#include <envmap_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,Ave=`#define LAMBERT
|
||
uniform vec3 diffuse;
|
||
uniform vec3 emissive;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <packing>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <emissivemap_pars_fragment>
|
||
#include <envmap_common_pars_fragment>
|
||
#include <envmap_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <bsdfs>
|
||
#include <lights_pars_begin>
|
||
#include <normal_pars_fragment>
|
||
#include <lights_lambert_pars_fragment>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <specularmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
vec3 totalEmissiveRadiance = emissive;
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <specularmap_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
#include <emissivemap_fragment>
|
||
#include <lights_lambert_fragment>
|
||
#include <lights_fragment_begin>
|
||
#include <lights_fragment_maps>
|
||
#include <lights_fragment_end>
|
||
#include <aomap_fragment>
|
||
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
||
#include <envmap_fragment>
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,Tve=`#define MATCAP
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <fog_vertex>
|
||
vViewPosition = - mvPosition.xyz;
|
||
}`,Cve=`#define MATCAP
|
||
uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
uniform sampler2D matcap;
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <normal_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
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 <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,Pve=`#define NORMAL
|
||
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
||
varying vec3 vViewPosition;
|
||
#endif
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
||
vViewPosition = - mvPosition.xyz;
|
||
#endif
|
||
}`,Rve=`#define NORMAL
|
||
uniform float opacity;
|
||
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
||
varying vec3 vViewPosition;
|
||
#endif
|
||
#include <packing>
|
||
#include <uv_pars_fragment>
|
||
#include <normal_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
|
||
#include <clipping_planes_fragment>
|
||
#include <logdepthbuf_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
|
||
#ifdef OPAQUE
|
||
gl_FragColor.a = 1.0;
|
||
#endif
|
||
}`,Nve=`#define PHONG
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <envmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vViewPosition = - mvPosition.xyz;
|
||
#include <worldpos_vertex>
|
||
#include <envmap_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,kve=`#define PHONG
|
||
uniform vec3 diffuse;
|
||
uniform vec3 emissive;
|
||
uniform vec3 specular;
|
||
uniform float shininess;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <packing>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <emissivemap_pars_fragment>
|
||
#include <envmap_common_pars_fragment>
|
||
#include <envmap_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <bsdfs>
|
||
#include <lights_pars_begin>
|
||
#include <normal_pars_fragment>
|
||
#include <lights_phong_pars_fragment>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <specularmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
vec3 totalEmissiveRadiance = emissive;
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <specularmap_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
#include <emissivemap_fragment>
|
||
#include <lights_phong_fragment>
|
||
#include <lights_fragment_begin>
|
||
#include <lights_fragment_maps>
|
||
#include <lights_fragment_end>
|
||
#include <aomap_fragment>
|
||
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
|
||
#include <envmap_fragment>
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,Ive=`#define STANDARD
|
||
varying vec3 vViewPosition;
|
||
#ifdef USE_TRANSMISSION
|
||
varying vec3 vWorldPosition;
|
||
#endif
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vViewPosition = - mvPosition.xyz;
|
||
#include <worldpos_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
#ifdef USE_TRANSMISSION
|
||
vWorldPosition = worldPosition.xyz;
|
||
#endif
|
||
}`,Lve=`#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_DISPERSION
|
||
uniform float dispersion;
|
||
#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 <common>
|
||
#include <packing>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <emissivemap_pars_fragment>
|
||
#include <iridescence_fragment>
|
||
#include <cube_uv_reflection_fragment>
|
||
#include <envmap_common_pars_fragment>
|
||
#include <envmap_physical_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <lights_pars_begin>
|
||
#include <normal_pars_fragment>
|
||
#include <lights_physical_pars_fragment>
|
||
#include <transmission_pars_fragment>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <clearcoat_pars_fragment>
|
||
#include <iridescence_pars_fragment>
|
||
#include <roughnessmap_pars_fragment>
|
||
#include <metalnessmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
vec3 totalEmissiveRadiance = emissive;
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <roughnessmap_fragment>
|
||
#include <metalnessmap_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
#include <clearcoat_normal_fragment_begin>
|
||
#include <clearcoat_normal_fragment_maps>
|
||
#include <emissivemap_fragment>
|
||
#include <lights_physical_fragment>
|
||
#include <lights_fragment_begin>
|
||
#include <lights_fragment_maps>
|
||
#include <lights_fragment_end>
|
||
#include <aomap_fragment>
|
||
vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
|
||
vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
|
||
#include <transmission_fragment>
|
||
vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
|
||
#ifdef USE_SHEEN
|
||
float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
|
||
outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT
|
||
float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
|
||
vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
|
||
outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
|
||
#endif
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,Ove=`#define TOON
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vViewPosition = - mvPosition.xyz;
|
||
#include <worldpos_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,Dve=`#define TOON
|
||
uniform vec3 diffuse;
|
||
uniform vec3 emissive;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <packing>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <emissivemap_pars_fragment>
|
||
#include <gradientmap_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <bsdfs>
|
||
#include <lights_pars_begin>
|
||
#include <normal_pars_fragment>
|
||
#include <lights_toon_pars_fragment>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
vec3 totalEmissiveRadiance = emissive;
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
#include <emissivemap_fragment>
|
||
#include <lights_toon_fragment>
|
||
#include <lights_fragment_begin>
|
||
#include <lights_fragment_maps>
|
||
#include <lights_fragment_end>
|
||
#include <aomap_fragment>
|
||
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,jve=`uniform float size;
|
||
uniform float scale;
|
||
#include <common>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
#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 <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <project_vertex>
|
||
gl_PointSize = size;
|
||
#ifdef USE_SIZEATTENUATION
|
||
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
||
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
|
||
#endif
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <worldpos_vertex>
|
||
#include <fog_vertex>
|
||
}`,Uve=`uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <color_pars_fragment>
|
||
#include <map_particle_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
vec3 outgoingLight = vec3( 0.0 );
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_particle_fragment>
|
||
#include <color_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
outgoingLight = diffuseColor.rgb;
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
}`,Fve=`#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
void main() {
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <worldpos_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,zve=`uniform vec3 color;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <packing>
|
||
#include <fog_pars_fragment>
|
||
#include <bsdfs>
|
||
#include <lights_pars_begin>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <shadowmask_pars_fragment>
|
||
void main() {
|
||
#include <logdepthbuf_fragment>
|
||
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
}`,Bve=`uniform float rotation;
|
||
uniform vec2 center;
|
||
#include <common>
|
||
#include <uv_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
vec4 mvPosition = modelViewMatrix[ 3 ];
|
||
vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
|
||
#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 <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <fog_vertex>
|
||
}`,Hve=`uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
vec3 outgoingLight = vec3( 0.0 );
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
outgoingLight = diffuseColor.rgb;
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
}`,fn={alphahash_fragment:ume,alphahash_pars_fragment:dme,alphamap_fragment:fme,alphamap_pars_fragment:hme,alphatest_fragment:pme,alphatest_pars_fragment:mme,aomap_fragment:gme,aomap_pars_fragment:vme,batching_pars_vertex:yme,batching_vertex:xme,begin_vertex:bme,beginnormal_vertex:_me,bsdfs:wme,iridescence_fragment:Sme,bumpmap_pars_fragment:Mme,clipping_planes_fragment:Eme,clipping_planes_pars_fragment:Ame,clipping_planes_pars_vertex:Tme,clipping_planes_vertex:Cme,color_fragment:Pme,color_pars_fragment:Rme,color_pars_vertex:Nme,color_vertex:kme,common:Ime,cube_uv_reflection_fragment:Lme,defaultnormal_vertex:Ome,displacementmap_pars_vertex:Dme,displacementmap_vertex:jme,emissivemap_fragment:Ume,emissivemap_pars_fragment:Fme,colorspace_fragment:zme,colorspace_pars_fragment:Bme,envmap_fragment:Hme,envmap_common_pars_fragment:Vme,envmap_pars_fragment:Gme,envmap_pars_vertex:Wme,envmap_physical_pars_fragment:nge,envmap_vertex:$me,fog_vertex:Xme,fog_pars_vertex:qme,fog_fragment:Kme,fog_pars_fragment:Yme,gradientmap_pars_fragment:Zme,lightmap_pars_fragment:Qme,lights_lambert_fragment:Jme,lights_lambert_pars_fragment:ege,lights_pars_begin:tge,lights_toon_fragment:rge,lights_toon_pars_fragment:ige,lights_phong_fragment:sge,lights_phong_pars_fragment:age,lights_physical_fragment:oge,lights_physical_pars_fragment:lge,lights_fragment_begin:cge,lights_fragment_maps:uge,lights_fragment_end:dge,logdepthbuf_fragment:fge,logdepthbuf_pars_fragment:hge,logdepthbuf_pars_vertex:pge,logdepthbuf_vertex:mge,map_fragment:gge,map_pars_fragment:vge,map_particle_fragment:yge,map_particle_pars_fragment:xge,metalnessmap_fragment:bge,metalnessmap_pars_fragment:_ge,morphinstance_vertex:wge,morphcolor_vertex:Sge,morphnormal_vertex:Mge,morphtarget_pars_vertex:Ege,morphtarget_vertex:Age,normal_fragment_begin:Tge,normal_fragment_maps:Cge,normal_pars_fragment:Pge,normal_pars_vertex:Rge,normal_vertex:Nge,normalmap_pars_fragment:kge,clearcoat_normal_fragment_begin:Ige,clearcoat_normal_fragment_maps:Lge,clearcoat_pars_fragment:Oge,iridescence_pars_fragment:Dge,opaque_fragment:jge,packing:Uge,premultiplied_alpha_fragment:Fge,project_vertex:zge,dithering_fragment:Bge,dithering_pars_fragment:Hge,roughnessmap_fragment:Vge,roughnessmap_pars_fragment:Gge,shadowmap_pars_fragment:Wge,shadowmap_pars_vertex:$ge,shadowmap_vertex:Xge,shadowmask_pars_fragment:qge,skinbase_vertex:Kge,skinning_pars_vertex:Yge,skinning_vertex:Zge,skinnormal_vertex:Qge,specularmap_fragment:Jge,specularmap_pars_fragment:eve,tonemapping_fragment:tve,tonemapping_pars_fragment:nve,transmission_fragment:rve,transmission_pars_fragment:ive,uv_pars_fragment:sve,uv_pars_vertex:ave,uv_vertex:ove,worldpos_vertex:lve,background_vert:cve,background_frag:uve,backgroundCube_vert:dve,backgroundCube_frag:fve,cube_vert:hve,cube_frag:pve,depth_vert:mve,depth_frag:gve,distanceRGBA_vert:vve,distanceRGBA_frag:yve,equirect_vert:xve,equirect_frag:bve,linedashed_vert:_ve,linedashed_frag:wve,meshbasic_vert:Sve,meshbasic_frag:Mve,meshlambert_vert:Eve,meshlambert_frag:Ave,meshmatcap_vert:Tve,meshmatcap_frag:Cve,meshnormal_vert:Pve,meshnormal_frag:Rve,meshphong_vert:Nve,meshphong_frag:kve,meshphysical_vert:Ive,meshphysical_frag:Lve,meshtoon_vert:Ove,meshtoon_frag:Dve,points_vert:jve,points_frag:Uve,shadow_vert:Fve,shadow_frag:zve,sprite_vert:Bve,sprite_frag:Hve},ht={common:{diffuse:{value:new ut(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Xt},alphaMap:{value:null},alphaMapTransform:{value:new Xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Xt}},envmap:{envMap:{value:null},envMapRotation:{value:new Xt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Xt},normalScale:{value:new He(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ut(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ut(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Xt},alphaTest:{value:0},uvTransform:{value:new Xt}},sprite:{diffuse:{value:new ut(16777215)},opacity:{value:1},center:{value:new He(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Xt},alphaMap:{value:null},alphaMapTransform:{value:new Xt},alphaTest:{value:0}}},jo={basic:{uniforms:_s([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.fog]),vertexShader:fn.meshbasic_vert,fragmentShader:fn.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 ut(0)}}]),vertexShader:fn.meshlambert_vert,fragmentShader:fn.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 ut(0)},specular:{value:new ut(1118481)},shininess:{value:30}}]),vertexShader:fn.meshphong_vert,fragmentShader:fn.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 ut(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:fn.meshphysical_vert,fragmentShader:fn.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 ut(0)}}]),vertexShader:fn.meshtoon_vert,fragmentShader:fn.meshtoon_frag},matcap:{uniforms:_s([ht.common,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,{matcap:{value:null}}]),vertexShader:fn.meshmatcap_vert,fragmentShader:fn.meshmatcap_frag},points:{uniforms:_s([ht.points,ht.fog]),vertexShader:fn.points_vert,fragmentShader:fn.points_frag},dashed:{uniforms:_s([ht.common,ht.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:fn.linedashed_vert,fragmentShader:fn.linedashed_frag},depth:{uniforms:_s([ht.common,ht.displacementmap]),vertexShader:fn.depth_vert,fragmentShader:fn.depth_frag},normal:{uniforms:_s([ht.common,ht.bumpmap,ht.normalmap,ht.displacementmap,{opacity:{value:1}}]),vertexShader:fn.meshnormal_vert,fragmentShader:fn.meshnormal_frag},sprite:{uniforms:_s([ht.sprite,ht.fog]),vertexShader:fn.sprite_vert,fragmentShader:fn.sprite_frag},background:{uniforms:{uvTransform:{value:new Xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:fn.background_vert,fragmentShader:fn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Xt}},vertexShader:fn.backgroundCube_vert,fragmentShader:fn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:fn.cube_vert,fragmentShader:fn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:fn.equirect_vert,fragmentShader:fn.equirect_frag},distanceRGBA:{uniforms:_s([ht.common,ht.displacementmap,{referencePosition:{value:new q},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:fn.distanceRGBA_vert,fragmentShader:fn.distanceRGBA_frag},shadow:{uniforms:_s([ht.lights,ht.fog,{color:{value:new ut(0)},opacity:{value:1}}]),vertexShader:fn.shadow_vert,fragmentShader:fn.shadow_frag}};jo.physical={uniforms:_s([jo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Xt},clearcoatNormalScale:{value:new He(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Xt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Xt},sheen:{value:0},sheenColor:{value:new ut(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Xt},transmissionSamplerSize:{value:new He},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Xt},attenuationDistance:{value:0},attenuationColor:{value:new ut(0)},specularColor:{value:new ut(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Xt},anisotropyVector:{value:new He},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Xt}}]),vertexShader:fn.meshphysical_vert,fragmentShader:fn.meshphysical_frag};const l_={r:0,b:0,g:0},Uf=new ls,Vve=new Rt;function Gve(t,e,n,r,i,s,a){const o=new ut(0);let l=s===!0?0:1,c,d,f=null,p=0,y=null;function x(M){let T=M.isScene===!0?M.background:null;return T&&T.isTexture&&(T=(M.backgroundBlurriness>0?n:e).get(T)),T}function S(M){let T=!1;const C=x(M);C===null?b(o,l):C&&C.isColor&&(b(C,1),T=!0);const L=t.xr.getEnvironmentBlendMode();L==="additive"?r.buffers.color.setClear(0,0,0,1,a):L==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,a),(t.autoClear||T)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function w(M,T){const C=x(T);C&&(C.isCubeTexture||C.mapping===ov)?(d===void 0&&(d=new xr(new cp(1,1,1),new Qa({name:"BackgroundCubeMaterial",uniforms:Vg(jo.backgroundCube.uniforms),vertexShader:jo.backgroundCube.vertexShader,fragmentShader:jo.backgroundCube.fragmentShader,side:as,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(L,N,D){this.matrixWorld.copyPosition(D.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(d)),Uf.copy(T.backgroundRotation),Uf.x*=-1,Uf.y*=-1,Uf.z*=-1,C.isCubeTexture&&C.isRenderTargetTexture===!1&&(Uf.y*=-1,Uf.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(Vve.makeRotationFromEuler(Uf)),d.material.toneMapped=Nn.getTransfer(C.colorSpace)!==er,(f!==C||p!==C.version||y!==t.toneMapping)&&(d.material.needsUpdate=!0,f=C,p=C.version,y=t.toneMapping),d.layers.enableAll(),M.unshift(d,d.geometry,d.material,0,0,null)):C&&C.isTexture&&(c===void 0&&(c=new xr(new cv(2,2),new Qa({name:"BackgroundMaterial",uniforms:Vg(jo.background.uniforms),vertexShader:jo.background.vertexShader,fragmentShader:jo.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=Nn.getTransfer(C.colorSpace)!==er,C.matrixAutoUpdate===!0&&C.updateMatrix(),c.material.uniforms.uvTransform.value.copy(C.matrix),(f!==C||p!==C.version||y!==t.toneMapping)&&(c.material.needsUpdate=!0,f=C,p=C.version,y=t.toneMapping),c.layers.enableAll(),M.unshift(c,c.geometry,c.material,0,0,null))}function b(M,T){M.getRGB(l_,R6(t)),r.buffers.color.setClear(l_.r,l_.g,l_.b,T,a)}return{getClearColor:function(){return o},setClearColor:function(M,T=1){o.set(M),l=T,b(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(M){l=M,b(o,l)},render:S,addToRenderList:w}}function Wve(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),r={},i=p(null);let s=i,a=!1;function o(I,U,X,te,re){let pe=!1;const ee=f(te,X,U);s!==ee&&(s=ee,c(s.object)),pe=y(I,te,X,re),pe&&x(I,te,X,re),re!==null&&e.update(re,t.ELEMENT_ARRAY_BUFFER),(pe||a)&&(a=!1,C(I,U,X,te),re!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(re).buffer))}function l(){return t.createVertexArray()}function c(I){return t.bindVertexArray(I)}function d(I){return t.deleteVertexArray(I)}function f(I,U,X){const te=X.wireframe===!0;let re=r[I.id];re===void 0&&(re={},r[I.id]=re);let pe=re[U.id];pe===void 0&&(pe={},re[U.id]=pe);let ee=pe[te];return ee===void 0&&(ee=p(l()),pe[te]=ee),ee}function p(I){const U=[],X=[],te=[];for(let re=0;re<n;re++)U[re]=0,X[re]=0,te[re]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:U,enabledAttributes:X,attributeDivisors:te,object:I,attributes:{},index:null}}function y(I,U,X,te){const re=s.attributes,pe=U.attributes;let ee=0;const ce=X.getAttributes();for(const B in ce)if(ce[B].location>=0){const Z=re[B];let G=pe[B];if(G===void 0&&(B==="instanceMatrix"&&I.instanceMatrix&&(G=I.instanceMatrix),B==="instanceColor"&&I.instanceColor&&(G=I.instanceColor)),Z===void 0||Z.attribute!==G||G&&Z.data!==G.data)return!0;ee++}return s.attributesNum!==ee||s.index!==te}function x(I,U,X,te){const re={},pe=U.attributes;let ee=0;const ce=X.getAttributes();for(const B in ce)if(ce[B].location>=0){let Z=pe[B];Z===void 0&&(B==="instanceMatrix"&&I.instanceMatrix&&(Z=I.instanceMatrix),B==="instanceColor"&&I.instanceColor&&(Z=I.instanceColor));const G={};G.attribute=Z,Z&&Z.data&&(G.data=Z.data),re[B]=G,ee++}s.attributes=re,s.attributesNum=ee,s.index=te}function S(){const I=s.newAttributes;for(let U=0,X=I.length;U<X;U++)I[U]=0}function w(I){b(I,0)}function b(I,U){const X=s.newAttributes,te=s.enabledAttributes,re=s.attributeDivisors;X[I]=1,te[I]===0&&(t.enableVertexAttribArray(I),te[I]=1),re[I]!==U&&(t.vertexAttribDivisor(I,U),re[I]=U)}function M(){const I=s.newAttributes,U=s.enabledAttributes;for(let X=0,te=U.length;X<te;X++)U[X]!==I[X]&&(t.disableVertexAttribArray(X),U[X]=0)}function T(I,U,X,te,re,pe,ee){ee===!0?t.vertexAttribIPointer(I,U,X,re,pe):t.vertexAttribPointer(I,U,X,te,re,pe)}function C(I,U,X,te){S();const re=te.attributes,pe=X.getAttributes(),ee=U.defaultAttributeValues;for(const ce in pe){const B=pe[ce];if(B.location>=0){let J=re[ce];if(J===void 0&&(ce==="instanceMatrix"&&I.instanceMatrix&&(J=I.instanceMatrix),ce==="instanceColor"&&I.instanceColor&&(J=I.instanceColor)),J!==void 0){const Z=J.normalized,G=J.itemSize,W=e.get(J);if(W===void 0)continue;const oe=W.buffer,se=W.type,le=W.bytesPerElement,Me=se===t.INT||se===t.UNSIGNED_INT||J.gpuType===QS;if(J.isInterleavedBufferAttribute){const Se=J.data,$e=Se.stride,Ee=J.offset;if(Se.isInstancedInterleavedBuffer){for(let Ge=0;Ge<B.locationSize;Ge++)b(B.location+Ge,Se.meshPerAttribute);I.isInstancedMesh!==!0&&te._maxInstanceCount===void 0&&(te._maxInstanceCount=Se.meshPerAttribute*Se.count)}else for(let Ge=0;Ge<B.locationSize;Ge++)w(B.location+Ge);t.bindBuffer(t.ARRAY_BUFFER,oe);for(let Ge=0;Ge<B.locationSize;Ge++)T(B.location+Ge,G/B.locationSize,se,Z,$e*le,(Ee+G/B.locationSize*Ge)*le,Me)}else{if(J.isInstancedBufferAttribute){for(let Se=0;Se<B.locationSize;Se++)b(B.location+Se,J.meshPerAttribute);I.isInstancedMesh!==!0&&te._maxInstanceCount===void 0&&(te._maxInstanceCount=J.meshPerAttribute*J.count)}else for(let Se=0;Se<B.locationSize;Se++)w(B.location+Se);t.bindBuffer(t.ARRAY_BUFFER,oe);for(let Se=0;Se<B.locationSize;Se++)T(B.location+Se,G/B.locationSize,se,Z,G*le,G/B.locationSize*Se*le,Me)}}else if(ee!==void 0){const Z=ee[ce];if(Z!==void 0)switch(Z.length){case 2:t.vertexAttrib2fv(B.location,Z);break;case 3:t.vertexAttrib3fv(B.location,Z);break;case 4:t.vertexAttrib4fv(B.location,Z);break;default:t.vertexAttrib1fv(B.location,Z)}}}}M()}function L(){F();for(const I in r){const U=r[I];for(const X in U){const te=U[X];for(const re in te)d(te[re].object),delete te[re];delete U[X]}delete r[I]}}function N(I){if(r[I.id]===void 0)return;const U=r[I.id];for(const X in U){const te=U[X];for(const re in te)d(te[re].object),delete te[re];delete U[X]}delete r[I.id]}function D(I){for(const U in r){const X=r[U];if(X[I.id]===void 0)continue;const te=X[I.id];for(const re in te)d(te[re].object),delete te[re];delete X[I.id]}}function F(){V(),a=!0,s!==i&&(s=i,c(s.object))}function V(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:F,resetDefaultState:V,dispose:L,releaseStatesOfGeometry:N,releaseStatesOfProgram:D,initAttributes:S,enableAttribute:w,disableUnusedAttributes:M}}function $ve(t,e,n){let r;function i(c){r=c}function s(c,d){t.drawArrays(r,c,d),n.update(d,r,1)}function a(c,d,f){f!==0&&(t.drawArraysInstanced(r,c,d,f),n.update(d,r,f))}function o(c,d,f){if(f===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(r,c,0,d,0,f);let y=0;for(let x=0;x<f;x++)y+=d[x];n.update(y,r,1)}function l(c,d,f,p){if(f===0)return;const y=e.get("WEBGL_multi_draw");if(y===null)for(let x=0;x<c.length;x++)a(c[x],d[x],p[x]);else{y.multiDrawArraysInstancedWEBGL(r,c,0,d,0,p,0,f);let x=0;for(let S=0;S<f;S++)x+=d[S];for(let S=0;S<p.length;S++)n.update(x,r,p[S])}}this.setMode=i,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function Xve(t,e,n,r){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const D=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(D.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(D){return!(D!==ss&&r.convert(D)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(D){const F=D===lv&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(D!==Vo&&r.convert(D)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&D!==ea&&!F)}function l(D){if(D==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";D="mediump"}return D==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=n.precision!==void 0?n.precision:"highp";const d=l(c);d!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",d,"instead."),c=d);const f=n.logarithmicDepthBuffer===!0,p=n.reverseDepthBuffer===!0&&e.has("EXT_clip_control");if(p===!0){const D=e.get("EXT_clip_control");D.clipControlEXT(D.LOWER_LEFT_EXT,D.ZERO_TO_ONE_EXT)}const y=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),x=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),S=t.getParameter(t.MAX_TEXTURE_SIZE),w=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),b=t.getParameter(t.MAX_VERTEX_ATTRIBS),M=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),T=t.getParameter(t.MAX_VARYING_VECTORS),C=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),L=x>0,N=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:f,reverseDepthBuffer:p,maxTextures:y,maxVertexTextures:x,maxTextureSize:S,maxCubemapSize:w,maxAttributes:b,maxVertexUniforms:M,maxVaryings:T,maxFragmentUniforms:C,vertexTextures:L,maxSamples:N}}function qve(t){const e=this;let n=null,r=0,i=!1,s=!1;const a=new Lc,o=new Xt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,p){const y=f.length!==0||p||r!==0||i;return i=p,r=f.length,y},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,p){n=d(f,p,0)},this.setState=function(f,p,y){const x=f.clippingPlanes,S=f.clipIntersection,w=f.clipShadows,b=t.get(f);if(!i||x===null||x.length===0||s&&!w)s?d(null):c();else{const M=s?0:r,T=M*4;let C=b.clippingState||null;l.value=C,C=d(x,p,T,y);for(let L=0;L!==T;++L)C[L]=n[L];b.clippingState=C,this.numIntersection=S?this.numPlanes:0,this.numPlanes+=M}};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function d(f,p,y,x){const S=f!==null?f.length:0;let w=null;if(S!==0){if(w=l.value,x!==!0||w===null){const b=y+S*4,M=p.matrixWorldInverse;o.getNormalMatrix(M),(w===null||w.length<b)&&(w=new Float32Array(b));for(let T=0,C=y;T!==S;++T,C+=4)a.copy(f[T]).applyMatrix4(M,o),a.normal.toArray(w,C),w[C+3]=a.constant}l.value=w,l.needsUpdate=!0}return e.numPlanes=S,e.numIntersection=0,w}}function Kve(t){let e=new WeakMap;function n(a,o){return o===ky?a.mapping=tu:o===Iy&&(a.mapping=Id),a}function r(a){if(a&&a.isTexture){const o=a.mapping;if(o===ky||o===Iy)if(e.has(a)){const l=e.get(a).texture;return n(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new k6(l.height);return c.fromEquirectangularTexture(t,a),e.set(a,c),a.addEventListener("dispose",i),n(c.texture,a.mapping)}else return null}}return a}function i(a){const o=a.target;o.removeEventListener("dispose",i);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}class qc extends vx{constructor(e=-1,n=1,r=1,i=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=r,this.bottom=i,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,n,r,i,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=r-e,a=r+e,o=i+n,l=i-n;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=d*this.view.offsetY,l=o-d*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}const eg=4,gD=[.125,.215,.35,.446,.526,.582],sh=20,SA=new qc,vD=new ut;let MA=null,EA=0,AA=0,TA=!1;const rh=(1+Math.sqrt(5))/2,Im=1/rh,yD=[new q(-rh,Im,0),new q(rh,Im,0),new q(-Im,0,rh),new q(Im,0,rh),new q(0,rh,-Im),new q(0,rh,Im),new q(-1,1,-1),new q(1,1,-1),new q(-1,1,1),new q(1,1,1)];class JC{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,n=0,r=.1,i=100){MA=this._renderer.getRenderTarget(),EA=this._renderer.getActiveCubeFace(),AA=this._renderer.getActiveMipmapLevel(),TA=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=_D(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=bD(),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;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(MA,EA,AA),this._renderer.xr.enabled=TA,e.scissorTest=!1,c_(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===tu||e.mapping===Id?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),MA=this._renderer.getRenderTarget(),EA=this._renderer.getActiveCubeFace(),AA=this._renderer.getActiveMipmapLevel(),TA=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const r=n||this._allocateTargets();return this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,r={magFilter:Pr,minFilter:Pr,generateMipmaps:!1,type:lv,format:ss,colorSpace:xi,depthBuffer:!1},i=xD(e,n,r);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=xD(e,n,r);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Yve(s)),this._blurMaterial=Zve(s,e,n)}return i}_compileMaterial(e){const n=new xr(this._lodPlanes[0],e);this._renderer.compile(n,SA)}_sceneToCubeUV(e,n,r,i){const o=new Cr(90,1,n,r),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],d=this._renderer,f=d.autoClear,p=d.toneMapping;d.getClearColor(vD),d.toneMapping=Cl,d.autoClear=!1;const y=new Ts({name:"PMREM.Background",side:as,depthWrite:!1,depthTest:!1}),x=new xr(new cp,y);let S=!1;const w=e.background;w?w.isColor&&(y.color.copy(w),e.background=null,S=!0):(y.color.copy(vD),S=!0);for(let b=0;b<6;b++){const M=b%3;M===0?(o.up.set(0,l[b],0),o.lookAt(c[b],0,0)):M===1?(o.up.set(0,0,l[b]),o.lookAt(0,c[b],0)):(o.up.set(0,l[b],0),o.lookAt(0,0,c[b]));const T=this._cubeSize;c_(i,M*T,b>2?T:0,T,T),d.setRenderTarget(i),S&&d.render(x,o),d.render(e,o)}x.geometry.dispose(),x.material.dispose(),d.toneMapping=p,d.autoClear=f,e.background=w}_textureToCubeUV(e,n){const r=this._renderer,i=e.mapping===tu||e.mapping===Id;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=_D()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=bD());const s=i?this._cubemapMaterial:this._equirectMaterial,a=new xr(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;c_(n,0,0,3*l,2*l),r.setRenderTarget(n),r.render(a,SA)}_applyPMREM(e){const n=this._renderer,r=n.autoClear;n.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;s<i;s++){const a=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),o=yD[(i-s-1)%yD.length];this._blur(e,s-1,s,a,o)}n.autoClear=r}_blur(e,n,r,i,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,n,r,i,"latitudinal",s),this._halfBlur(a,e,r,r,i,"longitudinal",s)}_halfBlur(e,n,r,i,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const d=3,f=new xr(this._lodPlanes[i],c),p=c.uniforms,y=this._sizeLods[r]-1,x=isFinite(s)?Math.PI/(2*y):2*Math.PI/(2*sh-1),S=s/x,w=isFinite(s)?1+Math.floor(d*S):sh;w>sh&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${w} samples when the maximum is set to ${sh}`);const b=[];let M=0;for(let D=0;D<sh;++D){const F=D/S,V=Math.exp(-F*F/2);b.push(V),D===0?M+=V:D<w&&(M+=2*V)}for(let D=0;D<b.length;D++)b[D]=b[D]/M;p.envMap.value=e.texture,p.samples.value=w,p.weights.value=b,p.latitudinal.value=a==="latitudinal",o&&(p.poleAxis.value=o);const{_lodMax:T}=this;p.dTheta.value=x,p.mipInt.value=T-r;const C=this._sizeLods[i],L=3*C*(i>T-eg?i-T+eg:0),N=4*(this._cubeSize-C);c_(n,L,N,3*C,2*C),l.setRenderTarget(n),l.render(f,SA)}}function Yve(t){const e=[],n=[],r=[];let i=t;const s=t-eg+1+gD.length;for(let a=0;a<s;a++){const o=Math.pow(2,i);n.push(o);let l=1/o;a>t-eg?l=gD[a-t+eg-1]:a===0&&(l=0),r.push(l);const c=1/(o-2),d=-c,f=1+c,p=[d,d,f,d,f,f,d,d,f,f,d,f],y=6,x=6,S=3,w=2,b=1,M=new Float32Array(S*x*y),T=new Float32Array(w*x*y),C=new Float32Array(b*x*y);for(let N=0;N<y;N++){const D=N%3*2/3-1,F=N>2?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];M.set(V,S*x*N),T.set(p,w*x*N);const I=[N,N,N,N,N,N];C.set(I,b*x*N)}const L=new Yt;L.setAttribute("position",new Qt(M,S)),L.setAttribute("uv",new Qt(T,w)),L.setAttribute("faceIndex",new Qt(C,b)),e.push(L),i>eg&&i--}return{lodPlanes:e,sizeLods:n,sigmas:r}}function xD(t,e,n){const r=new Go(t,e,n);return r.texture.mapping=ov,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function c_(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function Zve(t,e,n){const r=new Float32Array(sh),i=new q(0,1,0);return new Qa({name:"SphericalGaussianBlur",defines:{n:sh,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:IR(),fragmentShader:`
|
||
|
||
precision mediump float;
|
||
precision mediump int;
|
||
|
||
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 <cube_uv_reflection_fragment>
|
||
|
||
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:Xc,depthTest:!1,depthWrite:!1})}function bD(){return new Qa({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:IR(),fragmentShader:`
|
||
|
||
precision mediump float;
|
||
precision mediump int;
|
||
|
||
varying vec3 vOutputDirection;
|
||
|
||
uniform sampler2D envMap;
|
||
|
||
#include <common>
|
||
|
||
void main() {
|
||
|
||
vec3 outputDirection = normalize( vOutputDirection );
|
||
vec2 uv = equirectUv( outputDirection );
|
||
|
||
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
||
|
||
}
|
||
`,blending:Xc,depthTest:!1,depthWrite:!1})}function _D(){return new Qa({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:IR(),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:Xc,depthTest:!1,depthWrite:!1})}function IR(){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 Qve(t){let e=new WeakMap,n=null;function r(o){if(o&&o.isTexture){const l=o.mapping,c=l===ky||l===Iy,d=l===tu||l===Id;if(c||d){let f=e.get(o);const p=f!==void 0?f.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==p)return n===null&&(n=new JC(t)),f=c?n.fromEquirectangular(o,f):n.fromCubemap(o,f),f.texture.pmremVersion=o.pmremVersion,e.set(o,f),f.texture;if(f!==void 0)return f.texture;{const y=o.image;return c&&y&&y.height>0||d&&y&&i(y)?(n===null&&(n=new JC(t)),f=c?n.fromEquirectangular(o):n.fromCubemap(o),f.texture.pmremVersion=o.pmremVersion,e.set(o,f),o.addEventListener("dispose",s),f.texture):null}}}return o}function i(o){let l=0;const c=6;for(let d=0;d<c;d++)o[d]!==void 0&&l++;return l===c}function s(o){const l=o.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:a}}function Jve(t){const e={};function n(r){if(e[r]!==void 0)return e[r];let i;switch(r){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(r)}return e[r]=i,i}return{has:function(r){return n(r)!==null},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(r){const i=n(r);return i===null&&J_("THREE.WebGLRenderer: "+r+" extension not supported."),i}}}function e0e(t,e,n,r){const i={},s=new WeakMap;function a(f){const p=f.target;p.index!==null&&e.remove(p.index);for(const x in p.attributes)e.remove(p.attributes[x]);for(const x in p.morphAttributes){const S=p.morphAttributes[x];for(let w=0,b=S.length;w<b;w++)e.remove(S[w])}p.removeEventListener("dispose",a),delete i[p.id];const y=s.get(p);y&&(e.remove(y),s.delete(p)),r.releaseStatesOfGeometry(p),p.isInstancedBufferGeometry===!0&&delete p._maxInstanceCount,n.memory.geometries--}function o(f,p){return i[p.id]===!0||(p.addEventListener("dispose",a),i[p.id]=!0,n.memory.geometries++),p}function l(f){const p=f.attributes;for(const x in p)e.update(p[x],t.ARRAY_BUFFER);const y=f.morphAttributes;for(const x in y){const S=y[x];for(let w=0,b=S.length;w<b;w++)e.update(S[w],t.ARRAY_BUFFER)}}function c(f){const p=[],y=f.index,x=f.attributes.position;let S=0;if(y!==null){const M=y.array;S=y.version;for(let T=0,C=M.length;T<C;T+=3){const L=M[T+0],N=M[T+1],D=M[T+2];p.push(L,N,N,D,D,L)}}else if(x!==void 0){const M=x.array;S=x.version;for(let T=0,C=M.length/3-1;T<C;T+=3){const L=T+0,N=T+1,D=T+2;p.push(L,N,N,D,D,L)}}else return;const w=new(E6(p)?NR:RR)(p,1);w.version=S;const b=s.get(f);b&&e.remove(b),s.set(f,w)}function d(f){const p=s.get(f);if(p){const y=f.index;y!==null&&p.version<y.version&&c(f)}else c(f);return s.get(f)}return{get:o,update:l,getWireframeAttribute:d}}function t0e(t,e,n){let r;function i(p){r=p}let s,a;function o(p){s=p.type,a=p.bytesPerElement}function l(p,y){t.drawElements(r,y,s,p*a),n.update(y,r,1)}function c(p,y,x){x!==0&&(t.drawElementsInstanced(r,y,s,p*a,x),n.update(y,r,x))}function d(p,y,x){if(x===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(r,y,0,s,p,0,x);let w=0;for(let b=0;b<x;b++)w+=y[b];n.update(w,r,1)}function f(p,y,x,S){if(x===0)return;const w=e.get("WEBGL_multi_draw");if(w===null)for(let b=0;b<p.length;b++)c(p[b]/a,y[b],S[b]);else{w.multiDrawElementsInstancedWEBGL(r,y,0,s,p,0,S,0,x);let b=0;for(let M=0;M<x;M++)b+=y[M];for(let M=0;M<S.length;M++)n.update(b,r,S[M])}}this.setMode=i,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=d,this.renderMultiDrawInstances=f}function n0e(t){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function r(s,a,o){switch(n.calls++,a){case t.TRIANGLES:n.triangles+=o*(s/3);break;case t.LINES:n.lines+=o*(s/2);break;case t.LINE_STRIP:n.lines+=o*(s-1);break;case t.LINE_LOOP:n.lines+=o*s;break;case t.POINTS:n.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function i(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:e,render:n,programs:null,autoReset:!0,reset:i,update:r}}function r0e(t,e,n){const r=new WeakMap,i=new On;function s(a,o,l){const c=a.morphTargetInfluences,d=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,f=d!==void 0?d.length:0;let p=r.get(o);if(p===void 0||p.count!==f){let V=function(){D.dispose(),r.delete(o),o.removeEventListener("dispose",V)};p!==void 0&&p.texture.dispose();const y=o.morphAttributes.position!==void 0,x=o.morphAttributes.normal!==void 0,S=o.morphAttributes.color!==void 0,w=o.morphAttributes.position||[],b=o.morphAttributes.normal||[],M=o.morphAttributes.color||[];let T=0;y===!0&&(T=1),x===!0&&(T=2),S===!0&&(T=3);let C=o.attributes.position.count*T,L=1;C>e.maxTextureSize&&(L=Math.ceil(C/e.maxTextureSize),C=e.maxTextureSize);const N=new Float32Array(C*L*4*f),D=new aM(N,C,L,f);D.type=ea,D.needsUpdate=!0;const F=T*4;for(let I=0;I<f;I++){const U=w[I],X=b[I],te=M[I],re=C*L*4*I;for(let pe=0;pe<U.count;pe++){const ee=pe*F;y===!0&&(i.fromBufferAttribute(U,pe),N[re+ee+0]=i.x,N[re+ee+1]=i.y,N[re+ee+2]=i.z,N[re+ee+3]=0),x===!0&&(i.fromBufferAttribute(X,pe),N[re+ee+4]=i.x,N[re+ee+5]=i.y,N[re+ee+6]=i.z,N[re+ee+7]=0),S===!0&&(i.fromBufferAttribute(te,pe),N[re+ee+8]=i.x,N[re+ee+9]=i.y,N[re+ee+10]=i.z,N[re+ee+11]=te.itemSize===4?i.w:1)}}p={count:f,texture:D,size:new He(C,L)},r.set(o,p),o.addEventListener("dispose",V)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(t,"morphTexture",a.morphTexture,n);else{let y=0;for(let S=0;S<c.length;S++)y+=c[S];const x=o.morphTargetsRelative?1:1-y;l.getUniforms().setValue(t,"morphTargetBaseInfluence",x),l.getUniforms().setValue(t,"morphTargetInfluences",c)}l.getUniforms().setValue(t,"morphTargetsTexture",p.texture,n),l.getUniforms().setValue(t,"morphTargetsTextureSize",p.size)}return{update:s}}function i0e(t,e,n,r){let i=new WeakMap;function s(l){const c=r.render.frame,d=l.geometry,f=e.get(l,d);if(i.get(f)!==c&&(e.update(f),i.set(f,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),i.get(l)!==c&&(n.update(l.instanceMatrix,t.ARRAY_BUFFER),l.instanceColor!==null&&n.update(l.instanceColor,t.ARRAY_BUFFER),i.set(l,c))),l.isSkinnedMesh){const p=l.skeleton;i.get(p)!==c&&(p.update(),i.set(p,c))}return f}function a(){i=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),n.remove(c.instanceMatrix),c.instanceColor!==null&&n.remove(c.instanceColor)}return{update:s,dispose:a}}class LR extends fr{constructor(e,n,r,i,s,a,o,l,c,d=Ih){if(d!==Ih&&d!==qh)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&d===Ih&&(r=nu),r===void 0&&d===qh&&(r=Xh),super(null,i,s,a,o,l,d,r,c),this.isDepthTexture=!0,this.image={width:e,height:n},this.magFilter=o!==void 0?o:ri,this.minFilter=l!==void 0?l:ri,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}}const L6=new fr,wD=new LR(1,1),O6=new aM,D6=new PR,j6=new yx,SD=[],MD=[],ED=new Float32Array(16),AD=new Float32Array(9),TD=new Float32Array(4);function uv(t,e,n){const r=t[0];if(r<=0||r>0)return t;const i=e*n;let s=SD[i];if(s===void 0&&(s=new Float32Array(i),SD[i]=s),e!==0){r.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=n,t[a].toArray(s,o)}return s}function ii(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n<r;n++)if(t[n]!==e[n])return!1;return!0}function si(t,e){for(let n=0,r=e.length;n<r;n++)t[n]=e[n]}function oM(t,e){let n=MD[e];n===void 0&&(n=new Int32Array(e),MD[e]=n);for(let r=0;r!==e;++r)n[r]=t.allocateTextureUnit();return n}function s0e(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function a0e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ii(n,e))return;t.uniform2fv(this.addr,e),si(n,e)}}function o0e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(e.r!==void 0)(n[0]!==e.r||n[1]!==e.g||n[2]!==e.b)&&(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(ii(n,e))return;t.uniform3fv(this.addr,e),si(n,e)}}function l0e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ii(n,e))return;t.uniform4fv(this.addr,e),si(n,e)}}function c0e(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(ii(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),si(n,e)}else{if(ii(n,r))return;TD.set(r),t.uniformMatrix2fv(this.addr,!1,TD),si(n,r)}}function u0e(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(ii(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),si(n,e)}else{if(ii(n,r))return;AD.set(r),t.uniformMatrix3fv(this.addr,!1,AD),si(n,r)}}function d0e(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(ii(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),si(n,e)}else{if(ii(n,r))return;ED.set(r),t.uniformMatrix4fv(this.addr,!1,ED),si(n,r)}}function f0e(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function h0e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ii(n,e))return;t.uniform2iv(this.addr,e),si(n,e)}}function p0e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(ii(n,e))return;t.uniform3iv(this.addr,e),si(n,e)}}function m0e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ii(n,e))return;t.uniform4iv(this.addr,e),si(n,e)}}function g0e(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function v0e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ii(n,e))return;t.uniform2uiv(this.addr,e),si(n,e)}}function y0e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(ii(n,e))return;t.uniform3uiv(this.addr,e),si(n,e)}}function x0e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ii(n,e))return;t.uniform4uiv(this.addr,e),si(n,e)}}function b0e(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i);let s;this.type===t.SAMPLER_2D_SHADOW?(wD.compareFunction=TR,s=wD):s=L6,n.setTexture2D(e||s,i)}function _0e(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(e||D6,i)}function w0e(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(e||j6,i)}function S0e(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(e||O6,i)}function M0e(t){switch(t){case 5126:return s0e;case 35664:return a0e;case 35665:return o0e;case 35666:return l0e;case 35674:return c0e;case 35675:return u0e;case 35676:return d0e;case 5124:case 35670:return f0e;case 35667:case 35671:return h0e;case 35668:case 35672:return p0e;case 35669:case 35673:return m0e;case 5125:return g0e;case 36294:return v0e;case 36295:return y0e;case 36296:return x0e;case 35678:case 36198:case 36298:case 36306:case 35682:return b0e;case 35679:case 36299:case 36307:return _0e;case 35680:case 36300:case 36308:case 36293:return w0e;case 36289:case 36303:case 36311:case 36292:return S0e}}function E0e(t,e){t.uniform1fv(this.addr,e)}function A0e(t,e){const n=uv(e,this.size,2);t.uniform2fv(this.addr,n)}function T0e(t,e){const n=uv(e,this.size,3);t.uniform3fv(this.addr,n)}function C0e(t,e){const n=uv(e,this.size,4);t.uniform4fv(this.addr,n)}function P0e(t,e){const n=uv(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function R0e(t,e){const n=uv(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function N0e(t,e){const n=uv(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function k0e(t,e){t.uniform1iv(this.addr,e)}function I0e(t,e){t.uniform2iv(this.addr,e)}function L0e(t,e){t.uniform3iv(this.addr,e)}function O0e(t,e){t.uniform4iv(this.addr,e)}function D0e(t,e){t.uniform1uiv(this.addr,e)}function j0e(t,e){t.uniform2uiv(this.addr,e)}function U0e(t,e){t.uniform3uiv(this.addr,e)}function F0e(t,e){t.uniform4uiv(this.addr,e)}function z0e(t,e,n){const r=this.cache,i=e.length,s=oM(n,i);ii(r,s)||(t.uniform1iv(this.addr,s),si(r,s));for(let a=0;a!==i;++a)n.setTexture2D(e[a]||L6,s[a])}function B0e(t,e,n){const r=this.cache,i=e.length,s=oM(n,i);ii(r,s)||(t.uniform1iv(this.addr,s),si(r,s));for(let a=0;a!==i;++a)n.setTexture3D(e[a]||D6,s[a])}function H0e(t,e,n){const r=this.cache,i=e.length,s=oM(n,i);ii(r,s)||(t.uniform1iv(this.addr,s),si(r,s));for(let a=0;a!==i;++a)n.setTextureCube(e[a]||j6,s[a])}function V0e(t,e,n){const r=this.cache,i=e.length,s=oM(n,i);ii(r,s)||(t.uniform1iv(this.addr,s),si(r,s));for(let a=0;a!==i;++a)n.setTexture2DArray(e[a]||O6,s[a])}function G0e(t){switch(t){case 5126:return E0e;case 35664:return A0e;case 35665:return T0e;case 35666:return C0e;case 35674:return P0e;case 35675:return R0e;case 35676:return N0e;case 5124:case 35670:return k0e;case 35667:case 35671:return I0e;case 35668:case 35672:return L0e;case 35669:case 35673:return O0e;case 5125:return D0e;case 36294:return j0e;case 36295:return U0e;case 36296:return F0e;case 35678:case 36198:case 36298:case 36306:case 35682:return z0e;case 35679:case 36299:case 36307:return B0e;case 35680:case 36300:case 36308:case 36293:return H0e;case 36289:case 36303:case 36311:case 36292:return V0e}}class W0e{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.setValue=M0e(n.type)}}class $0e{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=G0e(n.type)}}class X0e{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,n,r){const i=this.seq;for(let s=0,a=i.length;s!==a;++s){const o=i[s];o.setValue(e,n[o.id],r)}}}const CA=/(\w+)(\])?(\[|\.)?/g;function CD(t,e){t.seq.push(e),t.map[e.id]=e}function q0e(t,e,n){const r=t.name,i=r.length;for(CA.lastIndex=0;;){const s=CA.exec(r),a=CA.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===i){CD(n,c===void 0?new W0e(o,t,e):new $0e(o,t,e));break}else{let f=n.map[o];f===void 0&&(f=new X0e(o),CD(n,f)),n=f}}}class e1{constructor(e,n){this.seq=[],this.map={};const r=e.getProgramParameter(n,e.ACTIVE_UNIFORMS);for(let i=0;i<r;++i){const s=e.getActiveUniform(n,i),a=e.getUniformLocation(n,s.name);q0e(s,a,this)}}setValue(e,n,r,i){const s=this.map[n];s!==void 0&&s.setValue(e,r,i)}setOptional(e,n,r){const i=n[r];i!==void 0&&this.setValue(e,r,i)}static upload(e,n,r,i){for(let s=0,a=n.length;s!==a;++s){const o=n[s],l=r[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,i)}}static seqWithValue(e,n){const r=[];for(let i=0,s=e.length;i!==s;++i){const a=e[i];a.id in n&&r.push(a)}return r}}function PD(t,e,n){const r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}const K0e=37297;let Y0e=0;function Z0e(t,e){const n=t.split(`
|
||
`),r=[],i=Math.max(e-6,0),s=Math.min(e+6,n.length);for(let a=i;a<s;a++){const o=a+1;r.push(`${o===e?">":" "} ${o}: ${n[a]}`)}return r.join(`
|
||
`)}function Q0e(t){const e=Nn.getPrimaries(Nn.workingColorSpace),n=Nn.getPrimaries(t);let r;switch(e===n?r="":e===jy&&n===Dy?r="LinearDisplayP3ToLinearSRGB":e===Dy&&n===jy&&(r="LinearSRGBToLinearDisplayP3"),t){case xi:case gx:return[r,"LinearTransferOETF"];case Fi:case sM:return[r,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[r,"LinearTransferOETF"]}}function RD(t,e,n){const r=t.getShaderParameter(e,t.COMPILE_STATUS),i=t.getShaderInfoLog(e).trim();if(r&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const a=parseInt(s[1]);return n.toUpperCase()+`
|
||
|
||
`+i+`
|
||
|
||
`+Z0e(t.getShaderSource(e),a)}else return i}function J0e(t,e){const n=Q0e(e);return`vec4 ${t}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function eye(t,e){let n;switch(e){case r6:n="Linear";break;case i6:n="Reinhard";break;case s6:n="Cineon";break;case mR:n="ACESFilmic";break;case o6:n="AgX";break;case l6:n="Neutral";break;case a6:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const u_=new q;function tye(){Nn.getLuminanceCoefficients(u_);const t=u_.x.toFixed(4),e=u_.y.toFixed(4),n=u_.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${t}, ${e}, ${n} );`," return dot( weights, rgb );","}"].join(`
|
||
`)}function nye(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Y0).join(`
|
||
`)}function rye(t){const e=[];for(const n in t){const r=t[n];r!==!1&&e.push("#define "+n+" "+r)}return e.join(`
|
||
`)}function iye(t,e){const n={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let i=0;i<r;i++){const s=t.getActiveAttrib(e,i),a=s.name;let o=1;s.type===t.FLOAT_MAT2&&(o=2),s.type===t.FLOAT_MAT3&&(o=3),s.type===t.FLOAT_MAT4&&(o=4),n[a]={type:s.type,location:t.getAttribLocation(e,a),locationSize:o}}return n}function Y0(t){return t!==""}function ND(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function kD(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const sye=/^[ \t]*#include +<([\w\d./]+)>/gm;function eP(t){return t.replace(sye,oye)}const aye=new Map;function oye(t,e){let n=fn[e];if(n===void 0){const r=aye.get(e);if(r!==void 0)n=fn[r],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return eP(n)}const lye=/#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 ID(t){return t.replace(lye,cye)}function cye(t,e,n,r){let i="";for(let s=parseInt(e);s<parseInt(n);s++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function LD(t){let e=`precision ${t.precision} float;
|
||
precision ${t.precision} int;
|
||
precision ${t.precision} sampler2D;
|
||
precision ${t.precision} samplerCube;
|
||
precision ${t.precision} sampler3D;
|
||
precision ${t.precision} sampler2DArray;
|
||
precision ${t.precision} sampler2DShadow;
|
||
precision ${t.precision} samplerCubeShadow;
|
||
precision ${t.precision} sampler2DArrayShadow;
|
||
precision ${t.precision} isampler2D;
|
||
precision ${t.precision} isampler3D;
|
||
precision ${t.precision} isamplerCube;
|
||
precision ${t.precision} isampler2DArray;
|
||
precision ${t.precision} usampler2D;
|
||
precision ${t.precision} usampler3D;
|
||
precision ${t.precision} usamplerCube;
|
||
precision ${t.precision} usampler2DArray;
|
||
`;return t.precision==="highp"?e+=`
|
||
#define HIGH_PRECISION`:t.precision==="mediump"?e+=`
|
||
#define MEDIUM_PRECISION`:t.precision==="lowp"&&(e+=`
|
||
#define LOW_PRECISION`),e}function uye(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===KS?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===ny?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===Oo&&(e="SHADOWMAP_TYPE_VSM"),e}function dye(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case tu:case Id:e="ENVMAP_TYPE_CUBE";break;case ov:e="ENVMAP_TYPE_CUBE_UV";break}return e}function fye(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case Id:e="ENVMAP_MODE_REFRACTION";break}return e}function hye(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case px:e="ENVMAP_BLENDING_MULTIPLY";break;case t6:e="ENVMAP_BLENDING_MIX";break;case n6:e="ENVMAP_BLENDING_ADD";break}return e}function pye(t){const e=t.envMapCubeUVHeight;if(e===null)return null;const n=Math.log2(e)-2,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:r,maxMip:n}}function mye(t,e,n,r){const i=t.getContext(),s=n.defines;let a=n.vertexShader,o=n.fragmentShader;const l=uye(n),c=dye(n),d=fye(n),f=hye(n),p=pye(n),y=nye(n),x=rye(s),S=i.createProgram();let w,b,M=n.glslVersion?"#version "+n.glslVersion+`
|
||
`:"";n.isRawShaderMaterial?(w=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(Y0).join(`
|
||
`),w.length>0&&(w+=`
|
||
`),b=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(Y0).join(`
|
||
`),b.length>0&&(b+=`
|
||
`)):(w=[LD(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(Y0).join(`
|
||
`),b=[LD(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:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Cl?"#define TONE_MAPPING":"",n.toneMapping!==Cl?fn.tonemapping_pars_fragment:"",n.toneMapping!==Cl?eye("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",fn.colorspace_pars_fragment,J0e("linearToOutputTexel",n.outputColorSpace),tye(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
|
||
`].filter(Y0).join(`
|
||
`)),a=eP(a),a=ND(a,n),a=kD(a,n),o=eP(o),o=ND(o,n),o=kD(o,n),a=ID(a),o=ID(o),n.isRawShaderMaterial!==!0&&(M=`#version 300 es
|
||
`,w=[y,"#define attribute in","#define varying out","#define texture2D texture"].join(`
|
||
`)+`
|
||
`+w,b=["#define varying in",n.glslVersion===QC?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===QC?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
|
||
`)+`
|
||
`+b);const T=M+w+a,C=M+b+o,L=PD(i,i.VERTEX_SHADER,T),N=PD(i,i.FRAGMENT_SHADER,C);i.attachShader(S,L),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 X=i.getProgramInfoLog(S).trim(),te=i.getShaderInfoLog(L).trim(),re=i.getShaderInfoLog(N).trim();let pe=!0,ee=!0;if(i.getProgramParameter(S,i.LINK_STATUS)===!1)if(pe=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(i,S,L,N);else{const ce=RD(i,L,"vertex"),B=RD(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: `+X+`
|
||
`+ce+`
|
||
`+B)}else X!==""?console.warn("THREE.WebGLProgram: Program Info Log:",X):(te===""||re==="")&&(ee=!1);ee&&(U.diagnostics={runnable:pe,programLog:X,vertexShader:{log:te,prefix:w},fragmentShader:{log:re,prefix:b}})}i.deleteShader(L),i.deleteShader(N),F=new e1(i,S),V=iye(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 I=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return I===!1&&(I=i.getProgramParameter(S,K0e)),I},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(S),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=Y0e++,this.cacheKey=e,this.usedTimes=1,this.program=S,this.vertexShader=L,this.fragmentShader=N,this}let gye=0;class vye{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(n),s=this._getShaderStage(r),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const r of n)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let r=n.get(e);return r===void 0&&(r=new Set,n.set(e,r)),r}_getShaderStage(e){const n=this.shaderCache;let r=n.get(e);return r===void 0&&(r=new yye(e),n.set(e,r)),r}}class yye{constructor(e){this.id=gye++,this.code=e,this.usedTimes=0}}function xye(t,e,n,r,i,s,a){const o=new Oh,l=new vye,c=new Set,d=[],f=i.logarithmicDepthBuffer,p=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(I){return c.add(I),I===0?"uv":`uv${I}`}function b(I,U,X,te,re){const pe=te.fog,ee=re.geometry,ce=I.isMeshStandardMaterial?te.environment:null,B=(I.isMeshStandardMaterial?n:e).get(I.envMap||ce),J=B&&B.mapping===ov?B.image.height:null,Z=S[I.type];I.precision!==null&&(x=i.getMaxPrecision(I.precision),x!==I.precision&&console.warn("THREE.WebGLProgram.getParameters:",I.precision,"not supported, using",x,"instead."));const G=ee.morphAttributes.position||ee.morphAttributes.normal||ee.morphAttributes.color,W=G!==void 0?G.length:0;let oe=0;ee.morphAttributes.position!==void 0&&(oe=1),ee.morphAttributes.normal!==void 0&&(oe=2),ee.morphAttributes.color!==void 0&&(oe=3);let se,le,Me,Se;if(Z){const Vn=jo[Z];se=Vn.vertexShader,le=Vn.fragmentShader}else se=I.vertexShader,le=I.fragmentShader,l.update(I),Me=l.getVertexShaderID(I),Se=l.getFragmentShaderID(I);const $e=t.getRenderTarget(),Ee=re.isInstancedMesh===!0,Ge=re.isBatchedMesh===!0,Xe=!!I.map,fe=!!I.matcap,Q=!!B,Ve=!!I.aoMap,Le=!!I.lightMap,We=!!I.bumpMap,Je=!!I.normalMap,de=!!I.displacementMap,De=!!I.emissiveMap,K=!!I.metalnessMap,H=!!I.roughnessMap,xe=I.anisotropy>0,je=I.clearcoat>0,Oe=I.dispersion>0,Fe=I.iridescence>0,xt=I.sheen>0,rt=I.transmission>0,ft=xe&&!!I.anisotropyMap,zt=je&&!!I.clearcoatMap,Ye=je&&!!I.clearcoatNormalMap,ne=je&&!!I.clearcoatRoughnessMap,tt=Fe&&!!I.iridescenceMap,Mt=Fe&&!!I.iridescenceThicknessMap,vt=xt&&!!I.sheenColorMap,Zt=xt&&!!I.sheenRoughnessMap,he=!!I.specularMap,Ke=!!I.specularColorMap,ue=!!I.specularIntensityMap,Ze=rt&&!!I.transmissionMap,Pe=rt&&!!I.thicknessMap,Be=!!I.gradientMap,at=!!I.alphaMap,pt=I.alphaTest>0,Jt=!!I.alphaHash,pn=!!I.extensions;let Fn=Cl;I.toneMapped&&($e===null||$e.isXRRenderTarget===!0)&&(Fn=t.toneMapping);const en={shaderID:Z,shaderType:I.type,shaderName:I.name,vertexShader:se,fragmentShader:le,defines:I.defines,customVertexShaderID:Me,customFragmentShaderID:Se,isRawShaderMaterial:I.isRawShaderMaterial===!0,glslVersion:I.glslVersion,precision:x,batching:Ge,batchingColor:Ge&&re._colorsTexture!==null,instancing:Ee,instancingColor:Ee&&re.instanceColor!==null,instancingMorph:Ee&&re.morphTexture!==null,supportsVertexTextures:y,outputColorSpace:$e===null?t.outputColorSpace:$e.isXRRenderTarget===!0?$e.texture.colorSpace:xi,alphaToCoverage:!!I.alphaToCoverage,map:Xe,matcap:fe,envMap:Q,envMapMode:Q&&B.mapping,envMapCubeUVHeight:J,aoMap:Ve,lightMap:Le,bumpMap:We,normalMap:Je,displacementMap:y&&de,emissiveMap:De,normalMapObjectSpace:Je&&I.normalMapType===g6,normalMapTangentSpace:Je&&I.normalMapType===uu,metalnessMap:K,roughnessMap:H,anisotropy:xe,anisotropyMap:ft,clearcoat:je,clearcoatMap:zt,clearcoatNormalMap:Ye,clearcoatRoughnessMap:ne,dispersion:Oe,iridescence:Fe,iridescenceMap:tt,iridescenceThicknessMap:Mt,sheen:xt,sheenColorMap:vt,sheenRoughnessMap:Zt,specularMap:he,specularColorMap:Ke,specularIntensityMap:ue,transmission:rt,transmissionMap:Ze,thicknessMap:Pe,gradientMap:Be,opaque:I.transparent===!1&&I.blending===kh&&I.alphaToCoverage===!1,alphaMap:at,alphaTest:pt,alphaHash:Jt,combine:I.combine,mapUv:Xe&&w(I.map.channel),aoMapUv:Ve&&w(I.aoMap.channel),lightMapUv:Le&&w(I.lightMap.channel),bumpMapUv:We&&w(I.bumpMap.channel),normalMapUv:Je&&w(I.normalMap.channel),displacementMapUv:de&&w(I.displacementMap.channel),emissiveMapUv:De&&w(I.emissiveMap.channel),metalnessMapUv:K&&w(I.metalnessMap.channel),roughnessMapUv:H&&w(I.roughnessMap.channel),anisotropyMapUv:ft&&w(I.anisotropyMap.channel),clearcoatMapUv:zt&&w(I.clearcoatMap.channel),clearcoatNormalMapUv:Ye&&w(I.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ne&&w(I.clearcoatRoughnessMap.channel),iridescenceMapUv:tt&&w(I.iridescenceMap.channel),iridescenceThicknessMapUv:Mt&&w(I.iridescenceThicknessMap.channel),sheenColorMapUv:vt&&w(I.sheenColorMap.channel),sheenRoughnessMapUv:Zt&&w(I.sheenRoughnessMap.channel),specularMapUv:he&&w(I.specularMap.channel),specularColorMapUv:Ke&&w(I.specularColorMap.channel),specularIntensityMapUv:ue&&w(I.specularIntensityMap.channel),transmissionMapUv:Ze&&w(I.transmissionMap.channel),thicknessMapUv:Pe&&w(I.thicknessMap.channel),alphaMapUv:at&&w(I.alphaMap.channel),vertexTangents:!!ee.attributes.tangent&&(Je||xe),vertexColors:I.vertexColors,vertexAlphas:I.vertexColors===!0&&!!ee.attributes.color&&ee.attributes.color.itemSize===4,pointsUvs:re.isPoints===!0&&!!ee.attributes.uv&&(Xe||at),fog:!!pe,useFog:I.fog===!0,fogExp2:!!pe&&pe.isFogExp2,flatShading:I.flatShading===!0,sizeAttenuation:I.sizeAttenuation===!0,logarithmicDepthBuffer:f,reverseDepthBuffer:p,skinning:re.isSkinnedMesh===!0,morphTargets:ee.morphAttributes.position!==void 0,morphNormals:ee.morphAttributes.normal!==void 0,morphColors:ee.morphAttributes.color!==void 0,morphTargetsCount:W,morphTextureStride:oe,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:a.numPlanes,numClipIntersection:a.numIntersection,dithering:I.dithering,shadowMapEnabled:t.shadowMap.enabled&&X.length>0,shadowMapType:t.shadowMap.type,toneMapping:Fn,decodeVideoTexture:Xe&&I.map.isVideoTexture===!0&&Nn.getTransfer(I.map.colorSpace)===er,premultipliedAlpha:I.premultipliedAlpha,doubleSided:I.side===_a,flipSided:I.side===as,useDepthPacking:I.depthPacking>=0,depthPacking:I.depthPacking||0,index0AttributeName:I.index0AttributeName,extensionClipCullDistance:pn&&I.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(pn&&I.extensions.multiDraw===!0||Ge)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:I.customProgramCacheKey()};return en.vertexUv1s=c.has(1),en.vertexUv2s=c.has(2),en.vertexUv3s=c.has(3),c.clear(),en}function M(I){const U=[];if(I.shaderID?U.push(I.shaderID):(U.push(I.customVertexShaderID),U.push(I.customFragmentShaderID)),I.defines!==void 0)for(const X in I.defines)U.push(X),U.push(I.defines[X]);return I.isRawShaderMaterial===!1&&(T(U,I),C(U,I),U.push(t.outputColorSpace)),U.push(I.customProgramCacheKey),U.join()}function T(I,U){I.push(U.precision),I.push(U.outputColorSpace),I.push(U.envMapMode),I.push(U.envMapCubeUVHeight),I.push(U.mapUv),I.push(U.alphaMapUv),I.push(U.lightMapUv),I.push(U.aoMapUv),I.push(U.bumpMapUv),I.push(U.normalMapUv),I.push(U.displacementMapUv),I.push(U.emissiveMapUv),I.push(U.metalnessMapUv),I.push(U.roughnessMapUv),I.push(U.anisotropyMapUv),I.push(U.clearcoatMapUv),I.push(U.clearcoatNormalMapUv),I.push(U.clearcoatRoughnessMapUv),I.push(U.iridescenceMapUv),I.push(U.iridescenceThicknessMapUv),I.push(U.sheenColorMapUv),I.push(U.sheenRoughnessMapUv),I.push(U.specularMapUv),I.push(U.specularColorMapUv),I.push(U.specularIntensityMapUv),I.push(U.transmissionMapUv),I.push(U.thicknessMapUv),I.push(U.combine),I.push(U.fogExp2),I.push(U.sizeAttenuation),I.push(U.morphTargetsCount),I.push(U.morphAttributeCount),I.push(U.numDirLights),I.push(U.numPointLights),I.push(U.numSpotLights),I.push(U.numSpotLightMaps),I.push(U.numHemiLights),I.push(U.numRectAreaLights),I.push(U.numDirLightShadows),I.push(U.numPointLightShadows),I.push(U.numSpotLightShadows),I.push(U.numSpotLightShadowsWithMaps),I.push(U.numLightProbes),I.push(U.shadowMapType),I.push(U.toneMapping),I.push(U.numClippingPlanes),I.push(U.numClipIntersection),I.push(U.depthPacking)}function C(I,U){o.disableAll(),U.supportsVertexTextures&&o.enable(0),U.instancing&&o.enable(1),U.instancingColor&&o.enable(2),U.instancingMorph&&o.enable(3),U.matcap&&o.enable(4),U.envMap&&o.enable(5),U.normalMapObjectSpace&&o.enable(6),U.normalMapTangentSpace&&o.enable(7),U.clearcoat&&o.enable(8),U.iridescence&&o.enable(9),U.alphaTest&&o.enable(10),U.vertexColors&&o.enable(11),U.vertexAlphas&&o.enable(12),U.vertexUv1s&&o.enable(13),U.vertexUv2s&&o.enable(14),U.vertexUv3s&&o.enable(15),U.vertexTangents&&o.enable(16),U.anisotropy&&o.enable(17),U.alphaHash&&o.enable(18),U.batching&&o.enable(19),U.dispersion&&o.enable(20),U.batchingColor&&o.enable(21),I.push(o.mask),o.disableAll(),U.fog&&o.enable(0),U.useFog&&o.enable(1),U.flatShading&&o.enable(2),U.logarithmicDepthBuffer&&o.enable(3),U.reverseDepthBuffer&&o.enable(4),U.skinning&&o.enable(5),U.morphTargets&&o.enable(6),U.morphNormals&&o.enable(7),U.morphColors&&o.enable(8),U.premultipliedAlpha&&o.enable(9),U.shadowMapEnabled&&o.enable(10),U.doubleSided&&o.enable(11),U.flipSided&&o.enable(12),U.useDepthPacking&&o.enable(13),U.dithering&&o.enable(14),U.transmission&&o.enable(15),U.sheen&&o.enable(16),U.opaque&&o.enable(17),U.pointsUvs&&o.enable(18),U.decodeVideoTexture&&o.enable(19),U.alphaToCoverage&&o.enable(20),I.push(o.mask)}function L(I){const U=S[I.type];let X;if(U){const te=jo[U];X=kR.clone(te.uniforms)}else X=I.uniforms;return X}function N(I,U){let X;for(let te=0,re=d.length;te<re;te++){const pe=d[te];if(pe.cacheKey===U){X=pe,++X.usedTimes;break}}return X===void 0&&(X=new mye(t,U,I,s),d.push(X)),X}function D(I){if(--I.usedTimes===0){const U=d.indexOf(I);d[U]=d[d.length-1],d.pop(),I.destroy()}}function F(I){l.remove(I)}function V(){l.dispose()}return{getParameters:b,getProgramCacheKey:M,getUniforms:L,acquireProgram:N,releaseProgram:D,releaseShaderCache:F,programs:d,dispose:V}}function bye(){let t=new WeakMap;function e(a){return t.has(a)}function n(a){let o=t.get(a);return o===void 0&&(o={},t.set(a,o)),o}function r(a){t.delete(a)}function i(a,o,l){t.get(a)[o]=l}function s(){t=new WeakMap}return{has:e,get:n,remove:r,update:i,dispose:s}}function _ye(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function OD(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function DD(){const t=[];let e=0;const n=[],r=[],i=[];function s(){e=0,n.length=0,r.length=0,i.length=0}function a(f,p,y,x,S,w){let b=t[e];return b===void 0?(b={id:f.id,object:f,geometry:p,material:y,groupOrder:x,renderOrder:f.renderOrder,z:S,group:w},t[e]=b):(b.id=f.id,b.object=f,b.geometry=p,b.material=y,b.groupOrder=x,b.renderOrder=f.renderOrder,b.z=S,b.group=w),e++,b}function o(f,p,y,x,S,w){const b=a(f,p,y,x,S,w);y.transmission>0?r.push(b):y.transparent===!0?i.push(b):n.push(b)}function l(f,p,y,x,S,w){const b=a(f,p,y,x,S,w);y.transmission>0?r.unshift(b):y.transparent===!0?i.unshift(b):n.unshift(b)}function c(f,p){n.length>1&&n.sort(f||_ye),r.length>1&&r.sort(p||OD),i.length>1&&i.sort(p||OD)}function d(){for(let f=e,p=t.length;f<p;f++){const y=t[f];if(y.id===null)break;y.id=null,y.object=null,y.geometry=null,y.material=null,y.group=null}}return{opaque:n,transmissive:r,transparent:i,init:s,push:o,unshift:l,finish:d,sort:c}}function wye(){let t=new WeakMap;function e(r,i){const s=t.get(r);let a;return s===void 0?(a=new DD,t.set(r,[a])):i>=s.length?(a=new DD,s.push(a)):a=s[i],a}function n(){t=new WeakMap}return{get:e,dispose:n}}function Sye(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new q,color:new ut};break;case"SpotLight":n={position:new q,direction:new q,color:new ut,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new q,color:new ut,distance:0,decay:0};break;case"HemisphereLight":n={direction:new q,skyColor:new ut,groundColor:new ut};break;case"RectAreaLight":n={color:new ut,position:new q,halfWidth:new q,halfHeight:new q};break}return t[e.id]=n,n}}}function Mye(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new He};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new He};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new He,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let Eye=0;function Aye(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function Tye(t){const e=new Sye,n=Mye(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)r.probe.push(new q);const i=new q,s=new Rt,a=new Rt;function o(c){let d=0,f=0,p=0;for(let V=0;V<9;V++)r.probe[V].set(0,0,0);let y=0,x=0,S=0,w=0,b=0,M=0,T=0,C=0,L=0,N=0,D=0;c.sort(Aye);for(let V=0,I=c.length;V<I;V++){const U=c[V],X=U.color,te=U.intensity,re=U.distance,pe=U.shadow&&U.shadow.map?U.shadow.map.texture:null;if(U.isAmbientLight)d+=X.r*te,f+=X.g*te,p+=X.b*te;else if(U.isLightProbe){for(let ee=0;ee<9;ee++)r.probe[ee].addScaledVector(U.sh.coefficients[ee],te);D++}else if(U.isDirectionalLight){const ee=e.get(U);if(ee.color.copy(U.color).multiplyScalar(U.intensity),U.castShadow){const ce=U.shadow,B=n.get(U);B.shadowIntensity=ce.intensity,B.shadowBias=ce.bias,B.shadowNormalBias=ce.normalBias,B.shadowRadius=ce.radius,B.shadowMapSize=ce.mapSize,r.directionalShadow[y]=B,r.directionalShadowMap[y]=pe,r.directionalShadowMatrix[y]=U.shadow.matrix,M++}r.directional[y]=ee,y++}else if(U.isSpotLight){const ee=e.get(U);ee.position.setFromMatrixPosition(U.matrixWorld),ee.color.copy(X).multiplyScalar(te),ee.distance=re,ee.coneCos=Math.cos(U.angle),ee.penumbraCos=Math.cos(U.angle*(1-U.penumbra)),ee.decay=U.decay,r.spot[S]=ee;const ce=U.shadow;if(U.map&&(r.spotLightMap[L]=U.map,L++,ce.updateMatrices(U),U.castShadow&&N++),r.spotLightMatrix[S]=ce.matrix,U.castShadow){const B=n.get(U);B.shadowIntensity=ce.intensity,B.shadowBias=ce.bias,B.shadowNormalBias=ce.normalBias,B.shadowRadius=ce.radius,B.shadowMapSize=ce.mapSize,r.spotShadow[S]=B,r.spotShadowMap[S]=pe,C++}S++}else if(U.isRectAreaLight){const ee=e.get(U);ee.color.copy(X).multiplyScalar(te),ee.halfWidth.set(U.width*.5,0,0),ee.halfHeight.set(0,U.height*.5,0),r.rectArea[w]=ee,w++}else if(U.isPointLight){const ee=e.get(U);if(ee.color.copy(U.color).multiplyScalar(U.intensity),ee.distance=U.distance,ee.decay=U.decay,U.castShadow){const ce=U.shadow,B=n.get(U);B.shadowIntensity=ce.intensity,B.shadowBias=ce.bias,B.shadowNormalBias=ce.normalBias,B.shadowRadius=ce.radius,B.shadowMapSize=ce.mapSize,B.shadowCameraNear=ce.camera.near,B.shadowCameraFar=ce.camera.far,r.pointShadow[x]=B,r.pointShadowMap[x]=pe,r.pointShadowMatrix[x]=U.shadow.matrix,T++}r.point[x]=ee,x++}else if(U.isHemisphereLight){const ee=e.get(U);ee.skyColor.copy(U.color).multiplyScalar(te),ee.groundColor.copy(U.groundColor).multiplyScalar(te),r.hemi[b]=ee,b++}}w>0&&(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]=p;const F=r.hash;(F.directionalLength!==y||F.pointLength!==x||F.spotLength!==S||F.rectAreaLength!==w||F.hemiLength!==b||F.numDirectionalShadows!==M||F.numPointShadows!==T||F.numSpotShadows!==C||F.numSpotMaps!==L||F.numLightProbes!==D)&&(r.directional.length=y,r.spot.length=S,r.rectArea.length=w,r.point.length=x,r.hemi.length=b,r.directionalShadow.length=M,r.directionalShadowMap.length=M,r.pointShadow.length=T,r.pointShadowMap.length=T,r.spotShadow.length=C,r.spotShadowMap.length=C,r.directionalShadowMatrix.length=M,r.pointShadowMatrix.length=T,r.spotLightMatrix.length=C+L-N,r.spotLightMap.length=L,r.numSpotLightShadowsWithMaps=N,r.numLightProbes=D,F.directionalLength=y,F.pointLength=x,F.spotLength=S,F.rectAreaLength=w,F.hemiLength=b,F.numDirectionalShadows=M,F.numPointShadows=T,F.numSpotShadows=C,F.numSpotMaps=L,F.numLightProbes=D,r.version=Eye++)}function l(c,d){let f=0,p=0,y=0,x=0,S=0;const w=d.matrixWorldInverse;for(let b=0,M=c.length;b<M;b++){const T=c[b];if(T.isDirectionalLight){const C=r.directional[f];C.direction.setFromMatrixPosition(T.matrixWorld),i.setFromMatrixPosition(T.target.matrixWorld),C.direction.sub(i),C.direction.transformDirection(w),f++}else if(T.isSpotLight){const C=r.spot[y];C.position.setFromMatrixPosition(T.matrixWorld),C.position.applyMatrix4(w),C.direction.setFromMatrixPosition(T.matrixWorld),i.setFromMatrixPosition(T.target.matrixWorld),C.direction.sub(i),C.direction.transformDirection(w),y++}else if(T.isRectAreaLight){const C=r.rectArea[x];C.position.setFromMatrixPosition(T.matrixWorld),C.position.applyMatrix4(w),a.identity(),s.copy(T.matrixWorld),s.premultiply(w),a.extractRotation(s),C.halfWidth.set(T.width*.5,0,0),C.halfHeight.set(0,T.height*.5,0),C.halfWidth.applyMatrix4(a),C.halfHeight.applyMatrix4(a),x++}else if(T.isPointLight){const C=r.point[p];C.position.setFromMatrixPosition(T.matrixWorld),C.position.applyMatrix4(w),p++}else if(T.isHemisphereLight){const C=r.hemi[S];C.direction.setFromMatrixPosition(T.matrixWorld),C.direction.transformDirection(w),S++}}}return{setup:o,setupView:l,state:r}}function jD(t){const e=new Tye(t),n=[],r=[];function i(d){c.camera=d,n.length=0,r.length=0}function s(d){n.push(d)}function a(d){r.push(d)}function o(){e.setup(n)}function l(d){e.setupView(n,d)}const c={lightsArray:n,shadowsArray:r,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:c,setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function Cye(t){let e=new WeakMap;function n(i,s=0){const a=e.get(i);let o;return a===void 0?(o=new jD(t),e.set(i,[o])):s>=a.length?(o=new jD(t),a.push(o)):o=a[s],o}function r(){e=new WeakMap}return{get:n,dispose:r}}class OR extends Gr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=p6,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 DR 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 Pye=`void main() {
|
||
gl_Position = vec4( position, 1.0 );
|
||
}`,Rye=`uniform sampler2D shadow_pass;
|
||
uniform vec2 resolution;
|
||
uniform float radius;
|
||
#include <packing>
|
||
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 Nye(t,e,n){let r=new xx;const i=new He,s=new He,a=new On,o=new OR({depthPacking:m6}),l=new DR,c={},d=n.maxTextureSize,f={[Ul]:as,[as]:Ul,[_a]:_a},p=new Qa({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new He},radius:{value:4}},vertexShader:Pye,fragmentShader:Rye}),y=p.clone();y.defines.HORIZONTAL_PASS=1;const x=new Yt;x.setAttribute("position",new Qt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const S=new xr(x,p),w=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=KS;let b=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(),I=t.getActiveCubeFace(),U=t.getActiveMipmapLevel(),X=t.state;X.setBlending(Xc),X.buffers.color.setClear(1,1,1,1),X.buffers.depth.setTest(!0),X.setScissorTest(!1);const te=b!==Oo&&this.type===Oo,re=b===Oo&&this.type!==Oo;for(let pe=0,ee=N.length;pe<ee;pe++){const ce=N[pe],B=ce.shadow;if(B===void 0){console.warn("THREE.WebGLShadowMap:",ce,"has no shadow.");continue}if(B.autoUpdate===!1&&B.needsUpdate===!1)continue;i.copy(B.mapSize);const J=B.getFrameExtents();if(i.multiply(J),s.copy(B.mapSize),(i.x>d||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||te===!0||re===!0){const G=this.type!==Oo?{minFilter:ri,magFilter:ri}:{};B.map!==null&&B.map.dispose(),B.map=new Go(i.x,i.y,G),B.map.texture.name=ce.name+".shadowMap",B.camera.updateProjectionMatrix()}t.setRenderTarget(B.map),t.clear();const Z=B.getViewportCount();for(let G=0;G<Z;G++){const W=B.getViewport(G);a.set(s.x*W.x,s.y*W.y,s.x*W.z,s.y*W.w),X.viewport(a),B.updateMatrices(ce,G),r=B.getFrustum(),C(D,F,B.camera,ce,this.type)}B.isPointLightShadow!==!0&&this.type===Oo&&M(B,F),B.needsUpdate=!1}b=this.type,w.needsUpdate=!1,t.setRenderTarget(V,I,U)};function M(N,D){const F=e.update(S);p.defines.VSM_SAMPLES!==N.blurSamples&&(p.defines.VSM_SAMPLES=N.blurSamples,y.defines.VSM_SAMPLES=N.blurSamples,p.needsUpdate=!0,y.needsUpdate=!0),N.mapPass===null&&(N.mapPass=new Go(i.x,i.y)),p.uniforms.shadow_pass.value=N.map.texture,p.uniforms.resolution.value=N.mapSize,p.uniforms.radius.value=N.radius,t.setRenderTarget(N.mapPass),t.clear(),t.renderBufferDirect(D,null,F,p,S,null),y.uniforms.shadow_pass.value=N.mapPass.texture,y.uniforms.resolution.value=N.mapSize,y.uniforms.radius.value=N.radius,t.setRenderTarget(N.map),t.clear(),t.renderBufferDirect(D,null,F,y,S,null)}function T(N,D,F,V){let I=null;const U=F.isPointLight===!0?N.customDistanceMaterial:N.customDepthMaterial;if(U!==void 0)I=U;else if(I=F.isPointLight===!0?l:o,t.localClippingEnabled&&D.clipShadows===!0&&Array.isArray(D.clippingPlanes)&&D.clippingPlanes.length!==0||D.displacementMap&&D.displacementScale!==0||D.alphaMap&&D.alphaTest>0||D.map&&D.alphaTest>0){const X=I.uuid,te=D.uuid;let re=c[X];re===void 0&&(re={},c[X]=re);let pe=re[te];pe===void 0&&(pe=I.clone(),re[te]=pe,D.addEventListener("dispose",L)),I=pe}if(I.visible=D.visible,I.wireframe=D.wireframe,V===Oo?I.side=D.shadowSide!==null?D.shadowSide:D.side:I.side=D.shadowSide!==null?D.shadowSide:f[D.side],I.alphaMap=D.alphaMap,I.alphaTest=D.alphaTest,I.map=D.map,I.clipShadows=D.clipShadows,I.clippingPlanes=D.clippingPlanes,I.clipIntersection=D.clipIntersection,I.displacementMap=D.displacementMap,I.displacementScale=D.displacementScale,I.displacementBias=D.displacementBias,I.wireframeLinewidth=D.wireframeLinewidth,I.linewidth=D.linewidth,F.isPointLight===!0&&I.isMeshDistanceMaterial===!0){const X=t.properties.get(I);X.light=F}return I}function C(N,D,F,V,I){if(N.visible===!1)return;if(N.layers.test(D.layers)&&(N.isMesh||N.isLine||N.isPoints)&&(N.castShadow||N.receiveShadow&&I===Oo)&&(!N.frustumCulled||r.intersectsObject(N))){N.modelViewMatrix.multiplyMatrices(F.matrixWorldInverse,N.matrixWorld);const te=e.update(N),re=N.material;if(Array.isArray(re)){const pe=te.groups;for(let ee=0,ce=pe.length;ee<ce;ee++){const B=pe[ee],J=re[B.materialIndex];if(J&&J.visible){const Z=T(N,J,V,I);N.onBeforeShadow(t,N,D,F,te,Z,B),t.renderBufferDirect(F,null,te,Z,N,B),N.onAfterShadow(t,N,D,F,te,Z,B)}}}else if(re.visible){const pe=T(N,re,V,I);N.onBeforeShadow(t,N,D,F,te,pe,null),t.renderBufferDirect(F,null,te,pe,N,null),N.onAfterShadow(t,N,D,F,te,pe,null)}}const X=N.children;for(let te=0,re=X.length;te<re;te++)C(X[te],D,F,V,I)}function L(N){N.target.removeEventListener("dispose",L);for(const F in c){const V=c[F],I=N.target.uuid;I in V&&(V[I].dispose(),delete V[I])}}}const kye={[uw]:dw,[fw]:mw,[hw]:gw,[$h]:pw,[dw]:uw,[mw]:fw,[gw]:hw,[pw]:$h};function Iye(t){function e(){let ue=!1;const Ze=new On;let Pe=null;const Be=new On(0,0,0,0);return{setMask:function(at){Pe!==at&&!ue&&(t.colorMask(at,at,at,at),Pe=at)},setLocked:function(at){ue=at},setClear:function(at,pt,Jt,pn,Fn){Fn===!0&&(at*=pn,pt*=pn,Jt*=pn),Ze.set(at,pt,Jt,pn),Be.equals(Ze)===!1&&(t.clearColor(at,pt,Jt,pn),Be.copy(Ze))},reset:function(){ue=!1,Pe=null,Be.set(-1,0,0,0)}}}function n(){let ue=!1,Ze=!1,Pe=null,Be=null,at=null;return{setReversed:function(pt){Ze=pt},setTest:function(pt){pt?Me(t.DEPTH_TEST):Se(t.DEPTH_TEST)},setMask:function(pt){Pe!==pt&&!ue&&(t.depthMask(pt),Pe=pt)},setFunc:function(pt){if(Ze&&(pt=kye[pt]),Be!==pt){switch(pt){case uw:t.depthFunc(t.NEVER);break;case dw:t.depthFunc(t.ALWAYS);break;case fw:t.depthFunc(t.LESS);break;case $h:t.depthFunc(t.LEQUAL);break;case hw:t.depthFunc(t.EQUAL);break;case pw:t.depthFunc(t.GEQUAL);break;case mw:t.depthFunc(t.GREATER);break;case gw:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}Be=pt}},setLocked:function(pt){ue=pt},setClear:function(pt){at!==pt&&(t.clearDepth(pt),at=pt)},reset:function(){ue=!1,Pe=null,Be=null,at=null}}}function r(){let ue=!1,Ze=null,Pe=null,Be=null,at=null,pt=null,Jt=null,pn=null,Fn=null;return{setTest:function(en){ue||(en?Me(t.STENCIL_TEST):Se(t.STENCIL_TEST))},setMask:function(en){Ze!==en&&!ue&&(t.stencilMask(en),Ze=en)},setFunc:function(en,Vn,pr){(Pe!==en||Be!==Vn||at!==pr)&&(t.stencilFunc(en,Vn,pr),Pe=en,Be=Vn,at=pr)},setOp:function(en,Vn,pr){(pt!==en||Jt!==Vn||pn!==pr)&&(t.stencilOp(en,Vn,pr),pt=en,Jt=Vn,pn=pr)},setLocked:function(en){ue=en},setClear:function(en){Fn!==en&&(t.clearStencil(en),Fn=en)},reset:function(){ue=!1,Ze=null,Pe=null,Be=null,at=null,pt=null,Jt=null,pn=null,Fn=null}}}const i=new e,s=new n,a=new r,o=new WeakMap,l=new WeakMap;let c={},d={},f=new WeakMap,p=[],y=null,x=!1,S=null,w=null,b=null,M=null,T=null,C=null,L=null,N=new ut(0,0,0),D=0,F=!1,V=null,I=null,U=null,X=null,te=null;const re=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let pe=!1,ee=0;const ce=t.getParameter(t.VERSION);ce.indexOf("WebGL")!==-1?(ee=parseFloat(/^WebGL (\d)/.exec(ce)[1]),pe=ee>=1):ce.indexOf("OpenGL ES")!==-1&&(ee=parseFloat(/^OpenGL ES (\d)/.exec(ce)[1]),pe=ee>=2);let B=null,J={};const Z=t.getParameter(t.SCISSOR_BOX),G=t.getParameter(t.VIEWPORT),W=new On().fromArray(Z),oe=new On().fromArray(G);function se(ue,Ze,Pe,Be){const at=new Uint8Array(4),pt=t.createTexture();t.bindTexture(ue,pt),t.texParameteri(ue,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(ue,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Jt=0;Jt<Pe;Jt++)ue===t.TEXTURE_3D||ue===t.TEXTURE_2D_ARRAY?t.texImage3D(Ze,0,t.RGBA,1,1,Be,0,t.RGBA,t.UNSIGNED_BYTE,at):t.texImage2D(Ze+Jt,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,at);return pt}const le={};le[t.TEXTURE_2D]=se(t.TEXTURE_2D,t.TEXTURE_2D,1),le[t.TEXTURE_CUBE_MAP]=se(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),le[t.TEXTURE_2D_ARRAY]=se(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),le[t.TEXTURE_3D]=se(t.TEXTURE_3D,t.TEXTURE_3D,1,1),i.setClear(0,0,0,1),s.setClear(1),a.setClear(0),Me(t.DEPTH_TEST),s.setFunc($h),Le(!1),We($C),Me(t.CULL_FACE),Q(Xc);function Me(ue){c[ue]!==!0&&(t.enable(ue),c[ue]=!0)}function Se(ue){c[ue]!==!1&&(t.disable(ue),c[ue]=!1)}function $e(ue,Ze){return d[ue]!==Ze?(t.bindFramebuffer(ue,Ze),d[ue]=Ze,ue===t.DRAW_FRAMEBUFFER&&(d[t.FRAMEBUFFER]=Ze),ue===t.FRAMEBUFFER&&(d[t.DRAW_FRAMEBUFFER]=Ze),!0):!1}function Ee(ue,Ze){let Pe=p,Be=!1;if(ue){Pe=f.get(Ze),Pe===void 0&&(Pe=[],f.set(Ze,Pe));const at=ue.textures;if(Pe.length!==at.length||Pe[0]!==t.COLOR_ATTACHMENT0){for(let pt=0,Jt=at.length;pt<Jt;pt++)Pe[pt]=t.COLOR_ATTACHMENT0+pt;Pe.length=at.length,Be=!0}}else Pe[0]!==t.BACK&&(Pe[0]=t.BACK,Be=!0);Be&&t.drawBuffers(Pe)}function Ge(ue){return y!==ue?(t.useProgram(ue),y=ue,!0):!1}const Xe={[hd]:t.FUNC_ADD,[UV]:t.FUNC_SUBTRACT,[FV]:t.FUNC_REVERSE_SUBTRACT};Xe[zV]=t.MIN,Xe[BV]=t.MAX;const fe={[HV]:t.ZERO,[VV]:t.ONE,[GV]:t.SRC_COLOR,[lw]:t.SRC_ALPHA,[YV]:t.SRC_ALPHA_SATURATE,[qV]:t.DST_COLOR,[$V]:t.DST_ALPHA,[WV]:t.ONE_MINUS_SRC_COLOR,[cw]:t.ONE_MINUS_SRC_ALPHA,[KV]:t.ONE_MINUS_DST_COLOR,[XV]:t.ONE_MINUS_DST_ALPHA,[ZV]:t.CONSTANT_COLOR,[QV]:t.ONE_MINUS_CONSTANT_COLOR,[JV]:t.CONSTANT_ALPHA,[e6]:t.ONE_MINUS_CONSTANT_ALPHA};function Q(ue,Ze,Pe,Be,at,pt,Jt,pn,Fn,en){if(ue===Xc){x===!0&&(Se(t.BLEND),x=!1);return}if(x===!1&&(Me(t.BLEND),x=!0),ue!==jV){if(ue!==S||en!==F){if((w!==hd||T!==hd)&&(t.blendEquation(t.FUNC_ADD),w=hd,T=hd),en)switch(ue){case kh:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case XC:t.blendFunc(t.ONE,t.ONE);break;case qC:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case KC:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",ue);break}else switch(ue){case kh:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case XC:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case qC:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case KC:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",ue);break}b=null,M=null,C=null,L=null,N.set(0,0,0),D=0,S=ue,F=en}return}at=at||Ze,pt=pt||Pe,Jt=Jt||Be,(Ze!==w||at!==T)&&(t.blendEquationSeparate(Xe[Ze],Xe[at]),w=Ze,T=at),(Pe!==b||Be!==M||pt!==C||Jt!==L)&&(t.blendFuncSeparate(fe[Pe],fe[Be],fe[pt],fe[Jt]),b=Pe,M=Be,C=pt,L=Jt),(pn.equals(N)===!1||Fn!==D)&&(t.blendColor(pn.r,pn.g,pn.b,Fn),N.copy(pn),D=Fn),S=ue,F=!1}function Ve(ue,Ze){ue.side===_a?Se(t.CULL_FACE):Me(t.CULL_FACE);let Pe=ue.side===as;Ze&&(Pe=!Pe),Le(Pe),ue.blending===kh&&ue.transparent===!1?Q(Xc):Q(ue.blending,ue.blendEquation,ue.blendSrc,ue.blendDst,ue.blendEquationAlpha,ue.blendSrcAlpha,ue.blendDstAlpha,ue.blendColor,ue.blendAlpha,ue.premultipliedAlpha),s.setFunc(ue.depthFunc),s.setTest(ue.depthTest),s.setMask(ue.depthWrite),i.setMask(ue.colorWrite);const Be=ue.stencilWrite;a.setTest(Be),Be&&(a.setMask(ue.stencilWriteMask),a.setFunc(ue.stencilFunc,ue.stencilRef,ue.stencilFuncMask),a.setOp(ue.stencilFail,ue.stencilZFail,ue.stencilZPass)),de(ue.polygonOffset,ue.polygonOffsetFactor,ue.polygonOffsetUnits),ue.alphaToCoverage===!0?Me(t.SAMPLE_ALPHA_TO_COVERAGE):Se(t.SAMPLE_ALPHA_TO_COVERAGE)}function Le(ue){V!==ue&&(ue?t.frontFace(t.CW):t.frontFace(t.CCW),V=ue)}function We(ue){ue!==LV?(Me(t.CULL_FACE),ue!==I&&(ue===$C?t.cullFace(t.BACK):ue===OV?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):Se(t.CULL_FACE),I=ue}function Je(ue){ue!==U&&(pe&&t.lineWidth(ue),U=ue)}function de(ue,Ze,Pe){ue?(Me(t.POLYGON_OFFSET_FILL),(X!==Ze||te!==Pe)&&(t.polygonOffset(Ze,Pe),X=Ze,te=Pe)):Se(t.POLYGON_OFFSET_FILL)}function De(ue){ue?Me(t.SCISSOR_TEST):Se(t.SCISSOR_TEST)}function K(ue){ue===void 0&&(ue=t.TEXTURE0+re-1),B!==ue&&(t.activeTexture(ue),B=ue)}function H(ue,Ze,Pe){Pe===void 0&&(B===null?Pe=t.TEXTURE0+re-1:Pe=B);let Be=J[Pe];Be===void 0&&(Be={type:void 0,texture:void 0},J[Pe]=Be),(Be.type!==ue||Be.texture!==Ze)&&(B!==Pe&&(t.activeTexture(Pe),B=Pe),t.bindTexture(ue,Ze||le[ue]),Be.type=ue,Be.texture=Ze)}function xe(){const ue=J[B];ue!==void 0&&ue.type!==void 0&&(t.bindTexture(ue.type,null),ue.type=void 0,ue.texture=void 0)}function je(){try{t.compressedTexImage2D.apply(t,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function Oe(){try{t.compressedTexImage3D.apply(t,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function Fe(){try{t.texSubImage2D.apply(t,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function xt(){try{t.texSubImage3D.apply(t,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function rt(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function ft(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function zt(){try{t.texStorage2D.apply(t,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function Ye(){try{t.texStorage3D.apply(t,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function ne(){try{t.texImage2D.apply(t,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function tt(){try{t.texImage3D.apply(t,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function Mt(ue){W.equals(ue)===!1&&(t.scissor(ue.x,ue.y,ue.z,ue.w),W.copy(ue))}function vt(ue){oe.equals(ue)===!1&&(t.viewport(ue.x,ue.y,ue.z,ue.w),oe.copy(ue))}function Zt(ue,Ze){let Pe=l.get(Ze);Pe===void 0&&(Pe=new WeakMap,l.set(Ze,Pe));let Be=Pe.get(ue);Be===void 0&&(Be=t.getUniformBlockIndex(Ze,ue.name),Pe.set(ue,Be))}function he(ue,Ze){const Be=l.get(Ze).get(ue);o.get(Ze)!==Be&&(t.uniformBlockBinding(Ze,Be,ue.__bindingPointIndex),o.set(Ze,Be))}function Ke(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),c={},B=null,J={},d={},f=new WeakMap,p=[],y=null,x=!1,S=null,w=null,b=null,M=null,T=null,C=null,L=null,N=new ut(0,0,0),D=0,F=!1,V=null,I=null,U=null,X=null,te=null,W.set(0,0,t.canvas.width,t.canvas.height),oe.set(0,0,t.canvas.width,t.canvas.height),i.reset(),s.reset(),a.reset()}return{buffers:{color:i,depth:s,stencil:a},enable:Me,disable:Se,bindFramebuffer:$e,drawBuffers:Ee,useProgram:Ge,setBlending:Q,setMaterial:Ve,setFlipSided:Le,setCullFace:We,setLineWidth:Je,setPolygonOffset:de,setScissorTest:De,activeTexture:K,bindTexture:H,unbindTexture:xe,compressedTexImage2D:je,compressedTexImage3D:Oe,texImage2D:ne,texImage3D:tt,updateUBOMapping:Zt,uniformBlockBinding:he,texStorage2D:zt,texStorage3D:Ye,texSubImage2D:Fe,texSubImage3D:xt,compressedTexSubImage2D:rt,compressedTexSubImage3D:ft,scissor:Mt,viewport:vt,reset:Ke}}function Lye(t,e){const n=t.image&&t.image.width?t.image.width/t.image.height:1;return n>e?(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 Oye(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 Dye(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}function tP(t,e,n,r){const i=jye(r);switch(n){case xR:return t*e;case _R:return t*e;case wR:return t*e*2;case tM:return t*e/i.components*i.byteLength;case mx:return t*e/i.components*i.byteLength;case SR:return t*e*2/i.components*i.byteLength;case nM:return t*e*2/i.components*i.byteLength;case bR:return t*e*3/i.components*i.byteLength;case ss:return t*e*4/i.components*i.byteLength;case rM:return t*e*4/i.components*i.byteLength;case ry:case iy:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case sy:case ay:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case yw:case bw:return Math.max(t,16)*Math.max(e,8)/4;case vw:case xw:return Math.max(t,8)*Math.max(e,8)/2;case _w:case ww:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Sw:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case Mw:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case Ew:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case Aw:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case Tw:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case Cw:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case Pw:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case Rw:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case Nw:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case kw:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case Iw:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case Lw:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case Ow:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case Dw:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case jw:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case oy:case Uw:case Fw:return Math.ceil(t/4)*Math.ceil(e/4)*16;case MR:case zw:return Math.ceil(t/4)*Math.ceil(e/4)*8;case Bw:case Hw:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function jye(t){switch(t){case Vo:case gR:return{byteLength:1,components:1};case Fg:case vR:case lv:return{byteLength:2,components:1};case JS:case eM:return{byteLength:2,components:4};case nu:case QS:case ea:return{byteLength:4,components:1};case yR:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}const Uye={contain:Lye,cover:Oye,fill:Dye,getByteLength:tP};function Fye(t,e,n,r,i,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new He,d=new WeakMap;let f;const p=new WeakMap;let y=!1;try{y=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(K,H){return y?new OffscreenCanvas(K,H):zy("canvas")}function S(K,H,xe){let je=1;const Oe=De(K);if((Oe.width>xe||Oe.height>xe)&&(je=xe/Math.max(Oe.width,Oe.height)),je<1)if(typeof HTMLImageElement<"u"&&K instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&K instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&K instanceof ImageBitmap||typeof VideoFrame<"u"&&K instanceof VideoFrame){const Fe=Math.floor(je*Oe.width),xt=Math.floor(je*Oe.height);f===void 0&&(f=x(Fe,xt));const rt=H?x(Fe,xt):f;return rt.width=Fe,rt.height=xt,rt.getContext("2d").drawImage(K,0,0,Fe,xt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Oe.width+"x"+Oe.height+") to ("+Fe+"x"+xt+")."),rt}else return"data"in K&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Oe.width+"x"+Oe.height+")."),K;return K}function w(K){return K.generateMipmaps&&K.minFilter!==ri&&K.minFilter!==Pr}function b(K){t.generateMipmap(K)}function M(K,H,xe,je,Oe=!1){if(K!==null){if(t[K]!==void 0)return t[K];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+K+"'")}let Fe=H;if(H===t.RED&&(xe===t.FLOAT&&(Fe=t.R32F),xe===t.HALF_FLOAT&&(Fe=t.R16F),xe===t.UNSIGNED_BYTE&&(Fe=t.R8)),H===t.RED_INTEGER&&(xe===t.UNSIGNED_BYTE&&(Fe=t.R8UI),xe===t.UNSIGNED_SHORT&&(Fe=t.R16UI),xe===t.UNSIGNED_INT&&(Fe=t.R32UI),xe===t.BYTE&&(Fe=t.R8I),xe===t.SHORT&&(Fe=t.R16I),xe===t.INT&&(Fe=t.R32I)),H===t.RG&&(xe===t.FLOAT&&(Fe=t.RG32F),xe===t.HALF_FLOAT&&(Fe=t.RG16F),xe===t.UNSIGNED_BYTE&&(Fe=t.RG8)),H===t.RG_INTEGER&&(xe===t.UNSIGNED_BYTE&&(Fe=t.RG8UI),xe===t.UNSIGNED_SHORT&&(Fe=t.RG16UI),xe===t.UNSIGNED_INT&&(Fe=t.RG32UI),xe===t.BYTE&&(Fe=t.RG8I),xe===t.SHORT&&(Fe=t.RG16I),xe===t.INT&&(Fe=t.RG32I)),H===t.RGB_INTEGER&&(xe===t.UNSIGNED_BYTE&&(Fe=t.RGB8UI),xe===t.UNSIGNED_SHORT&&(Fe=t.RGB16UI),xe===t.UNSIGNED_INT&&(Fe=t.RGB32UI),xe===t.BYTE&&(Fe=t.RGB8I),xe===t.SHORT&&(Fe=t.RGB16I),xe===t.INT&&(Fe=t.RGB32I)),H===t.RGBA_INTEGER&&(xe===t.UNSIGNED_BYTE&&(Fe=t.RGBA8UI),xe===t.UNSIGNED_SHORT&&(Fe=t.RGBA16UI),xe===t.UNSIGNED_INT&&(Fe=t.RGBA32UI),xe===t.BYTE&&(Fe=t.RGBA8I),xe===t.SHORT&&(Fe=t.RGBA16I),xe===t.INT&&(Fe=t.RGBA32I)),H===t.RGB&&xe===t.UNSIGNED_INT_5_9_9_9_REV&&(Fe=t.RGB9_E5),H===t.RGBA){const xt=Oe?Oy:Nn.getTransfer(je);xe===t.FLOAT&&(Fe=t.RGBA32F),xe===t.HALF_FLOAT&&(Fe=t.RGBA16F),xe===t.UNSIGNED_BYTE&&(Fe=xt===er?t.SRGB8_ALPHA8:t.RGBA8),xe===t.UNSIGNED_SHORT_4_4_4_4&&(Fe=t.RGBA4),xe===t.UNSIGNED_SHORT_5_5_5_1&&(Fe=t.RGB5_A1)}return(Fe===t.R16F||Fe===t.R32F||Fe===t.RG16F||Fe===t.RG32F||Fe===t.RGBA16F||Fe===t.RGBA32F)&&e.get("EXT_color_buffer_float"),Fe}function T(K,H){let xe;return K?H===null||H===nu||H===Xh?xe=t.DEPTH24_STENCIL8:H===ea?xe=t.DEPTH32F_STENCIL8:H===Fg&&(xe=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):H===null||H===nu||H===Xh?xe=t.DEPTH_COMPONENT24:H===ea?xe=t.DEPTH_COMPONENT32F:H===Fg&&(xe=t.DEPTH_COMPONENT16),xe}function C(K,H){return w(K)===!0||K.isFramebufferTexture&&K.minFilter!==ri&&K.minFilter!==Pr?Math.log2(Math.max(H.width,H.height))+1:K.mipmaps!==void 0&&K.mipmaps.length>0?K.mipmaps.length:K.isCompressedTexture&&Array.isArray(K.image)?H.mipmaps.length:1}function L(K){const H=K.target;H.removeEventListener("dispose",L),D(H),H.isVideoTexture&&d.delete(H)}function N(K){const H=K.target;H.removeEventListener("dispose",N),V(H)}function D(K){const H=r.get(K);if(H.__webglInit===void 0)return;const xe=K.source,je=p.get(xe);if(je){const Oe=je[H.__cacheKey];Oe.usedTimes--,Oe.usedTimes===0&&F(K),Object.keys(je).length===0&&p.delete(xe)}r.remove(K)}function F(K){const H=r.get(K);t.deleteTexture(H.__webglTexture);const xe=K.source,je=p.get(xe);delete je[H.__cacheKey],a.memory.textures--}function V(K){const H=r.get(K);if(K.depthTexture&&K.depthTexture.dispose(),K.isWebGLCubeRenderTarget)for(let je=0;je<6;je++){if(Array.isArray(H.__webglFramebuffer[je]))for(let Oe=0;Oe<H.__webglFramebuffer[je].length;Oe++)t.deleteFramebuffer(H.__webglFramebuffer[je][Oe]);else t.deleteFramebuffer(H.__webglFramebuffer[je]);H.__webglDepthbuffer&&t.deleteRenderbuffer(H.__webglDepthbuffer[je])}else{if(Array.isArray(H.__webglFramebuffer))for(let je=0;je<H.__webglFramebuffer.length;je++)t.deleteFramebuffer(H.__webglFramebuffer[je]);else t.deleteFramebuffer(H.__webglFramebuffer);if(H.__webglDepthbuffer&&t.deleteRenderbuffer(H.__webglDepthbuffer),H.__webglMultisampledFramebuffer&&t.deleteFramebuffer(H.__webglMultisampledFramebuffer),H.__webglColorRenderbuffer)for(let je=0;je<H.__webglColorRenderbuffer.length;je++)H.__webglColorRenderbuffer[je]&&t.deleteRenderbuffer(H.__webglColorRenderbuffer[je]);H.__webglDepthRenderbuffer&&t.deleteRenderbuffer(H.__webglDepthRenderbuffer)}const xe=K.textures;for(let je=0,Oe=xe.length;je<Oe;je++){const Fe=r.get(xe[je]);Fe.__webglTexture&&(t.deleteTexture(Fe.__webglTexture),a.memory.textures--),r.remove(xe[je])}r.remove(K)}let I=0;function U(){I=0}function X(){const K=I;return K>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+K+" texture units while this GPU supports only "+i.maxTextures),I+=1,K}function te(K){const H=[];return H.push(K.wrapS),H.push(K.wrapT),H.push(K.wrapR||0),H.push(K.magFilter),H.push(K.minFilter),H.push(K.anisotropy),H.push(K.internalFormat),H.push(K.format),H.push(K.type),H.push(K.generateMipmaps),H.push(K.premultiplyAlpha),H.push(K.flipY),H.push(K.unpackAlignment),H.push(K.colorSpace),H.join()}function re(K,H){const xe=r.get(K);if(K.isVideoTexture&&Je(K),K.isRenderTargetTexture===!1&&K.version>0&&xe.__version!==K.version){const je=K.image;if(je===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(je.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{oe(xe,K,H);return}}n.bindTexture(t.TEXTURE_2D,xe.__webglTexture,t.TEXTURE0+H)}function pe(K,H){const xe=r.get(K);if(K.version>0&&xe.__version!==K.version){oe(xe,K,H);return}n.bindTexture(t.TEXTURE_2D_ARRAY,xe.__webglTexture,t.TEXTURE0+H)}function ee(K,H){const xe=r.get(K);if(K.version>0&&xe.__version!==K.version){oe(xe,K,H);return}n.bindTexture(t.TEXTURE_3D,xe.__webglTexture,t.TEXTURE0+H)}function ce(K,H){const xe=r.get(K);if(K.version>0&&xe.__version!==K.version){se(xe,K,H);return}n.bindTexture(t.TEXTURE_CUBE_MAP,xe.__webglTexture,t.TEXTURE0+H)}const B={[Ld]:t.REPEAT,[Sa]:t.CLAMP_TO_EDGE,[Ug]:t.MIRRORED_REPEAT},J={[ri]:t.NEAREST,[ZS]:t.NEAREST_MIPMAP_NEAREST,[ph]:t.NEAREST_MIPMAP_LINEAR,[Pr]:t.LINEAR,[cg]:t.LINEAR_MIPMAP_NEAREST,[qa]:t.LINEAR_MIPMAP_LINEAR},Z={[v6]:t.NEVER,[S6]:t.ALWAYS,[y6]:t.LESS,[TR]:t.LEQUAL,[x6]:t.EQUAL,[w6]:t.GEQUAL,[b6]:t.GREATER,[_6]:t.NOTEQUAL};function G(K,H){if(H.type===ea&&e.has("OES_texture_float_linear")===!1&&(H.magFilter===Pr||H.magFilter===cg||H.magFilter===ph||H.magFilter===qa||H.minFilter===Pr||H.minFilter===cg||H.minFilter===ph||H.minFilter===qa)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(K,t.TEXTURE_WRAP_S,B[H.wrapS]),t.texParameteri(K,t.TEXTURE_WRAP_T,B[H.wrapT]),(K===t.TEXTURE_3D||K===t.TEXTURE_2D_ARRAY)&&t.texParameteri(K,t.TEXTURE_WRAP_R,B[H.wrapR]),t.texParameteri(K,t.TEXTURE_MAG_FILTER,J[H.magFilter]),t.texParameteri(K,t.TEXTURE_MIN_FILTER,J[H.minFilter]),H.compareFunction&&(t.texParameteri(K,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(K,t.TEXTURE_COMPARE_FUNC,Z[H.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(H.magFilter===ri||H.minFilter!==ph&&H.minFilter!==qa||H.type===ea&&e.has("OES_texture_float_linear")===!1)return;if(H.anisotropy>1||r.get(H).__currentAnisotropy){const xe=e.get("EXT_texture_filter_anisotropic");t.texParameterf(K,xe.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(H.anisotropy,i.getMaxAnisotropy())),r.get(H).__currentAnisotropy=H.anisotropy}}}function W(K,H){let xe=!1;K.__webglInit===void 0&&(K.__webglInit=!0,H.addEventListener("dispose",L));const je=H.source;let Oe=p.get(je);Oe===void 0&&(Oe={},p.set(je,Oe));const Fe=te(H);if(Fe!==K.__cacheKey){Oe[Fe]===void 0&&(Oe[Fe]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,xe=!0),Oe[Fe].usedTimes++;const xt=Oe[K.__cacheKey];xt!==void 0&&(Oe[K.__cacheKey].usedTimes--,xt.usedTimes===0&&F(H)),K.__cacheKey=Fe,K.__webglTexture=Oe[Fe].texture}return xe}function oe(K,H,xe){let je=t.TEXTURE_2D;(H.isDataArrayTexture||H.isCompressedArrayTexture)&&(je=t.TEXTURE_2D_ARRAY),H.isData3DTexture&&(je=t.TEXTURE_3D);const Oe=W(K,H),Fe=H.source;n.bindTexture(je,K.__webglTexture,t.TEXTURE0+xe);const xt=r.get(Fe);if(Fe.version!==xt.__version||Oe===!0){n.activeTexture(t.TEXTURE0+xe);const rt=Nn.getPrimaries(Nn.workingColorSpace),ft=H.colorSpace===Uc?null:Nn.getPrimaries(H.colorSpace),zt=H.colorSpace===Uc||rt===ft?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,H.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,H.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,H.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,zt);let Ye=S(H.image,!1,i.maxTextureSize);Ye=de(H,Ye);const ne=s.convert(H.format,H.colorSpace),tt=s.convert(H.type);let Mt=M(H.internalFormat,ne,tt,H.colorSpace,H.isVideoTexture);G(je,H);let vt;const Zt=H.mipmaps,he=H.isVideoTexture!==!0,Ke=xt.__version===void 0||Oe===!0,ue=Fe.dataReady,Ze=C(H,Ye);if(H.isDepthTexture)Mt=T(H.format===qh,H.type),Ke&&(he?n.texStorage2D(t.TEXTURE_2D,1,Mt,Ye.width,Ye.height):n.texImage2D(t.TEXTURE_2D,0,Mt,Ye.width,Ye.height,0,ne,tt,null));else if(H.isDataTexture)if(Zt.length>0){he&&Ke&&n.texStorage2D(t.TEXTURE_2D,Ze,Mt,Zt[0].width,Zt[0].height);for(let Pe=0,Be=Zt.length;Pe<Be;Pe++)vt=Zt[Pe],he?ue&&n.texSubImage2D(t.TEXTURE_2D,Pe,0,0,vt.width,vt.height,ne,tt,vt.data):n.texImage2D(t.TEXTURE_2D,Pe,Mt,vt.width,vt.height,0,ne,tt,vt.data);H.generateMipmaps=!1}else he?(Ke&&n.texStorage2D(t.TEXTURE_2D,Ze,Mt,Ye.width,Ye.height),ue&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,Ye.width,Ye.height,ne,tt,Ye.data)):n.texImage2D(t.TEXTURE_2D,0,Mt,Ye.width,Ye.height,0,ne,tt,Ye.data);else if(H.isCompressedTexture)if(H.isCompressedArrayTexture){he&&Ke&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Ze,Mt,Zt[0].width,Zt[0].height,Ye.depth);for(let Pe=0,Be=Zt.length;Pe<Be;Pe++)if(vt=Zt[Pe],H.format!==ss)if(ne!==null)if(he){if(ue)if(H.layerUpdates.size>0){const at=tP(vt.width,vt.height,H.format,H.type);for(const pt of H.layerUpdates){const Jt=vt.data.subarray(pt*at/vt.data.BYTES_PER_ELEMENT,(pt+1)*at/vt.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Pe,0,0,pt,vt.width,vt.height,1,ne,Jt,0,0)}H.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Pe,0,0,0,vt.width,vt.height,Ye.depth,ne,vt.data,0,0)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,Pe,Mt,vt.width,vt.height,Ye.depth,0,vt.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else he?ue&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,Pe,0,0,0,vt.width,vt.height,Ye.depth,ne,tt,vt.data):n.texImage3D(t.TEXTURE_2D_ARRAY,Pe,Mt,vt.width,vt.height,Ye.depth,0,ne,tt,vt.data)}else{he&&Ke&&n.texStorage2D(t.TEXTURE_2D,Ze,Mt,Zt[0].width,Zt[0].height);for(let Pe=0,Be=Zt.length;Pe<Be;Pe++)vt=Zt[Pe],H.format!==ss?ne!==null?he?ue&&n.compressedTexSubImage2D(t.TEXTURE_2D,Pe,0,0,vt.width,vt.height,ne,vt.data):n.compressedTexImage2D(t.TEXTURE_2D,Pe,Mt,vt.width,vt.height,0,vt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):he?ue&&n.texSubImage2D(t.TEXTURE_2D,Pe,0,0,vt.width,vt.height,ne,tt,vt.data):n.texImage2D(t.TEXTURE_2D,Pe,Mt,vt.width,vt.height,0,ne,tt,vt.data)}else if(H.isDataArrayTexture)if(he){if(Ke&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Ze,Mt,Ye.width,Ye.height,Ye.depth),ue)if(H.layerUpdates.size>0){const Pe=tP(Ye.width,Ye.height,H.format,H.type);for(const Be of H.layerUpdates){const at=Ye.data.subarray(Be*Pe/Ye.data.BYTES_PER_ELEMENT,(Be+1)*Pe/Ye.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,Be,Ye.width,Ye.height,1,ne,tt,at)}H.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,Ye.width,Ye.height,Ye.depth,ne,tt,Ye.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,Mt,Ye.width,Ye.height,Ye.depth,0,ne,tt,Ye.data);else if(H.isData3DTexture)he?(Ke&&n.texStorage3D(t.TEXTURE_3D,Ze,Mt,Ye.width,Ye.height,Ye.depth),ue&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,Ye.width,Ye.height,Ye.depth,ne,tt,Ye.data)):n.texImage3D(t.TEXTURE_3D,0,Mt,Ye.width,Ye.height,Ye.depth,0,ne,tt,Ye.data);else if(H.isFramebufferTexture){if(Ke)if(he)n.texStorage2D(t.TEXTURE_2D,Ze,Mt,Ye.width,Ye.height);else{let Pe=Ye.width,Be=Ye.height;for(let at=0;at<Ze;at++)n.texImage2D(t.TEXTURE_2D,at,Mt,Pe,Be,0,ne,tt,null),Pe>>=1,Be>>=1}}else if(Zt.length>0){if(he&&Ke){const Pe=De(Zt[0]);n.texStorage2D(t.TEXTURE_2D,Ze,Mt,Pe.width,Pe.height)}for(let Pe=0,Be=Zt.length;Pe<Be;Pe++)vt=Zt[Pe],he?ue&&n.texSubImage2D(t.TEXTURE_2D,Pe,0,0,ne,tt,vt):n.texImage2D(t.TEXTURE_2D,Pe,Mt,ne,tt,vt);H.generateMipmaps=!1}else if(he){if(Ke){const Pe=De(Ye);n.texStorage2D(t.TEXTURE_2D,Ze,Mt,Pe.width,Pe.height)}ue&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,ne,tt,Ye)}else n.texImage2D(t.TEXTURE_2D,0,Mt,ne,tt,Ye);w(H)&&b(je),xt.__version=Fe.version,H.onUpdate&&H.onUpdate(H)}K.__version=H.version}function se(K,H,xe){if(H.image.length!==6)return;const je=W(K,H),Oe=H.source;n.bindTexture(t.TEXTURE_CUBE_MAP,K.__webglTexture,t.TEXTURE0+xe);const Fe=r.get(Oe);if(Oe.version!==Fe.__version||je===!0){n.activeTexture(t.TEXTURE0+xe);const xt=Nn.getPrimaries(Nn.workingColorSpace),rt=H.colorSpace===Uc?null:Nn.getPrimaries(H.colorSpace),ft=H.colorSpace===Uc||xt===rt?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,H.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,H.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,H.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,ft);const zt=H.isCompressedTexture||H.image[0].isCompressedTexture,Ye=H.image[0]&&H.image[0].isDataTexture,ne=[];for(let Be=0;Be<6;Be++)!zt&&!Ye?ne[Be]=S(H.image[Be],!0,i.maxCubemapSize):ne[Be]=Ye?H.image[Be].image:H.image[Be],ne[Be]=de(H,ne[Be]);const tt=ne[0],Mt=s.convert(H.format,H.colorSpace),vt=s.convert(H.type),Zt=M(H.internalFormat,Mt,vt,H.colorSpace),he=H.isVideoTexture!==!0,Ke=Fe.__version===void 0||je===!0,ue=Oe.dataReady;let Ze=C(H,tt);G(t.TEXTURE_CUBE_MAP,H);let Pe;if(zt){he&&Ke&&n.texStorage2D(t.TEXTURE_CUBE_MAP,Ze,Zt,tt.width,tt.height);for(let Be=0;Be<6;Be++){Pe=ne[Be].mipmaps;for(let at=0;at<Pe.length;at++){const pt=Pe[at];H.format!==ss?Mt!==null?he?ue&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Be,at,0,0,pt.width,pt.height,Mt,pt.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Be,at,Zt,pt.width,pt.height,0,pt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):he?ue&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Be,at,0,0,pt.width,pt.height,Mt,vt,pt.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Be,at,Zt,pt.width,pt.height,0,Mt,vt,pt.data)}}}else{if(Pe=H.mipmaps,he&&Ke){Pe.length>0&&Ze++;const Be=De(ne[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,Ze,Zt,Be.width,Be.height)}for(let Be=0;Be<6;Be++)if(Ye){he?ue&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Be,0,0,0,ne[Be].width,ne[Be].height,Mt,vt,ne[Be].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Be,0,Zt,ne[Be].width,ne[Be].height,0,Mt,vt,ne[Be].data);for(let at=0;at<Pe.length;at++){const Jt=Pe[at].image[Be].image;he?ue&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Be,at+1,0,0,Jt.width,Jt.height,Mt,vt,Jt.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Be,at+1,Zt,Jt.width,Jt.height,0,Mt,vt,Jt.data)}}else{he?ue&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Be,0,0,0,Mt,vt,ne[Be]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Be,0,Zt,Mt,vt,ne[Be]);for(let at=0;at<Pe.length;at++){const pt=Pe[at];he?ue&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Be,at+1,0,0,Mt,vt,pt.image[Be]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Be,at+1,Zt,Mt,vt,pt.image[Be])}}}w(H)&&b(t.TEXTURE_CUBE_MAP),Fe.__version=Oe.version,H.onUpdate&&H.onUpdate(H)}K.__version=H.version}function le(K,H,xe,je,Oe,Fe){const xt=s.convert(xe.format,xe.colorSpace),rt=s.convert(xe.type),ft=M(xe.internalFormat,xt,rt,xe.colorSpace);if(!r.get(H).__hasExternalTextures){const Ye=Math.max(1,H.width>>Fe),ne=Math.max(1,H.height>>Fe);Oe===t.TEXTURE_3D||Oe===t.TEXTURE_2D_ARRAY?n.texImage3D(Oe,Fe,ft,Ye,ne,H.depth,0,xt,rt,null):n.texImage2D(Oe,Fe,ft,Ye,ne,0,xt,rt,null)}n.bindFramebuffer(t.FRAMEBUFFER,K),We(H)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,je,Oe,r.get(xe).__webglTexture,0,Le(H)):(Oe===t.TEXTURE_2D||Oe>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&Oe<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,je,Oe,r.get(xe).__webglTexture,Fe),n.bindFramebuffer(t.FRAMEBUFFER,null)}function Me(K,H,xe){if(t.bindRenderbuffer(t.RENDERBUFFER,K),H.depthBuffer){const je=H.depthTexture,Oe=je&&je.isDepthTexture?je.type:null,Fe=T(H.stencilBuffer,Oe),xt=H.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,rt=Le(H);We(H)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,rt,Fe,H.width,H.height):xe?t.renderbufferStorageMultisample(t.RENDERBUFFER,rt,Fe,H.width,H.height):t.renderbufferStorage(t.RENDERBUFFER,Fe,H.width,H.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,xt,t.RENDERBUFFER,K)}else{const je=H.textures;for(let Oe=0;Oe<je.length;Oe++){const Fe=je[Oe],xt=s.convert(Fe.format,Fe.colorSpace),rt=s.convert(Fe.type),ft=M(Fe.internalFormat,xt,rt,Fe.colorSpace),zt=Le(H);xe&&We(H)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,zt,ft,H.width,H.height):We(H)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,zt,ft,H.width,H.height):t.renderbufferStorage(t.RENDERBUFFER,ft,H.width,H.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function Se(K,H){if(H&&H.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,K),!(H.depthTexture&&H.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!r.get(H.depthTexture).__webglTexture||H.depthTexture.image.width!==H.width||H.depthTexture.image.height!==H.height)&&(H.depthTexture.image.width=H.width,H.depthTexture.image.height=H.height,H.depthTexture.needsUpdate=!0),re(H.depthTexture,0);const je=r.get(H.depthTexture).__webglTexture,Oe=Le(H);if(H.depthTexture.format===Ih)We(H)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,je,0,Oe):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,je,0);else if(H.depthTexture.format===qh)We(H)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,je,0,Oe):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,je,0);else throw new Error("Unknown depthTexture format")}function $e(K){const H=r.get(K),xe=K.isWebGLCubeRenderTarget===!0;if(H.__boundDepthTexture!==K.depthTexture){const je=K.depthTexture;if(H.__depthDisposeCallback&&H.__depthDisposeCallback(),je){const Oe=()=>{delete H.__boundDepthTexture,delete H.__depthDisposeCallback,je.removeEventListener("dispose",Oe)};je.addEventListener("dispose",Oe),H.__depthDisposeCallback=Oe}H.__boundDepthTexture=je}if(K.depthTexture&&!H.__autoAllocateDepthBuffer){if(xe)throw new Error("target.depthTexture not supported in Cube render targets");Se(H.__webglFramebuffer,K)}else if(xe){H.__webglDepthbuffer=[];for(let je=0;je<6;je++)if(n.bindFramebuffer(t.FRAMEBUFFER,H.__webglFramebuffer[je]),H.__webglDepthbuffer[je]===void 0)H.__webglDepthbuffer[je]=t.createRenderbuffer(),Me(H.__webglDepthbuffer[je],K,!1);else{const Oe=K.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Fe=H.__webglDepthbuffer[je];t.bindRenderbuffer(t.RENDERBUFFER,Fe),t.framebufferRenderbuffer(t.FRAMEBUFFER,Oe,t.RENDERBUFFER,Fe)}}else if(n.bindFramebuffer(t.FRAMEBUFFER,H.__webglFramebuffer),H.__webglDepthbuffer===void 0)H.__webglDepthbuffer=t.createRenderbuffer(),Me(H.__webglDepthbuffer,K,!1);else{const je=K.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Oe=H.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,Oe),t.framebufferRenderbuffer(t.FRAMEBUFFER,je,t.RENDERBUFFER,Oe)}n.bindFramebuffer(t.FRAMEBUFFER,null)}function Ee(K,H,xe){const je=r.get(K);H!==void 0&&le(je.__webglFramebuffer,K,K.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),xe!==void 0&&$e(K)}function Ge(K){const H=K.texture,xe=r.get(K),je=r.get(H);K.addEventListener("dispose",N);const Oe=K.textures,Fe=K.isWebGLCubeRenderTarget===!0,xt=Oe.length>1;if(xt||(je.__webglTexture===void 0&&(je.__webglTexture=t.createTexture()),je.__version=H.version,a.memory.textures++),Fe){xe.__webglFramebuffer=[];for(let rt=0;rt<6;rt++)if(H.mipmaps&&H.mipmaps.length>0){xe.__webglFramebuffer[rt]=[];for(let ft=0;ft<H.mipmaps.length;ft++)xe.__webglFramebuffer[rt][ft]=t.createFramebuffer()}else xe.__webglFramebuffer[rt]=t.createFramebuffer()}else{if(H.mipmaps&&H.mipmaps.length>0){xe.__webglFramebuffer=[];for(let rt=0;rt<H.mipmaps.length;rt++)xe.__webglFramebuffer[rt]=t.createFramebuffer()}else xe.__webglFramebuffer=t.createFramebuffer();if(xt)for(let rt=0,ft=Oe.length;rt<ft;rt++){const zt=r.get(Oe[rt]);zt.__webglTexture===void 0&&(zt.__webglTexture=t.createTexture(),a.memory.textures++)}if(K.samples>0&&We(K)===!1){xe.__webglMultisampledFramebuffer=t.createFramebuffer(),xe.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,xe.__webglMultisampledFramebuffer);for(let rt=0;rt<Oe.length;rt++){const ft=Oe[rt];xe.__webglColorRenderbuffer[rt]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,xe.__webglColorRenderbuffer[rt]);const zt=s.convert(ft.format,ft.colorSpace),Ye=s.convert(ft.type),ne=M(ft.internalFormat,zt,Ye,ft.colorSpace,K.isXRRenderTarget===!0),tt=Le(K);t.renderbufferStorageMultisample(t.RENDERBUFFER,tt,ne,K.width,K.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+rt,t.RENDERBUFFER,xe.__webglColorRenderbuffer[rt])}t.bindRenderbuffer(t.RENDERBUFFER,null),K.depthBuffer&&(xe.__webglDepthRenderbuffer=t.createRenderbuffer(),Me(xe.__webglDepthRenderbuffer,K,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(Fe){n.bindTexture(t.TEXTURE_CUBE_MAP,je.__webglTexture),G(t.TEXTURE_CUBE_MAP,H);for(let rt=0;rt<6;rt++)if(H.mipmaps&&H.mipmaps.length>0)for(let ft=0;ft<H.mipmaps.length;ft++)le(xe.__webglFramebuffer[rt][ft],K,H,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+rt,ft);else le(xe.__webglFramebuffer[rt],K,H,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+rt,0);w(H)&&b(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(xt){for(let rt=0,ft=Oe.length;rt<ft;rt++){const zt=Oe[rt],Ye=r.get(zt);n.bindTexture(t.TEXTURE_2D,Ye.__webglTexture),G(t.TEXTURE_2D,zt),le(xe.__webglFramebuffer,K,zt,t.COLOR_ATTACHMENT0+rt,t.TEXTURE_2D,0),w(zt)&&b(t.TEXTURE_2D)}n.unbindTexture()}else{let rt=t.TEXTURE_2D;if((K.isWebGL3DRenderTarget||K.isWebGLArrayRenderTarget)&&(rt=K.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(rt,je.__webglTexture),G(rt,H),H.mipmaps&&H.mipmaps.length>0)for(let ft=0;ft<H.mipmaps.length;ft++)le(xe.__webglFramebuffer[ft],K,H,t.COLOR_ATTACHMENT0,rt,ft);else le(xe.__webglFramebuffer,K,H,t.COLOR_ATTACHMENT0,rt,0);w(H)&&b(rt),n.unbindTexture()}K.depthBuffer&&$e(K)}function Xe(K){const H=K.textures;for(let xe=0,je=H.length;xe<je;xe++){const Oe=H[xe];if(w(Oe)){const Fe=K.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,xt=r.get(Oe).__webglTexture;n.bindTexture(Fe,xt),b(Fe),n.unbindTexture()}}}const fe=[],Q=[];function Ve(K){if(K.samples>0){if(We(K)===!1){const H=K.textures,xe=K.width,je=K.height;let Oe=t.COLOR_BUFFER_BIT;const Fe=K.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,xt=r.get(K),rt=H.length>1;if(rt)for(let ft=0;ft<H.length;ft++)n.bindFramebuffer(t.FRAMEBUFFER,xt.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+ft,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,xt.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+ft,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,xt.__webglMultisampledFramebuffer),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,xt.__webglFramebuffer);for(let ft=0;ft<H.length;ft++){if(K.resolveDepthBuffer&&(K.depthBuffer&&(Oe|=t.DEPTH_BUFFER_BIT),K.stencilBuffer&&K.resolveStencilBuffer&&(Oe|=t.STENCIL_BUFFER_BIT)),rt){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,xt.__webglColorRenderbuffer[ft]);const zt=r.get(H[ft]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,zt,0)}t.blitFramebuffer(0,0,xe,je,0,0,xe,je,Oe,t.NEAREST),l===!0&&(fe.length=0,Q.length=0,fe.push(t.COLOR_ATTACHMENT0+ft),K.depthBuffer&&K.resolveDepthBuffer===!1&&(fe.push(Fe),Q.push(Fe),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,Q)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,fe))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),rt)for(let ft=0;ft<H.length;ft++){n.bindFramebuffer(t.FRAMEBUFFER,xt.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+ft,t.RENDERBUFFER,xt.__webglColorRenderbuffer[ft]);const zt=r.get(H[ft]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,xt.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+ft,t.TEXTURE_2D,zt,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,xt.__webglMultisampledFramebuffer)}else if(K.depthBuffer&&K.resolveDepthBuffer===!1&&l){const H=K.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[H])}}}function Le(K){return Math.min(i.maxSamples,K.samples)}function We(K){const H=r.get(K);return K.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&H.__useRenderToTexture!==!1}function Je(K){const H=a.render.frame;d.get(K)!==H&&(d.set(K,H),K.update())}function de(K,H){const xe=K.colorSpace,je=K.format,Oe=K.type;return K.isCompressedTexture===!0||K.isVideoTexture===!0||xe!==xi&&xe!==Uc&&(Nn.getTransfer(xe)===er?(je!==ss||Oe!==Vo)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",xe)),H}function De(K){return typeof HTMLImageElement<"u"&&K instanceof HTMLImageElement?(c.width=K.naturalWidth||K.width,c.height=K.naturalHeight||K.height):typeof VideoFrame<"u"&&K instanceof VideoFrame?(c.width=K.displayWidth,c.height=K.displayHeight):(c.width=K.width,c.height=K.height),c}this.allocateTextureUnit=X,this.resetTextureUnits=U,this.setTexture2D=re,this.setTexture2DArray=pe,this.setTexture3D=ee,this.setTextureCube=ce,this.rebindTextures=Ee,this.setupRenderTarget=Ge,this.updateRenderTargetMipmap=Xe,this.updateMultisampleRenderTarget=Ve,this.setupDepthRenderbuffer=$e,this.setupFrameBufferTexture=le,this.useMultisampledRTT=We}function U6(t,e){function n(r,i=Uc){let s;const a=Nn.getTransfer(i);if(r===Vo)return t.UNSIGNED_BYTE;if(r===JS)return t.UNSIGNED_SHORT_4_4_4_4;if(r===eM)return t.UNSIGNED_SHORT_5_5_5_1;if(r===yR)return t.UNSIGNED_INT_5_9_9_9_REV;if(r===gR)return t.BYTE;if(r===vR)return t.SHORT;if(r===Fg)return t.UNSIGNED_SHORT;if(r===QS)return t.INT;if(r===nu)return t.UNSIGNED_INT;if(r===ea)return t.FLOAT;if(r===lv)return t.HALF_FLOAT;if(r===xR)return t.ALPHA;if(r===bR)return t.RGB;if(r===ss)return t.RGBA;if(r===_R)return t.LUMINANCE;if(r===wR)return t.LUMINANCE_ALPHA;if(r===Ih)return t.DEPTH_COMPONENT;if(r===qh)return t.DEPTH_STENCIL;if(r===tM)return t.RED;if(r===mx)return t.RED_INTEGER;if(r===SR)return t.RG;if(r===nM)return t.RG_INTEGER;if(r===rM)return t.RGBA_INTEGER;if(r===ry||r===iy||r===sy||r===ay)if(a===er)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===ry)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===iy)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===sy)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===ay)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===ry)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===iy)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===sy)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===ay)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===vw||r===yw||r===xw||r===bw)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===vw)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===yw)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===xw)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===bw)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===_w||r===ww||r===Sw)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===_w||r===ww)return a===er?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===Sw)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===Mw||r===Ew||r===Aw||r===Tw||r===Cw||r===Pw||r===Rw||r===Nw||r===kw||r===Iw||r===Lw||r===Ow||r===Dw||r===jw)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===Mw)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===Ew)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===Aw)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===Tw)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===Cw)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===Pw)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===Rw)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===Nw)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===kw)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===Iw)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===Lw)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===Ow)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===Dw)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===jw)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===oy||r===Uw||r===Fw)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===oy)return a===er?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===Uw)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===Fw)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===MR||r===zw||r===Bw||r===Hw)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===oy)return s.COMPRESSED_RED_RGTC1_EXT;if(r===zw)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===Bw)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===Hw)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===Xh?t.UNSIGNED_INT_24_8:t[r]!==void 0?t[r]:null}return{convert:n}}class F6 extends Cr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Cs extends mn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const zye={type:"move"};class PA{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Cs,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 Cs,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new q,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new q),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Cs,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new q,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new q),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const r of e.hand.values())this._getHandJoint(n,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,r){let i=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const S of e.hand.values()){const w=n.getJointPose(S,r),b=this._getHandJoint(c,S);w!==null&&(b.matrix.fromArray(w.transform.matrix),b.matrix.decompose(b.position,b.rotation,b.scale),b.matrixWorldNeedsUpdate=!0,b.jointRadius=w.radius),b.visible=w!==null}const d=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],p=d.position.distanceTo(f.position),y=.02,x=.005;c.inputState.pinching&&p>y+x?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=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));o!==null&&(i=n.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(zye)))}return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const r=new Cs;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}}const Bye=`
|
||
void main() {
|
||
|
||
gl_Position = vec4( position, 1.0 );
|
||
|
||
}`,Hye=`
|
||
uniform sampler2DArray depthColor;
|
||
uniform float depthWidth;
|
||
uniform float depthHeight;
|
||
|
||
void main() {
|
||
|
||
vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
|
||
|
||
if ( coord.x >= 1.0 ) {
|
||
|
||
gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
|
||
|
||
} else {
|
||
|
||
gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
|
||
|
||
}
|
||
|
||
}`;class Vye{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n,r){if(this.texture===null){const i=new fr,s=e.properties.get(i);s.__webglTexture=n.texture,(n.depthNear!=r.depthNear||n.depthFar!=r.depthFar)&&(this.depthNear=n.depthNear,this.depthFar=n.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const n=e.cameras[0].viewport,r=new Qa({vertexShader:Bye,fragmentShader:Hye,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new xr(new cv(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Gye extends Gl{constructor(e,n){super();const r=this;let i=null,s=1,a=null,o="local-floor",l=1,c=null,d=null,f=null,p=null,y=null,x=null;const S=new Vye,w=n.getContextAttributes();let b=null,M=null;const T=[],C=[],L=new He;let N=null;const D=new Cr;D.layers.enable(1),D.viewport=new On;const F=new Cr;F.layers.enable(2),F.viewport=new On;const V=[D,F],I=new F6;I.layers.enable(1),I.layers.enable(2);let U=null,X=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(se){let le=T[se];return le===void 0&&(le=new PA,T[se]=le),le.getTargetRaySpace()},this.getControllerGrip=function(se){let le=T[se];return le===void 0&&(le=new PA,T[se]=le),le.getGripSpace()},this.getHand=function(se){let le=T[se];return le===void 0&&(le=new PA,T[se]=le),le.getHandSpace()};function te(se){const le=C.indexOf(se.inputSource);if(le===-1)return;const Me=T[le];Me!==void 0&&(Me.update(se.inputSource,se.frame,c||a),Me.dispatchEvent({type:se.type,data:se.inputSource}))}function re(){i.removeEventListener("select",te),i.removeEventListener("selectstart",te),i.removeEventListener("selectend",te),i.removeEventListener("squeeze",te),i.removeEventListener("squeezestart",te),i.removeEventListener("squeezeend",te),i.removeEventListener("end",re),i.removeEventListener("inputsourceschange",pe);for(let se=0;se<T.length;se++){const le=C[se];le!==null&&(C[se]=null,T[se].disconnect(le))}U=null,X=null,S.reset(),e.setRenderTarget(b),y=null,p=null,f=null,i=null,M=null,oe.stop(),r.isPresenting=!1,e.setPixelRatio(N),e.setSize(L.width,L.height,!1),r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(se){s=se,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(se){o=se,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(se){c=se},this.getBaseLayer=function(){return p!==null?p:y},this.getBinding=function(){return f},this.getFrame=function(){return x},this.getSession=function(){return i},this.setSession=async function(se){if(i=se,i!==null){if(b=e.getRenderTarget(),i.addEventListener("select",te),i.addEventListener("selectstart",te),i.addEventListener("selectend",te),i.addEventListener("squeeze",te),i.addEventListener("squeezestart",te),i.addEventListener("squeezeend",te),i.addEventListener("end",re),i.addEventListener("inputsourceschange",pe),w.xrCompatible!==!0&&await n.makeXRCompatible(),N=e.getPixelRatio(),e.getSize(L),i.renderState.layers===void 0){const le={antialias:w.antialias,alpha:!0,depth:w.depth,stencil:w.stencil,framebufferScaleFactor:s};y=new XRWebGLLayer(i,n,le),i.updateRenderState({baseLayer:y}),e.setPixelRatio(1),e.setSize(y.framebufferWidth,y.framebufferHeight,!1),M=new Go(y.framebufferWidth,y.framebufferHeight,{format:ss,type:Vo,colorSpace:e.outputColorSpace,stencilBuffer:w.stencil})}else{let le=null,Me=null,Se=null;w.depth&&(Se=w.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,le=w.stencil?qh:Ih,Me=w.stencil?Xh:nu);const $e={colorFormat:n.RGBA8,depthFormat:Se,scaleFactor:s};f=new XRWebGLBinding(i,n),p=f.createProjectionLayer($e),i.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),M=new Go(p.textureWidth,p.textureHeight,{format:ss,type:Vo,depthTexture:new LR(p.textureWidth,p.textureHeight,Me,void 0,void 0,void 0,void 0,void 0,void 0,le),stencilBuffer:w.stencil,colorSpace:e.outputColorSpace,samples:w.antialias?4:0,resolveDepthBuffer:p.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await i.requestReferenceSpace(o),oe.setContext(i),oe.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return S.getDepthTexture()};function pe(se){for(let le=0;le<se.removed.length;le++){const Me=se.removed[le],Se=C.indexOf(Me);Se>=0&&(C[Se]=null,T[Se].disconnect(Me))}for(let le=0;le<se.added.length;le++){const Me=se.added[le];let Se=C.indexOf(Me);if(Se===-1){for(let Ee=0;Ee<T.length;Ee++)if(Ee>=C.length){C.push(Me),Se=Ee;break}else if(C[Ee]===null){C[Ee]=Me,Se=Ee;break}if(Se===-1)break}const $e=T[Se];$e&&$e.connect(Me)}}const ee=new q,ce=new q;function B(se,le,Me){ee.setFromMatrixPosition(le.matrixWorld),ce.setFromMatrixPosition(Me.matrixWorld);const Se=ee.distanceTo(ce),$e=le.projectionMatrix.elements,Ee=Me.projectionMatrix.elements,Ge=$e[14]/($e[10]-1),Xe=$e[14]/($e[10]+1),fe=($e[9]+1)/$e[5],Q=($e[9]-1)/$e[5],Ve=($e[8]-1)/$e[0],Le=(Ee[8]+1)/Ee[0],We=Ge*Ve,Je=Ge*Le,de=Se/(-Ve+Le),De=de*-Ve;if(le.matrixWorld.decompose(se.position,se.quaternion,se.scale),se.translateX(De),se.translateZ(de),se.matrixWorld.compose(se.position,se.quaternion,se.scale),se.matrixWorldInverse.copy(se.matrixWorld).invert(),$e[10]===-1)se.projectionMatrix.copy(le.projectionMatrix),se.projectionMatrixInverse.copy(le.projectionMatrixInverse);else{const K=Ge+de,H=Xe+de,xe=We-De,je=Je+(Se-De),Oe=fe*Xe/H*K,Fe=Q*Xe/H*K;se.projectionMatrix.makePerspective(xe,je,Oe,Fe,K,H),se.projectionMatrixInverse.copy(se.projectionMatrix).invert()}}function J(se,le){le===null?se.matrixWorld.copy(se.matrix):se.matrixWorld.multiplyMatrices(le.matrixWorld,se.matrix),se.matrixWorldInverse.copy(se.matrixWorld).invert()}this.updateCamera=function(se){if(i===null)return;let le=se.near,Me=se.far;S.texture!==null&&(S.depthNear>0&&(le=S.depthNear),S.depthFar>0&&(Me=S.depthFar)),I.near=F.near=D.near=le,I.far=F.far=D.far=Me,(U!==I.near||X!==I.far)&&(i.updateRenderState({depthNear:I.near,depthFar:I.far}),U=I.near,X=I.far);const Se=se.parent,$e=I.cameras;J(I,Se);for(let Ee=0;Ee<$e.length;Ee++)J($e[Ee],Se);$e.length===2?B(I,D,F):I.projectionMatrix.copy(D.projectionMatrix),Z(se,I,Se)};function Z(se,le,Me){Me===null?se.matrix.copy(le.matrixWorld):(se.matrix.copy(Me.matrixWorld),se.matrix.invert(),se.matrix.multiply(le.matrixWorld)),se.matrix.decompose(se.position,se.quaternion,se.scale),se.updateMatrixWorld(!0),se.projectionMatrix.copy(le.projectionMatrix),se.projectionMatrixInverse.copy(le.projectionMatrixInverse),se.isPerspectiveCamera&&(se.fov=Hg*2*Math.atan(1/se.projectionMatrix.elements[5]),se.zoom=1)}this.getCamera=function(){return I},this.getFoveation=function(){if(!(p===null&&y===null))return l},this.setFoveation=function(se){l=se,p!==null&&(p.fixedFoveation=se),y!==null&&y.fixedFoveation!==void 0&&(y.fixedFoveation=se)},this.hasDepthSensing=function(){return S.texture!==null},this.getDepthSensingMesh=function(){return S.getMesh(I)};let G=null;function W(se,le){if(d=le.getViewerPose(c||a),x=le,d!==null){const Me=d.views;y!==null&&(e.setRenderTargetFramebuffer(M,y.framebuffer),e.setRenderTarget(M));let Se=!1;Me.length!==I.cameras.length&&(I.cameras.length=0,Se=!0);for(let Ee=0;Ee<Me.length;Ee++){const Ge=Me[Ee];let Xe=null;if(y!==null)Xe=y.getViewport(Ge);else{const Q=f.getViewSubImage(p,Ge);Xe=Q.viewport,Ee===0&&(e.setRenderTargetTextures(M,Q.colorTexture,p.ignoreDepthValues?void 0:Q.depthStencilTexture),e.setRenderTarget(M))}let fe=V[Ee];fe===void 0&&(fe=new Cr,fe.layers.enable(Ee),fe.viewport=new On,V[Ee]=fe),fe.matrix.fromArray(Ge.transform.matrix),fe.matrix.decompose(fe.position,fe.quaternion,fe.scale),fe.projectionMatrix.fromArray(Ge.projectionMatrix),fe.projectionMatrixInverse.copy(fe.projectionMatrix).invert(),fe.viewport.set(Xe.x,Xe.y,Xe.width,Xe.height),Ee===0&&(I.matrix.copy(fe.matrix),I.matrix.decompose(I.position,I.quaternion,I.scale)),Se===!0&&I.cameras.push(fe)}const $e=i.enabledFeatures;if($e&&$e.includes("depth-sensing")){const Ee=f.getDepthInformation(Me[0]);Ee&&Ee.isValid&&Ee.texture&&S.init(e,Ee,i.renderState)}}for(let Me=0;Me<T.length;Me++){const Se=C[Me],$e=T[Me];Se!==null&&$e!==void 0&&$e.update(Se,le,c||a)}G&&G(se,le),le.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:le}),x=null}const oe=new I6;oe.setAnimationLoop(W),this.setAnimationLoop=function(se){G=se},this.dispose=function(){}}}const Ff=new ls,Wye=new Rt;function $ye(t,e){function n(w,b){w.matrixAutoUpdate===!0&&w.updateMatrix(),b.value.copy(w.matrix)}function r(w,b){b.color.getRGB(w.fogColor.value,R6(t)),b.isFog?(w.fogNear.value=b.near,w.fogFar.value=b.far):b.isFogExp2&&(w.fogDensity.value=b.density)}function i(w,b,M,T,C){b.isMeshBasicMaterial||b.isMeshLambertMaterial?s(w,b):b.isMeshToonMaterial?(s(w,b),f(w,b)):b.isMeshPhongMaterial?(s(w,b),d(w,b)):b.isMeshStandardMaterial?(s(w,b),p(w,b),b.isMeshPhysicalMaterial&&y(w,b,C)):b.isMeshMatcapMaterial?(s(w,b),x(w,b)):b.isMeshDepthMaterial?s(w,b):b.isMeshDistanceMaterial?(s(w,b),S(w,b)):b.isMeshNormalMaterial?s(w,b):b.isLineBasicMaterial?(a(w,b),b.isLineDashedMaterial&&o(w,b)):b.isPointsMaterial?l(w,b,M,T):b.isSpriteMaterial?c(w,b):b.isShadowMaterial?(w.color.value.copy(b.color),w.opacity.value=b.opacity):b.isShaderMaterial&&(b.uniformsNeedUpdate=!1)}function s(w,b){w.opacity.value=b.opacity,b.color&&w.diffuse.value.copy(b.color),b.emissive&&w.emissive.value.copy(b.emissive).multiplyScalar(b.emissiveIntensity),b.map&&(w.map.value=b.map,n(b.map,w.mapTransform)),b.alphaMap&&(w.alphaMap.value=b.alphaMap,n(b.alphaMap,w.alphaMapTransform)),b.bumpMap&&(w.bumpMap.value=b.bumpMap,n(b.bumpMap,w.bumpMapTransform),w.bumpScale.value=b.bumpScale,b.side===as&&(w.bumpScale.value*=-1)),b.normalMap&&(w.normalMap.value=b.normalMap,n(b.normalMap,w.normalMapTransform),w.normalScale.value.copy(b.normalScale),b.side===as&&w.normalScale.value.negate()),b.displacementMap&&(w.displacementMap.value=b.displacementMap,n(b.displacementMap,w.displacementMapTransform),w.displacementScale.value=b.displacementScale,w.displacementBias.value=b.displacementBias),b.emissiveMap&&(w.emissiveMap.value=b.emissiveMap,n(b.emissiveMap,w.emissiveMapTransform)),b.specularMap&&(w.specularMap.value=b.specularMap,n(b.specularMap,w.specularMapTransform)),b.alphaTest>0&&(w.alphaTest.value=b.alphaTest);const M=e.get(b),T=M.envMap,C=M.envMapRotation;T&&(w.envMap.value=T,Ff.copy(C),Ff.x*=-1,Ff.y*=-1,Ff.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(Ff.y*=-1,Ff.z*=-1),w.envMapRotation.value.setFromMatrix4(Wye.makeRotationFromEuler(Ff)),w.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,w.reflectivity.value=b.reflectivity,w.ior.value=b.ior,w.refractionRatio.value=b.refractionRatio),b.lightMap&&(w.lightMap.value=b.lightMap,w.lightMapIntensity.value=b.lightMapIntensity,n(b.lightMap,w.lightMapTransform)),b.aoMap&&(w.aoMap.value=b.aoMap,w.aoMapIntensity.value=b.aoMapIntensity,n(b.aoMap,w.aoMapTransform))}function a(w,b){w.diffuse.value.copy(b.color),w.opacity.value=b.opacity,b.map&&(w.map.value=b.map,n(b.map,w.mapTransform))}function o(w,b){w.dashSize.value=b.dashSize,w.totalSize.value=b.dashSize+b.gapSize,w.scale.value=b.scale}function l(w,b,M,T){w.diffuse.value.copy(b.color),w.opacity.value=b.opacity,w.size.value=b.size*M,w.scale.value=T*.5,b.map&&(w.map.value=b.map,n(b.map,w.uvTransform)),b.alphaMap&&(w.alphaMap.value=b.alphaMap,n(b.alphaMap,w.alphaMapTransform)),b.alphaTest>0&&(w.alphaTest.value=b.alphaTest)}function c(w,b){w.diffuse.value.copy(b.color),w.opacity.value=b.opacity,w.rotation.value=b.rotation,b.map&&(w.map.value=b.map,n(b.map,w.mapTransform)),b.alphaMap&&(w.alphaMap.value=b.alphaMap,n(b.alphaMap,w.alphaMapTransform)),b.alphaTest>0&&(w.alphaTest.value=b.alphaTest)}function d(w,b){w.specular.value.copy(b.specular),w.shininess.value=Math.max(b.shininess,1e-4)}function f(w,b){b.gradientMap&&(w.gradientMap.value=b.gradientMap)}function p(w,b){w.metalness.value=b.metalness,b.metalnessMap&&(w.metalnessMap.value=b.metalnessMap,n(b.metalnessMap,w.metalnessMapTransform)),w.roughness.value=b.roughness,b.roughnessMap&&(w.roughnessMap.value=b.roughnessMap,n(b.roughnessMap,w.roughnessMapTransform)),b.envMap&&(w.envMapIntensity.value=b.envMapIntensity)}function y(w,b,M){w.ior.value=b.ior,b.sheen>0&&(w.sheenColor.value.copy(b.sheenColor).multiplyScalar(b.sheen),w.sheenRoughness.value=b.sheenRoughness,b.sheenColorMap&&(w.sheenColorMap.value=b.sheenColorMap,n(b.sheenColorMap,w.sheenColorMapTransform)),b.sheenRoughnessMap&&(w.sheenRoughnessMap.value=b.sheenRoughnessMap,n(b.sheenRoughnessMap,w.sheenRoughnessMapTransform))),b.clearcoat>0&&(w.clearcoat.value=b.clearcoat,w.clearcoatRoughness.value=b.clearcoatRoughness,b.clearcoatMap&&(w.clearcoatMap.value=b.clearcoatMap,n(b.clearcoatMap,w.clearcoatMapTransform)),b.clearcoatRoughnessMap&&(w.clearcoatRoughnessMap.value=b.clearcoatRoughnessMap,n(b.clearcoatRoughnessMap,w.clearcoatRoughnessMapTransform)),b.clearcoatNormalMap&&(w.clearcoatNormalMap.value=b.clearcoatNormalMap,n(b.clearcoatNormalMap,w.clearcoatNormalMapTransform),w.clearcoatNormalScale.value.copy(b.clearcoatNormalScale),b.side===as&&w.clearcoatNormalScale.value.negate())),b.dispersion>0&&(w.dispersion.value=b.dispersion),b.iridescence>0&&(w.iridescence.value=b.iridescence,w.iridescenceIOR.value=b.iridescenceIOR,w.iridescenceThicknessMinimum.value=b.iridescenceThicknessRange[0],w.iridescenceThicknessMaximum.value=b.iridescenceThicknessRange[1],b.iridescenceMap&&(w.iridescenceMap.value=b.iridescenceMap,n(b.iridescenceMap,w.iridescenceMapTransform)),b.iridescenceThicknessMap&&(w.iridescenceThicknessMap.value=b.iridescenceThicknessMap,n(b.iridescenceThicknessMap,w.iridescenceThicknessMapTransform))),b.transmission>0&&(w.transmission.value=b.transmission,w.transmissionSamplerMap.value=M.texture,w.transmissionSamplerSize.value.set(M.width,M.height),b.transmissionMap&&(w.transmissionMap.value=b.transmissionMap,n(b.transmissionMap,w.transmissionMapTransform)),w.thickness.value=b.thickness,b.thicknessMap&&(w.thicknessMap.value=b.thicknessMap,n(b.thicknessMap,w.thicknessMapTransform)),w.attenuationDistance.value=b.attenuationDistance,w.attenuationColor.value.copy(b.attenuationColor)),b.anisotropy>0&&(w.anisotropyVector.value.set(b.anisotropy*Math.cos(b.anisotropyRotation),b.anisotropy*Math.sin(b.anisotropyRotation)),b.anisotropyMap&&(w.anisotropyMap.value=b.anisotropyMap,n(b.anisotropyMap,w.anisotropyMapTransform))),w.specularIntensity.value=b.specularIntensity,w.specularColor.value.copy(b.specularColor),b.specularColorMap&&(w.specularColorMap.value=b.specularColorMap,n(b.specularColorMap,w.specularColorMapTransform)),b.specularIntensityMap&&(w.specularIntensityMap.value=b.specularIntensityMap,n(b.specularIntensityMap,w.specularIntensityMapTransform))}function x(w,b){b.matcap&&(w.matcap.value=b.matcap)}function S(w,b){const M=e.get(b).light;w.referencePosition.value.setFromMatrixPosition(M.matrixWorld),w.nearDistance.value=M.shadow.camera.near,w.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function Xye(t,e,n,r){let i={},s={},a=[];const o=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(M,T){const C=T.program;r.uniformBlockBinding(M,C)}function c(M,T){let C=i[M.id];C===void 0&&(x(M),C=d(M),i[M.id]=C,M.addEventListener("dispose",w));const L=T.program;r.updateUBOMapping(M,L);const N=e.render.frame;s[M.id]!==N&&(p(M),s[M.id]=N)}function d(M){const T=f();M.__bindingPointIndex=T;const C=t.createBuffer(),L=M.__size,N=M.usage;return t.bindBuffer(t.UNIFORM_BUFFER,C),t.bufferData(t.UNIFORM_BUFFER,L,N),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,T,C),C}function f(){for(let M=0;M<o;M++)if(a.indexOf(M)===-1)return a.push(M),M;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function p(M){const T=i[M.id],C=M.uniforms,L=M.__cache;t.bindBuffer(t.UNIFORM_BUFFER,T);for(let N=0,D=C.length;N<D;N++){const F=Array.isArray(C[N])?C[N]:[C[N]];for(let V=0,I=F.length;V<I;V++){const U=F[V];if(y(U,N,V,L)===!0){const X=U.__offset,te=Array.isArray(U.value)?U.value:[U.value];let re=0;for(let pe=0;pe<te.length;pe++){const ee=te[pe],ce=S(ee);typeof ee=="number"||typeof ee=="boolean"?(U.__data[0]=ee,t.bufferSubData(t.UNIFORM_BUFFER,X+re,U.__data)):ee.isMatrix3?(U.__data[0]=ee.elements[0],U.__data[1]=ee.elements[1],U.__data[2]=ee.elements[2],U.__data[3]=0,U.__data[4]=ee.elements[3],U.__data[5]=ee.elements[4],U.__data[6]=ee.elements[5],U.__data[7]=0,U.__data[8]=ee.elements[6],U.__data[9]=ee.elements[7],U.__data[10]=ee.elements[8],U.__data[11]=0):(ee.toArray(U.__data,re),re+=ce.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,X,U.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function y(M,T,C,L){const N=M.value,D=T+"_"+C;if(L[D]===void 0)return typeof N=="number"||typeof N=="boolean"?L[D]=N:L[D]=N.clone(),!0;{const F=L[D];if(typeof N=="number"||typeof N=="boolean"){if(F!==N)return L[D]=N,!0}else if(F.equals(N)===!1)return F.copy(N),!0}return!1}function x(M){const T=M.uniforms;let C=0;const L=16;for(let D=0,F=T.length;D<F;D++){const V=Array.isArray(T[D])?T[D]:[T[D]];for(let I=0,U=V.length;I<U;I++){const X=V[I],te=Array.isArray(X.value)?X.value:[X.value];for(let re=0,pe=te.length;re<pe;re++){const ee=te[re],ce=S(ee),B=C%L,J=B%ce.boundary,Z=B+J;C+=J,Z!==0&&L-Z<ce.storage&&(C+=L-Z),X.__data=new Float32Array(ce.storage/Float32Array.BYTES_PER_ELEMENT),X.__offset=C,C+=ce.storage}}}const N=C%L;return N>0&&(C+=L-N),M.__size=C,M.__cache={},this}function S(M){const T={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(T.boundary=4,T.storage=4):M.isVector2?(T.boundary=8,T.storage=8):M.isVector3||M.isColor?(T.boundary=16,T.storage=12):M.isVector4?(T.boundary=16,T.storage=16):M.isMatrix3?(T.boundary=48,T.storage=48):M.isMatrix4?(T.boundary=64,T.storage=64):M.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",M),T}function w(M){const T=M.target;T.removeEventListener("dispose",w);const C=a.indexOf(T.__bindingPointIndex);a.splice(C,1),t.deleteBuffer(i[T.id]),delete i[T.id],delete s[T.id]}function b(){for(const M in i)t.deleteBuffer(i[M]);a=[],i={},s={}}return{bind:l,update:c,dispose:b}}class z6{constructor(e={}){const{canvas:n=A6(),context:r=null,depth:i=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let p;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=r.getContextAttributes().alpha}else p=a;const y=new Uint32Array(4),x=new Int32Array(4);let S=null,w=null;const b=[],M=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Fi,this.toneMapping=Cl,this.toneMappingExposure=1;const T=this;let C=!1,L=0,N=0,D=null,F=-1,V=null;const I=new On,U=new On;let X=null;const te=new ut(0);let re=0,pe=n.width,ee=n.height,ce=1,B=null,J=null;const Z=new On(0,0,pe,ee),G=new On(0,0,pe,ee);let W=!1;const oe=new xx;let se=!1,le=!1;const Me=new Rt,Se=new Rt,$e=new q,Ee=new On,Ge={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Xe=!1;function fe(){return D===null?ce:1}let Q=r;function Ve(Y,be){return n.getContext(Y,be)}try{const Y={alpha:!0,depth:i,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:f};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${kd}`),n.addEventListener("webglcontextlost",Be,!1),n.addEventListener("webglcontextrestored",at,!1),n.addEventListener("webglcontextcreationerror",pt,!1),Q===null){const be="webgl2";if(Q=Ve(be,Y),Q===null)throw Ve(be)?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 Le,We,Je,de,De,K,H,xe,je,Oe,Fe,xt,rt,ft,zt,Ye,ne,tt,Mt,vt,Zt,he,Ke,ue;function Ze(){Le=new Jve(Q),Le.init(),he=new U6(Q,Le),We=new Xve(Q,Le,e,he),Je=new Iye(Q),We.reverseDepthBuffer&&Je.buffers.depth.setReversed(!0),de=new n0e(Q),De=new bye,K=new Fye(Q,Le,Je,De,We,he,de),H=new Kve(T),xe=new Qve(T),je=new cme(Q),Ke=new Wve(Q,je),Oe=new e0e(Q,je,de,Ke),Fe=new i0e(Q,Oe,je,de),Mt=new r0e(Q,We,K),Ye=new qve(De),xt=new xye(T,H,xe,Le,We,Ke,Ye),rt=new $ye(T,De),ft=new wye,zt=new Cye(Le),tt=new Gve(T,H,xe,Je,Fe,p,l),ne=new Nye(T,Fe,We),ue=new Xye(Q,de,We,Je),vt=new $ve(Q,Le,de),Zt=new t0e(Q,Le,de),de.programs=xt.programs,T.capabilities=We,T.extensions=Le,T.properties=De,T.renderLists=ft,T.shadowMap=ne,T.state=Je,T.info=de}Ze();const Pe=new Gye(T,Q);this.xr=Pe,this.getContext=function(){return Q},this.getContextAttributes=function(){return Q.getContextAttributes()},this.forceContextLoss=function(){const Y=Le.get("WEBGL_lose_context");Y&&Y.loseContext()},this.forceContextRestore=function(){const Y=Le.get("WEBGL_lose_context");Y&&Y.restoreContext()},this.getPixelRatio=function(){return ce},this.setPixelRatio=function(Y){Y!==void 0&&(ce=Y,this.setSize(pe,ee,!1))},this.getSize=function(Y){return Y.set(pe,ee)},this.setSize=function(Y,be,Te=!0){if(Pe.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}pe=Y,ee=be,n.width=Math.floor(Y*ce),n.height=Math.floor(be*ce),Te===!0&&(n.style.width=Y+"px",n.style.height=be+"px"),this.setViewport(0,0,Y,be)},this.getDrawingBufferSize=function(Y){return Y.set(pe*ce,ee*ce).floor()},this.setDrawingBufferSize=function(Y,be,Te){pe=Y,ee=be,ce=Te,n.width=Math.floor(Y*Te),n.height=Math.floor(be*Te),this.setViewport(0,0,Y,be)},this.getCurrentViewport=function(Y){return Y.copy(I)},this.getViewport=function(Y){return Y.copy(Z)},this.setViewport=function(Y,be,Te,Ne){Y.isVector4?Z.set(Y.x,Y.y,Y.z,Y.w):Z.set(Y,be,Te,Ne),Je.viewport(I.copy(Z).multiplyScalar(ce).round())},this.getScissor=function(Y){return Y.copy(G)},this.setScissor=function(Y,be,Te,Ne){Y.isVector4?G.set(Y.x,Y.y,Y.z,Y.w):G.set(Y,be,Te,Ne),Je.scissor(U.copy(G).multiplyScalar(ce).round())},this.getScissorTest=function(){return W},this.setScissorTest=function(Y){Je.setScissorTest(W=Y)},this.setOpaqueSort=function(Y){B=Y},this.setTransparentSort=function(Y){J=Y},this.getClearColor=function(Y){return Y.copy(tt.getClearColor())},this.setClearColor=function(){tt.setClearColor.apply(tt,arguments)},this.getClearAlpha=function(){return tt.getClearAlpha()},this.setClearAlpha=function(){tt.setClearAlpha.apply(tt,arguments)},this.clear=function(Y=!0,be=!0,Te=!0){let Ne=0;if(Y){let we=!1;if(D!==null){const it=D.texture.format;we=it===rM||it===nM||it===mx}if(we){const it=D.texture.type,yt=it===Vo||it===nu||it===Fg||it===Xh||it===JS||it===eM,ct=tt.getClearColor(),Et=tt.getClearAlpha(),Ut=ct.r,Ht=ct.g,Nt=ct.b;yt?(y[0]=Ut,y[1]=Ht,y[2]=Nt,y[3]=Et,Q.clearBufferuiv(Q.COLOR,0,y)):(x[0]=Ut,x[1]=Ht,x[2]=Nt,x[3]=Et,Q.clearBufferiv(Q.COLOR,0,x))}else Ne|=Q.COLOR_BUFFER_BIT}be&&(Ne|=Q.DEPTH_BUFFER_BIT,Q.clearDepth(this.capabilities.reverseDepthBuffer?0:1)),Te&&(Ne|=Q.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Q.clear(Ne)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",Be,!1),n.removeEventListener("webglcontextrestored",at,!1),n.removeEventListener("webglcontextcreationerror",pt,!1),ft.dispose(),zt.dispose(),De.dispose(),H.dispose(),xe.dispose(),Fe.dispose(),Ke.dispose(),ue.dispose(),xt.dispose(),Pe.dispose(),Pe.removeEventListener("sessionstart",Mi),Pe.removeEventListener("sessionend",ro),Ei.stop()};function Be(Y){Y.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),C=!0}function at(){console.log("THREE.WebGLRenderer: Context Restored."),C=!1;const Y=de.autoReset,be=ne.enabled,Te=ne.autoUpdate,Ne=ne.needsUpdate,we=ne.type;Ze(),de.autoReset=Y,ne.enabled=be,ne.autoUpdate=Te,ne.needsUpdate=Ne,ne.type=we}function pt(Y){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",Y.statusMessage)}function Jt(Y){const be=Y.target;be.removeEventListener("dispose",Jt),pn(be)}function pn(Y){Fn(Y),De.remove(Y)}function Fn(Y){const be=De.get(Y).programs;be!==void 0&&(be.forEach(function(Te){xt.releaseProgram(Te)}),Y.isShaderMaterial&&xt.releaseShaderCache(Y))}this.renderBufferDirect=function(Y,be,Te,Ne,we,it){be===null&&(be=Ge);const yt=we.isMesh&&we.matrixWorld.determinant()<0,ct=Pa(Y,be,Te,Ne,we);Je.setMaterial(Ne,yt);let Et=Te.index,Ut=1;if(Ne.wireframe===!0){if(Et=Oe.getWireframeAttribute(Te),Et===void 0)return;Ut=2}const Ht=Te.drawRange,Nt=Te.attributes.position;let Sn=Ht.start*Ut,Mn=(Ht.start+Ht.count)*Ut;it!==null&&(Sn=Math.max(Sn,it.start*Ut),Mn=Math.min(Mn,(it.start+it.count)*Ut)),Et!==null?(Sn=Math.max(Sn,0),Mn=Math.min(Mn,Et.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;Ke.setup(we,Ne,ct,Te,Et);let Kt,jt=vt;if(Et!==null&&(Kt=je.get(Et),jt=Zt,jt.setIndex(Kt)),we.isMesh)Ne.wireframe===!0?(Je.setLineWidth(Ne.wireframeLinewidth*fe()),jt.setMode(Q.LINES)):jt.setMode(Q.TRIANGLES);else if(we.isLine){let mt=Ne.linewidth;mt===void 0&&(mt=1),Je.setLineWidth(mt*fe()),we.isLineSegments?jt.setMode(Q.LINES):we.isLineLoop?jt.setMode(Q.LINE_LOOP):jt.setMode(Q.LINE_STRIP)}else we.isPoints?jt.setMode(Q.POINTS):we.isSprite&&jt.setMode(Q.TRIANGLES);if(we.isBatchedMesh)if(we._multiDrawInstances!==null)jt.renderMultiDrawInstances(we._multiDrawStarts,we._multiDrawCounts,we._multiDrawCount,we._multiDrawInstances);else if(Le.get("WEBGL_multi_draw"))jt.renderMultiDraw(we._multiDrawStarts,we._multiDrawCounts,we._multiDrawCount);else{const mt=we._multiDrawStarts,xn=we._multiDrawCounts,tn=we._multiDrawCount,Rr=Et?je.get(Et).bytesPerElement:1,li=De.get(Ne).currentProgram.getUniforms();for(let In=0;In<tn;In++)li.setValue(Q,"_gl_DrawID",In),jt.render(mt[In]/Rr,xn[In])}else if(we.isInstancedMesh)jt.renderInstances(Sn,yn,we.count);else if(Te.isInstancedBufferGeometry){const mt=Te._maxInstanceCount!==void 0?Te._maxInstanceCount:1/0,xn=Math.min(Te.instanceCount,mt);jt.renderInstances(Sn,yn,xn)}else jt.render(Sn,yn)};function en(Y,be,Te){Y.transparent===!0&&Y.side===_a&&Y.forceSinglePass===!1?(Y.side=as,Y.needsUpdate=!0,so(Y,be,Te),Y.side=Ul,Y.needsUpdate=!0,so(Y,be,Te),Y.side=_a):so(Y,be,Te)}this.compile=function(Y,be,Te=null){Te===null&&(Te=Y),w=zt.get(Te),w.init(be),M.push(w),Te.traverseVisible(function(we){we.isLight&&we.layers.test(be.layers)&&(w.pushLight(we),we.castShadow&&w.pushShadow(we))}),Y!==Te&&Y.traverseVisible(function(we){we.isLight&&we.layers.test(be.layers)&&(w.pushLight(we),we.castShadow&&w.pushShadow(we))}),w.setupLights();const Ne=new Set;return Y.traverse(function(we){if(!(we.isMesh||we.isPoints||we.isLine||we.isSprite))return;const it=we.material;if(it)if(Array.isArray(it))for(let yt=0;yt<it.length;yt++){const ct=it[yt];en(ct,Te,we),Ne.add(ct)}else en(it,Te,we),Ne.add(it)}),M.pop(),w=null,Ne},this.compileAsync=function(Y,be,Te=null){const Ne=this.compile(Y,be,Te);return new Promise(we=>{function it(){if(Ne.forEach(function(yt){De.get(yt).currentProgram.isReady()&&Ne.delete(yt)}),Ne.size===0){we(Y);return}setTimeout(it,10)}Le.get("KHR_parallel_shader_compile")!==null?it():setTimeout(it,10)})};let Vn=null;function pr(Y){Vn&&Vn(Y)}function Mi(){Ei.stop()}function ro(){Ei.start()}const Ei=new I6;Ei.setAnimationLoop(pr),typeof self<"u"&&Ei.setContext(self),this.setAnimationLoop=function(Y){Vn=Y,Pe.setAnimationLoop(Y),Y===null?Ei.stop():Ei.start()},Pe.addEventListener("sessionstart",Mi),Pe.addEventListener("sessionend",ro),this.render=function(Y,be){if(be!==void 0&&be.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(),be.parent===null&&be.matrixWorldAutoUpdate===!0&&be.updateMatrixWorld(),Pe.enabled===!0&&Pe.isPresenting===!0&&(Pe.cameraAutoUpdate===!0&&Pe.updateCamera(be),be=Pe.getCamera()),Y.isScene===!0&&Y.onBeforeRender(T,Y,be,D),w=zt.get(Y,M.length),w.init(be),M.push(w),Se.multiplyMatrices(be.projectionMatrix,be.matrixWorldInverse),oe.setFromProjectionMatrix(Se),le=this.localClippingEnabled,se=Ye.init(this.clippingPlanes,le),S=ft.get(Y,b.length),S.init(),b.push(S),Pe.enabled===!0&&Pe.isPresenting===!0){const it=T.xr.getDepthSensingMesh();it!==null&&Yo(it,be,-1/0,T.sortObjects)}Yo(Y,be,0,T.sortObjects),S.finish(),T.sortObjects===!0&&S.sort(B,J),Xe=Pe.enabled===!1||Pe.isPresenting===!1||Pe.hasDepthSensing()===!1,Xe&&tt.addToRenderList(S,Y),this.info.render.frame++,se===!0&&Ye.beginShadows();const Te=w.state.shadowsArray;ne.render(Te,Y,be),se===!0&&Ye.endShadows(),this.info.autoReset===!0&&this.info.reset();const Ne=S.opaque,we=S.transmissive;if(w.setupLights(),be.isArrayCamera){const it=be.cameras;if(we.length>0)for(let yt=0,ct=it.length;yt<ct;yt++){const Et=it[yt];io(Ne,we,Y,Et)}Xe&&tt.render(Y);for(let yt=0,ct=it.length;yt<ct;yt++){const Et=it[yt];Is(S,Y,Et,Et.viewport)}}else we.length>0&&io(Ne,we,Y,be),Xe&&tt.render(Y),Is(S,Y,be);D!==null&&(K.updateMultisampleRenderTarget(D),K.updateRenderTargetMipmap(D)),Y.isScene===!0&&Y.onAfterRender(T,Y,be),Ke.resetDefaultState(),F=-1,V=null,M.pop(),M.length>0?(w=M[M.length-1],se===!0&&Ye.setGlobalState(T.clippingPlanes,w.state.camera)):w=null,b.pop(),b.length>0?S=b[b.length-1]:S=null};function Yo(Y,be,Te,Ne){if(Y.visible===!1)return;if(Y.layers.test(be.layers)){if(Y.isGroup)Te=Y.renderOrder;else if(Y.isLOD)Y.autoUpdate===!0&&Y.update(be);else if(Y.isLight)w.pushLight(Y),Y.castShadow&&w.pushShadow(Y);else if(Y.isSprite){if(!Y.frustumCulled||oe.intersectsSprite(Y)){Ne&&Ee.setFromMatrixPosition(Y.matrixWorld).applyMatrix4(Se);const yt=Fe.update(Y),ct=Y.material;ct.visible&&S.push(Y,yt,ct,Te,Ee.z,null)}}else if((Y.isMesh||Y.isLine||Y.isPoints)&&(!Y.frustumCulled||oe.intersectsObject(Y))){const yt=Fe.update(Y),ct=Y.material;if(Ne&&(Y.boundingSphere!==void 0?(Y.boundingSphere===null&&Y.computeBoundingSphere(),Ee.copy(Y.boundingSphere.center)):(yt.boundingSphere===null&&yt.computeBoundingSphere(),Ee.copy(yt.boundingSphere.center)),Ee.applyMatrix4(Y.matrixWorld).applyMatrix4(Se)),Array.isArray(ct)){const Et=yt.groups;for(let Ut=0,Ht=Et.length;Ut<Ht;Ut++){const Nt=Et[Ut],Sn=ct[Nt.materialIndex];Sn&&Sn.visible&&S.push(Y,yt,Sn,Te,Ee.z,Nt)}}else ct.visible&&S.push(Y,yt,ct,Te,Ee.z,null)}}const it=Y.children;for(let yt=0,ct=it.length;yt<ct;yt++)Yo(it[yt],be,Te,Ne)}function Is(Y,be,Te,Ne){const we=Y.opaque,it=Y.transmissive,yt=Y.transparent;w.setupLightsView(Te),se===!0&&Ye.setGlobalState(T.clippingPlanes,Te),Ne&&Je.viewport(I.copy(Ne)),we.length>0&&Ai(we,be,Te),it.length>0&&Ai(it,be,Te),yt.length>0&&Ai(yt,be,Te),Je.buffers.depth.setTest(!0),Je.buffers.depth.setMask(!0),Je.buffers.color.setMask(!0),Je.setPolygonOffset(!1)}function io(Y,be,Te,Ne){if((Te.isScene===!0?Te.overrideMaterial:null)!==null)return;w.state.transmissionRenderTarget[Ne.id]===void 0&&(w.state.transmissionRenderTarget[Ne.id]=new Go(1,1,{generateMipmaps:!0,type:Le.has("EXT_color_buffer_half_float")||Le.has("EXT_color_buffer_float")?lv:Vo,minFilter:qa,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Nn.workingColorSpace}));const it=w.state.transmissionRenderTarget[Ne.id],yt=Ne.viewport||I;it.setSize(yt.z,yt.w);const ct=T.getRenderTarget();T.setRenderTarget(it),T.getClearColor(te),re=T.getClearAlpha(),re<1&&T.setClearColor(16777215,.5),T.clear(),Xe&&tt.render(Te);const Et=T.toneMapping;T.toneMapping=Cl;const Ut=Ne.viewport;if(Ne.viewport!==void 0&&(Ne.viewport=void 0),w.setupLightsView(Ne),se===!0&&Ye.setGlobalState(T.clippingPlanes,Ne),Ai(Y,Te,Ne),K.updateMultisampleRenderTarget(it),K.updateRenderTargetMipmap(it),Le.has("WEBGL_multisampled_render_to_texture")===!1){let Ht=!1;for(let Nt=0,Sn=be.length;Nt<Sn;Nt++){const Mn=be[Nt],yn=Mn.object,Kt=Mn.geometry,jt=Mn.material,mt=Mn.group;if(jt.side===_a&&yn.layers.test(Ne.layers)){const xn=jt.side;jt.side=as,jt.needsUpdate=!0,Ca(yn,Te,Ne,Kt,jt,mt),jt.side=xn,jt.needsUpdate=!0,Ht=!0}}Ht===!0&&(K.updateMultisampleRenderTarget(it),K.updateRenderTargetMipmap(it))}T.setRenderTarget(ct),T.setClearColor(te,re),Ut!==void 0&&(Ne.viewport=Ut),T.toneMapping=Et}function Ai(Y,be,Te){const Ne=be.isScene===!0?be.overrideMaterial:null;for(let we=0,it=Y.length;we<it;we++){const yt=Y[we],ct=yt.object,Et=yt.geometry,Ut=Ne===null?yt.material:Ne,Ht=yt.group;ct.layers.test(Te.layers)&&Ca(ct,be,Te,Et,Ut,Ht)}}function Ca(Y,be,Te,Ne,we,it){Y.onBeforeRender(T,be,Te,Ne,we,it),Y.modelViewMatrix.multiplyMatrices(Te.matrixWorldInverse,Y.matrixWorld),Y.normalMatrix.getNormalMatrix(Y.modelViewMatrix),we.onBeforeRender(T,be,Te,Ne,Y,it),we.transparent===!0&&we.side===_a&&we.forceSinglePass===!1?(we.side=as,we.needsUpdate=!0,T.renderBufferDirect(Te,be,Ne,we,Y,it),we.side=Ul,we.needsUpdate=!0,T.renderBufferDirect(Te,be,Ne,we,Y,it),we.side=_a):T.renderBufferDirect(Te,be,Ne,we,Y,it),Y.onAfterRender(T,be,Te,Ne,we,it)}function so(Y,be,Te){be.isScene!==!0&&(be=Ge);const Ne=De.get(Y),we=w.state.lights,it=w.state.shadowsArray,yt=we.state.version,ct=xt.getParameters(Y,we.state,it,be,Te),Et=xt.getProgramCacheKey(ct);let Ut=Ne.programs;Ne.environment=Y.isMeshStandardMaterial?be.environment:null,Ne.fog=be.fog,Ne.envMap=(Y.isMeshStandardMaterial?xe:H).get(Y.envMap||Ne.environment),Ne.envMapRotation=Ne.environment!==null&&Y.envMap===null?be.environmentRotation:Y.envMapRotation,Ut===void 0&&(Y.addEventListener("dispose",Jt),Ut=new Map,Ne.programs=Ut);let Ht=Ut.get(Et);if(Ht!==void 0){if(Ne.currentProgram===Ht&&Ne.lightsStateVersion===yt)return fu(Y,ct),Ht}else ct.uniforms=xt.getUniforms(Y),Y.onBeforeCompile(ct,T),Ht=xt.acquireProgram(ct,Et),Ut.set(Et,Ht),Ne.uniforms=ct.uniforms;const Nt=Ne.uniforms;return(!Y.isShaderMaterial&&!Y.isRawShaderMaterial||Y.clipping===!0)&&(Nt.clippingPlanes=Ye.uniform),fu(Y,ct),Ne.needsLights=Wl(Y),Ne.lightsStateVersion=yt,Ne.needsLights&&(Nt.ambientLightColor.value=we.state.ambient,Nt.lightProbe.value=we.state.probe,Nt.directionalLights.value=we.state.directional,Nt.directionalLightShadows.value=we.state.directionalShadow,Nt.spotLights.value=we.state.spot,Nt.spotLightShadows.value=we.state.spotShadow,Nt.rectAreaLights.value=we.state.rectArea,Nt.ltc_1.value=we.state.rectAreaLTC1,Nt.ltc_2.value=we.state.rectAreaLTC2,Nt.pointLights.value=we.state.point,Nt.pointLightShadows.value=we.state.pointShadow,Nt.hemisphereLights.value=we.state.hemi,Nt.directionalShadowMap.value=we.state.directionalShadowMap,Nt.directionalShadowMatrix.value=we.state.directionalShadowMatrix,Nt.spotShadowMap.value=we.state.spotShadowMap,Nt.spotLightMatrix.value=we.state.spotLightMatrix,Nt.spotLightMap.value=we.state.spotLightMap,Nt.pointShadowMap.value=we.state.pointShadowMap,Nt.pointShadowMatrix.value=we.state.pointShadowMatrix),Ne.currentProgram=Ht,Ne.uniformsList=null,Ht}function du(Y){if(Y.uniformsList===null){const be=Y.currentProgram.getUniforms();Y.uniformsList=e1.seqWithValue(be.seq,Y.uniforms)}return Y.uniformsList}function fu(Y,be){const Te=De.get(Y);Te.outputColorSpace=be.outputColorSpace,Te.batching=be.batching,Te.batchingColor=be.batchingColor,Te.instancing=be.instancing,Te.instancingColor=be.instancingColor,Te.instancingMorph=be.instancingMorph,Te.skinning=be.skinning,Te.morphTargets=be.morphTargets,Te.morphNormals=be.morphNormals,Te.morphColors=be.morphColors,Te.morphTargetsCount=be.morphTargetsCount,Te.numClippingPlanes=be.numClippingPlanes,Te.numIntersection=be.numClipIntersection,Te.vertexAlphas=be.vertexAlphas,Te.vertexTangents=be.vertexTangents,Te.toneMapping=be.toneMapping}function Pa(Y,be,Te,Ne,we){be.isScene!==!0&&(be=Ge),K.resetTextureUnits();const it=be.fog,yt=Ne.isMeshStandardMaterial?be.environment:null,ct=D===null?T.outputColorSpace:D.isXRRenderTarget===!0?D.texture.colorSpace:xi,Et=(Ne.isMeshStandardMaterial?xe:H).get(Ne.envMap||yt),Ut=Ne.vertexColors===!0&&!!Te.attributes.color&&Te.attributes.color.itemSize===4,Ht=!!Te.attributes.tangent&&(!!Ne.normalMap||Ne.anisotropy>0),Nt=!!Te.morphAttributes.position,Sn=!!Te.morphAttributes.normal,Mn=!!Te.morphAttributes.color;let yn=Cl;Ne.toneMapped&&(D===null||D.isXRRenderTarget===!0)&&(yn=T.toneMapping);const Kt=Te.morphAttributes.position||Te.morphAttributes.normal||Te.morphAttributes.color,jt=Kt!==void 0?Kt.length:0,mt=De.get(Ne),xn=w.state.lights;if(se===!0&&(le===!0||Y!==V)){const Xr=Y===V&&Ne.id===F;Ye.setState(Ne,Y,Xr)}let tn=!1;Ne.version===mt.__version?(mt.needsLights&&mt.lightsStateVersion!==xn.state.version||mt.outputColorSpace!==ct||we.isBatchedMesh&&mt.batching===!1||!we.isBatchedMesh&&mt.batching===!0||we.isBatchedMesh&&mt.batchingColor===!0&&we.colorTexture===null||we.isBatchedMesh&&mt.batchingColor===!1&&we.colorTexture!==null||we.isInstancedMesh&&mt.instancing===!1||!we.isInstancedMesh&&mt.instancing===!0||we.isSkinnedMesh&&mt.skinning===!1||!we.isSkinnedMesh&&mt.skinning===!0||we.isInstancedMesh&&mt.instancingColor===!0&&we.instanceColor===null||we.isInstancedMesh&&mt.instancingColor===!1&&we.instanceColor!==null||we.isInstancedMesh&&mt.instancingMorph===!0&&we.morphTexture===null||we.isInstancedMesh&&mt.instancingMorph===!1&&we.morphTexture!==null||mt.envMap!==Et||Ne.fog===!0&&mt.fog!==it||mt.numClippingPlanes!==void 0&&(mt.numClippingPlanes!==Ye.numPlanes||mt.numIntersection!==Ye.numIntersection)||mt.vertexAlphas!==Ut||mt.vertexTangents!==Ht||mt.morphTargets!==Nt||mt.morphNormals!==Sn||mt.morphColors!==Mn||mt.toneMapping!==yn||mt.morphTargetsCount!==jt)&&(tn=!0):(tn=!0,mt.__version=Ne.version);let Rr=mt.currentProgram;tn===!0&&(Rr=so(Ne,be,we));let li=!1,In=!1,Ls=!1;const Gn=Rr.getUniforms(),ra=mt.uniforms;if(Je.useProgram(Rr.program)&&(li=!0,In=!0,Ls=!0),Ne.id!==F&&(F=Ne.id,In=!0),li||V!==Y){We.reverseDepthBuffer?(Me.copy(Y.projectionMatrix),Ipe(Me),Lpe(Me),Gn.setValue(Q,"projectionMatrix",Me)):Gn.setValue(Q,"projectionMatrix",Y.projectionMatrix),Gn.setValue(Q,"viewMatrix",Y.matrixWorldInverse);const Xr=Gn.map.cameraPosition;Xr!==void 0&&Xr.setValue(Q,$e.setFromMatrixPosition(Y.matrixWorld)),We.logarithmicDepthBuffer&&Gn.setValue(Q,"logDepthBufFC",2/(Math.log(Y.far+1)/Math.LN2)),(Ne.isMeshPhongMaterial||Ne.isMeshToonMaterial||Ne.isMeshLambertMaterial||Ne.isMeshBasicMaterial||Ne.isMeshStandardMaterial||Ne.isShaderMaterial)&&Gn.setValue(Q,"isOrthographic",Y.isOrthographicCamera===!0),V!==Y&&(V=Y,In=!0,Ls=!0)}if(we.isSkinnedMesh){Gn.setOptional(Q,we,"bindMatrix"),Gn.setOptional(Q,we,"bindMatrixInverse");const Xr=we.skeleton;Xr&&(Xr.boneTexture===null&&Xr.computeBoneTexture(),Gn.setValue(Q,"boneTexture",Xr.boneTexture,K))}we.isBatchedMesh&&(Gn.setOptional(Q,we,"batchingTexture"),Gn.setValue(Q,"batchingTexture",we._matricesTexture,K),Gn.setOptional(Q,we,"batchingIdTexture"),Gn.setValue(Q,"batchingIdTexture",we._indirectTexture,K),Gn.setOptional(Q,we,"batchingColorTexture"),we._colorsTexture!==null&&Gn.setValue(Q,"batchingColorTexture",we._colorsTexture,K));const Zo=Te.morphAttributes;if((Zo.position!==void 0||Zo.normal!==void 0||Zo.color!==void 0)&&Mt.update(we,Te,Rr),(In||mt.receiveShadow!==we.receiveShadow)&&(mt.receiveShadow=we.receiveShadow,Gn.setValue(Q,"receiveShadow",we.receiveShadow)),Ne.isMeshGouraudMaterial&&Ne.envMap!==null&&(ra.envMap.value=Et,ra.flipEnvMap.value=Et.isCubeTexture&&Et.isRenderTargetTexture===!1?-1:1),Ne.isMeshStandardMaterial&&Ne.envMap===null&&be.environment!==null&&(ra.envMapIntensity.value=be.environmentIntensity),In&&(Gn.setValue(Q,"toneMappingExposure",T.toneMappingExposure),mt.needsLights&&hu(ra,Ls),it&&Ne.fog===!0&&rt.refreshFogUniforms(ra,it),rt.refreshMaterialUniforms(ra,Ne,ce,ee,w.state.transmissionRenderTarget[Y.id]),e1.upload(Q,du(mt),ra,K)),Ne.isShaderMaterial&&Ne.uniformsNeedUpdate===!0&&(e1.upload(Q,du(mt),ra,K),Ne.uniformsNeedUpdate=!1),Ne.isSpriteMaterial&&Gn.setValue(Q,"center",we.center),Gn.setValue(Q,"modelViewMatrix",we.modelViewMatrix),Gn.setValue(Q,"normalMatrix",we.normalMatrix),Gn.setValue(Q,"modelMatrix",we.matrixWorld),Ne.isShaderMaterial||Ne.isRawShaderMaterial){const Xr=Ne.uniformsGroups;for(let ci=0,Hd=Xr.length;ci<Hd;ci++){const Qo=Xr[ci];ue.update(Qo,Rr),ue.bind(Qo,Rr)}}return Rr}function hu(Y,be){Y.ambientLightColor.needsUpdate=be,Y.lightProbe.needsUpdate=be,Y.directionalLights.needsUpdate=be,Y.directionalLightShadows.needsUpdate=be,Y.pointLights.needsUpdate=be,Y.pointLightShadows.needsUpdate=be,Y.spotLights.needsUpdate=be,Y.spotLightShadows.needsUpdate=be,Y.rectAreaLights.needsUpdate=be,Y.hemisphereLights.needsUpdate=be}function Wl(Y){return Y.isMeshLambertMaterial||Y.isMeshToonMaterial||Y.isMeshPhongMaterial||Y.isMeshStandardMaterial||Y.isShadowMaterial||Y.isShaderMaterial&&Y.lights===!0}this.getActiveCubeFace=function(){return L},this.getActiveMipmapLevel=function(){return N},this.getRenderTarget=function(){return D},this.setRenderTargetTextures=function(Y,be,Te){De.get(Y.texture).__webglTexture=be,De.get(Y.depthTexture).__webglTexture=Te;const Ne=De.get(Y);Ne.__hasExternalTextures=!0,Ne.__autoAllocateDepthBuffer=Te===void 0,Ne.__autoAllocateDepthBuffer||Le.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),Ne.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(Y,be){const Te=De.get(Y);Te.__webglFramebuffer=be,Te.__useDefaultFramebuffer=be===void 0},this.setRenderTarget=function(Y,be=0,Te=0){D=Y,L=be,N=Te;let Ne=!0,we=null,it=!1,yt=!1;if(Y){const Et=De.get(Y);if(Et.__useDefaultFramebuffer!==void 0)Je.bindFramebuffer(Q.FRAMEBUFFER,null),Ne=!1;else if(Et.__webglFramebuffer===void 0)K.setupRenderTarget(Y);else if(Et.__hasExternalTextures)K.rebindTextures(Y,De.get(Y.texture).__webglTexture,De.get(Y.depthTexture).__webglTexture);else if(Y.depthBuffer){const Nt=Y.depthTexture;if(Et.__boundDepthTexture!==Nt){if(Nt!==null&&De.has(Nt)&&(Y.width!==Nt.image.width||Y.height!==Nt.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");K.setupDepthRenderbuffer(Y)}}const Ut=Y.texture;(Ut.isData3DTexture||Ut.isDataArrayTexture||Ut.isCompressedArrayTexture)&&(yt=!0);const Ht=De.get(Y).__webglFramebuffer;Y.isWebGLCubeRenderTarget?(Array.isArray(Ht[be])?we=Ht[be][Te]:we=Ht[be],it=!0):Y.samples>0&&K.useMultisampledRTT(Y)===!1?we=De.get(Y).__webglMultisampledFramebuffer:Array.isArray(Ht)?we=Ht[Te]:we=Ht,I.copy(Y.viewport),U.copy(Y.scissor),X=Y.scissorTest}else I.copy(Z).multiplyScalar(ce).floor(),U.copy(G).multiplyScalar(ce).floor(),X=W;if(Je.bindFramebuffer(Q.FRAMEBUFFER,we)&&Ne&&Je.drawBuffers(Y,we),Je.viewport(I),Je.scissor(U),Je.setScissorTest(X),it){const Et=De.get(Y.texture);Q.framebufferTexture2D(Q.FRAMEBUFFER,Q.COLOR_ATTACHMENT0,Q.TEXTURE_CUBE_MAP_POSITIVE_X+be,Et.__webglTexture,Te)}else if(yt){const Et=De.get(Y.texture),Ut=be||0;Q.framebufferTextureLayer(Q.FRAMEBUFFER,Q.COLOR_ATTACHMENT0,Et.__webglTexture,Te||0,Ut)}F=-1},this.readRenderTargetPixels=function(Y,be,Te,Ne,we,it,yt){if(!(Y&&Y.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ct=De.get(Y).__webglFramebuffer;if(Y.isWebGLCubeRenderTarget&&yt!==void 0&&(ct=ct[yt]),ct){Je.bindFramebuffer(Q.FRAMEBUFFER,ct);try{const Et=Y.texture,Ut=Et.format,Ht=Et.type;if(!We.textureFormatReadable(Ut)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!We.textureTypeReadable(Ht)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}be>=0&&be<=Y.width-Ne&&Te>=0&&Te<=Y.height-we&&Q.readPixels(be,Te,Ne,we,he.convert(Ut),he.convert(Ht),it)}finally{const Et=D!==null?De.get(D).__webglFramebuffer:null;Je.bindFramebuffer(Q.FRAMEBUFFER,Et)}}},this.readRenderTargetPixelsAsync=async function(Y,be,Te,Ne,we,it,yt){if(!(Y&&Y.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ct=De.get(Y).__webglFramebuffer;if(Y.isWebGLCubeRenderTarget&&yt!==void 0&&(ct=ct[yt]),ct){const Et=Y.texture,Ut=Et.format,Ht=Et.type;if(!We.textureFormatReadable(Ut))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!We.textureTypeReadable(Ht))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(be>=0&&be<=Y.width-Ne&&Te>=0&&Te<=Y.height-we){Je.bindFramebuffer(Q.FRAMEBUFFER,ct);const Nt=Q.createBuffer();Q.bindBuffer(Q.PIXEL_PACK_BUFFER,Nt),Q.bufferData(Q.PIXEL_PACK_BUFFER,it.byteLength,Q.STREAM_READ),Q.readPixels(be,Te,Ne,we,he.convert(Ut),he.convert(Ht),0);const Sn=D!==null?De.get(D).__webglFramebuffer:null;Je.bindFramebuffer(Q.FRAMEBUFFER,Sn);const Mn=Q.fenceSync(Q.SYNC_GPU_COMMANDS_COMPLETE,0);return Q.flush(),await kpe(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,be=null,Te=0){Y.isTexture!==!0&&(J_("WebGLRenderer: copyFramebufferToTexture function signature has changed."),be=arguments[0]||null,Y=arguments[1]);const Ne=Math.pow(2,-Te),we=Math.floor(Y.image.width*Ne),it=Math.floor(Y.image.height*Ne),yt=be!==null?be.x:0,ct=be!==null?be.y:0;K.setTexture2D(Y,0),Q.copyTexSubImage2D(Q.TEXTURE_2D,Te,0,0,yt,ct,we,it),Je.unbindTexture()},this.copyTextureToTexture=function(Y,be,Te=null,Ne=null,we=0){Y.isTexture!==!0&&(J_("WebGLRenderer: copyTextureToTexture function signature has changed."),Ne=arguments[0]||null,Y=arguments[1],be=arguments[2],we=arguments[3]||0,Te=null);let it,yt,ct,Et,Ut,Ht;Te!==null?(it=Te.max.x-Te.min.x,yt=Te.max.y-Te.min.y,ct=Te.min.x,Et=Te.min.y):(it=Y.image.width,yt=Y.image.height,ct=0,Et=0),Ne!==null?(Ut=Ne.x,Ht=Ne.y):(Ut=0,Ht=0);const Nt=he.convert(be.format),Sn=he.convert(be.type);K.setTexture2D(be,0),Q.pixelStorei(Q.UNPACK_FLIP_Y_WEBGL,be.flipY),Q.pixelStorei(Q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,be.premultiplyAlpha),Q.pixelStorei(Q.UNPACK_ALIGNMENT,be.unpackAlignment);const Mn=Q.getParameter(Q.UNPACK_ROW_LENGTH),yn=Q.getParameter(Q.UNPACK_IMAGE_HEIGHT),Kt=Q.getParameter(Q.UNPACK_SKIP_PIXELS),jt=Q.getParameter(Q.UNPACK_SKIP_ROWS),mt=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,ct),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,Et),Y.isDataTexture?Q.texSubImage2D(Q.TEXTURE_2D,we,Ut,Ht,it,yt,Nt,Sn,xn.data):Y.isCompressedTexture?Q.compressedTexSubImage2D(Q.TEXTURE_2D,we,Ut,Ht,xn.width,xn.height,Nt,xn.data):Q.texSubImage2D(Q.TEXTURE_2D,we,Ut,Ht,it,yt,Nt,Sn,xn),Q.pixelStorei(Q.UNPACK_ROW_LENGTH,Mn),Q.pixelStorei(Q.UNPACK_IMAGE_HEIGHT,yn),Q.pixelStorei(Q.UNPACK_SKIP_PIXELS,Kt),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,jt),Q.pixelStorei(Q.UNPACK_SKIP_IMAGES,mt),we===0&&be.generateMipmaps&&Q.generateMipmap(Q.TEXTURE_2D),Je.unbindTexture()},this.copyTextureToTexture3D=function(Y,be,Te=null,Ne=null,we=0){Y.isTexture!==!0&&(J_("WebGLRenderer: copyTextureToTexture3D function signature has changed."),Te=arguments[0]||null,Ne=arguments[1]||null,Y=arguments[2],be=arguments[3],we=arguments[4]||0);let it,yt,ct,Et,Ut,Ht,Nt,Sn,Mn;const yn=Y.isCompressedTexture?Y.mipmaps[we]:Y.image;Te!==null?(it=Te.max.x-Te.min.x,yt=Te.max.y-Te.min.y,ct=Te.max.z-Te.min.z,Et=Te.min.x,Ut=Te.min.y,Ht=Te.min.z):(it=yn.width,yt=yn.height,ct=yn.depth,Et=0,Ut=0,Ht=0),Ne!==null?(Nt=Ne.x,Sn=Ne.y,Mn=Ne.z):(Nt=0,Sn=0,Mn=0);const Kt=he.convert(be.format),jt=he.convert(be.type);let mt;if(be.isData3DTexture)K.setTexture3D(be,0),mt=Q.TEXTURE_3D;else if(be.isDataArrayTexture||be.isCompressedArrayTexture)K.setTexture2DArray(be,0),mt=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,be.flipY),Q.pixelStorei(Q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,be.premultiplyAlpha),Q.pixelStorei(Q.UNPACK_ALIGNMENT,be.unpackAlignment);const xn=Q.getParameter(Q.UNPACK_ROW_LENGTH),tn=Q.getParameter(Q.UNPACK_IMAGE_HEIGHT),Rr=Q.getParameter(Q.UNPACK_SKIP_PIXELS),li=Q.getParameter(Q.UNPACK_SKIP_ROWS),In=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,Et),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,Ut),Q.pixelStorei(Q.UNPACK_SKIP_IMAGES,Ht),Y.isDataTexture||Y.isData3DTexture?Q.texSubImage3D(mt,we,Nt,Sn,Mn,it,yt,ct,Kt,jt,yn.data):be.isCompressedArrayTexture?Q.compressedTexSubImage3D(mt,we,Nt,Sn,Mn,it,yt,ct,Kt,yn.data):Q.texSubImage3D(mt,we,Nt,Sn,Mn,it,yt,ct,Kt,jt,yn),Q.pixelStorei(Q.UNPACK_ROW_LENGTH,xn),Q.pixelStorei(Q.UNPACK_IMAGE_HEIGHT,tn),Q.pixelStorei(Q.UNPACK_SKIP_PIXELS,Rr),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,li),Q.pixelStorei(Q.UNPACK_SKIP_IMAGES,In),we===0&&be.generateMipmaps&&Q.generateMipmap(mt),Je.unbindTexture()},this.initRenderTarget=function(Y){De.get(Y).__webglFramebuffer===void 0&&K.setupRenderTarget(Y)},this.initTexture=function(Y){Y.isCubeTexture?K.setTextureCube(Y,0):Y.isData3DTexture?K.setTexture3D(Y,0):Y.isDataArrayTexture||Y.isCompressedArrayTexture?K.setTexture2DArray(Y,0):K.setTexture2D(Y,0),Je.unbindTexture()},this.resetState=function(){L=0,N=0,D=null,Je.reset(),Ke.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return El}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=e===sM?"display-p3":"srgb",n.unpackColorSpace=Nn.workingColorSpace===gx?"display-p3":"srgb"}}class lM{constructor(e,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new ut(e),this.density=n}clone(){return new lM(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class cM{constructor(e,n=1,r=1e3){this.isFog=!0,this.name="",this.color=new ut(e),this.near=n,this.far=r}clone(){return new cM(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class jR extends mn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new ls,this.environmentIntensity=1,this.environmentRotation=new ls,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}}class up{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=Uy,this.updateRanges=[],this.version=0,this.uuid=Ea()}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;i<s;i++)this.array[e+i]=n.array[r+i];return this}set(e,n=0){return this.array.set(e,n),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ea()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const n=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),r=new this.constructor(n,this.stride);return r.setUsage(this.usage),r}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ea()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const bs=new q;class Fl{constructor(e,n,r,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=n,this.offset=r,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let n=0,r=this.data.count;n<r;n++)bs.fromBufferAttribute(this,n),bs.applyMatrix4(e),this.setXYZ(n,bs.x,bs.y,bs.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)bs.fromBufferAttribute(this,n),bs.applyNormalMatrix(e),this.setXYZ(n,bs.x,bs.y,bs.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)bs.fromBufferAttribute(this,n),bs.transformDirection(e),this.setXYZ(n,bs.x,bs.y,bs.z);return this}getComponent(e,n){let r=this.array[e*this.data.stride+this.offset+n];return this.normalized&&(r=Ms(r,this.array)),r}setComponent(e,n,r){return this.normalized&&(r=cn(r,this.array)),this.data.array[e*this.data.stride+this.offset+n]=r,this}setX(e,n){return this.normalized&&(n=cn(n,this.array)),this.data.array[e*this.data.stride+this.offset]=n,this}setY(e,n){return this.normalized&&(n=cn(n,this.array)),this.data.array[e*this.data.stride+this.offset+1]=n,this}setZ(e,n){return this.normalized&&(n=cn(n,this.array)),this.data.array[e*this.data.stride+this.offset+2]=n,this}setW(e,n){return this.normalized&&(n=cn(n,this.array)),this.data.array[e*this.data.stride+this.offset+3]=n,this}getX(e){let n=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(n=Ms(n,this.array)),n}getY(e){let n=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(n=Ms(n,this.array)),n}getZ(e){let n=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(n=Ms(n,this.array)),n}getW(e){let n=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(n=Ms(n,this.array)),n}setXY(e,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(n=cn(n,this.array),r=cn(r,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=r,this}setXYZ(e,n,r,i){return e=e*this.data.stride+this.offset,this.normalized&&(n=cn(n,this.array),r=cn(r,this.array),i=cn(i,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=r,this.data.array[e+2]=i,this}setXYZW(e,n,r,i,s){return e=e*this.data.stride+this.offset,this.normalized&&(n=cn(n,this.array),r=cn(r,this.array),i=cn(i,this.array),s=cn(s,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=r,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const n=[];for(let r=0;r<this.count;r++){const i=r*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)n.push(this.data.array[i+s])}return new Qt(new this.array.constructor(n),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Fl(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const n=[];for(let r=0;r<this.count;r++){const i=r*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)n.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:n,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class UR extends Gr{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new ut(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let Lm;const T0=new q,Om=new q,Dm=new q,jm=new He,C0=new He,B6=new Rt,d_=new q,P0=new q,f_=new q,UD=new He,RA=new He,FD=new He;class H6 extends mn{constructor(e=new UR){if(super(),this.isSprite=!0,this.type="Sprite",Lm===void 0){Lm=new Yt;const n=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),r=new up(n,5);Lm.setIndex([0,1,2,0,2,3]),Lm.setAttribute("position",new Fl(r,3,0,!1)),Lm.setAttribute("uv",new Fl(r,2,3,!1))}this.geometry=Lm,this.material=e,this.center=new He(.5,.5)}raycast(e,n){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Om.setFromMatrixScale(this.matrixWorld),B6.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Dm.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Om.multiplyScalar(-Dm.z);const r=this.material.rotation;let i,s;r!==0&&(s=Math.cos(r),i=Math.sin(r));const a=this.center;h_(d_.set(-.5,-.5,0),Dm,a,Om,i,s),h_(P0.set(.5,-.5,0),Dm,a,Om,i,s),h_(f_.set(.5,.5,0),Dm,a,Om,i,s),UD.set(0,0),RA.set(1,0),FD.set(1,1);let o=e.ray.intersectTriangle(d_,P0,f_,!1,T0);if(o===null&&(h_(P0.set(-.5,.5,0),Dm,a,Om,i,s),RA.set(0,1),o=e.ray.intersectTriangle(d_,f_,P0,!1,T0),o===null))return;const l=e.ray.origin.distanceTo(T0);l<e.near||l>e.far||n.push({distance:l,point:T0.clone(),uv:Zs.getInterpolation(T0,d_,P0,f_,UD,RA,FD,new He),face:null,object:this})}copy(e,n){return super.copy(e,n),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function h_(t,e,n,r,i,s){jm.subVectors(t,n).addScalar(.5).multiply(r),i!==void 0?(C0.x=s*jm.x-i*jm.y,C0.y=i*jm.x+s*jm.y):C0.copy(jm),t.copy(e),t.x+=C0.x,t.y+=C0.y,t.applyMatrix4(B6)}const p_=new q,zD=new q;class V6 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;r<i;r++){const s=n[r];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,n=0,r=0){n=Math.abs(n);const i=this.levels;let s;for(s=0;s<i.length&&!(n<i[s].distance);s++);return i.splice(s,0,{distance:n,hysteresis:r,object:e}),this.add(e),this}removeLevel(e){const n=this.levels;for(let r=0;r<n.length;r++)if(n[r].distance===e){const i=n.splice(r,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const n=this.levels;if(n.length>0){let r,i;for(r=1,i=n.length;r<i;r++){let s=n[r].distance;if(n[r].object.visible&&(s-=s*n[r].hysteresis),e<s)break}return n[r-1].object}return null}raycast(e,n){if(this.levels.length>0){p_.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(p_);this.getObjectForDistance(i).raycast(e,n)}}update(e){const n=this.levels;if(n.length>1){p_.setFromMatrixPosition(e.matrixWorld),zD.setFromMatrixPosition(this.matrixWorld);const r=p_.distanceTo(zD)/e.zoom;n[0].object.visible=!0;let i,s;for(i=1,s=n.length;i<s;i++){let a=n[i].distance;if(n[i].object.visible&&(a-=a*n[i].hysteresis),r>=a)n[i-1].object.visible=!1,n[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<s;i++)n[i].object.visible=!1}}toJSON(e){const n=super.toJSON(e);this.autoUpdate===!1&&(n.object.autoUpdate=!1),n.object.levels=[];const r=this.levels;for(let i=0,s=r.length;i<s;i++){const a=r[i];n.object.levels.push({object:a.object.uuid,distance:a.distance,hysteresis:a.hysteresis})}return n}}const BD=new q,HD=new On,VD=new On,qye=new q,GD=new Rt,m_=new q,NA=new Hi,WD=new Rt,kA=new lp;class uM extends xr{constructor(e,n){super(e,n),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=YC,this.bindMatrix=new Rt,this.bindMatrixInverse=new Rt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new os),this.boundingBox.makeEmpty();const n=e.getAttribute("position");for(let r=0;r<n.count;r++)this.getVertexPosition(r,m_),this.boundingBox.expandByPoint(m_)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Hi),this.boundingSphere.makeEmpty();const n=e.getAttribute("position");for(let r=0;r<n.count;r++)this.getVertexPosition(r,m_),this.boundingSphere.expandByPoint(m_)}copy(e,n){return super.copy(e,n),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,n){const r=this.material,i=this.matrixWorld;r!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),NA.copy(this.boundingSphere),NA.applyMatrix4(i),e.ray.intersectsSphere(NA)!==!1&&(WD.copy(i).invert(),kA.copy(e.ray).applyMatrix4(WD),!(this.boundingBox!==null&&kA.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,n,kA)))}getVertexPosition(e,n){return super.getVertexPosition(e,n),this.applyBoneTransform(e,n),n}bind(e,n){this.skeleton=e,n===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),n=this.matrixWorld),this.bindMatrix.copy(n),this.bindMatrixInverse.copy(n).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new On,n=this.geometry.attributes.skinWeight;for(let r=0,i=n.count;r<i;r++){e.fromBufferAttribute(n,r);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),n.setXYZW(r,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===YC?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===c6?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,n){const r=this.skeleton,i=this.geometry;HD.fromBufferAttribute(i.attributes.skinIndex,e),VD.fromBufferAttribute(i.attributes.skinWeight,e),BD.copy(n).applyMatrix4(this.bindMatrix),n.set(0,0,0);for(let s=0;s<4;s++){const a=VD.getComponent(s);if(a!==0){const o=HD.getComponent(s);GD.multiplyMatrices(r.bones[o].matrixWorld,r.boneInverses[o]),n.addScaledVector(qye.copy(BD).applyMatrix4(GD),a)}}return n.applyMatrix4(this.bindMatrixInverse)}}class dM extends mn{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Pl extends fr{constructor(e=null,n=1,r=1,i,s,a,o,l,c=ri,d=ri,f,p){super(null,a,o,l,c,d,i,s,f,p),this.isDataTexture=!0,this.image={data:e,width:n,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const $D=new Rt,Kye=new Rt;class Fd{constructor(e=[],n=[]){this.uuid=Ea(),this.bones=e.slice(0),this.boneInverses=n,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,n=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),n.length===0)this.calculateInverses();else if(e.length!==n.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let r=0,i=this.bones.length;r<i;r++)this.boneInverses.push(new Rt)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,n=this.bones.length;e<n;e++){const r=new Rt;this.bones[e]&&r.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(r)}}pose(){for(let e=0,n=this.bones.length;e<n;e++){const r=this.bones[e];r&&r.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,n=this.bones.length;e<n;e++){const r=this.bones[e];r&&(r.parent&&r.parent.isBone?(r.matrix.copy(r.parent.matrixWorld).invert(),r.matrix.multiply(r.matrixWorld)):r.matrix.copy(r.matrixWorld),r.matrix.decompose(r.position,r.quaternion,r.scale))}}update(){const e=this.bones,n=this.boneInverses,r=this.boneMatrices,i=this.boneTexture;for(let s=0,a=e.length;s<a;s++){const o=e[s]?e[s].matrixWorld:Kye;$D.multiplyMatrices(o,n[s]),$D.toArray(r,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Fd(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const n=new Float32Array(e*e*4);n.set(this.boneMatrices);const r=new Pl(n,e,e,ss,ea);return r.needsUpdate=!0,this.boneMatrices=n,this.boneTexture=r,this}getBoneByName(e){for(let n=0,r=this.bones.length;n<r;n++){const i=this.bones[n];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,n){this.uuid=e.uuid;for(let r=0,i=e.bones.length;r<i;r++){const s=e.bones[r];let a=n[s];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),a=new dM),this.bones.push(a),this.boneInverses.push(new Rt().fromArray(e.boneInverses[r]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const n=this.bones,r=this.boneInverses;for(let i=0,s=n.length;i<s;i++){const a=n[i];e.bones.push(a.uuid);const o=r[i];e.boneInverses.push(o.toArray())}return e}}class Kh extends Qt{constructor(e,n,r,i=1){super(e,n,r),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Um=new Rt,XD=new Rt,g_=[],qD=new os,Yye=new Rt,R0=new xr,N0=new Hi;class FR extends xr{constructor(e,n,r){super(e,n),this.isInstancedMesh=!0,this.instanceMatrix=new Kh(new Float32Array(r*16),16),this.instanceColor=null,this.morphTexture=null,this.count=r,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<r;i++)this.setMatrixAt(i,Yye)}computeBoundingBox(){const e=this.geometry,n=this.count;this.boundingBox===null&&(this.boundingBox=new os),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let r=0;r<n;r++)this.getMatrixAt(r,Um),qD.copy(e.boundingBox).applyMatrix4(Um),this.boundingBox.union(qD)}computeBoundingSphere(){const e=this.geometry,n=this.count;this.boundingSphere===null&&(this.boundingSphere=new Hi),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let r=0;r<n;r++)this.getMatrixAt(r,Um),N0.copy(e.boundingSphere).applyMatrix4(Um),this.boundingSphere.union(N0)}copy(e,n){return super.copy(e,n),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,n){n.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,n){n.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,n){const r=n.morphTargetInfluences,i=this.morphTexture.source.data.data,s=r.length+1,a=e*s+1;for(let o=0;o<r.length;o++)r[o]=i[a+o]}raycast(e,n){const r=this.matrixWorld,i=this.count;if(R0.geometry=this.geometry,R0.material=this.material,R0.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),N0.copy(this.boundingSphere),N0.applyMatrix4(r),e.ray.intersectsSphere(N0)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,Um),XD.multiplyMatrices(r,Um),R0.matrixWorld=XD,R0.raycast(e,g_);for(let a=0,o=g_.length;a<o;a++){const l=g_[a];l.instanceId=s,l.object=this,n.push(l)}g_.length=0}}setColorAt(e,n){this.instanceColor===null&&(this.instanceColor=new Kh(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),n.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,n){n.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,n){const r=n.morphTargetInfluences,i=r.length+1;this.morphTexture===null&&(this.morphTexture=new Pl(new Float32Array(i*this.count),i,this.count,tM,ea));const s=this.morphTexture.source.data.data;let a=0;for(let c=0;c<r.length;c++)a+=r[c];const o=this.geometry.morphTargetsRelative?1:1-a,l=i*e;s[l]=o,s.set(r,l+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}function Zye(t,e){return t.z-e.z}function Qye(t,e){return e.z-t.z}class Jye{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,n,r){const i=this.pool,s=this.list;this.index>=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});const a=i[this.index];s.push(a),this.index++,a.start=e.start,a.count=e.count,a.z=n,a.index=r}reset(){this.list.length=0,this.index=0}}const td=new Rt,IA=new Rt,exe=new Rt,txe=new ut(1,1,1),KD=new Rt,LA=new xx,v_=new os,zf=new Hi,k0=new q,YD=new q,nxe=new q,OA=new Jye,ts=new xr,y_=[];function rxe(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;s<i;s++)for(let a=0;a<r;a++)e.setComponent(s+n,a,t.getComponent(s,a))}else e.array.set(t.array,n*r);e.needsUpdate=!0}class G6 extends xr{get maxInstanceCount(){return this._maxInstanceCount}constructor(e,n,r=n*2,i){super(new Yt,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawInfo=[],this._availableInstanceIds=[],this._drawRanges=[],this._reservedRanges=[],this._bounds=[],this._maxInstanceCount=e,this._maxVertexCount=n,this._maxIndexCount=r,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._visibilityChanged=!0,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const n=new Float32Array(e*e*4),r=new Pl(n,e,e,ss,ea);this._matricesTexture=r}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const n=new Uint32Array(e*e),r=new Pl(n,e,e,mx,nu);this._indirectTexture=r}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const n=new Float32Array(e*e*4).fill(1),r=new Pl(n,e,e,ss,ea);r.colorSpace=Nn.workingColorSpace,this._colorsTexture=r}_initializeGeometry(e){const n=this.geometry,r=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in e.attributes){const a=e.getAttribute(s),{array:o,itemSize:l,normalized:c}=a,d=new o.constructor(r*l),f=new Qt(d,l,c);n.setAttribute(s,f)}if(e.getIndex()!==null){const s=r>65535?new Uint32Array(i):new Uint16Array(i);n.setIndex(new Qt(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const n=this.geometry;if(!!e.getIndex()!=!!n.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const r in n.attributes){if(!e.hasAttribute(r))throw new Error(`BatchedMesh: Added geometry missing "${r}". All geometries must have consistent attributes.`);const i=e.getAttribute(r),s=n.getAttribute(r);if(i.itemSize!==s.itemSize||i.normalized!==s.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new os);const e=this.boundingBox,n=this._drawInfo;e.makeEmpty();for(let r=0,i=n.length;r<i;r++){if(n[r].active===!1)continue;const s=n[r].geometryIndex;this.getMatrixAt(r,td),this.getBoundingBoxAt(s,v_).applyMatrix4(td),e.union(v_)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Hi);const e=this.boundingSphere,n=this._drawInfo;e.makeEmpty();for(let r=0,i=n.length;r<i;r++){if(n[r].active===!1)continue;const s=n[r].geometryIndex;this.getMatrixAt(r,td),this.getBoundingSphereAt(s,zf).applyMatrix4(td),e.union(zf)}}addInstance(e){if(this._drawInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("BatchedMesh: Maximum item count reached.");const r={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(i=this._availableInstanceIds.pop(),this._drawInfo[i]=r):(i=this._drawInfo.length,this._drawInfo.push(r));const s=this._matricesTexture,a=s.image.data;exe.toArray(a,i*16),s.needsUpdate=!0;const o=this._colorsTexture;return o&&(txe.toArray(o.image.data,i*4),o.needsUpdate=!0),i}addGeometry(e,n=-1,r=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const a=this._reservedRanges,o=this._drawRanges,l=this._bounds;this._geometryCount!==0&&(s=a[a.length-1]),n===-1?i.vertexCount=e.getAttribute("position").count:i.vertexCount=n,s===null?i.vertexStart=0:i.vertexStart=s.vertexStart+s.vertexCount;const c=e.getIndex(),d=c!==null;if(d&&(r===-1?i.indexCount=c.count:i.indexCount=r,s===null?i.indexStart=0:i.indexStart=s.indexStart+s.indexCount),i.indexStart!==-1&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const f=this._geometryCount;return this._geometryCount++,a.push(i),o.push({start:d?i.indexStart:i.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new os,sphereInitialized:!1,sphere:new Hi}),this.setGeometryAt(f,e),f}setGeometryAt(e,n){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(n);const r=this.geometry,i=r.getIndex()!==null,s=r.getIndex(),a=n.getIndex(),o=this._reservedRanges[e];if(i&&a.count>o.indexCount||n.attributes.position.count>o.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=o.vertexStart,c=o.vertexCount;for(const y in r.attributes){const x=n.getAttribute(y),S=r.getAttribute(y);rxe(x,S,l);const w=x.itemSize;for(let b=x.count,M=c;b<M;b++){const T=l+b;for(let C=0;C<w;C++)S.setComponent(T,C,0)}S.needsUpdate=!0,S.addUpdateRange(l*w,c*w)}if(i){const y=o.indexStart;for(let x=0;x<a.count;x++)s.setX(y+x,l+a.getX(x));for(let x=a.count,S=o.indexCount;x<S;x++)s.setX(y+x,l);s.needsUpdate=!0,s.addUpdateRange(y,o.indexCount)}const d=this._bounds[e];n.boundingBox!==null?(d.box.copy(n.boundingBox),d.boxInitialized=!0):d.boxInitialized=!1,n.boundingSphere!==null?(d.sphere.copy(n.boundingSphere),d.sphereInitialized=!0):d.sphereInitialized=!1;const f=this._drawRanges[e],p=n.getAttribute("position");return f.count=i?a.count:p.count,this._visibilityChanged=!0,e}deleteInstance(e){const n=this._drawInfo;return e>=n.length||n[e].active===!1?this:(n[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this)}getBoundingBoxAt(e,n){if(e>=this._geometryCount)return null;const r=this._bounds[e],i=r.box,s=this.geometry;if(r.boxInitialized===!1){i.makeEmpty();const a=s.index,o=s.attributes.position,l=this._drawRanges[e];for(let c=l.start,d=l.start+l.count;c<d;c++){let f=c;a&&(f=a.getX(f)),i.expandByPoint(k0.fromBufferAttribute(o,f))}r.boxInitialized=!0}return n.copy(i),n}getBoundingSphereAt(e,n){if(e>=this._geometryCount)return null;const r=this._bounds[e],i=r.sphere,s=this.geometry;if(r.sphereInitialized===!1){i.makeEmpty(),this.getBoundingBoxAt(e,v_),v_.getCenter(i.center);const a=s.index,o=s.attributes.position,l=this._drawRanges[e];let c=0;for(let d=l.start,f=l.start+l.count;d<f;d++){let p=d;a&&(p=a.getX(p)),k0.fromBufferAttribute(o,p),c=Math.max(c,i.center.distanceToSquared(k0))}i.radius=Math.sqrt(c),r.sphereInitialized=!0}return n.copy(i),n}setMatrixAt(e,n){const r=this._drawInfo,i=this._matricesTexture,s=this._matricesTexture.image.data;return e>=r.length||r[e].active===!1?this:(n.toArray(s,e*16),i.needsUpdate=!0,this)}getMatrixAt(e,n){const r=this._drawInfo,i=this._matricesTexture.image.data;return e>=r.length||r[e].active===!1?null:n.fromArray(i,e*16)}setColorAt(e,n){this._colorsTexture===null&&this._initColorsTexture();const r=this._colorsTexture,i=this._colorsTexture.image.data,s=this._drawInfo;return e>=s.length||s[e].active===!1?this:(n.toArray(i,e*4),r.needsUpdate=!0,this)}getColorAt(e,n){const r=this._colorsTexture.image.data,i=this._drawInfo;return e>=i.length||i[e].active===!1?null:n.fromArray(r,e*4)}setVisibleAt(e,n){const r=this._drawInfo;return e>=r.length||r[e].active===!1||r[e].visible===n?this:(r[e].visible=n,this._visibilityChanged=!0,this)}getVisibleAt(e){const n=this._drawInfo;return e>=n.length||n[e].active===!1?!1:n[e].visible}setGeometryIdAt(e,n){const r=this._drawInfo;return e>=r.length||r[e].active===!1||n<0||n>=this._geometryCount?null:(r[e].geometryIndex=n,this)}getGeometryIdAt(e){const n=this._drawInfo;return e>=n.length||n[e].active===!1?-1:n[e].geometryIndex}getGeometryRangeAt(e,n={}){if(e<0||e>=this._geometryCount)return null;const r=this._drawRanges[e];return n.start=r.start,n.count=r.count,n}raycast(e,n){const r=this._drawInfo,i=this._drawRanges,s=this.matrixWorld,a=this.geometry;ts.material=this.material,ts.geometry.index=a.index,ts.geometry.attributes=a.attributes,ts.geometry.boundingBox===null&&(ts.geometry.boundingBox=new os),ts.geometry.boundingSphere===null&&(ts.geometry.boundingSphere=new Hi);for(let o=0,l=r.length;o<l;o++){if(!r[o].visible||!r[o].active)continue;const c=r[o].geometryIndex,d=i[c];ts.geometry.setDrawRange(d.start,d.count),this.getMatrixAt(o,ts.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,ts.geometry.boundingBox),this.getBoundingSphereAt(c,ts.geometry.boundingSphere),ts.raycast(e,y_);for(let f=0,p=y_.length;f<p;f++){const y=y_[f];y.object=this,y.batchId=o,n.push(y)}y_.length=0}ts.material=null,ts.geometry.index=null,ts.geometry.attributes={},ts.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._drawRanges=e._drawRanges.map(n=>({...n})),this._reservedRanges=e._reservedRanges.map(n=>({...n})),this._drawInfo=e._drawInfo.map(n=>({...n})),this._bounds=e._bounds.map(n=>({boxInitialized:n.boxInitialized,box:n.box.clone(),sphereInitialized:n.sphereInitialized,sphere:n.sphere.clone()})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,n,r,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const a=i.getIndex(),o=a===null?1:a.array.BYTES_PER_ELEMENT,l=this._drawInfo,c=this._multiDrawStarts,d=this._multiDrawCounts,f=this._drawRanges,p=this.perObjectFrustumCulled,y=this._indirectTexture,x=y.image.data;p&&(KD.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),LA.setFromProjectionMatrix(KD,e.coordinateSystem));let S=0;if(this.sortObjects){IA.copy(this.matrixWorld).invert(),k0.setFromMatrixPosition(r.matrixWorld).applyMatrix4(IA),YD.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(IA);for(let M=0,T=l.length;M<T;M++)if(l[M].visible&&l[M].active){const C=l[M].geometryIndex;this.getMatrixAt(M,td),this.getBoundingSphereAt(C,zf).applyMatrix4(td);let L=!1;if(p&&(L=!LA.intersectsSphere(zf)),!L){const N=nxe.subVectors(zf.center,k0).dot(YD);OA.push(f[C],N,M)}}const w=OA.list,b=this.customSort;b===null?w.sort(s.transparent?Qye:Zye):b.call(this,w,r);for(let M=0,T=w.length;M<T;M++){const C=w[M];c[S]=C.start*o,d[S]=C.count,x[S]=C.index,S++}OA.reset()}else for(let w=0,b=l.length;w<b;w++)if(l[w].visible&&l[w].active){const M=l[w].geometryIndex;let T=!1;if(p&&(this.getMatrixAt(w,td),this.getBoundingSphereAt(M,zf).applyMatrix4(td),T=!LA.intersectsSphere(zf)),!T){const C=f[M];c[S]=C.start*o,d[S]=C.count,x[S]=w,S++}}y.needsUpdate=!0,this._multiDrawCount=S,this._visibilityChanged=!1}onBeforeShadow(e,n,r,i,s,a){this.onBeforeRender(e,null,i,s,a)}}class $r extends Gr{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new ut(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Gw=new q,Ww=new q,ZD=new Rt,I0=new lp,x_=new Hi,DA=new q,QD=new q;class zl extends mn{constructor(e=new Yt,n=new $r){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=n,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,r=[0];for(let i=1,s=n.count;i<s;i++)Gw.fromBufferAttribute(n,i-1),Ww.fromBufferAttribute(n,i),r[i]=r[i-1],r[i]+=Gw.distanceTo(Ww);e.setAttribute("lineDistance",new Ot(r,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,n){const r=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,a=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),x_.copy(r.boundingSphere),x_.applyMatrix4(i),x_.radius+=s,e.ray.intersectsSphere(x_)===!1)return;ZD.copy(i).invert(),I0.copy(e.ray).applyMatrix4(ZD);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,d=r.index,p=r.attributes.position;if(d!==null){const y=Math.max(0,a.start),x=Math.min(d.count,a.start+a.count);for(let S=y,w=x-1;S<w;S+=c){const b=d.getX(S),M=d.getX(S+1),T=b_(this,e,I0,l,b,M);T&&n.push(T)}if(this.isLineLoop){const S=d.getX(x-1),w=d.getX(y),b=b_(this,e,I0,l,S,w);b&&n.push(b)}}else{const y=Math.max(0,a.start),x=Math.min(p.count,a.start+a.count);for(let S=y,w=x-1;S<w;S+=c){const b=b_(this,e,I0,l,S,S+1);b&&n.push(b)}if(this.isLineLoop){const S=b_(this,e,I0,l,x-1,y);S&&n.push(S)}}}updateMorphTargets(){const n=this.geometry.morphAttributes,r=Object.keys(n);if(r.length>0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function b_(t,e,n,r,i,s){const a=t.geometry.attributes.position;if(Gw.fromBufferAttribute(a,i),Ww.fromBufferAttribute(a,s),n.distanceSqToSegment(Gw,Ww,DA,QD)>r)return;DA.applyMatrix4(t.matrixWorld);const l=e.ray.origin.distanceTo(DA);if(!(l<e.near||l>e.far))return{distance:l,point:QD.clone().applyMatrix4(t.matrixWorld),index:i,face:null,faceIndex:null,barycoord:null,object:t}}const JD=new q,ej=new q;class na 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;i<s;i+=2)JD.fromBufferAttribute(n,i),ej.fromBufferAttribute(n,i+1),r[i]=i===0?0:r[i-1],r[i+1]=r[i]+JD.distanceTo(ej);e.setAttribute("lineDistance",new Ot(r,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class zR extends zl{constructor(e,n){super(e,n),this.isLineLoop=!0,this.type="LineLoop"}}class fM extends Gr{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new ut(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const tj=new Rt,nP=new lp,__=new Hi,w_=new q;class BR extends mn{constructor(e=new Yt,n=new fM){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=n,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,n){const r=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,a=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),__.copy(r.boundingSphere),__.applyMatrix4(i),__.radius+=s,e.ray.intersectsSphere(__)===!1)return;tj.copy(i).invert(),nP.copy(e.ray).applyMatrix4(tj);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=r.index,f=r.attributes.position;if(c!==null){const p=Math.max(0,a.start),y=Math.min(c.count,a.start+a.count);for(let x=p,S=y;x<S;x++){const w=c.getX(x);w_.fromBufferAttribute(f,w),nj(w_,w,l,i,e,n,this)}}else{const p=Math.max(0,a.start),y=Math.min(f.count,a.start+a.count);for(let x=p,S=y;x<S;x++)w_.fromBufferAttribute(f,x),nj(w_,x,l,i,e,n,this)}}updateMorphTargets(){const n=this.geometry.morphAttributes,r=Object.keys(n);if(r.length>0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function nj(t,e,n,r,i,s,a){const o=nP.distanceSqToPoint(t);if(o<n){const l=new q;nP.closestPointToPoint(t,l),l.applyMatrix4(r);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class ixe extends fr{constructor(e,n,r,i,s,a,o,l,c){super(e,n,r,i,s,a,o,l,c),this.isVideoTexture=!0,this.minFilter=a!==void 0?a:Pr,this.magFilter=s!==void 0?s:Pr,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 sxe extends fr{constructor(e,n){super({width:e,height:n}),this.isFramebufferTexture=!0,this.magFilter=ri,this.minFilter=ri,this.generateMipmaps=!1,this.needsUpdate=!0}}class hM extends fr{constructor(e,n,r,i,s,a,o,l,c,d,f,p){super(null,a,o,l,c,d,i,s,f,p),this.isCompressedTexture=!0,this.image={width:n,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class axe extends hM{constructor(e,n,r,i,s,a){super(e,n,r,s,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Sa,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class oxe extends hM{constructor(e,n,r){super(void 0,e[0].width,e[0].height,n,r,tu),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class lxe extends fr{constructor(e,n,r,i,s,a,o,l,c){super(e,n,r,i,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class qo{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,n){const r=this.getUtoTmapping(e);return this.getPoint(r,n)}getPoints(e=5){const n=[];for(let r=0;r<=e;r++)n.push(this.getPoint(r/e));return n}getSpacedPoints(e=5){const n=[];for(let r=0;r<=e;r++)n.push(this.getPointAt(r/e));return n}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const n=[];let r,i=this.getPoint(0),s=0;n.push(0);for(let a=1;a<=e;a++)r=this.getPoint(a/e),s+=r.distanceTo(i),n.push(s),i=r;return this.cacheArcLengths=n,n}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,n){const r=this.getLengths();let i=0;const s=r.length;let a;n?a=n:a=e*r[s-1];let o=0,l=s-1,c;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),c=r[i]-a,c<0)o=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===a)return i/(s-1);const d=r[i],p=r[i+1]-d,y=(a-d)/p;return(i+y)/(s-1)}getTangent(e,n){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const a=this.getPoint(i),o=this.getPoint(s),l=n||(a.isVector2?new He:new q);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,n){const r=this.getUtoTmapping(e);return this.getTangent(r,n)}computeFrenetFrames(e,n){const r=new q,i=[],s=[],a=[],o=new q,l=new Rt;for(let y=0;y<=e;y++){const x=y/e;i[y]=this.getTangentAt(x,new q)}s[0]=new q,a[0]=new q;let c=Number.MAX_VALUE;const d=Math.abs(i[0].x),f=Math.abs(i[0].y),p=Math.abs(i[0].z);d<=c&&(c=d,r.set(1,0,0)),f<=c&&(c=f,r.set(0,1,0)),p<=c&&r.set(0,0,1),o.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],o),a[0].crossVectors(i[0],s[0]);for(let y=1;y<=e;y++){if(s[y]=s[y-1].clone(),a[y]=a[y-1].clone(),o.crossVectors(i[y-1],i[y]),o.length()>Number.EPSILON){o.normalize();const x=Math.acos(Tr(i[y-1].dot(i[y]),-1,1));s[y].applyMatrix4(l.makeRotationAxis(o,x))}a[y].crossVectors(i[y],s[y])}if(n===!0){let y=Math.acos(Tr(s[0].dot(s[e]),-1,1));y/=e,i[0].dot(o.crossVectors(s[0],s[e]))>0&&(y=-y);for(let x=1;x<=e;x++)s[x].applyMatrix4(l.makeRotationAxis(i[x],y*x)),a[x].crossVectors(i[x],s[x])}return{tangents:i,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class pM extends qo{constructor(e=0,n=0,r=1,i=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=n,this.xRadius=r,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,n=new He){const r=n,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(a?s=0:s=i),this.aClockwise===!0&&!a&&(s===i?s=-i:s=s-i);const o=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const d=Math.cos(this.aRotation),f=Math.sin(this.aRotation),p=l-this.aX,y=c-this.aY;l=p*d-y*f+this.aX,c=p*f+y*d+this.aY}return r.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class W6 extends pM{constructor(e,n,r,i,s,a){super(e,n,r,r,i,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function HR(){let t=0,e=0,n=0,r=0;function i(s,a,o,l){t=s,e=o,n=-3*s+3*a-2*o-l,r=2*s-2*a+o+l}return{initCatmullRom:function(s,a,o,l,c){i(a,o,c*(o-s),c*(l-a))},initNonuniformCatmullRom:function(s,a,o,l,c,d,f){let p=(a-s)/c-(o-s)/(c+d)+(o-a)/d,y=(o-a)/d-(l-a)/(d+f)+(l-o)/f;p*=d,y*=d,i(a,o,p,y)},calc:function(s){const a=s*s,o=a*s;return t+e*s+n*a+r*o}}}const S_=new q,jA=new HR,UA=new HR,FA=new HR;class $6 extends qo{constructor(e=[],n=!1,r="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=n,this.curveType=r,this.tension=i}getPoint(e,n=new q){const r=n,i=this.points,s=i.length,a=(s-(this.closed?0:1))*e;let o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,d;this.closed||o>0?c=i[(o-1)%s]:(S_.subVectors(i[0],i[1]).add(i[0]),c=S_);const f=i[o%s],p=i[(o+1)%s];if(this.closed||o+2<s?d=i[(o+2)%s]:(S_.subVectors(i[s-1],i[s-2]).add(i[s-1]),d=S_),this.curveType==="centripetal"||this.curveType==="chordal"){const y=this.curveType==="chordal"?.5:.25;let x=Math.pow(c.distanceToSquared(f),y),S=Math.pow(f.distanceToSquared(p),y),w=Math.pow(p.distanceToSquared(d),y);S<1e-4&&(S=1),x<1e-4&&(x=S),w<1e-4&&(w=S),jA.initNonuniformCatmullRom(c.x,f.x,p.x,d.x,x,S,w),UA.initNonuniformCatmullRom(c.y,f.y,p.y,d.y,x,S,w),FA.initNonuniformCatmullRom(c.z,f.z,p.z,d.z,x,S,w)}else this.curveType==="catmullrom"&&(jA.initCatmullRom(c.x,f.x,p.x,d.x,this.tension),UA.initCatmullRom(c.y,f.y,p.y,d.y,this.tension),FA.initCatmullRom(c.z,f.z,p.z,d.z,this.tension));return r.set(jA.calc(l),UA.calc(l),FA.calc(l)),r}copy(e){super.copy(e),this.points=[];for(let n=0,r=e.points.length;n<r;n++){const i=e.points[n];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let n=0,r=this.points.length;n<r;n++){const i=this.points[n];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let n=0,r=e.points.length;n<r;n++){const i=e.points[n];this.points.push(new q().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function rj(t,e,n,r,i){const s=(r-e)*.5,a=(i-n)*.5,o=t*t,l=t*o;return(2*n-2*r+s+a)*l+(-3*n+3*r-2*s-a)*o+s*t+n}function cxe(t,e){const n=1-t;return n*n*e}function uxe(t,e){return 2*(1-t)*t*e}function dxe(t,e){return t*t*e}function cy(t,e,n,r){return cxe(t,e)+uxe(t,n)+dxe(t,r)}function fxe(t,e){const n=1-t;return n*n*n*e}function hxe(t,e){const n=1-t;return 3*n*n*t*e}function pxe(t,e){return 3*(1-t)*t*t*e}function mxe(t,e){return t*t*t*e}function uy(t,e,n,r,i){return fxe(t,e)+hxe(t,n)+pxe(t,r)+mxe(t,i)}class VR extends qo{constructor(e=new He,n=new He,r=new He,i=new He){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=n,this.v2=r,this.v3=i}getPoint(e,n=new He){const r=n,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return r.set(uy(e,i.x,s.x,a.x,o.x),uy(e,i.y,s.y,a.y,o.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class X6 extends qo{constructor(e=new q,n=new q,r=new q,i=new q){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=n,this.v2=r,this.v3=i}getPoint(e,n=new q){const r=n,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return r.set(uy(e,i.x,s.x,a.x,o.x),uy(e,i.y,s.y,a.y,o.y),uy(e,i.z,s.z,a.z,o.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class GR extends qo{constructor(e=new He,n=new He){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=n}getPoint(e,n=new He){const r=n;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,n){return this.getPoint(e,n)}getTangent(e,n=new He){return n.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,n){return this.getTangent(e,n)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class q6 extends qo{constructor(e=new q,n=new q){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=n}getPoint(e,n=new q){const r=n;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,n){return this.getPoint(e,n)}getTangent(e,n=new q){return n.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,n){return this.getTangent(e,n)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class WR extends qo{constructor(e=new He,n=new He,r=new He){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=n,this.v2=r}getPoint(e,n=new He){const r=n,i=this.v0,s=this.v1,a=this.v2;return r.set(cy(e,i.x,s.x,a.x),cy(e,i.y,s.y,a.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class $R extends qo{constructor(e=new q,n=new q,r=new q){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=n,this.v2=r}getPoint(e,n=new q){const r=n,i=this.v0,s=this.v1,a=this.v2;return r.set(cy(e,i.x,s.x,a.x),cy(e,i.y,s.y,a.y),cy(e,i.z,s.z,a.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class XR extends qo{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,n=new He){const r=n,i=this.points,s=(i.length-1)*e,a=Math.floor(s),o=s-a,l=i[a===0?a:a-1],c=i[a],d=i[a>i.length-2?i.length-1:a+1],f=i[a>i.length-3?i.length-1:a+2];return r.set(rj(o,l.x,c.x,d.x,f.x),rj(o,l.y,c.y,d.y,f.y)),r}copy(e){super.copy(e),this.points=[];for(let n=0,r=e.points.length;n<r;n++){const i=e.points[n];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let n=0,r=this.points.length;n<r;n++){const i=this.points[n];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let n=0,r=e.points.length;n<r;n++){const i=e.points[n];this.points.push(new He().fromArray(i))}return this}}var $w=Object.freeze({__proto__:null,ArcCurve:W6,CatmullRomCurve3:$6,CubicBezierCurve:VR,CubicBezierCurve3:X6,EllipseCurve:pM,LineCurve:GR,LineCurve3:q6,QuadraticBezierCurve:WR,QuadraticBezierCurve3:$R,SplineCurve:XR});class K6 extends qo{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),n=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(n)){const r=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new $w[r](n,e))}return this}getPoint(e,n){const r=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=r){const a=i[s]-r,o=this.curves[s],l=o.getLength(),c=l===0?0:1-a/l;return o.getPointAt(c,n)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let n=0;for(let r=0,i=this.curves.length;r<i;r++)n+=this.curves[r].getLength(),e.push(n);return this.cacheLengths=e,e}getSpacedPoints(e=40){const n=[];for(let r=0;r<=e;r++)n.push(this.getPoint(r/e));return this.autoClose&&n.push(n[0]),n}getPoints(e=12){const n=[];let r;for(let i=0,s=this.curves;i<s.length;i++){const a=s[i],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,l=a.getPoints(o);for(let c=0;c<l.length;c++){const d=l[c];r&&r.equals(d)||(n.push(d),r=d)}}return this.autoClose&&n.length>1&&!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;n<r;n++){const i=e.curves[n];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let n=0,r=this.curves.length;n<r;n++){const i=this.curves[n];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let n=0,r=e.curves.length;n<r;n++){const i=e.curves[n];this.curves.push(new $w[i.type]().fromJSON(i))}return this}}class By extends K6{constructor(e){super(),this.type="Path",this.currentPoint=new He,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let n=1,r=e.length;n<r;n++)this.lineTo(e[n].x,e[n].y);return this}moveTo(e,n){return this.currentPoint.set(e,n),this}lineTo(e,n){const r=new GR(this.currentPoint.clone(),new He(e,n));return this.curves.push(r),this.currentPoint.set(e,n),this}quadraticCurveTo(e,n,r,i){const s=new WR(this.currentPoint.clone(),new He(e,n),new He(r,i));return this.curves.push(s),this.currentPoint.set(r,i),this}bezierCurveTo(e,n,r,i,s,a){const o=new VR(this.currentPoint.clone(),new He(e,n),new He(r,i),new He(s,a));return this.curves.push(o),this.currentPoint.set(s,a),this}splineThru(e){const n=[this.currentPoint.clone()].concat(e),r=new XR(n);return this.curves.push(r),this.currentPoint.copy(e[e.length-1]),this}arc(e,n,r,i,s,a){const o=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+o,n+l,r,i,s,a),this}absarc(e,n,r,i,s,a){return this.absellipse(e,n,r,r,i,s,a),this}ellipse(e,n,r,i,s,a,o,l){const c=this.currentPoint.x,d=this.currentPoint.y;return this.absellipse(e+c,n+d,r,i,s,a,o,l),this}absellipse(e,n,r,i,s,a,o,l){const c=new pM(e,n,r,i,s,a,o,l);if(this.curves.length>0){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 bx extends Yt{constructor(e=[new He(0,-.5),new He(.5,0),new He(0,.5)],n=12,r=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:n,phiStart:r,phiLength:i},n=Math.floor(n),i=Tr(i,0,Math.PI*2);const s=[],a=[],o=[],l=[],c=[],d=1/n,f=new q,p=new He,y=new q,x=new q,S=new q;let w=0,b=0;for(let M=0;M<=e.length-1;M++)switch(M){case 0:w=e[M+1].x-e[M].x,b=e[M+1].y-e[M].y,y.x=b*1,y.y=-w,y.z=b*0,S.copy(y),y.normalize(),l.push(y.x,y.y,y.z);break;case e.length-1:l.push(S.x,S.y,S.z);break;default:w=e[M+1].x-e[M].x,b=e[M+1].y-e[M].y,y.x=b*1,y.y=-w,y.z=b*0,x.copy(y),y.x+=S.x,y.y+=S.y,y.z+=S.z,y.normalize(),l.push(y.x,y.y,y.z),S.copy(x)}for(let M=0;M<=n;M++){const T=r+M*d*i,C=Math.sin(T),L=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*L,a.push(f.x,f.y,f.z),p.x=M/n,p.y=N/(e.length-1),o.push(p.x,p.y);const D=l[3*N+0]*C,F=l[3*N+1],V=l[3*N+0]*L;c.push(D,F,V)}}for(let M=0;M<n;M++)for(let T=0;T<e.length-1;T++){const C=T+M*e.length,L=C,N=C+e.length,D=C+e.length+1,F=C+1;s.push(L,N,F),s.push(D,F,N)}this.setIndex(s),this.setAttribute("position",new Ot(a,3)),this.setAttribute("uv",new Ot(o,2)),this.setAttribute("normal",new Ot(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new bx(e.points,e.segments,e.phiStart,e.phiLength)}}class mM extends bx{constructor(e=1,n=1,r=4,i=8){const s=new By;s.absarc(0,-n/2,e,Math.PI*1.5,0),s.absarc(0,n/2,e,0,Math.PI*.5),super(s.getPoints(r),i),this.type="CapsuleGeometry",this.parameters={radius:e,length:n,capSegments:r,radialSegments:i}}static fromJSON(e){return new mM(e.radius,e.length,e.capSegments,e.radialSegments)}}class gM extends Yt{constructor(e=1,n=32,r=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:n,thetaStart:r,thetaLength:i},n=Math.max(3,n);const s=[],a=[],o=[],l=[],c=new q,d=new He;a.push(0,0,0),o.push(0,0,1),l.push(.5,.5);for(let f=0,p=3;f<=n;f++,p+=3){const y=r+f/n*i;c.x=e*Math.cos(y),c.y=e*Math.sin(y),a.push(c.x,c.y,c.z),o.push(0,0,1),d.x=(a[p]/e+1)/2,d.y=(a[p+1]/e+1)/2,l.push(d.x,d.y)}for(let f=1;f<=n;f++)s.push(f,f+1,0);this.setIndex(s),this.setAttribute("position",new Ot(a,3)),this.setAttribute("normal",new Ot(o,3)),this.setAttribute("uv",new Ot(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new gM(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class dv extends Yt{constructor(e=1,n=1,r=1,i=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:n,height:r,radialSegments:i,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;i=Math.floor(i),s=Math.floor(s);const d=[],f=[],p=[],y=[];let x=0;const S=[],w=r/2;let b=0;M(),a===!1&&(e>0&&T(!0),n>0&&T(!1)),this.setIndex(d),this.setAttribute("position",new Ot(f,3)),this.setAttribute("normal",new Ot(p,3)),this.setAttribute("uv",new Ot(y,2));function M(){const C=new q,L=new q;let N=0;const D=(n-e)/r;for(let F=0;F<=s;F++){const V=[],I=F/s,U=I*(n-e)+e;for(let X=0;X<=i;X++){const te=X/i,re=te*l+o,pe=Math.sin(re),ee=Math.cos(re);L.x=U*pe,L.y=-I*r+w,L.z=U*ee,f.push(L.x,L.y,L.z),C.set(pe,D,ee).normalize(),p.push(C.x,C.y,C.z),y.push(te,1-I),V.push(x++)}S.push(V)}for(let F=0;F<i;F++)for(let V=0;V<s;V++){const I=S[V][F],U=S[V+1][F],X=S[V+1][F+1],te=S[V][F+1];e>0&&(d.push(I,U,te),N+=3),n>0&&(d.push(U,X,te),N+=3)}c.addGroup(b,N,0),b+=N}function T(C){const L=x,N=new He,D=new q;let F=0;const V=C===!0?e:n,I=C===!0?1:-1;for(let X=1;X<=i;X++)f.push(0,w*I,0),p.push(0,I,0),y.push(.5,.5),x++;const U=x;for(let X=0;X<=i;X++){const re=X/i*l+o,pe=Math.cos(re),ee=Math.sin(re);D.x=V*ee,D.y=w*I,D.z=V*pe,f.push(D.x,D.y,D.z),p.push(0,I,0),N.x=pe*.5+.5,N.y=ee*.5*I+.5,y.push(N.x,N.y),x++}for(let X=0;X<i;X++){const te=L+X,re=U+X;C===!0?d.push(re,re+1,te):d.push(re+1,re,te),F+=3}c.addGroup(b,F,C===!0?1:2),b+=F}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new dv(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class vM extends dv{constructor(e=1,n=1,r=32,i=1,s=!1,a=0,o=Math.PI*2){super(0,e,n,r,i,s,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:n,radialSegments:r,heightSegments:i,openEnded:s,thetaStart:a,thetaLength:o}}static fromJSON(e){return new vM(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class zd extends Yt{constructor(e=[],n=[],r=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:n,radius:r,detail:i};const s=[],a=[];o(i),c(r),d(),this.setAttribute("position",new Ot(s,3)),this.setAttribute("normal",new Ot(s.slice(),3)),this.setAttribute("uv",new Ot(a,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function o(M){const T=new q,C=new q,L=new q;for(let N=0;N<n.length;N+=3)y(n[N+0],T),y(n[N+1],C),y(n[N+2],L),l(T,C,L,M)}function l(M,T,C,L){const N=L+1,D=[];for(let F=0;F<=N;F++){D[F]=[];const V=M.clone().lerp(C,F/N),I=T.clone().lerp(C,F/N),U=N-F;for(let X=0;X<=U;X++)X===0&&F===N?D[F][X]=V:D[F][X]=V.clone().lerp(I,X/U)}for(let F=0;F<N;F++)for(let V=0;V<2*(N-F)-1;V++){const I=Math.floor(V/2);V%2===0?(p(D[F][I+1]),p(D[F+1][I]),p(D[F][I])):(p(D[F][I+1]),p(D[F+1][I+1]),p(D[F+1][I]))}}function c(M){const T=new q;for(let C=0;C<s.length;C+=3)T.x=s[C+0],T.y=s[C+1],T.z=s[C+2],T.normalize().multiplyScalar(M),s[C+0]=T.x,s[C+1]=T.y,s[C+2]=T.z}function d(){const M=new q;for(let T=0;T<s.length;T+=3){M.x=s[T+0],M.y=s[T+1],M.z=s[T+2];const C=w(M)/2/Math.PI+.5,L=b(M)/Math.PI+.5;a.push(C,1-L)}x(),f()}function f(){for(let M=0;M<a.length;M+=6){const T=a[M+0],C=a[M+2],L=a[M+4],N=Math.max(T,C,L),D=Math.min(T,C,L);N>.9&&D<.1&&(T<.2&&(a[M+0]+=1),C<.2&&(a[M+2]+=1),L<.2&&(a[M+4]+=1))}}function p(M){s.push(M.x,M.y,M.z)}function y(M,T){const C=M*3;T.x=e[C+0],T.y=e[C+1],T.z=e[C+2]}function x(){const M=new q,T=new q,C=new q,L=new q,N=new He,D=new He,F=new He;for(let V=0,I=0;V<s.length;V+=9,I+=6){M.set(s[V+0],s[V+1],s[V+2]),T.set(s[V+3],s[V+4],s[V+5]),C.set(s[V+6],s[V+7],s[V+8]),N.set(a[I+0],a[I+1]),D.set(a[I+2],a[I+3]),F.set(a[I+4],a[I+5]),L.copy(M).add(T).add(C).divideScalar(3);const U=w(L);S(N,I+0,M,U),S(D,I+2,T,U),S(F,I+4,C,U)}}function S(M,T,C,L){L<0&&M.x===1&&(a[T]=M.x-1),C.x===0&&C.z===0&&(a[T]=L/2/Math.PI+.5)}function w(M){return Math.atan2(M.z,-M.x)}function b(M){return Math.atan2(-M.y,Math.sqrt(M.x*M.x+M.z*M.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new zd(e.vertices,e.indices,e.radius,e.details)}}class yM extends zd{constructor(e=1,n=0){const r=(1+Math.sqrt(5))/2,i=1/r,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-r,0,-i,r,0,i,-r,0,i,r,-i,-r,0,-i,r,0,i,-r,0,i,r,0,-r,0,-i,r,0,-i,-r,0,i,r,0,i],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,a,e,n),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:n}}static fromJSON(e){return new yM(e.radius,e.detail)}}const M_=new q,E_=new q,zA=new q,A_=new Zs;class Y6 extends Yt{constructor(e=null,n=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:n},e!==null){const i=Math.pow(10,4),s=Math.cos(Lh*n),a=e.getIndex(),o=e.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],d=["a","b","c"],f=new Array(3),p={},y=[];for(let x=0;x<l;x+=3){a?(c[0]=a.getX(x),c[1]=a.getX(x+1),c[2]=a.getX(x+2)):(c[0]=x,c[1]=x+1,c[2]=x+2);const{a:S,b:w,c:b}=A_;if(S.fromBufferAttribute(o,c[0]),w.fromBufferAttribute(o,c[1]),b.fromBufferAttribute(o,c[2]),A_.getNormal(zA),f[0]=`${Math.round(S.x*i)},${Math.round(S.y*i)},${Math.round(S.z*i)}`,f[1]=`${Math.round(w.x*i)},${Math.round(w.y*i)},${Math.round(w.z*i)}`,f[2]=`${Math.round(b.x*i)},${Math.round(b.y*i)},${Math.round(b.z*i)}`,!(f[0]===f[1]||f[1]===f[2]||f[2]===f[0]))for(let M=0;M<3;M++){const T=(M+1)%3,C=f[M],L=f[T],N=A_[d[M]],D=A_[d[T]],F=`${C}_${L}`,V=`${L}_${C}`;V in p&&p[V]?(zA.dot(p[V].normal)<=s&&(y.push(N.x,N.y,N.z),y.push(D.x,D.y,D.z)),p[V]=null):F in p||(p[F]={index0:c[M],index1:c[T],normal:zA.clone()})}}for(const x in p)if(p[x]){const{index0:S,index1:w}=p[x];M_.fromBufferAttribute(o,S),E_.fromBufferAttribute(o,w),y.push(M_.x,M_.y,M_.z),y.push(E_.x,E_.y,E_.z)}this.setAttribute("position",new Ot(y,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Dh extends By{constructor(e){super(e),this.uuid=Ea(),this.type="Shape",this.holes=[]}getPointsHoles(e){const n=[];for(let r=0,i=this.holes.length;r<i;r++)n[r]=this.holes[r].getPoints(e);return n}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let n=0,r=e.holes.length;n<r;n++){const i=e.holes[n];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let n=0,r=this.holes.length;n<r;n++){const i=this.holes[n];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let n=0,r=e.holes.length;n<r;n++){const i=e.holes[n];this.holes.push(new By().fromJSON(i))}return this}}const gxe={triangulate:function(t,e,n=2){const r=e&&e.length,i=r?e[0]*n:t.length;let s=Z6(t,0,i,n,!0);const a=[];if(!s||s.next===s.prev)return a;let o,l,c,d,f,p,y;if(r&&(s=_xe(t,e,s,n)),t.length>80*n){o=c=t[0],l=d=t[1];for(let x=n;x<i;x+=n)f=t[x],p=t[x+1],f<o&&(o=f),p<l&&(l=p),f>c&&(c=f),p>d&&(d=p);y=Math.max(c-o,d-l),y=y!==0?32767/y:0}return Hy(s,a,n,o,l,y,0),a}};function Z6(t,e,n,r,i){let s,a;if(i===kxe(t,e,n,r)>0)for(s=e;s<n;s+=r)a=ij(s,t[s],t[s+1],a);else for(s=n-r;s>=e;s-=r)a=ij(s,t[s],t[s+1],a);return a&&xM(a,a.next)&&(Gy(a),a=a.next),a}function Yh(t,e){if(!t)return t;e||(e=t);let n=t,r;do if(r=!1,!n.steiner&&(xM(n,n.next)||yr(n.prev,n,n.next)===0)){if(Gy(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function Hy(t,e,n,r,i,s,a){if(!t)return;!a&&s&&Axe(t,r,i,s);let o=t,l,c;for(;t.prev!==t.next;){if(l=t.prev,c=t.next,s?yxe(t,r,i,s):vxe(t)){e.push(l.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),Gy(t),t=c.next,o=c.next;continue}if(t=c,t===o){a?a===1?(t=xxe(Yh(t),e,n),Hy(t,e,n,r,i,s,2)):a===2&&bxe(t,e,n,r,i,s):Hy(Yh(t),e,n,r,i,s,1);break}}}function vxe(t){const e=t.prev,n=t,r=t.next;if(yr(e,n,r)>=0)return!1;const i=e.x,s=n.x,a=r.x,o=e.y,l=n.y,c=r.y,d=i<s?i<a?i:a:s<a?s:a,f=o<l?o<c?o:c:l<c?l:c,p=i>s?i>a?i:a:s>a?s:a,y=o>l?o>c?o:c:l>c?l:c;let x=r.next;for(;x!==e;){if(x.x>=d&&x.x<=p&&x.y>=f&&x.y<=y&&tg(i,o,s,l,a,c,x.x,x.y)&&yr(x.prev,x,x.next)>=0)return!1;x=x.next}return!0}function yxe(t,e,n,r){const i=t.prev,s=t,a=t.next;if(yr(i,s,a)>=0)return!1;const o=i.x,l=s.x,c=a.x,d=i.y,f=s.y,p=a.y,y=o<l?o<c?o:c:l<c?l:c,x=d<f?d<p?d:p:f<p?f:p,S=o>l?o>c?o:c:l>c?l:c,w=d>f?d>p?d:p:f>p?f:p,b=rP(y,x,e,n,r),M=rP(S,w,e,n,r);let T=t.prevZ,C=t.nextZ;for(;T&&T.z>=b&&C&&C.z<=M;){if(T.x>=y&&T.x<=S&&T.y>=x&&T.y<=w&&T!==i&&T!==a&&tg(o,d,l,f,c,p,T.x,T.y)&&yr(T.prev,T,T.next)>=0||(T=T.prevZ,C.x>=y&&C.x<=S&&C.y>=x&&C.y<=w&&C!==i&&C!==a&&tg(o,d,l,f,c,p,C.x,C.y)&&yr(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;T&&T.z>=b;){if(T.x>=y&&T.x<=S&&T.y>=x&&T.y<=w&&T!==i&&T!==a&&tg(o,d,l,f,c,p,T.x,T.y)&&yr(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;C&&C.z<=M;){if(C.x>=y&&C.x<=S&&C.y>=x&&C.y<=w&&C!==i&&C!==a&&tg(o,d,l,f,c,p,C.x,C.y)&&yr(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function xxe(t,e,n){let r=t;do{const i=r.prev,s=r.next.next;!xM(i,s)&&Q6(i,r,r.next,s)&&Vy(i,s)&&Vy(s,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(s.i/n|0),Gy(r),Gy(r.next),r=t=s),r=r.next}while(r!==t);return Yh(r)}function bxe(t,e,n,r,i,s){let a=t;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&Pxe(a,o)){let l=J6(a,o);a=Yh(a,a.next),l=Yh(l,l.next),Hy(a,e,n,r,i,s,0),Hy(l,e,n,r,i,s,0);return}o=o.next}a=a.next}while(a!==t)}function _xe(t,e,n,r){const i=[];let s,a,o,l,c;for(s=0,a=e.length;s<a;s++)o=e[s]*r,l=s<a-1?e[s+1]*r:t.length,c=Z6(t,o,l,r,!1),c===c.next&&(c.steiner=!0),i.push(Cxe(c));for(i.sort(wxe),s=0;s<i.length;s++)n=Sxe(i[s],n);return n}function wxe(t,e){return t.x-e.x}function Sxe(t,e){const n=Mxe(t,e);if(!n)return e;const r=J6(n,t);return Yh(r,r.next),Yh(n,n.next)}function Mxe(t,e){let n=e,r=-1/0,i;const s=t.x,a=t.y;do{if(a<=n.y&&a>=n.next.y&&n.next.y!==n.y){const p=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(p<=s&&p>r&&(r=p,i=n.x<n.next.x?n:n.next,p===s))return i}n=n.next}while(n!==e);if(!i)return null;const o=i,l=i.x,c=i.y;let d=1/0,f;n=i;do s>=n.x&&n.x>=l&&s!==n.x&&tg(a<c?s:r,a,l,c,a<c?r:s,a,n.x,n.y)&&(f=Math.abs(a-n.y)/(s-n.x),Vy(n,t)&&(f<d||f===d&&(n.x>i.x||n.x===i.x&&Exe(i,n)))&&(i=n,d=f)),n=n.next;while(n!==o);return i}function Exe(t,e){return yr(t.prev,t,e.prev)<0&&yr(e.next,t,t.next)<0}function Axe(t,e,n,r){let i=t;do i.z===0&&(i.z=rP(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,Txe(i)}function Txe(t){let e,n,r,i,s,a,o,l,c=1;do{for(n=t,t=null,s=null,a=0;n;){for(a++,r=n,o=0,e=0;e<c&&(o++,r=r.nextZ,!!r);e++);for(l=c;o>0||l>0&&r;)o!==0&&(l===0||!r||n.z<=r.z)?(i=n,n=n.nextZ,o--):(i=r,r=r.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;n=r}s.nextZ=null,c*=2}while(a>1);return t}function rP(t,e,n,r,i){return t=(t-n)*i|0,e=(e-r)*i|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function Cxe(t){let e=t,n=t;do(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next;while(e!==t);return n}function tg(t,e,n,r,i,s,a,o){return(i-a)*(e-o)>=(t-a)*(s-o)&&(t-a)*(r-o)>=(n-a)*(e-o)&&(n-a)*(s-o)>=(i-a)*(r-o)}function Pxe(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Rxe(t,e)&&(Vy(t,e)&&Vy(e,t)&&Nxe(t,e)&&(yr(t.prev,t,e.prev)||yr(t,e.prev,e))||xM(t,e)&&yr(t.prev,t,t.next)>0&&yr(e.prev,e,e.next)>0)}function yr(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function xM(t,e){return t.x===e.x&&t.y===e.y}function Q6(t,e,n,r){const i=C_(yr(t,e,n)),s=C_(yr(t,e,r)),a=C_(yr(n,r,t)),o=C_(yr(n,r,e));return!!(i!==s&&a!==o||i===0&&T_(t,n,e)||s===0&&T_(t,r,e)||a===0&&T_(n,t,r)||o===0&&T_(n,e,r))}function T_(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 C_(t){return t>0?1:t<0?-1:0}function Rxe(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&&Q6(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function Vy(t,e){return yr(t.prev,t,t.next)<0?yr(t,e,t.next)>=0&&yr(t,t.prev,e)>=0:yr(t,e,t.prev)<0||yr(t,t.next,e)<0}function Nxe(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,s=(t.y+e.y)/2;do n.y>s!=n.next.y>s&&n.next.y!==n.y&&i<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==t);return r}function J6(t,e){const n=new iP(t.i,t.x,t.y),r=new iP(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,s.next=r,r.prev=s,r}function ij(t,e,n,r){const i=new iP(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Gy(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function iP(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function kxe(t,e,n,r){let i=0;for(let s=e,a=n-r;s<n;s+=r)i+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return i}class Rl{static area(e){const n=e.length;let r=0;for(let i=n-1,s=0;s<n;i=s++)r+=e[i].x*e[s].y-e[s].x*e[i].y;return r*.5}static isClockWise(e){return Rl.area(e)<0}static triangulateShape(e,n){const r=[],i=[],s=[];sj(e),aj(r,e);let a=e.length;n.forEach(sj);for(let l=0;l<n.length;l++)i.push(a),a+=n[l].length,aj(r,n[l]);const o=gxe.triangulate(r,i);for(let l=0;l<o.length;l+=3)s.push(o.slice(l,l+3));return s}}function sj(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function aj(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class bM extends Yt{constructor(e=new Dh([new He(.5,.5),new He(-.5,.5),new He(-.5,-.5),new He(.5,-.5)]),n={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:n},e=Array.isArray(e)?e:[e];const r=this,i=[],s=[];for(let o=0,l=e.length;o<l;o++){const c=e[o];a(c)}this.setAttribute("position",new Ot(i,3)),this.setAttribute("uv",new Ot(s,2)),this.computeVertexNormals();function a(o){const l=[],c=n.curveSegments!==void 0?n.curveSegments:12,d=n.steps!==void 0?n.steps:1,f=n.depth!==void 0?n.depth:1;let p=n.bevelEnabled!==void 0?n.bevelEnabled:!0,y=n.bevelThickness!==void 0?n.bevelThickness:.2,x=n.bevelSize!==void 0?n.bevelSize:y-.1,S=n.bevelOffset!==void 0?n.bevelOffset:0,w=n.bevelSegments!==void 0?n.bevelSegments:3;const b=n.extrudePath,M=n.UVGenerator!==void 0?n.UVGenerator:Ixe;let T,C=!1,L,N,D,F;b&&(T=b.getSpacedPoints(d),C=!0,p=!1,L=b.computeFrenetFrames(d,!1),N=new q,D=new q,F=new q),p||(w=0,y=0,x=0,S=0);const V=o.extractPoints(c);let I=V.shape;const U=V.holes;if(!Rl.isClockWise(I)){I=I.reverse();for(let fe=0,Q=U.length;fe<Q;fe++){const Ve=U[fe];Rl.isClockWise(Ve)&&(U[fe]=Ve.reverse())}}const te=Rl.triangulateShape(I,U),re=I;for(let fe=0,Q=U.length;fe<Q;fe++){const Ve=U[fe];I=I.concat(Ve)}function pe(fe,Q,Ve){return Q||console.error("THREE.ExtrudeGeometry: vec does not exist"),fe.clone().addScaledVector(Q,Ve)}const ee=I.length,ce=te.length;function B(fe,Q,Ve){let Le,We,Je;const de=fe.x-Q.x,De=fe.y-Q.y,K=Ve.x-fe.x,H=Ve.y-fe.y,xe=de*de+De*De,je=de*H-De*K;if(Math.abs(je)>Number.EPSILON){const Oe=Math.sqrt(xe),Fe=Math.sqrt(K*K+H*H),xt=Q.x-De/Oe,rt=Q.y+de/Oe,ft=Ve.x-H/Fe,zt=Ve.y+K/Fe,Ye=((ft-xt)*H-(zt-rt)*K)/(de*H-De*K);Le=xt+de*Ye-fe.x,We=rt+De*Ye-fe.y;const ne=Le*Le+We*We;if(ne<=2)return new He(Le,We);Je=Math.sqrt(ne/2)}else{let Oe=!1;de>Number.EPSILON?K>Number.EPSILON&&(Oe=!0):de<-Number.EPSILON?K<-Number.EPSILON&&(Oe=!0):Math.sign(De)===Math.sign(H)&&(Oe=!0),Oe?(Le=-De,We=de,Je=Math.sqrt(xe)):(Le=de,We=De,Je=Math.sqrt(xe/2))}return new He(Le/Je,We/Je)}const J=[];for(let fe=0,Q=re.length,Ve=Q-1,Le=fe+1;fe<Q;fe++,Ve++,Le++)Ve===Q&&(Ve=0),Le===Q&&(Le=0),J[fe]=B(re[fe],re[Ve],re[Le]);const Z=[];let G,W=J.concat();for(let fe=0,Q=U.length;fe<Q;fe++){const Ve=U[fe];G=[];for(let Le=0,We=Ve.length,Je=We-1,de=Le+1;Le<We;Le++,Je++,de++)Je===We&&(Je=0),de===We&&(de=0),G[Le]=B(Ve[Le],Ve[Je],Ve[de]);Z.push(G),W=W.concat(G)}for(let fe=0;fe<w;fe++){const Q=fe/w,Ve=y*Math.cos(Q*Math.PI/2),Le=x*Math.sin(Q*Math.PI/2)+S;for(let We=0,Je=re.length;We<Je;We++){const de=pe(re[We],J[We],Le);Se(de.x,de.y,-Ve)}for(let We=0,Je=U.length;We<Je;We++){const de=U[We];G=Z[We];for(let De=0,K=de.length;De<K;De++){const H=pe(de[De],G[De],Le);Se(H.x,H.y,-Ve)}}}const oe=x+S;for(let fe=0;fe<ee;fe++){const Q=p?pe(I[fe],W[fe],oe):I[fe];C?(D.copy(L.normals[0]).multiplyScalar(Q.x),N.copy(L.binormals[0]).multiplyScalar(Q.y),F.copy(T[0]).add(D).add(N),Se(F.x,F.y,F.z)):Se(Q.x,Q.y,0)}for(let fe=1;fe<=d;fe++)for(let Q=0;Q<ee;Q++){const Ve=p?pe(I[Q],W[Q],oe):I[Q];C?(D.copy(L.normals[fe]).multiplyScalar(Ve.x),N.copy(L.binormals[fe]).multiplyScalar(Ve.y),F.copy(T[fe]).add(D).add(N),Se(F.x,F.y,F.z)):Se(Ve.x,Ve.y,f/d*fe)}for(let fe=w-1;fe>=0;fe--){const Q=fe/w,Ve=y*Math.cos(Q*Math.PI/2),Le=x*Math.sin(Q*Math.PI/2)+S;for(let We=0,Je=re.length;We<Je;We++){const de=pe(re[We],J[We],Le);Se(de.x,de.y,f+Ve)}for(let We=0,Je=U.length;We<Je;We++){const de=U[We];G=Z[We];for(let De=0,K=de.length;De<K;De++){const H=pe(de[De],G[De],Le);C?Se(H.x,H.y+T[d-1].y,T[d-1].x+Ve):Se(H.x,H.y,f+Ve)}}}se(),le();function se(){const fe=i.length/3;if(p){let Q=0,Ve=ee*Q;for(let Le=0;Le<ce;Le++){const We=te[Le];$e(We[2]+Ve,We[1]+Ve,We[0]+Ve)}Q=d+w*2,Ve=ee*Q;for(let Le=0;Le<ce;Le++){const We=te[Le];$e(We[0]+Ve,We[1]+Ve,We[2]+Ve)}}else{for(let Q=0;Q<ce;Q++){const Ve=te[Q];$e(Ve[2],Ve[1],Ve[0])}for(let Q=0;Q<ce;Q++){const Ve=te[Q];$e(Ve[0]+ee*d,Ve[1]+ee*d,Ve[2]+ee*d)}}r.addGroup(fe,i.length/3-fe,0)}function le(){const fe=i.length/3;let Q=0;Me(re,Q),Q+=re.length;for(let Ve=0,Le=U.length;Ve<Le;Ve++){const We=U[Ve];Me(We,Q),Q+=We.length}r.addGroup(fe,i.length/3-fe,1)}function Me(fe,Q){let Ve=fe.length;for(;--Ve>=0;){const Le=Ve;let We=Ve-1;We<0&&(We=fe.length-1);for(let Je=0,de=d+w*2;Je<de;Je++){const De=ee*Je,K=ee*(Je+1),H=Q+Le+De,xe=Q+We+De,je=Q+We+K,Oe=Q+Le+K;Ee(H,xe,je,Oe)}}}function Se(fe,Q,Ve){l.push(fe),l.push(Q),l.push(Ve)}function $e(fe,Q,Ve){Ge(fe),Ge(Q),Ge(Ve);const Le=i.length/3,We=M.generateTopUV(r,i,Le-3,Le-2,Le-1);Xe(We[0]),Xe(We[1]),Xe(We[2])}function Ee(fe,Q,Ve,Le){Ge(fe),Ge(Q),Ge(Le),Ge(Q),Ge(Ve),Ge(Le);const We=i.length/3,Je=M.generateSideWallUV(r,i,We-6,We-3,We-2,We-1);Xe(Je[0]),Xe(Je[1]),Xe(Je[3]),Xe(Je[1]),Xe(Je[2]),Xe(Je[3])}function Ge(fe){i.push(l[fe*3+0]),i.push(l[fe*3+1]),i.push(l[fe*3+2])}function Xe(fe){s.push(fe.x),s.push(fe.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),n=this.parameters.shapes,r=this.parameters.options;return Lxe(n,r,e)}static fromJSON(e,n){const r=[];for(let s=0,a=e.shapes.length;s<a;s++){const o=n[e.shapes[s]];r.push(o)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new $w[i.type]().fromJSON(i)),new bM(r,e.options)}}const Ixe={generateTopUV:function(t,e,n,r,i){const s=e[n*3],a=e[n*3+1],o=e[r*3],l=e[r*3+1],c=e[i*3],d=e[i*3+1];return[new He(s,a),new He(o,l),new He(c,d)]},generateSideWallUV:function(t,e,n,r,i,s){const a=e[n*3],o=e[n*3+1],l=e[n*3+2],c=e[r*3],d=e[r*3+1],f=e[r*3+2],p=e[i*3],y=e[i*3+1],x=e[i*3+2],S=e[s*3],w=e[s*3+1],b=e[s*3+2];return Math.abs(o-d)<Math.abs(a-c)?[new He(a,1-l),new He(c,1-f),new He(p,1-x),new He(S,1-b)]:[new He(o,1-l),new He(d,1-f),new He(y,1-x),new He(w,1-b)]}};function Lxe(t,e,n){if(n.shapes=[],Array.isArray(t))for(let r=0,i=t.length;r<i;r++){const s=t[r];n.shapes.push(s.uuid)}else n.shapes.push(t.uuid);return n.options=Object.assign({},e),e.extrudePath!==void 0&&(n.options.extrudePath=e.extrudePath.toJSON()),n}class _M extends zd{constructor(e=1,n=0){const r=(1+Math.sqrt(5))/2,i=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,s,e,n),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:n}}static fromJSON(e){return new _M(e.radius,e.detail)}}class _x extends zd{constructor(e=1,n=0){const r=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(r,i,e,n),this.type="OctahedronGeometry",this.parameters={radius:e,detail:n}}static fromJSON(e){return new _x(e.radius,e.detail)}}class wM extends Yt{constructor(e=.5,n=1,r=32,i=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:n,thetaSegments:r,phiSegments:i,thetaStart:s,thetaLength:a},r=Math.max(3,r),i=Math.max(1,i);const o=[],l=[],c=[],d=[];let f=e;const p=(n-e)/i,y=new q,x=new He;for(let S=0;S<=i;S++){for(let w=0;w<=r;w++){const b=s+w/r*a;y.x=f*Math.cos(b),y.y=f*Math.sin(b),l.push(y.x,y.y,y.z),c.push(0,0,1),x.x=(y.x/n+1)/2,x.y=(y.y/n+1)/2,d.push(x.x,x.y)}f+=p}for(let S=0;S<i;S++){const w=S*(r+1);for(let b=0;b<r;b++){const M=b+w,T=M,C=M+r+1,L=M+r+2,N=M+1;o.push(T,C,N),o.push(C,L,N)}}this.setIndex(o),this.setAttribute("position",new Ot(l,3)),this.setAttribute("normal",new Ot(c,3)),this.setAttribute("uv",new Ot(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new wM(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class SM extends Yt{constructor(e=new Dh([new He(0,.5),new He(-.5,-.5),new He(.5,-.5)]),n=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:n};const r=[],i=[],s=[],a=[];let o=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let d=0;d<e.length;d++)c(e[d]),this.addGroup(o,l,d),o+=l,l=0;this.setIndex(r),this.setAttribute("position",new Ot(i,3)),this.setAttribute("normal",new Ot(s,3)),this.setAttribute("uv",new Ot(a,2));function c(d){const f=i.length/3,p=d.extractPoints(n);let y=p.shape;const x=p.holes;Rl.isClockWise(y)===!1&&(y=y.reverse());for(let w=0,b=x.length;w<b;w++){const M=x[w];Rl.isClockWise(M)===!0&&(x[w]=M.reverse())}const S=Rl.triangulateShape(y,x);for(let w=0,b=x.length;w<b;w++){const M=x[w];y=y.concat(M)}for(let w=0,b=y.length;w<b;w++){const M=y[w];i.push(M.x,M.y,0),s.push(0,0,1),a.push(M.x,M.y)}for(let w=0,b=S.length;w<b;w++){const M=S[w],T=M[0]+f,C=M[1]+f,L=M[2]+f;r.push(T,C,L),l+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),n=this.parameters.shapes;return Oxe(n,e)}static fromJSON(e,n){const r=[];for(let i=0,s=e.shapes.length;i<s;i++){const a=n[e.shapes[i]];r.push(a)}return new SM(r,e.curveSegments)}}function Oxe(t,e){if(e.shapes=[],Array.isArray(t))for(let n=0,r=t.length;n<r;n++){const i=t[n];e.shapes.push(i.uuid)}else e.shapes.push(t.uuid);return e}class wx extends Yt{constructor(e=1,n=32,r=16,i=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:n,heightSegments:r,phiStart:i,phiLength:s,thetaStart:a,thetaLength:o},n=Math.max(3,Math.floor(n)),r=Math.max(2,Math.floor(r));const l=Math.min(a+o,Math.PI);let c=0;const d=[],f=new q,p=new q,y=[],x=[],S=[],w=[];for(let b=0;b<=r;b++){const M=[],T=b/r;let C=0;b===0&&a===0?C=.5/n:b===r&&l===Math.PI&&(C=-.5/n);for(let L=0;L<=n;L++){const N=L/n;f.x=-e*Math.cos(i+N*s)*Math.sin(a+T*o),f.y=e*Math.cos(a+T*o),f.z=e*Math.sin(i+N*s)*Math.sin(a+T*o),x.push(f.x,f.y,f.z),p.copy(f).normalize(),S.push(p.x,p.y,p.z),w.push(N+C,1-T),M.push(c++)}d.push(M)}for(let b=0;b<r;b++)for(let M=0;M<n;M++){const T=d[b][M+1],C=d[b][M],L=d[b+1][M],N=d[b+1][M+1];(b!==0||a>0)&&y.push(T,C,N),(b!==r-1||l<Math.PI)&&y.push(C,L,N)}this.setIndex(y),this.setAttribute("position",new Ot(x,3)),this.setAttribute("normal",new Ot(S,3)),this.setAttribute("uv",new Ot(w,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new wx(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class MM extends zd{constructor(e=1,n=0){const r=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(r,i,e,n),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:n}}static fromJSON(e){return new MM(e.radius,e.detail)}}class EM extends Yt{constructor(e=1,n=.4,r=12,i=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:n,radialSegments:r,tubularSegments:i,arc:s},r=Math.floor(r),i=Math.floor(i);const a=[],o=[],l=[],c=[],d=new q,f=new q,p=new q;for(let y=0;y<=r;y++)for(let x=0;x<=i;x++){const S=x/i*s,w=y/r*Math.PI*2;f.x=(e+n*Math.cos(w))*Math.cos(S),f.y=(e+n*Math.cos(w))*Math.sin(S),f.z=n*Math.sin(w),o.push(f.x,f.y,f.z),d.x=e*Math.cos(S),d.y=e*Math.sin(S),p.subVectors(f,d).normalize(),l.push(p.x,p.y,p.z),c.push(x/i),c.push(y/r)}for(let y=1;y<=r;y++)for(let x=1;x<=i;x++){const S=(i+1)*y+x-1,w=(i+1)*(y-1)+x-1,b=(i+1)*(y-1)+x,M=(i+1)*y+x;a.push(S,w,M),a.push(w,b,M)}this.setIndex(a),this.setAttribute("position",new Ot(o,3)),this.setAttribute("normal",new Ot(l,3)),this.setAttribute("uv",new Ot(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new EM(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class AM extends Yt{constructor(e=1,n=.4,r=64,i=8,s=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:n,tubularSegments:r,radialSegments:i,p:s,q:a},r=Math.floor(r),i=Math.floor(i);const o=[],l=[],c=[],d=[],f=new q,p=new q,y=new q,x=new q,S=new q,w=new q,b=new q;for(let T=0;T<=r;++T){const C=T/r*s*Math.PI*2;M(C,s,a,e,y),M(C+.01,s,a,e,x),w.subVectors(x,y),b.addVectors(x,y),S.crossVectors(w,b),b.crossVectors(S,w),S.normalize(),b.normalize();for(let L=0;L<=i;++L){const N=L/i*Math.PI*2,D=-n*Math.cos(N),F=n*Math.sin(N);f.x=y.x+(D*b.x+F*S.x),f.y=y.y+(D*b.y+F*S.y),f.z=y.z+(D*b.z+F*S.z),l.push(f.x,f.y,f.z),p.subVectors(f,y).normalize(),c.push(p.x,p.y,p.z),d.push(T/r),d.push(L/i)}}for(let T=1;T<=r;T++)for(let C=1;C<=i;C++){const L=(i+1)*(T-1)+(C-1),N=(i+1)*T+(C-1),D=(i+1)*T+C,F=(i+1)*(T-1)+C;o.push(L,N,F),o.push(N,D,F)}this.setIndex(o),this.setAttribute("position",new Ot(l,3)),this.setAttribute("normal",new Ot(c,3)),this.setAttribute("uv",new Ot(d,2));function M(T,C,L,N,D){const F=Math.cos(T),V=Math.sin(T),I=L/C*T,U=Math.cos(I);D.x=N*(2+U)*.5*F,D.y=N*(2+U)*V*.5,D.z=N*Math.sin(I)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new AM(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class TM extends Yt{constructor(e=new $R(new q(-1,-1,0),new q(-1,1,0),new q(1,1,0)),n=64,r=1,i=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:n,radius:r,radialSegments:i,closed:s};const a=e.computeFrenetFrames(n,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new q,l=new q,c=new He;let d=new q;const f=[],p=[],y=[],x=[];S(),this.setIndex(x),this.setAttribute("position",new Ot(f,3)),this.setAttribute("normal",new Ot(p,3)),this.setAttribute("uv",new Ot(y,2));function S(){for(let T=0;T<n;T++)w(T);w(s===!1?n:0),M(),b()}function w(T){d=e.getPointAt(T/n,d);const C=a.normals[T],L=a.binormals[T];for(let N=0;N<=i;N++){const D=N/i*Math.PI*2,F=Math.sin(D),V=-Math.cos(D);l.x=V*C.x+F*L.x,l.y=V*C.y+F*L.y,l.z=V*C.z+F*L.z,l.normalize(),p.push(l.x,l.y,l.z),o.x=d.x+r*l.x,o.y=d.y+r*l.y,o.z=d.z+r*l.z,f.push(o.x,o.y,o.z)}}function b(){for(let T=1;T<=n;T++)for(let C=1;C<=i;C++){const L=(i+1)*(T-1)+(C-1),N=(i+1)*T+(C-1),D=(i+1)*T+C,F=(i+1)*(T-1)+C;x.push(L,N,F),x.push(N,D,F)}}function M(){for(let T=0;T<=n;T++)for(let C=0;C<=i;C++)c.x=T/n,c.y=C/i,y.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new TM(new $w[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class eG extends Yt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const n=[],r=new Set,i=new q,s=new q;if(e.index!==null){const a=e.attributes.position,o=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:o.count,materialIndex:0}]);for(let c=0,d=l.length;c<d;++c){const f=l[c],p=f.start,y=f.count;for(let x=p,S=p+y;x<S;x+=3)for(let w=0;w<3;w++){const b=o.getX(x+w),M=o.getX(x+(w+1)%3);i.fromBufferAttribute(a,b),s.fromBufferAttribute(a,M),oj(i,s,r)===!0&&(n.push(i.x,i.y,i.z),n.push(s.x,s.y,s.z))}}}else{const a=e.attributes.position;for(let o=0,l=a.count/3;o<l;o++)for(let c=0;c<3;c++){const d=3*o+c,f=3*o+(c+1)%3;i.fromBufferAttribute(a,d),s.fromBufferAttribute(a,f),oj(i,s,r)===!0&&(n.push(i.x,i.y,i.z),n.push(s.x,s.y,s.z))}}this.setAttribute("position",new Ot(n,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function oj(t,e,n){const r=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`;return n.has(r)===!0||n.has(i)===!0?!1:(n.add(r),n.add(i),!0)}var lj=Object.freeze({__proto__:null,BoxGeometry:cp,CapsuleGeometry:mM,CircleGeometry:gM,ConeGeometry:vM,CylinderGeometry:dv,DodecahedronGeometry:yM,EdgesGeometry:Y6,ExtrudeGeometry:bM,IcosahedronGeometry:_M,LatheGeometry:bx,OctahedronGeometry:_x,PlaneGeometry:cv,PolyhedronGeometry:zd,RingGeometry:wM,ShapeGeometry:SM,SphereGeometry:wx,TetrahedronGeometry:MM,TorusGeometry:EM,TorusKnotGeometry:AM,TubeGeometry:TM,WireframeGeometry:eG});class tG extends Gr{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new ut(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class nG extends Qa{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Sx extends Gr{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new ut(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=uu,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ls,this.envMapIntensity=1,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.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,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.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,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 no extends Sx{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new He(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Tr(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(n){this.ior=(1+.4*n)/(1-.4*n)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new ut(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new ut(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new ut(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=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 rG extends Gr{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ut(16777215),this.specular=new ut(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=uu,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ls,this.combine=px,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 iG extends Gr{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ut(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=uu,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class sG extends Gr{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=uu,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class aG extends Gr{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ut(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=uu,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ls,this.combine=px,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 oG extends Gr{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ut(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=uu,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class lG 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 yh(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 cG(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function uG(t){function e(i,s){return t[i]-t[s]}const n=t.length,r=new Array(n);for(let i=0;i!==n;++i)r[i]=i;return r.sort(e),r}function sP(t,e,n){const r=t.length,i=new t.constructor(r);for(let s=0,a=0;a!==r;++s){const o=n[s]*e;for(let l=0;l!==e;++l)i[a++]=t[o+l]}return i}function qR(t,e,n,r){let i=1,s=t[0];for(;s!==void 0&&s[r]===void 0;)s=t[i++];if(s===void 0)return;let a=s[r];if(a!==void 0)if(Array.isArray(a))do a=s[r],a!==void 0&&(e.push(s.time),n.push.apply(n,a)),s=t[i++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[r],a!==void 0&&(e.push(s.time),a.toArray(n,n.length)),s=t[i++];while(s!==void 0);else do a=s[r],a!==void 0&&(e.push(s.time),n.push(a)),s=t[i++];while(s!==void 0)}function Dxe(t,e,n,r,i=30){const s=t.clone();s.name=e;const a=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],d=c.getValueSize(),f=[],p=[];for(let y=0;y<c.times.length;++y){const x=c.times[y]*i;if(!(x<n||x>=r)){f.push(c.times[y]);for(let S=0;S<d;++S)p.push(c.values[y*d+S])}}f.length!==0&&(c.times=yh(f,c.times.constructor),c.values=yh(p,c.values.constructor),a.push(c))}s.tracks=a;let o=1/0;for(let l=0;l<s.tracks.length;++l)o>s.tracks[l].times[0]&&(o=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*o);return s.resetDuration(),s}function jxe(t,e=0,n=t,r=30){r<=0&&(r=30);const i=n.tracks.length,s=e/r;for(let a=0;a<i;++a){const o=n.tracks[a],l=o.ValueTypeName;if(l==="bool"||l==="string")continue;const c=t.tracks.find(function(b){return b.name===o.name&&b.ValueTypeName===l});if(c===void 0)continue;let d=0;const f=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=f/3);let p=0;const y=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(p=y/3);const x=o.times.length-1;let S;if(s<=o.times[0]){const b=d,M=f-d;S=o.values.slice(b,M)}else if(s>=o.times[x]){const b=x*f+d,M=b+f-d;S=o.values.slice(b,M)}else{const b=o.createInterpolant(),M=d,T=f-d;b.evaluate(s),S=b.resultBuffer.slice(M,T)}l==="quaternion"&&new qt().fromArray(S).normalize().conjugate().toArray(S);const w=c.times.length;for(let b=0;b<w;++b){const M=b*y+p;if(l==="quaternion")qt.multiplyQuaternionsFlat(c.values,M,S,0,c.values,M);else{const T=y-p*2;for(let C=0;C<T;++C)c.values[M+C]-=S[C]}}}return t.blendMode=ER,t}const Uxe={convertArray:yh,isTypedArray:cG,getKeyframeOrder:uG,sortedArray:sP,flattenJSON:qR,subclip:Dxe,makeClipAdditive:jxe};class fv{constructor(e,n,r,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new n.constructor(r),this.sampleValues=n,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){const n=this.parameterPositions;let r=this._cachedIndex,i=n[r],s=n[r-1];e:{t:{let a;n:{r:if(!(e<i)){for(let o=r+2;;){if(i===void 0){if(e<s)break r;return r=n.length,this._cachedIndex=r,this.copySampleValue_(r-1)}if(r===o)break;if(s=i,i=n[++r],e<i)break t}a=n.length;break n}if(!(e>=s)){const o=n[1];e<o&&(r=2,s=o);for(let l=r-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===l)break;if(i=s,s=n[--r-1],e>=s)break t}a=r,r=0;break n}break e}for(;r<a;){const o=r+a>>>1;e<n[o]?a=o:r=o+1}if(i=n[r],s=n[r-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return r=n.length,this._cachedIndex=r,this.copySampleValue_(r-1)}this._cachedIndex=r,this.intervalChanged_(r,s,i)}return this.interpolate_(r,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const n=this.resultBuffer,r=this.sampleValues,i=this.valueSize,s=e*i;for(let a=0;a!==i;++a)n[a]=r[s+a];return n}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class dG extends fv{constructor(e,n,r,i){super(e,n,r,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:mh,endingEnd:mh}}intervalChanged_(e,n,r){const i=this.parameterPositions;let s=e-2,a=e+1,o=i[s],l=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case gh:s=e,o=2*n-r;break;case Ly:s=i.length-2,o=n+i[s]-i[s+1];break;default:s=e,o=r}if(l===void 0)switch(this.getSettings_().endingEnd){case gh:a=e,l=2*r-n;break;case Ly:a=1,l=r+i[1]-i[0];break;default:a=e-1,l=n}const c=(r-n)*.5,d=this.valueSize;this._weightPrev=c/(n-o),this._weightNext=c/(l-r),this._offsetPrev=s*d,this._offsetNext=a*d}interpolate_(e,n,r,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,d=this._offsetPrev,f=this._offsetNext,p=this._weightPrev,y=this._weightNext,x=(r-n)/(i-n),S=x*x,w=S*x,b=-p*w+2*p*S-p*x,M=(1+p)*w+(-1.5-2*p)*S+(-.5+p)*x+1,T=(-1-y)*w+(1.5+y)*S+.5*x,C=y*w-y*S;for(let L=0;L!==o;++L)s[L]=b*a[d+L]+M*a[c+L]+T*a[l+L]+C*a[f+L];return s}}class KR extends fv{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e,n,r,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,d=(r-n)/(i-n),f=1-d;for(let p=0;p!==o;++p)s[p]=a[c+p]*f+a[l+p]*d;return s}}class fG extends fv{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class Ko{constructor(e,n,r,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(n===void 0||n.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=yh(n,this.TimeBufferType),this.values=yh(r,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const n=e.constructor;let r;if(n.toJSON!==this.toJSON)r=n.toJSON(e);else{r={name:e.name,times:yh(e.times,Array),values:yh(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(r.interpolation=i)}return r.type=e.ValueTypeName,r}InterpolantFactoryMethodDiscrete(e){return new fG(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new KR(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new dG(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let n;switch(e){case zg:n=this.InterpolantFactoryMethodDiscrete;break;case Bg:n=this.InterpolantFactoryMethodLinear;break;case Q_:n=this.InterpolantFactoryMethodSmooth;break}if(n===void 0){const r="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(r);return console.warn("THREE.KeyframeTrack:",r),this}return this.createInterpolant=n,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return zg;case this.InterpolantFactoryMethodLinear:return Bg;case this.InterpolantFactoryMethodSmooth:return Q_}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const n=this.times;for(let r=0,i=n.length;r!==i;++r)n[r]+=e}return this}scale(e){if(e!==1){const n=this.times;for(let r=0,i=n.length;r!==i;++r)n[r]*=e}return this}trim(e,n){const r=this.times,i=r.length;let s=0,a=i-1;for(;s!==i&&r[s]<e;)++s;for(;a!==-1&&r[a]>n;)--a;if(++a,s!==0||a!==i){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=r.slice(s,a),this.values=this.values.slice(s*o,a*o)}return this}validate(){let e=!0;const n=this.getValueSize();n-Math.floor(n)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,i=this.values,s=r.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const l=r[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(i!==void 0&&cG(i))for(let o=0,l=i.length;o!==l;++o){const c=i[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),n=this.values.slice(),r=this.getValueSize(),i=this.getInterpolation()===Q_,s=e.length-1;let a=1;for(let o=1;o<s;++o){let l=!1;const c=e[o],d=e[o+1];if(c!==d&&(o!==1||c!==e[0]))if(i)l=!0;else{const f=o*r,p=f-r,y=f+r;for(let x=0;x!==r;++x){const S=n[f+x];if(S!==n[p+x]||S!==n[y+x]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];const f=o*r,p=a*r;for(let y=0;y!==r;++y)n[p+y]=n[f+y]}++a}}if(s>0){e[a]=e[s];for(let o=s*r,l=a*r,c=0;c!==r;++c)n[l+c]=n[o+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=n.slice(0,a*r)):(this.times=e,this.values=n),this}clone(){const e=this.times.slice(),n=this.values.slice(),r=this.constructor,i=new r(this.name,e,n);return i.createInterpolant=this.createInterpolant,i}}Ko.prototype.TimeBufferType=Float32Array;Ko.prototype.ValueBufferType=Float32Array;Ko.prototype.DefaultInterpolation=Bg;class dp extends Ko{constructor(e,n,r){super(e,n,r)}}dp.prototype.ValueTypeName="bool";dp.prototype.ValueBufferType=Array;dp.prototype.DefaultInterpolation=zg;dp.prototype.InterpolantFactoryMethodLinear=void 0;dp.prototype.InterpolantFactoryMethodSmooth=void 0;class YR extends Ko{}YR.prototype.ValueTypeName="color";class Zh extends Ko{}Zh.prototype.ValueTypeName="number";class hG extends fv{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e,n,r,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(r-n)/(i-n);let c=e*o;for(let d=c+o;c!==d;c+=4)qt.slerpFlat(s,0,a,c-o,a,c,l);return s}}class Qh extends Ko{InterpolantFactoryMethodLinear(e){return new hG(this.times,this.values,this.getValueSize(),e)}}Qh.prototype.ValueTypeName="quaternion";Qh.prototype.InterpolantFactoryMethodSmooth=void 0;class fp extends Ko{constructor(e,n,r){super(e,n,r)}}fp.prototype.ValueTypeName="string";fp.prototype.ValueBufferType=Array;fp.prototype.DefaultInterpolation=zg;fp.prototype.InterpolantFactoryMethodLinear=void 0;fp.prototype.InterpolantFactoryMethodSmooth=void 0;class Jh extends Ko{}Jh.prototype.ValueTypeName="vector";class Gg{constructor(e="",n=-1,r=[],i=iM){this.name=e,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=Ea(),this.duration<0&&this.resetDuration()}static parse(e){const n=[],r=e.tracks,i=1/(e.fps||1);for(let a=0,o=r.length;a!==o;++a)n.push(zxe(r[a]).scale(i));const s=new this(e.name,e.duration,n,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const n=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:n,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,a=r.length;s!==a;++s)n.push(Ko.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,n,r,i){const s=n.length,a=[];for(let o=0;o<s;o++){let l=[],c=[];l.push((o+s-1)%s,o,(o+1)%s),c.push(0,1,0);const d=uG(l);l=sP(l,1,d),c=sP(c,1,d),!i&&l[0]===0&&(l.push(s),c.push(c[0])),a.push(new Zh(".morphTargetInfluences["+n[o].name+"]",l,c).scale(1/r))}return new this(e,-1,a)}static findByName(e,n){let r=e;if(!Array.isArray(e)){const i=e;r=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<r.length;i++)if(r[i].name===n)return r[i];return null}static CreateClipsFromMorphTargetSequences(e,n,r){const i={},s=/^([\w-]*?)([\d]+)$/;for(let o=0,l=e.length;o<l;o++){const c=e[o],d=c.name.match(s);if(d&&d.length>1){const f=d[1];let p=i[f];p||(i[f]=p=[]),p.push(c)}}const a=[];for(const o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],n,r));return a}static parseAnimation(e,n){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const r=function(f,p,y,x,S){if(y.length!==0){const w=[],b=[];qR(y,w,b,x),w.length!==0&&S.push(new f(p,w,b))}},i=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let f=0;f<c.length;f++){const p=c[f].keys;if(!(!p||p.length===0))if(p[0].morphTargets){const y={};let x;for(x=0;x<p.length;x++)if(p[x].morphTargets)for(let S=0;S<p[x].morphTargets.length;S++)y[p[x].morphTargets[S]]=-1;for(const S in y){const w=[],b=[];for(let M=0;M!==p[x].morphTargets.length;++M){const T=p[x];w.push(T.time),b.push(T.morphTarget===S?1:0)}i.push(new Zh(".morphTargetInfluence["+S+"]",w,b))}l=y.length*a}else{const y=".bones["+n[f].name+"]";r(Jh,y+".position",p,"pos",i),r(Qh,y+".quaternion",p,"rot",i),r(Jh,y+".scale",p,"scl",i)}}return i.length===0?null:new this(s,l,i,o)}resetDuration(){const e=this.tracks;let n=0;for(let r=0,i=e.length;r!==i;++r){const s=this.tracks[r];n=Math.max(n,s.times[s.times.length-1])}return this.duration=n,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let n=0;n<this.tracks.length;n++)e=e&&this.tracks[n].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Fxe(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Zh;case"vector":case"vector2":case"vector3":case"vector4":return Jh;case"color":return YR;case"quaternion":return Qh;case"bool":case"boolean":return dp;case"string":return fp}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}function zxe(t){if(t.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=Fxe(t.type);if(t.times===void 0){const n=[],r=[];qR(t.keys,n,r,"value"),t.times=n,t.values=r}return e.parse!==void 0?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const Vc={enabled:!1,files:{},add:function(t,e){this.enabled!==!1&&(this.files[t]=e)},get:function(t){if(this.enabled!==!1)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class ZR{constructor(e,n,r){const i=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=n,this.onError=r,this.itemStart=function(d){o++,s===!1&&i.onStart!==void 0&&i.onStart(d,a,o),s=!0},this.itemEnd=function(d){a++,i.onProgress!==void 0&&i.onProgress(d,a,o),a===o&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(d){i.onError!==void 0&&i.onError(d)},this.resolveURL=function(d){return l?l(d):d},this.setURLModifier=function(d){return l=d,this},this.addHandler=function(d,f){return c.push(d,f),this},this.removeHandler=function(d){const f=c.indexOf(d);return f!==-1&&c.splice(f,2),this},this.getHandler=function(d){for(let f=0,p=c.length;f<p;f+=2){const y=c[f],x=c[f+1];if(y.global&&(y.lastIndex=0),y.test(d))return x}return null}}}const pG=new ZR;class ks{constructor(e){this.manager=e!==void 0?e:pG,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,n){const r=this;return new Promise(function(i,s){r.load(e,i,n,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}ks.DEFAULT_MATERIAL_NAME="__DEFAULT";const Rc={};class Bxe extends Error{constructor(e,n){super(e),this.response=n}}class Wo extends ks{constructor(e){super(e)}load(e,n,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Vc.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{n&&n(s),this.manager.itemEnd(e)},0),s;if(Rc[e]!==void 0){Rc[e].push({onLoad:n,onProgress:r,onError:i});return}Rc[e]=[],Rc[e].push({onLoad:n,onProgress:r,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const d=Rc[e],f=c.body.getReader(),p=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),y=p?parseInt(p):0,x=y!==0;let S=0;const w=new ReadableStream({start(b){M();function M(){f.read().then(({done:T,value:C})=>{if(T)b.close();else{S+=C.byteLength;const L=new ProgressEvent("progress",{lengthComputable:x,loaded:S,total:y});for(let N=0,D=d.length;N<D;N++){const F=d[N];F.onProgress&&F.onProgress(L)}b.enqueue(C),M()}},T=>{b.error(T)})}}});return new Response(w)}else throw new Bxe(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(d=>new DOMParser().parseFromString(d,o));case"json":return c.json();default:if(o===void 0)return c.text();{const f=/charset="?([^;"\s]*)"?/i.exec(o),p=f&&f[1]?f[1].toLowerCase():void 0,y=new TextDecoder(p);return c.arrayBuffer().then(x=>y.decode(x))}}}).then(c=>{Vc.add(e,c);const d=Rc[e];delete Rc[e];for(let f=0,p=d.length;f<p;f++){const y=d[f];y.onLoad&&y.onLoad(c)}}).catch(c=>{const d=Rc[e];if(d===void 0)throw this.manager.itemError(e),c;delete Rc[e];for(let f=0,p=d.length;f<p;f++){const y=d[f];y.onError&&y.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class Hxe extends ks{constructor(e){super(e)}load(e,n,r,i){const s=this,a=new Wo(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{n(s.parse(JSON.parse(o)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},r,i)}parse(e){const n=[];for(let r=0;r<e.length;r++){const i=Gg.parse(e[r]);n.push(i)}return n}}class Vxe extends ks{constructor(e){super(e)}load(e,n,r,i){const s=this,a=[],o=new hM,l=new Wo(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function d(f){l.load(e[f],function(p){const y=s.parse(p,!0);a[f]={width:y.width,height:y.height,format:y.format,mipmaps:y.mipmaps},c+=1,c===6&&(y.mipmapCount===1&&(o.minFilter=Pr),o.image=a,o.format=y.format,o.needsUpdate=!0,n&&n(o))},r,i)}if(Array.isArray(e))for(let f=0,p=e.length;f<p;++f)d(f);else l.load(e,function(f){const p=s.parse(f,!0);if(p.isCubemap){const y=p.mipmaps.length/p.mipmapCount;for(let x=0;x<y;x++){a[x]={mipmaps:[]};for(let S=0;S<p.mipmapCount;S++)a[x].mipmaps.push(p.mipmaps[x*p.mipmapCount+S]),a[x].format=p.format,a[x].width=p.width,a[x].height=p.height}o.image=a}else o.image.width=p.width,o.image.height=p.height,o.mipmaps=p.mipmaps;p.mipmapCount===1&&(o.minFilter=Pr),o.format=p.format,o.needsUpdate=!0,n&&n(o)},r,i);return o}}class Wg extends ks{constructor(e){super(e)}load(e,n,r,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Vc.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){n&&n(a),s.manager.itemEnd(e)},0),a;const o=zy("img");function l(){d(),Vc.add(e,this),n&&n(this),s.manager.itemEnd(e)}function c(f){d(),i&&i(f),s.manager.itemError(e),s.manager.itemEnd(e)}function d(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),s.manager.itemStart(e),o.src=e,o}}class Gxe extends ks{constructor(e){super(e)}load(e,n,r,i){const s=new yx;s.colorSpace=Fi;const a=new Wg(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let o=0;function l(c){a.load(e[c],function(d){s.images[c]=d,o++,o===6&&(s.needsUpdate=!0,n&&n(s))},void 0,i)}for(let c=0;c<e.length;++c)l(c);return s}}class Wxe extends ks{constructor(e){super(e)}load(e,n,r,i){const s=this,a=new Pl,o=new Wo(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(s.withCredentials),o.load(e,function(l){let c;try{c=s.parse(l)}catch(d){if(i!==void 0)i(d);else{console.error(d);return}}c.image!==void 0?a.image=c.image:c.data!==void 0&&(a.image.width=c.width,a.image.height=c.height,a.image.data=c.data),a.wrapS=c.wrapS!==void 0?c.wrapS:Sa,a.wrapT=c.wrapT!==void 0?c.wrapT:Sa,a.magFilter=c.magFilter!==void 0?c.magFilter:Pr,a.minFilter=c.minFilter!==void 0?c.minFilter:Pr,a.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(a.colorSpace=c.colorSpace),c.flipY!==void 0&&(a.flipY=c.flipY),c.format!==void 0&&(a.format=c.format),c.type!==void 0&&(a.type=c.type),c.mipmaps!==void 0&&(a.mipmaps=c.mipmaps,a.minFilter=qa),c.mipmapCount===1&&(a.minFilter=Pr),c.generateMipmaps!==void 0&&(a.generateMipmaps=c.generateMipmaps),a.needsUpdate=!0,n&&n(a,c)},r,i),a}}class mG extends ks{constructor(e){super(e)}load(e,n,r,i){const s=new fr,a=new Wg(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,n!==void 0&&n(s)},r,i),s}}class Bd extends mn{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new ut(e),this.intensity=n}dispose(){}copy(e,n){return super.copy(e,n),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const n=super.toJSON(e);return n.object.color=this.color.getHex(),n.object.intensity=this.intensity,this.groundColor!==void 0&&(n.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(n.object.distance=this.distance),this.angle!==void 0&&(n.object.angle=this.angle),this.decay!==void 0&&(n.object.decay=this.decay),this.penumbra!==void 0&&(n.object.penumbra=this.penumbra),this.shadow!==void 0&&(n.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(n.object.target=this.target.uuid),n}}class gG extends Bd{constructor(e,n,r){super(e,r),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(mn.DEFAULT_UP),this.updateMatrix(),this.groundColor=new ut(n)}copy(e,n){return super.copy(e,n),this.groundColor.copy(e.groundColor),this}}const BA=new Rt,cj=new q,uj=new q;class QR{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new He(512,512),this.map=null,this.mapPass=null,this.matrix=new Rt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new xx,this._frameExtents=new He(1,1),this._viewportCount=1,this._viewports=[new On(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,r=this.matrix;cj.setFromMatrixPosition(e.matrixWorld),n.position.copy(cj),uj.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(uj),n.updateMatrixWorld(),BA.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(BA),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(BA)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class $xe extends QR{constructor(){super(new Cr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const n=this.camera,r=Hg*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||n.far;(r!==n.fov||i!==n.aspect||s!==n.far)&&(n.fov=r,n.aspect=i,n.far=s,n.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class JR extends Bd{constructor(e,n,r=0,i=Math.PI/3,s=0,a=2){super(e,n),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(mn.DEFAULT_UP),this.updateMatrix(),this.target=new mn,this.distance=r,this.angle=i,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new $xe}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,n){return super.copy(e,n),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const dj=new Rt,L0=new q,HA=new q;class Xxe extends QR{constructor(){super(new Cr(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new He(4,2),this._viewportCount=6,this._viewports=[new On(2,1,1,1),new On(0,1,1,1),new On(3,1,1,1),new On(1,1,1,1),new On(3,0,1,1),new On(1,0,1,1)],this._cubeDirections=[new q(1,0,0),new q(-1,0,0),new q(0,0,1),new q(0,0,-1),new q(0,1,0),new q(0,-1,0)],this._cubeUps=[new q(0,1,0),new q(0,1,0),new q(0,1,0),new q(0,1,0),new q(0,0,1),new q(0,0,-1)]}updateMatrices(e,n=0){const r=this.camera,i=this.matrix,s=e.distance||r.far;s!==r.far&&(r.far=s,r.updateProjectionMatrix()),L0.setFromMatrixPosition(e.matrixWorld),r.position.copy(L0),HA.copy(r.position),HA.add(this._cubeDirections[n]),r.up.copy(this._cubeUps[n]),r.lookAt(HA),r.updateMatrixWorld(),i.makeTranslation(-L0.x,-L0.y,-L0.z),dj.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(dj)}}class eN extends Bd{constructor(e,n,r=0,i=2){super(e,n),this.isPointLight=!0,this.type="PointLight",this.distance=r,this.decay=i,this.shadow=new Xxe}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,n){return super.copy(e,n),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class qxe extends QR{constructor(){super(new qc(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class tN extends Bd{constructor(e,n){super(e,n),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(mn.DEFAULT_UP),this.updateMatrix(),this.target=new mn,this.shadow=new qxe}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class vG extends Bd{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}class yG extends Bd{constructor(e,n,r=10,i=10){super(e,n),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=r,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const n=super.toJSON(e);return n.object.width=this.width,n.object.height=this.height,n}}class xG{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new q)}set(e){for(let n=0;n<9;n++)this.coefficients[n].copy(e[n]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,n){const r=e.x,i=e.y,s=e.z,a=this.coefficients;return n.copy(a[0]).multiplyScalar(.282095),n.addScaledVector(a[1],.488603*i),n.addScaledVector(a[2],.488603*s),n.addScaledVector(a[3],.488603*r),n.addScaledVector(a[4],1.092548*(r*i)),n.addScaledVector(a[5],1.092548*(i*s)),n.addScaledVector(a[6],.315392*(3*s*s-1)),n.addScaledVector(a[7],1.092548*(r*s)),n.addScaledVector(a[8],.546274*(r*r-i*i)),n}getIrradianceAt(e,n){const r=e.x,i=e.y,s=e.z,a=this.coefficients;return n.copy(a[0]).multiplyScalar(.886227),n.addScaledVector(a[1],2*.511664*i),n.addScaledVector(a[2],2*.511664*s),n.addScaledVector(a[3],2*.511664*r),n.addScaledVector(a[4],2*.429043*r*i),n.addScaledVector(a[5],2*.429043*i*s),n.addScaledVector(a[6],.743125*s*s-.247708),n.addScaledVector(a[7],2*.429043*r*s),n.addScaledVector(a[8],.429043*(r*r-i*i)),n}add(e){for(let n=0;n<9;n++)this.coefficients[n].add(e.coefficients[n]);return this}addScaledSH(e,n){for(let r=0;r<9;r++)this.coefficients[r].addScaledVector(e.coefficients[r],n);return this}scale(e){for(let n=0;n<9;n++)this.coefficients[n].multiplyScalar(e);return this}lerp(e,n){for(let r=0;r<9;r++)this.coefficients[r].lerp(e.coefficients[r],n);return this}equals(e){for(let n=0;n<9;n++)if(!this.coefficients[n].equals(e.coefficients[n]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,n=0){const r=this.coefficients;for(let i=0;i<9;i++)r[i].fromArray(e,n+i*3);return this}toArray(e=[],n=0){const r=this.coefficients;for(let i=0;i<9;i++)r[i].toArray(e,n+i*3);return e}static getBasisAt(e,n){const r=e.x,i=e.y,s=e.z;n[0]=.282095,n[1]=.488603*i,n[2]=.488603*s,n[3]=.488603*r,n[4]=1.092548*r*i,n[5]=1.092548*i*s,n[6]=.315392*(3*s*s-1),n[7]=1.092548*r*s,n[8]=.546274*(r*r-i*i)}}class bG extends Bd{constructor(e=new xG,n=1){super(void 0,n),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const n=super.toJSON(e);return n.object.sh=this.sh.toArray(),n}}class CM extends ks{constructor(e){super(e),this.textures={}}load(e,n,r,i){const s=this,a=new Wo(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{n(s.parse(JSON.parse(o)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},r,i)}parse(e){const n=this.textures;function r(s){return n[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),n[s]}const i=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new ut().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(i.dispersion=e.dispersion),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(i.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(i.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(i.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(i.depthFunc=e.depthFunc),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(i.blendSrc=e.blendSrc),e.blendDst!==void 0&&(i.blendDst=e.blendDst),e.blendEquation!==void 0&&(i.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(i.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(i.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==void 0&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(i.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const a=e.uniforms[s];switch(i.uniforms[s]={},a.type){case"t":i.uniforms[s].value=r(a.value);break;case"c":i.uniforms[s].value=new ut().setHex(a.value);break;case"v2":i.uniforms[s].value=new He().fromArray(a.value);break;case"v3":i.uniforms[s].value=new q().fromArray(a.value);break;case"v4":i.uniforms[s].value=new On().fromArray(a.value);break;case"m3":i.uniforms[s].value=new Xt().fromArray(a.value);break;case"m4":i.uniforms[s].value=new Rt().fromArray(a.value);break;default:i.uniforms[s].value=a.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=r(e.map)),e.matcap!==void 0&&(i.matcap=r(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=r(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=r(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=r(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new He().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=r(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=r(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=r(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=r(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=r(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=r(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=r(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=r(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=r(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=r(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=r(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=r(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=r(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=r(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new He().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=r(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=r(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=r(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=r(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=r(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=r(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=r(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return CM.createMaterialFromType(e)}static createMaterialFromType(e){const n={ShadowMaterial:tG,SpriteMaterial:UR,RawShaderMaterial:nG,ShaderMaterial:Qa,PointsMaterial:fM,MeshPhysicalMaterial:no,MeshStandardMaterial:Sx,MeshPhongMaterial:rG,MeshToonMaterial:iG,MeshNormalMaterial:sG,MeshLambertMaterial:aG,MeshDepthMaterial:OR,MeshDistanceMaterial:DR,MeshBasicMaterial:Ts,MeshMatcapMaterial:oG,LineDashedMaterial:lG,LineBasicMaterial:$r,Material:Gr};return new n[e]}}class Cd{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;r<i;r++)n+=String.fromCharCode(e[r]);try{return decodeURIComponent(escape(n))}catch{return n}}static extractUrlBase(e){const n=e.lastIndexOf("/");return n===-1?"./":e.slice(0,n+1)}static resolveURL(e,n){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(n)&&/^\//.test(e)&&(n=n.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:n+e)}}class _G extends Yt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class wG extends ks{constructor(e){super(e)}load(e,n,r,i){const s=this,a=new Wo(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{n(s.parse(JSON.parse(o)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},r,i)}parse(e){const n={},r={};function i(y,x){if(n[x]!==void 0)return n[x];const w=y.interleavedBuffers[x],b=s(y,w.buffer),M=Jm(w.type,b),T=new up(M,w.stride);return T.uuid=w.uuid,n[x]=T,T}function s(y,x){if(r[x]!==void 0)return r[x];const w=y.arrayBuffers[x],b=new Uint32Array(w).buffer;return r[x]=b,b}const a=e.isInstancedBufferGeometry?new _G:new Yt,o=e.data.index;if(o!==void 0){const y=Jm(o.type,o.array);a.setIndex(new Qt(y,1))}const l=e.data.attributes;for(const y in l){const x=l[y];let S;if(x.isInterleavedBufferAttribute){const w=i(e.data,x.data);S=new Fl(w,x.itemSize,x.offset,x.normalized)}else{const w=Jm(x.type,x.array),b=x.isInstancedBufferAttribute?Kh:Qt;S=new b(w,x.itemSize,x.normalized)}x.name!==void 0&&(S.name=x.name),x.usage!==void 0&&S.setUsage(x.usage),a.setAttribute(y,S)}const c=e.data.morphAttributes;if(c)for(const y in c){const x=c[y],S=[];for(let w=0,b=x.length;w<b;w++){const M=x[w];let T;if(M.isInterleavedBufferAttribute){const C=i(e.data,M.data);T=new Fl(C,M.itemSize,M.offset,M.normalized)}else{const C=Jm(M.type,M.array);T=new Qt(C,M.itemSize,M.normalized)}M.name!==void 0&&(T.name=M.name),S.push(T)}a.morphAttributes[y]=S}e.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);const f=e.data.groups||e.data.drawcalls||e.data.offsets;if(f!==void 0)for(let y=0,x=f.length;y!==x;++y){const S=f[y];a.addGroup(S.start,S.count,S.materialIndex)}const p=e.data.boundingSphere;if(p!==void 0){const y=new q;p.center!==void 0&&y.fromArray(p.center),a.boundingSphere=new Hi(y,p.radius)}return e.name&&(a.name=e.name),e.userData&&(a.userData=e.userData),a}}class Kxe extends ks{constructor(e){super(e)}load(e,n,r,i){const s=this,a=this.path===""?Cd.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;const o=new Wo(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(f){i!==void 0&&i(f),console.error("THREE:ObjectLoader: Can't parse "+e+".",f.message);return}const d=c.metadata;if(d===void 0||d.type===void 0||d.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(c,n)},r,i)}async loadAsync(e,n){const r=this,i=this.path===""?Cd.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new Wo(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const a=await s.loadAsync(e,n),o=JSON.parse(a),l=o.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await r.parseAsync(o)}parse(e,n){const r=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),a=this.parseImages(e.images,function(){n!==void 0&&n(c)}),o=this.parseTextures(e.textures,a),l=this.parseMaterials(e.materials,o),c=this.parseObject(e.object,s,l,o,r),d=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,d),this.bindLightTargets(c),n!==void 0){let f=!1;for(const p in a)if(a[p].data instanceof HTMLImageElement){f=!0;break}f===!1&&n(c)}return c}async parseAsync(e){const n=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,r),s=await this.parseImagesAsync(e.images),a=this.parseTextures(e.textures,s),o=this.parseMaterials(e.materials,a),l=this.parseObject(e.object,i,o,a,n),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),this.bindLightTargets(l),l}parseShapes(e){const n={};if(e!==void 0)for(let r=0,i=e.length;r<i;r++){const s=new Dh().fromJSON(e[r]);n[s.uuid]=s}return n}parseSkeletons(e,n){const r={},i={};if(n.traverse(function(s){s.isBone&&(i[s.uuid]=s)}),e!==void 0)for(let s=0,a=e.length;s<a;s++){const o=new Fd().fromJSON(e[s],i);r[o.uuid]=o}return r}parseGeometries(e,n){const r={};if(e!==void 0){const i=new wG;for(let s=0,a=e.length;s<a;s++){let o;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":o=i.parse(l);break;default:l.type in lj?o=lj[l.type].fromJSON(l,n):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}o.uuid=l.uuid,l.name!==void 0&&(o.name=l.name),l.userData!==void 0&&(o.userData=l.userData),r[l.uuid]=o}}return r}parseMaterials(e,n){const r={},i={};if(e!==void 0){const s=new CM;s.setTextures(n);for(let a=0,o=e.length;a<o;a++){const l=e[a];r[l.uuid]===void 0&&(r[l.uuid]=s.parse(l)),i[l.uuid]=r[l.uuid]}}return i}parseAnimations(e){const n={};if(e!==void 0)for(let r=0;r<e.length;r++){const i=e[r],s=Gg.parse(i);n[s.uuid]=s}return n}parseImages(e,n){const r=this,i={};let s;function a(l){return r.manager.itemStart(l),s.load(l,function(){r.manager.itemEnd(l)},void 0,function(){r.manager.itemError(l),r.manager.itemEnd(l)})}function o(l){if(typeof l=="string"){const c=l,d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:r.resourcePath+c;return a(d)}else return l.data?{data:Jm(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new ZR(n);s=new Wg(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,d=e.length;c<d;c++){const f=e[c],p=f.url;if(Array.isArray(p)){const y=[];for(let x=0,S=p.length;x<S;x++){const w=p[x],b=o(w);b!==null&&(b instanceof HTMLImageElement?y.push(b):y.push(new Pl(b.data,b.width,b.height)))}i[f.uuid]=new vh(y)}else{const y=o(f.url);i[f.uuid]=new vh(y)}}}return i}async parseImagesAsync(e){const n=this,r={};let i;async function s(a){if(typeof a=="string"){const o=a,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(o)?o:n.resourcePath+o;return await i.loadAsync(l)}else return a.data?{data:Jm(a.type,a.data),width:a.width,height:a.height}:null}if(e!==void 0&&e.length>0){i=new Wg(this.manager),i.setCrossOrigin(this.crossOrigin);for(let a=0,o=e.length;a<o;a++){const l=e[a],c=l.url;if(Array.isArray(c)){const d=[];for(let f=0,p=c.length;f<p;f++){const y=c[f],x=await s(y);x!==null&&(x instanceof HTMLImageElement?d.push(x):d.push(new Pl(x.data,x.width,x.height)))}r[l.uuid]=new vh(d)}else{const d=await s(l.url);r[l.uuid]=new vh(d)}}}return r}parseTextures(e,n){function r(s,a){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),a[s])}const i={};if(e!==void 0)for(let s=0,a=e.length;s<a;s++){const o=e[s];o.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),n[o.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",o.image);const l=n[o.image],c=l.data;let d;Array.isArray(c)?(d=new yx,c.length===6&&(d.needsUpdate=!0)):(c&&c.data?d=new Pl:d=new fr,c&&(d.needsUpdate=!0)),d.source=l,d.uuid=o.uuid,o.name!==void 0&&(d.name=o.name),o.mapping!==void 0&&(d.mapping=r(o.mapping,Yxe)),o.channel!==void 0&&(d.channel=o.channel),o.offset!==void 0&&d.offset.fromArray(o.offset),o.repeat!==void 0&&d.repeat.fromArray(o.repeat),o.center!==void 0&&d.center.fromArray(o.center),o.rotation!==void 0&&(d.rotation=o.rotation),o.wrap!==void 0&&(d.wrapS=r(o.wrap[0],fj),d.wrapT=r(o.wrap[1],fj)),o.format!==void 0&&(d.format=o.format),o.internalFormat!==void 0&&(d.internalFormat=o.internalFormat),o.type!==void 0&&(d.type=o.type),o.colorSpace!==void 0&&(d.colorSpace=o.colorSpace),o.minFilter!==void 0&&(d.minFilter=r(o.minFilter,hj)),o.magFilter!==void 0&&(d.magFilter=r(o.magFilter,hj)),o.anisotropy!==void 0&&(d.anisotropy=o.anisotropy),o.flipY!==void 0&&(d.flipY=o.flipY),o.generateMipmaps!==void 0&&(d.generateMipmaps=o.generateMipmaps),o.premultiplyAlpha!==void 0&&(d.premultiplyAlpha=o.premultiplyAlpha),o.unpackAlignment!==void 0&&(d.unpackAlignment=o.unpackAlignment),o.compareFunction!==void 0&&(d.compareFunction=o.compareFunction),o.userData!==void 0&&(d.userData=o.userData),i[o.uuid]=d}return i}parseObject(e,n,r,i,s){let a;function o(p){return n[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",p),n[p]}function l(p){if(p!==void 0){if(Array.isArray(p)){const y=[];for(let x=0,S=p.length;x<S;x++){const w=p[x];r[w]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",w),y.push(r[w])}return y}return r[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",p),r[p]}}function c(p){return i[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",p),i[p]}let d,f;switch(e.type){case"Scene":a=new jR,e.background!==void 0&&(Number.isInteger(e.background)?a.background=new ut(e.background):a.background=c(e.background)),e.environment!==void 0&&(a.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?a.fog=new cM(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(a.fog=new lM(e.fog.color,e.fog.density)),e.fog.name!==""&&(a.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(a.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(a.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&a.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(a.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&a.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":a=new Cr(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(a.focus=e.focus),e.zoom!==void 0&&(a.zoom=e.zoom),e.filmGauge!==void 0&&(a.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(a.filmOffset=e.filmOffset),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new qc(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(a.zoom=e.zoom),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"AmbientLight":a=new vG(e.color,e.intensity);break;case"DirectionalLight":a=new tN(e.color,e.intensity),a.target=e.target||"";break;case"PointLight":a=new eN(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new yG(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new JR(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),a.target=e.target||"";break;case"HemisphereLight":a=new gG(e.color,e.groundColor,e.intensity);break;case"LightProbe":a=new bG().fromJSON(e);break;case"SkinnedMesh":d=o(e.geometry),f=l(e.material),a=new uM(d,f),e.bindMode!==void 0&&(a.bindMode=e.bindMode),e.bindMatrix!==void 0&&a.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(a.skeleton=e.skeleton);break;case"Mesh":d=o(e.geometry),f=l(e.material),a=new xr(d,f);break;case"InstancedMesh":d=o(e.geometry),f=l(e.material);const p=e.count,y=e.instanceMatrix,x=e.instanceColor;a=new FR(d,f,p),a.instanceMatrix=new Kh(new Float32Array(y.array),16),x!==void 0&&(a.instanceColor=new Kh(new Float32Array(x.array),x.itemSize));break;case"BatchedMesh":d=o(e.geometry),f=l(e.material),a=new G6(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,f),a.geometry=d,a.perObjectFrustumCulled=e.perObjectFrustumCulled,a.sortObjects=e.sortObjects,a._drawRanges=e.drawRanges,a._reservedRanges=e.reservedRanges,a._visibility=e.visibility,a._active=e.active,a._bounds=e.bounds.map(S=>{const w=new os;w.min.fromArray(S.boxMin),w.max.fromArray(S.boxMax);const b=new Hi;return b.radius=S.sphereRadius,b.center.fromArray(S.sphereCenter),{boxInitialized:S.boxInitialized,box:w,sphereInitialized:S.sphereInitialized,sphere:b}}),a._maxInstanceCount=e.maxInstanceCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._geometryCount=e.geometryCount,a._matricesTexture=c(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(a._colorsTexture=c(e.colorsTexture.uuid));break;case"LOD":a=new V6;break;case"Line":a=new zl(o(e.geometry),l(e.material));break;case"LineLoop":a=new zR(o(e.geometry),l(e.material));break;case"LineSegments":a=new na(o(e.geometry),l(e.material));break;case"PointCloud":case"Points":a=new BR(o(e.geometry),l(e.material));break;case"Sprite":a=new H6(l(e.material));break;case"Group":a=new Cs;break;case"Bone":a=new dM;break;default:a=new mn}if(a.uuid=e.uuid,e.name!==void 0&&(a.name=e.name),e.matrix!==void 0?(a.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(e.position!==void 0&&a.position.fromArray(e.position),e.rotation!==void 0&&a.rotation.fromArray(e.rotation),e.quaternion!==void 0&&a.quaternion.fromArray(e.quaternion),e.scale!==void 0&&a.scale.fromArray(e.scale)),e.up!==void 0&&a.up.fromArray(e.up),e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(a.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(a.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(a.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(a.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(a.visible=e.visible),e.frustumCulled!==void 0&&(a.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(a.renderOrder=e.renderOrder),e.userData!==void 0&&(a.userData=e.userData),e.layers!==void 0&&(a.layers.mask=e.layers),e.children!==void 0){const p=e.children;for(let y=0;y<p.length;y++)a.add(this.parseObject(p[y],n,r,i,s))}if(e.animations!==void 0){const p=e.animations;for(let y=0;y<p.length;y++){const x=p[y];a.animations.push(s[x])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(a.autoUpdate=e.autoUpdate);const p=e.levels;for(let y=0;y<p.length;y++){const x=p[y],S=a.getObjectByProperty("uuid",x.object);S!==void 0&&a.addLevel(S,x.distance,x.hysteresis)}}return a}bindSkeletons(e,n){Object.keys(n).length!==0&&e.traverse(function(r){if(r.isSkinnedMesh===!0&&r.skeleton!==void 0){const i=n[r.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",r.skeleton):r.bind(i,r.bindMatrix)}})}bindLightTargets(e){e.traverse(function(n){if(n.isDirectionalLight||n.isSpotLight){const r=n.target,i=e.getObjectByProperty("uuid",r);i!==void 0?n.target=i:n.target=new mn}})}}const Yxe={UVMapping:YS,CubeReflectionMapping:tu,CubeRefractionMapping:Id,EquirectangularReflectionMapping:ky,EquirectangularRefractionMapping:Iy,CubeUVReflectionMapping:ov},fj={RepeatWrapping:Ld,ClampToEdgeWrapping:Sa,MirroredRepeatWrapping:Ug},hj={NearestFilter:ri,NearestMipmapNearestFilter:ZS,NearestMipmapLinearFilter:ph,LinearFilter:Pr,LinearMipmapNearestFilter:cg,LinearMipmapLinearFilter:qa};class SG extends ks{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,n,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Vc.get(e);if(a!==void 0){if(s.manager.itemStart(e),a.then){a.then(c=>{n&&n(c),s.manager.itemEnd(e)}).catch(c=>{i&&i(c)});return}return setTimeout(function(){n&&n(a),s.manager.itemEnd(e)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader;const l=fetch(e,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Vc.add(e,c),n&&n(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),Vc.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Vc.add(e,l),s.manager.itemStart(e)}}let P_;class nN{static getContext(){return P_===void 0&&(P_=new(window.AudioContext||window.webkitAudioContext)),P_}static setContext(e){P_=e}}class Zxe extends ks{constructor(e){super(e)}load(e,n,r,i){const s=this,a=new Wo(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{const c=l.slice(0);nN.getContext().decodeAudioData(c,function(f){n(f)}).catch(o)}catch(c){o(c)}},r,i);function o(l){i?i(l):console.error(l),s.manager.itemError(e)}}}const pj=new Rt,mj=new Rt,Bf=new Rt;class Qxe{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Cr,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Cr,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,Bf.copy(e.projectionMatrix);const i=n.eyeSep/2,s=i*n.near/n.focus,a=n.near*Math.tan(Lh*n.fov*.5)/n.zoom;let o,l;mj.elements[12]=-i,pj.elements[12]=i,o=-a*n.aspect+s,l=a*n.aspect+s,Bf.elements[0]=2*n.near/(l-o),Bf.elements[8]=(l+o)/(l-o),this.cameraL.projectionMatrix.copy(Bf),o=-a*n.aspect-s,l=a*n.aspect-s,Bf.elements[0]=2*n.near/(l-o),Bf.elements[8]=(l+o)/(l-o),this.cameraR.projectionMatrix.copy(Bf)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(mj),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(pj)}}class rN{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=gj(),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=gj();e=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=e}return e}}function gj(){return performance.now()}const Hf=new q,vj=new qt,Jxe=new q,Vf=new q;class ebe extends mn{constructor(){super(),this.type="AudioListener",this.context=nN.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new rN}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(Hf,vj,Jxe),Vf.set(0,0,-1).applyQuaternion(vj),n.positionX){const i=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(Hf.x,i),n.positionY.linearRampToValueAtTime(Hf.y,i),n.positionZ.linearRampToValueAtTime(Hf.z,i),n.forwardX.linearRampToValueAtTime(Vf.x,i),n.forwardY.linearRampToValueAtTime(Vf.y,i),n.forwardZ.linearRampToValueAtTime(Vf.z,i),n.upX.linearRampToValueAtTime(r.x,i),n.upY.linearRampToValueAtTime(r.y,i),n.upZ.linearRampToValueAtTime(r.z,i)}else n.setPosition(Hf.x,Hf.y,Hf.z),n.setOrientation(Vf.x,Vf.y,Vf.z,r.x,r.y,r.z)}}let MG=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;e<n;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,n=this.filters.length;e<n;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}};const Gf=new q,yj=new qt,tbe=new q,Wf=new q;class nbe extends MG{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,n,r){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=n,this.panner.coneOuterGain=r,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Gf,yj,tbe),Wf.set(0,0,1).applyQuaternion(yj);const n=this.panner;if(n.positionX){const r=this.context.currentTime+this.listener.timeDelta;n.positionX.linearRampToValueAtTime(Gf.x,r),n.positionY.linearRampToValueAtTime(Gf.y,r),n.positionZ.linearRampToValueAtTime(Gf.z,r),n.orientationX.linearRampToValueAtTime(Wf.x,r),n.orientationY.linearRampToValueAtTime(Wf.y,r),n.orientationZ.linearRampToValueAtTime(Wf.z,r)}else n.setPosition(Gf.x,Gf.y,Gf.z),n.setOrientation(Wf.x,Wf.y,Wf.z)}}class rbe{constructor(e,n=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=n,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const n=this.getFrequencyData();for(let r=0;r<n.length;r++)e+=n[r];return e/n.length}}class EG{constructor(e,n,r){this.binding=e,this.valueSize=r;let i,s,a;switch(n){case"quaternion":i=this._slerp,s=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(r*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(r*5);break;default:i=this._lerp,s=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(r*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,n){const r=this.buffer,i=this.valueSize,s=e*i+i;let a=this.cumulativeWeight;if(a===0){for(let o=0;o!==i;++o)r[s+o]=r[o];a=n}else{a+=n;const o=n/a;this._mixBufferRegion(r,s,0,o,i)}this.cumulativeWeight=a}accumulateAdditive(e){const n=this.buffer,r=this.valueSize,i=r*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(n,i,0,e,r),this.cumulativeWeightAdditive+=e}apply(e){const n=this.valueSize,r=this.buffer,i=e*n+n,s=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=n*this._origIndex;this._mixBufferRegion(r,i,l,1-s,n)}a>0&&this._mixBufferRegionAdditive(r,i,this._addIndex*n,1,n);for(let l=n,c=n+n;l!==c;++l)if(r[l]!==r[l+n]){o.setValue(r,i);break}}saveOriginalState(){const e=this.binding,n=this.buffer,r=this.valueSize,i=r*this._origIndex;e.getValue(n,i);for(let s=r,a=i;s!==a;++s)n[s]=n[i+s%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,n=e+this.valueSize;for(let r=e;r<n;r++)this.buffer[r]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,n=this._addIndex*this.valueSize;for(let r=0;r<this.valueSize;r++)this.buffer[n+r]=this.buffer[e+r]}_select(e,n,r,i,s){if(i>=.5)for(let a=0;a!==s;++a)e[n+a]=e[r+a]}_slerp(e,n,r,i){qt.slerpFlat(e,n,e,n,e,r,i)}_slerpAdditive(e,n,r,i,s){const a=this._workIndex*s;qt.multiplyQuaternionsFlat(e,a,e,n,e,r),qt.slerpFlat(e,n,e,n,e,a,i)}_lerp(e,n,r,i,s){const a=1-i;for(let o=0;o!==s;++o){const l=n+o;e[l]=e[l]*a+e[r+o]*i}}_lerpAdditive(e,n,r,i,s){for(let a=0;a!==s;++a){const o=n+a;e[o]=e[o]+e[r+a]*i}}}const iN="\\[\\]\\.:\\/",ibe=new RegExp("["+iN+"]","g"),sN="[^"+iN+"]",sbe="[^"+iN.replace("\\.","")+"]",abe=/((?:WC+[\/:])*)/.source.replace("WC",sN),obe=/(WCOD+)?/.source.replace("WCOD",sbe),lbe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",sN),cbe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",sN),ube=new RegExp("^"+abe+obe+lbe+cbe+"$"),dbe=["material","materials","bones","map"];class fbe{constructor(e,n,r){const i=r||Rn.parseTrackName(n);this._targetGroup=e,this._bindings=e.subscribe_(n,i)}getValue(e,n){this.bind();const r=this._targetGroup.nCachedObjects_,i=this._bindings[r];i!==void 0&&i.getValue(e,n)}setValue(e,n){const r=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=r.length;i!==s;++i)r[i].setValue(e,n)}bind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=e.length;n!==r;++n)e[n].bind()}unbind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=e.length;n!==r;++n)e[n].unbind()}}class Rn{constructor(e,n,r){this.path=n,this.parsedPath=r||Rn.parseTrackName(n),this.node=Rn.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,n,r){return e&&e.isAnimationObjectGroup?new Rn.Composite(e,n,r):new Rn(e,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(ibe,"")}static parseTrackName(e){const n=ube.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);dbe.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,n){if(n===void 0||n===""||n==="."||n===-1||n===e.name||n===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(n);if(r!==void 0)return r}if(e.children){const r=function(s){for(let a=0;a<s.length;a++){const o=s[a];if(o.name===n||o.uuid===n)return o;const l=r(o.children);if(l)return l}return null},i=r(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,n){e[n]=this.targetObject[this.propertyName]}_getValue_array(e,n){const r=this.resolvedProperty;for(let i=0,s=r.length;i!==s;++i)e[n++]=r[i]}_getValue_arrayElement(e,n){e[n]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,n){this.resolvedProperty.toArray(e,n)}_setValue_direct(e,n){this.targetObject[this.propertyName]=e[n]}_setValue_direct_setNeedsUpdate(e,n){this.targetObject[this.propertyName]=e[n],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,n){this.targetObject[this.propertyName]=e[n],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,n){const r=this.resolvedProperty;for(let i=0,s=r.length;i!==s;++i)r[i]=e[n++]}_setValue_array_setNeedsUpdate(e,n){const r=this.resolvedProperty;for(let i=0,s=r.length;i!==s;++i)r[i]=e[n++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,n){const r=this.resolvedProperty;for(let i=0,s=r.length;i!==s;++i)r[i]=e[n++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,n){this.resolvedProperty[this.propertyIndex]=e[n]}_setValue_arrayElement_setNeedsUpdate(e,n){this.resolvedProperty[this.propertyIndex]=e[n],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,n){this.resolvedProperty[this.propertyIndex]=e[n],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,n){this.resolvedProperty.fromArray(e,n)}_setValue_fromArray_setNeedsUpdate(e,n){this.resolvedProperty.fromArray(e,n),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,n){this.resolvedProperty.fromArray(e,n),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,n){this.bind(),this.getValue(e,n)}_setValue_unbound(e,n){this.bind(),this.setValue(e,n)}bind(){let e=this.node;const n=this.parsedPath,r=n.objectName,i=n.propertyName;let s=n.propertyIndex;if(e||(e=Rn.findNode(this.rootNode,n.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(r){let c=n.objectIndex;switch(r){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let d=0;d<e.length;d++)if(e[d].name===c){c=d;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[r]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[r]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const a=e[i];if(a===void 0){const c=n.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?o=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Rn.Composite=fbe;Rn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Rn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Rn.prototype.GetterByBindingType=[Rn.prototype._getValue_direct,Rn.prototype._getValue_array,Rn.prototype._getValue_arrayElement,Rn.prototype._getValue_toArray];Rn.prototype.SetterByBindingTypeAndVersioning=[[Rn.prototype._setValue_direct,Rn.prototype._setValue_direct_setNeedsUpdate,Rn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Rn.prototype._setValue_array,Rn.prototype._setValue_array_setNeedsUpdate,Rn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Rn.prototype._setValue_arrayElement,Rn.prototype._setValue_arrayElement_setNeedsUpdate,Rn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Rn.prototype._setValue_fromArray,Rn.prototype._setValue_fromArray_setNeedsUpdate,Rn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class hbe{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Ea(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let r=0,i=arguments.length;r!==i;++r)e[arguments[r].uuid]=r;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}}add(){const e=this._objects,n=this._indicesByUUID,r=this._paths,i=this._parsedPaths,s=this._bindings,a=s.length;let o,l=e.length,c=this.nCachedObjects_;for(let d=0,f=arguments.length;d!==f;++d){const p=arguments[d],y=p.uuid;let x=n[y];if(x===void 0){x=l++,n[y]=x,e.push(p);for(let S=0,w=a;S!==w;++S)s[S].push(new Rn(p,r[S],i[S]))}else if(x<c){o=e[x];const S=--c,w=e[S];n[w.uuid]=x,e[x]=w,n[y]=S,e[S]=p;for(let b=0,M=a;b!==M;++b){const T=s[b],C=T[S];let L=T[x];T[x]=C,L===void 0&&(L=new Rn(p,r[b],i[b])),T[S]=L}}else e[x]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const e=this._objects,n=this._indicesByUUID,r=this._bindings,i=r.length;let s=this.nCachedObjects_;for(let a=0,o=arguments.length;a!==o;++a){const l=arguments[a],c=l.uuid,d=n[c];if(d!==void 0&&d>=s){const f=s++,p=e[f];n[p.uuid]=d,e[d]=p,n[c]=f,e[f]=l;for(let y=0,x=i;y!==x;++y){const S=r[y],w=S[f],b=S[d];S[d]=w,S[f]=b}}}this.nCachedObjects_=s}uncache(){const e=this._objects,n=this._indicesByUUID,r=this._bindings,i=r.length;let s=this.nCachedObjects_,a=e.length;for(let o=0,l=arguments.length;o!==l;++o){const c=arguments[o],d=c.uuid,f=n[d];if(f!==void 0)if(delete n[d],f<s){const p=--s,y=e[p],x=--a,S=e[x];n[y.uuid]=f,e[f]=y,n[S.uuid]=p,e[p]=S,e.pop();for(let w=0,b=i;w!==b;++w){const M=r[w],T=M[p],C=M[x];M[f]=T,M[p]=C,M.pop()}}else{const p=--a,y=e[p];p>0&&(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[p],w.pop()}}}this.nCachedObjects_=s}subscribe_(e,n){const r=this._bindingsIndicesByPath;let i=r[e];const s=this._bindings;if(i!==void 0)return s[i];const a=this._paths,o=this._parsedPaths,l=this._objects,c=l.length,d=this.nCachedObjects_,f=new Array(c);i=s.length,r[e]=i,a.push(e),o.push(n),s.push(f);for(let p=d,y=l.length;p!==y;++p){const x=l[p];f[p]=new Rn(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,a=this._bindings,o=a.length-1,l=a[o],c=e[o];n[c]=r,a[r]=l,a.pop(),s[r]=s[o],s.pop(),i[r]=i[o],i.pop()}}}class AG{constructor(e,n,r=null,i=n.blendMode){this._mixer=e,this._clip=n,this._localRoot=r,this.blendMode=i;const s=n.tracks,a=s.length,o=new Array(a),l={endingStart:mh,endingEnd:mh};for(let c=0;c!==a;++c){const d=s[c].createInterpolant(null);o[c]=d,d.settings=l}this._interpolantSettings=l,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=d6,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,n){return this.loop=e,this.repetitions=n,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,n,r){if(e.fadeOut(n),this.fadeIn(n),r){const i=this._clip.duration,s=e._clip.duration,a=s/i,o=i/s;e.warp(1,a,n),this.warp(o,1,n)}return this}crossFadeTo(e,n,r){return e.crossFadeFrom(this,n,r)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,n,r){const i=this._mixer,s=i.time,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const l=o.parameterPositions,c=o.sampleValues;return l[0]=s,l[1]=s+r,c[0]=e/a,c[1]=n/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,n,r,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*r;l<0||r===0?n=0:(this._startTime=null,n=r*l)}n*=this._updateTimeScale(e);const a=this._updateTime(n),o=this._updateWeight(e);if(o>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case ER:for(let d=0,f=l.length;d!==f;++d)l[d].evaluate(a),c[d].accumulateAdditive(o);break;case iM:default:for(let d=0,f=l.length;d!==f;++d)l[d].evaluate(a),c[d].accumulate(i,o)}}}_updateWeight(e){let n=0;if(this.enabled){n=this.weight;const r=this._weightInterpolant;if(r!==null){const i=r.evaluate(e)[0];n*=i,e>r.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=n,n}_updateTimeScale(e){let n=0;if(!this.paused){n=this.timeScale;const r=this._timeScaleInterpolant;if(r!==null){const i=r.evaluate(e)[0];n*=i,e>r.parameterPositions[1]&&(this.stopWarping(),n===0?this.paused=!0:this.timeScale=n)}}return this._effectiveTimeScale=n,n}_updateTime(e){const n=this._clip.duration,r=this.loop;let i=this.time+e,s=this._loopCount;const a=r===f6;if(e===0)return s===-1?i:a&&(s&1)===1?n-i:i;if(r===u6){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=n)i=n;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=n||i<0){const o=Math.floor(i/n);i-=n*o,s+=Math.abs(o);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?n:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=i;if(a&&(s&1)===1)return n-i}return i}_setEndings(e,n,r){const i=this._interpolantSettings;r?(i.endingStart=gh,i.endingEnd=gh):(e?i.endingStart=this.zeroSlopeAtStart?gh:mh:i.endingStart=Ly,n?i.endingEnd=this.zeroSlopeAtEnd?gh:mh:i.endingEnd=Ly)}_scheduleFading(e,n,r){const i=this._mixer,s=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=s,l[0]=n,o[1]=s+e,l[1]=r,this}}const pbe=new Float32Array(1);class mbe extends Gl{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,n){const r=e._localRoot||this._root,i=e._clip.tracks,s=i.length,a=e._propertyBindings,o=e._interpolants,l=r.uuid,c=this._bindingsByRootAndName;let d=c[l];d===void 0&&(d={},c[l]=d);for(let f=0;f!==s;++f){const p=i[f],y=p.name;let x=d[y];if(x!==void 0)++x.referenceCount,a[f]=x;else{if(x=a[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 EG(Rn.create(r,y,S),p.ValueTypeName,p.getValueSize()),++x.referenceCount,this._addInactiveBinding(x,l,y),a[f]=x}o[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<this._nActiveActions}_addInactiveAction(e,n,r){const i=this._actions,s=this._actionsByClip;let a=s[n];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[n]=a;else{const o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[r]=e}_removeInactiveAction(e){const n=this._actions,r=n[n.length-1],i=e._cacheIndex;r._cacheIndex=i,n[i]=r,n.pop(),e._cacheIndex=null;const s=e._clip.uuid,a=this._actionsByClip,o=a[s],l=o.knownActions,c=l[l.length-1],d=e._byClipCacheIndex;c._byClipCacheIndex=d,l[d]=c,l.pop(),e._byClipCacheIndex=null;const f=o.actionByRoot,p=(e._localRoot||this._root).uuid;delete f[p],l.length===0&&delete a[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const n=e._propertyBindings;for(let r=0,i=n.length;r!==i;++r){const s=n[r];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const n=this._actions,r=e._cacheIndex,i=this._nActiveActions++,s=n[i];e._cacheIndex=i,n[i]=e,s._cacheIndex=r,n[r]=s}_takeBackAction(e){const n=this._actions,r=e._cacheIndex,i=--this._nActiveActions,s=n[i];e._cacheIndex=i,n[i]=e,s._cacheIndex=r,n[r]=s}_addInactiveBinding(e,n,r){const i=this._bindingsByRootAndName,s=this._bindings;let a=i[n];a===void 0&&(a={},i[n]=a),a[r]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const n=this._bindings,r=e.binding,i=r.rootNode.uuid,s=r.path,a=this._bindingsByRootAndName,o=a[i],l=n[n.length-1],c=e._cacheIndex;l._cacheIndex=c,n[c]=l,n.pop(),delete o[s],Object.keys(o).length===0&&delete a[i]}_lendBinding(e){const n=this._bindings,r=e._cacheIndex,i=this._nActiveBindings++,s=n[i];e._cacheIndex=i,n[i]=e,s._cacheIndex=r,n[r]=s}_takeBackBinding(e){const n=this._bindings,r=e._cacheIndex,i=--this._nActiveBindings,s=n[i];e._cacheIndex=i,n[i]=e,s._cacheIndex=r,n[r]=s}_lendControlInterpolant(){const e=this._controlInterpolants,n=this._nActiveControlInterpolants++;let r=e[n];return r===void 0&&(r=new KR(new Float32Array(2),new Float32Array(2),1,pbe),r.__cacheIndex=n,e[n]=r),r}_takeBackControlInterpolant(e){const n=this._controlInterpolants,r=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=n[i];e.__cacheIndex=i,n[i]=e,s.__cacheIndex=r,n[r]=s}clipAction(e,n,r){const i=n||this._root,s=i.uuid;let a=typeof e=="string"?Gg.findByName(i,e):e;const o=a!==null?a.uuid:e,l=this._actionsByClip[o];let c=null;if(r===void 0&&(a!==null?r=a.blendMode:r=iM),l!==void 0){const f=l.actionByRoot[s];if(f!==void 0&&f.blendMode===r)return f;c=l.knownActions[0],a===null&&(a=c._clip)}if(a===null)return null;const d=new AG(this,a,n,r);return this._bindAction(d,c),this._addInactiveAction(d,o,s),d}existingAction(e,n){const r=n||this._root,i=r.uuid,s=typeof e=="string"?Gg.findByName(r,e):e,a=s?s.uuid:e,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[i]||null}stopAllAction(){const e=this._actions,n=this._nActiveActions;for(let r=n-1;r>=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;const n=this._actions,r=this._nActiveActions,i=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let c=0;c!==r;++c)n[c]._update(i,e,s,a);const o=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)o[c].apply(a);return this}setTime(e){this.time=0;for(let n=0;n<this._actions.length;n++)this._actions[n].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const n=this._actions,r=e.uuid,i=this._actionsByClip,s=i[r];if(s!==void 0){const a=s.knownActions;for(let o=0,l=a.length;o!==l;++o){const c=a[o];this._deactivateAction(c);const d=c._cacheIndex,f=n[n.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,f._cacheIndex=d,n[d]=f,n.pop(),this._removeInactiveBindingsForAction(c)}delete i[r]}}uncacheRoot(e){const n=e.uuid,r=this._actionsByClip;for(const a in r){const o=r[a].actionByRoot,l=o[n];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const i=this._bindingsByRootAndName,s=i[n];if(s!==void 0)for(const a in s){const o=s[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,n){const r=this.existingAction(e,n);r!==null&&(this._deactivateAction(r),this._removeInactiveAction(r))}}class aN{constructor(e){this.value=e}clone(){return new aN(this.value.clone===void 0?this.value:this.value.clone())}}let gbe=0;class vbe extends Gl{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:gbe++}),this.name="",this.usage=Uy,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const n=this.uniforms.indexOf(e);return n!==-1&&this.uniforms.splice(n,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const n=e.uniforms;this.uniforms.length=0;for(let r=0,i=n.length;r<i;r++){const s=Array.isArray(n[r])?n[r]:[n[r]];for(let a=0;a<s.length;a++)this.uniforms.push(s[a].clone())}return this}clone(){return new this.constructor().copy(this)}}class ybe extends up{constructor(e,n,r=1){super(e,n),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const n=super.clone(e);return n.meshPerAttribute=this.meshPerAttribute,n}toJSON(e){const n=super.toJSON(e);return n.isInstancedInterleavedBuffer=!0,n.meshPerAttribute=this.meshPerAttribute,n}}class aP{constructor(e,n,r,i,s){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=n,this.itemSize=r,this.elementSize=i,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,n){return this.type=e,this.elementSize=n,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const xj=new Rt;class TG{constructor(e,n,r=0,i=1/0){this.ray=new lp(e,n),this.near=r,this.far=i,this.camera=null,this.layers=new Oh,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,n){this.ray.set(e,n)}setFromCamera(e,n){n.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(n.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(n).sub(this.ray.origin).normalize(),this.camera=n):n.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(n.near+n.far)/(n.near-n.far)).unproject(n),this.ray.direction.set(0,0,-1).transformDirection(n.matrixWorld),this.camera=n):console.error("THREE.Raycaster: Unsupported camera type: "+n.type)}setFromXRController(e){return xj.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(xj),this}intersectObject(e,n=!0,r=[]){return oP(e,this,r,n),r.sort(bj),r}intersectObjects(e,n=!0,r=[]){for(let i=0,s=e.length;i<s;i++)oP(e[i],this,r,n);return r.sort(bj),r}}function bj(t,e){return t.distance-e.distance}function oP(t,e,n,r){let i=!0;if(t.layers.test(e.layers)&&t.raycast(e,n)===!1&&(i=!1),i===!0&&r===!0){const s=t.children;for(let a=0,o=s.length;a<o;a++)oP(s[a],e,n,!0)}}class lP{constructor(e=1,n=0,r=0){return this.radius=e,this.phi=n,this.theta=r,this}set(e,n,r){return this.radius=e,this.phi=n,this.theta=r,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,r){return this.radius=Math.sqrt(e*e+n*n+r*r),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(Tr(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class xbe{constructor(e=1,n=0,r=0){return this.radius=e,this.theta=n,this.y=r,this}set(e,n,r){return this.radius=e,this.theta=n,this.y=r,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,r){return this.radius=Math.sqrt(e*e+r*r),this.theta=Math.atan2(e,r),this.y=n,this}clone(){return new this.constructor().copy(this)}}class oN{constructor(e,n,r,i){oN.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,n,r,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,n=0){for(let r=0;r<4;r++)this.elements[r]=e[r+n];return this}set(e,n,r,i){const s=this.elements;return s[0]=e,s[2]=n,s[1]=r,s[3]=i,this}}const _j=new He;class bbe{constructor(e=new He(1/0,1/0),n=new He(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromPoints(e){this.makeEmpty();for(let n=0,r=e.length;n<r;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const r=_j.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=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,_j).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 wj=new q,R_=new q;class _be{constructor(e=new q,n=new q){this.start=e,this.end=n}set(e,n){return this.start.copy(e),this.end.copy(n),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,n){return this.delta(n).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,n){wj.subVectors(e,this.start),R_.subVectors(this.end,this.start);const r=R_.dot(R_);let s=R_.dot(wj)/r;return n&&(s=Tr(s,0,1)),s}closestPointToPoint(e,n,r){const i=this.closestPointToPointParameter(e,n);return this.delta(r).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const Sj=new q;class wbe extends mn{constructor(e,n){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=n,this.type="SpotLightHelper";const r=new Yt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,o=1,l=32;a<l;a++,o++){const c=a/l*Math.PI*2,d=o/l*Math.PI*2;i.push(Math.cos(c),Math.sin(c),1,Math.cos(d),Math.sin(d),1)}r.setAttribute("position",new Ot(i,3));const s=new $r({fog:!1,toneMapped:!1});this.cone=new na(r,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,n=e*Math.tan(this.light.angle);this.cone.scale.set(n,n,e),Sj.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Sj),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const nd=new q,N_=new Rt,VA=new Rt;class Sbe extends na{constructor(e){const n=CG(e),r=new Yt,i=[],s=[],a=new ut(0,0,1),o=new ut(0,1,0);for(let c=0;c<n.length;c++){const d=n[c];d.parent&&d.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(a.r,a.g,a.b),s.push(o.r,o.g,o.b))}r.setAttribute("position",new Ot(i,3)),r.setAttribute("color",new Ot(s,3));const l=new $r({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(r,l),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=n,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const n=this.bones,r=this.geometry,i=r.getAttribute("position");VA.copy(this.root.matrixWorld).invert();for(let s=0,a=0;s<n.length;s++){const o=n[s];o.parent&&o.parent.isBone&&(N_.multiplyMatrices(VA,o.matrixWorld),nd.setFromMatrixPosition(N_),i.setXYZ(a,nd.x,nd.y,nd.z),N_.multiplyMatrices(VA,o.parent.matrixWorld),nd.setFromMatrixPosition(N_),i.setXYZ(a+1,nd.x,nd.y,nd.z),a+=2)}r.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function CG(t){const e=[];t.isBone===!0&&e.push(t);for(let n=0;n<t.children.length;n++)e.push.apply(e,CG(t.children[n]));return e}class Mbe extends xr{constructor(e,n,r){const i=new wx(n,4,2),s=new Ts({wireframe:!0,fog:!1,toneMapped:!1});super(i,s),this.light=e,this.color=r,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const Ebe=new q,Mj=new ut,Ej=new ut;class Abe extends mn{constructor(e,n,r){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,this.type="HemisphereLightHelper";const i=new _x(n);i.rotateY(Math.PI*.5),this.material=new Ts({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),a=new Float32Array(s.count*3);i.setAttribute("color",new Qt(a,3)),this.add(new xr(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const n=e.geometry.getAttribute("color");Mj.copy(this.light.color),Ej.copy(this.light.groundColor);for(let r=0,i=n.count;r<i;r++){const s=r<i/2?Mj:Ej;n.setXYZ(r,s.r,s.g,s.b)}n.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(Ebe.setFromMatrixPosition(this.light.matrixWorld).negate())}}class Tbe extends na{constructor(e=10,n=10,r=4473924,i=8947848){r=new ut(r),i=new ut(i);const s=n/2,a=e/n,o=e/2,l=[],c=[];for(let p=0,y=0,x=-o;p<=n;p++,x+=a){l.push(-o,0,x,o,0,x),l.push(x,0,-o,x,0,o);const S=p===s?r:i;S.toArray(c,y),y+=3,S.toArray(c,y),y+=3,S.toArray(c,y),y+=3,S.toArray(c,y),y+=3}const d=new Yt;d.setAttribute("position",new Ot(l,3)),d.setAttribute("color",new Ot(c,3));const f=new $r({vertexColors:!0,toneMapped:!1});super(d,f),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class Cbe extends na{constructor(e=10,n=16,r=8,i=64,s=4473924,a=8947848){s=new ut(s),a=new ut(a);const o=[],l=[];if(n>1)for(let f=0;f<n;f++){const p=f/n*(Math.PI*2),y=Math.sin(p)*e,x=Math.cos(p)*e;o.push(0,0,0),o.push(y,0,x);const S=f&1?s:a;l.push(S.r,S.g,S.b),l.push(S.r,S.g,S.b)}for(let f=0;f<r;f++){const p=f&1?s:a,y=e-e/r*f;for(let x=0;x<i;x++){let S=x/i*(Math.PI*2),w=Math.sin(S)*y,b=Math.cos(S)*y;o.push(w,0,b),l.push(p.r,p.g,p.b),S=(x+1)/i*(Math.PI*2),w=Math.sin(S)*y,b=Math.cos(S)*y,o.push(w,0,b),l.push(p.r,p.g,p.b)}}const c=new Yt;c.setAttribute("position",new Ot(o,3)),c.setAttribute("color",new Ot(l,3));const d=new $r({vertexColors:!0,toneMapped:!1});super(c,d),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Aj=new q,k_=new q,Tj=new q;class Pbe extends mn{constructor(e,n,r){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,this.type="DirectionalLightHelper",n===void 0&&(n=1);let i=new Yt;i.setAttribute("position",new Ot([-n,n,0,n,n,0,n,-n,0,-n,-n,0,-n,n,0],3));const s=new $r({fog:!1,toneMapped:!1});this.lightPlane=new zl(i,s),this.add(this.lightPlane),i=new Yt,i.setAttribute("position",new Ot([0,0,0,0,0,1],3)),this.targetLine=new zl(i,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),Aj.setFromMatrixPosition(this.light.matrixWorld),k_.setFromMatrixPosition(this.light.target.matrixWorld),Tj.subVectors(k_,Aj),this.lightPlane.lookAt(k_),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(k_),this.targetLine.scale.z=Tj.length()}}const I_=new q,Sr=new vx;class Rbe extends na{constructor(e){const n=new Yt,r=new $r({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],a={};o("n1","n2"),o("n2","n4"),o("n4","n3"),o("n3","n1"),o("f1","f2"),o("f2","f4"),o("f4","f3"),o("f3","f1"),o("n1","f1"),o("n2","f2"),o("n3","f3"),o("n4","f4"),o("p","n1"),o("p","n2"),o("p","n3"),o("p","n4"),o("u1","u2"),o("u2","u3"),o("u3","u1"),o("c","t"),o("p","c"),o("cn1","cn2"),o("cn3","cn4"),o("cf1","cf2"),o("cf3","cf4");function o(x,S){l(x),l(S)}function l(x){i.push(0,0,0),s.push(0,0,0),a[x]===void 0&&(a[x]=[]),a[x].push(i.length/3-1)}n.setAttribute("position",new Ot(i,3)),n.setAttribute("color",new Ot(s,3)),super(n,r),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();const c=new ut(16755200),d=new ut(16711680),f=new ut(43775),p=new ut(16777215),y=new ut(3355443);this.setColors(c,d,f,p,y)}setColors(e,n,r,i,s){const o=this.geometry.getAttribute("color");o.setXYZ(0,e.r,e.g,e.b),o.setXYZ(1,e.r,e.g,e.b),o.setXYZ(2,e.r,e.g,e.b),o.setXYZ(3,e.r,e.g,e.b),o.setXYZ(4,e.r,e.g,e.b),o.setXYZ(5,e.r,e.g,e.b),o.setXYZ(6,e.r,e.g,e.b),o.setXYZ(7,e.r,e.g,e.b),o.setXYZ(8,e.r,e.g,e.b),o.setXYZ(9,e.r,e.g,e.b),o.setXYZ(10,e.r,e.g,e.b),o.setXYZ(11,e.r,e.g,e.b),o.setXYZ(12,e.r,e.g,e.b),o.setXYZ(13,e.r,e.g,e.b),o.setXYZ(14,e.r,e.g,e.b),o.setXYZ(15,e.r,e.g,e.b),o.setXYZ(16,e.r,e.g,e.b),o.setXYZ(17,e.r,e.g,e.b),o.setXYZ(18,e.r,e.g,e.b),o.setXYZ(19,e.r,e.g,e.b),o.setXYZ(20,e.r,e.g,e.b),o.setXYZ(21,e.r,e.g,e.b),o.setXYZ(22,e.r,e.g,e.b),o.setXYZ(23,e.r,e.g,e.b),o.setXYZ(24,n.r,n.g,n.b),o.setXYZ(25,n.r,n.g,n.b),o.setXYZ(26,n.r,n.g,n.b),o.setXYZ(27,n.r,n.g,n.b),o.setXYZ(28,n.r,n.g,n.b),o.setXYZ(29,n.r,n.g,n.b),o.setXYZ(30,n.r,n.g,n.b),o.setXYZ(31,n.r,n.g,n.b),o.setXYZ(32,r.r,r.g,r.b),o.setXYZ(33,r.r,r.g,r.b),o.setXYZ(34,r.r,r.g,r.b),o.setXYZ(35,r.r,r.g,r.b),o.setXYZ(36,r.r,r.g,r.b),o.setXYZ(37,r.r,r.g,r.b),o.setXYZ(38,i.r,i.g,i.b),o.setXYZ(39,i.r,i.g,i.b),o.setXYZ(40,s.r,s.g,s.b),o.setXYZ(41,s.r,s.g,s.b),o.setXYZ(42,s.r,s.g,s.b),o.setXYZ(43,s.r,s.g,s.b),o.setXYZ(44,s.r,s.g,s.b),o.setXYZ(45,s.r,s.g,s.b),o.setXYZ(46,s.r,s.g,s.b),o.setXYZ(47,s.r,s.g,s.b),o.setXYZ(48,s.r,s.g,s.b),o.setXYZ(49,s.r,s.g,s.b),o.needsUpdate=!0}update(){const e=this.geometry,n=this.pointMap,r=1,i=1;Sr.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Lr("c",n,e,Sr,0,0,-1),Lr("t",n,e,Sr,0,0,1),Lr("n1",n,e,Sr,-r,-i,-1),Lr("n2",n,e,Sr,r,-i,-1),Lr("n3",n,e,Sr,-r,i,-1),Lr("n4",n,e,Sr,r,i,-1),Lr("f1",n,e,Sr,-r,-i,1),Lr("f2",n,e,Sr,r,-i,1),Lr("f3",n,e,Sr,-r,i,1),Lr("f4",n,e,Sr,r,i,1),Lr("u1",n,e,Sr,r*.7,i*1.1,-1),Lr("u2",n,e,Sr,-r*.7,i*1.1,-1),Lr("u3",n,e,Sr,0,i*2,-1),Lr("cf1",n,e,Sr,-r,0,1),Lr("cf2",n,e,Sr,r,0,1),Lr("cf3",n,e,Sr,0,-i,1),Lr("cf4",n,e,Sr,0,i,1),Lr("cn1",n,e,Sr,-r,0,-1),Lr("cn2",n,e,Sr,r,0,-1),Lr("cn3",n,e,Sr,0,-i,-1),Lr("cn4",n,e,Sr,0,i,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Lr(t,e,n,r,i,s,a){I_.set(i,s,a).unproject(r);const o=e[t];if(o!==void 0){const l=n.getAttribute("position");for(let c=0,d=o.length;c<d;c++)l.setXYZ(o[c],I_.x,I_.y,I_.z)}}const L_=new os;class Nbe extends na{constructor(e,n=16776960){const r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),s=new Yt;s.setIndex(new Qt(r,1)),s.setAttribute("position",new Qt(i,3)),super(s,new $r({color:n,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&L_.setFromObject(this.object),L_.isEmpty())return;const n=L_.min,r=L_.max,i=this.geometry.attributes.position,s=i.array;s[0]=r.x,s[1]=r.y,s[2]=r.z,s[3]=n.x,s[4]=r.y,s[5]=r.z,s[6]=n.x,s[7]=n.y,s[8]=r.z,s[9]=r.x,s[10]=n.y,s[11]=r.z,s[12]=r.x,s[13]=r.y,s[14]=n.z,s[15]=n.x,s[16]=r.y,s[17]=n.z,s[18]=n.x,s[19]=n.y,s[20]=n.z,s[21]=r.x,s[22]=n.y,s[23]=n.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,n){return super.copy(e,n),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class kbe extends na{constructor(e,n=16776960){const r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new Yt;s.setIndex(new Qt(r,1)),s.setAttribute("position",new Ot(i,3)),super(s,new $r({color:n,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const n=this.box;n.isEmpty()||(n.getCenter(this.position),n.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class Ibe extends zl{constructor(e,n=1,r=16776960){const i=r,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],a=new Yt;a.setAttribute("position",new Ot(s,3)),a.computeBoundingSphere(),super(a,new $r({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=n;const o=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new Yt;l.setAttribute("position",new Ot(o,3)),l.computeBoundingSphere(),this.add(new xr(l,new Ts({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const Cj=new q;let O_,GA;class Lbe extends mn{constructor(e=new q(0,0,1),n=new q(0,0,0),r=1,i=16776960,s=r*.2,a=s*.2){super(),this.type="ArrowHelper",O_===void 0&&(O_=new Yt,O_.setAttribute("position",new Ot([0,0,0,0,1,0],3)),GA=new dv(0,.5,1,5,1),GA.translate(0,-.5,0)),this.position.copy(n),this.line=new zl(O_,new $r({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new xr(GA,new Ts({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(r,s,a)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Cj.set(e.z,0,-e.x).normalize();const n=Math.acos(e.y);this.quaternion.setFromAxisAngle(Cj,n)}}setLength(e,n=e*.2,r=n*.2){this.line.scale.set(1,Math.max(1e-4,e-n),1),this.line.updateMatrix(),this.cone.scale.set(r,n,r),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class PG extends na{constructor(e=1){const n=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new Yt;i.setAttribute("position",new 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 ut,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(n),i.toArray(s,6),i.toArray(s,9),i.set(r),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Obe{constructor(){this.type="ShapePath",this.color=new ut,this.subPaths=[],this.currentPath=null}moveTo(e,n){return this.currentPath=new By,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,n),this}lineTo(e,n){return this.currentPath.lineTo(e,n),this}quadraticCurveTo(e,n,r,i){return this.currentPath.quadraticCurveTo(e,n,r,i),this}bezierCurveTo(e,n,r,i,s,a){return this.currentPath.bezierCurveTo(e,n,r,i,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function n(b){const M=[];for(let T=0,C=b.length;T<C;T++){const L=b[T],N=new Dh;N.curves=L.curves,M.push(N)}return M}function r(b,M){const T=M.length;let C=!1;for(let L=T-1,N=0;N<T;L=N++){let D=M[L],F=M[N],V=F.x-D.x,I=F.y-D.y;if(Math.abs(I)>Number.EPSILON){if(I<0&&(D=M[N],V=-V,F=M[L],I=-I),b.y<D.y||b.y>F.y)continue;if(b.y===D.y){if(b.x===D.x)return!0}else{const U=I*(b.x-D.x)-V*(b.y-D.y);if(U===0)return!0;if(U<0)continue;C=!C}}else{if(b.y!==D.y)continue;if(F.x<=b.x&&b.x<=D.x||D.x<=b.x&&b.x<=F.x)return!0}}return C}const i=Rl.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,o,l;const c=[];if(s.length===1)return o=s[0],l=new Dh,l.curves=o.curves,c.push(l),c;let d=!i(s[0].getPoints());d=e?!d:d;const f=[],p=[];let y=[],x=0,S;p[x]=void 0,y[x]=[];for(let b=0,M=s.length;b<M;b++)o=s[b],S=o.getPoints(),a=i(S),a=e?!a:a,a?(!d&&p[x]&&x++,p[x]={s:new Dh,p:S},p[x].s.curves=o.curves,d&&x++,y[x]=[]):y[x].push({h:o,p:S[0]});if(!p[0])return n(s);if(p.length>1){let b=!1,M=0;for(let T=0,C=p.length;T<C;T++)f[T]=[];for(let T=0,C=p.length;T<C;T++){const L=y[T];for(let N=0;N<L.length;N++){const D=L[N];let F=!0;for(let V=0;V<p.length;V++)r(D.p,p[V].p)&&(T!==V&&M++,F?(F=!1,f[V].push(D)):b=!0);F&&f[T].push(D)}}M>0&&b===!1&&(y=f)}let w;for(let b=0,M=p.length;b<M;b++){l=p[b].s,c.push(l),w=y[b];for(let T=0,C=w.length;T<C;T++)l.holes.push(w[T].h)}return c}}class Dbe extends Gl{constructor(e,n=null){super(),this.object=e,this.domElement=n,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}class jbe extends Go{constructor(e=1,n=1,r=1,i={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'),super(e,n,{...i,count:r}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:kd}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=kd);const Ube=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:mR,AddEquation:hd,AddOperation:n6,AdditiveAnimationBlendMode:ER,AdditiveBlending:XC,AgXToneMapping:o6,AlphaFormat:xR,AlwaysCompare:S6,AlwaysDepth:dw,AlwaysStencilFunc:ZC,AmbientLight:vG,AnimationAction:AG,AnimationClip:Gg,AnimationLoader:Hxe,AnimationMixer:mbe,AnimationObjectGroup:hbe,AnimationUtils:Uxe,ArcCurve:W6,ArrayCamera:F6,ArrowHelper:Lbe,AttachedBindMode:YC,Audio:MG,AudioAnalyser:rbe,AudioContext:nN,AudioListener:ebe,AudioLoader:Zxe,AxesHelper:PG,BackSide:as,BasicDepthPacking:p6,BasicShadowMap:DV,BatchedMesh:G6,Bone:dM,BooleanKeyframeTrack:dp,Box2:bbe,Box3:os,Box3Helper:kbe,BoxGeometry:cp,BoxHelper:Nbe,BufferAttribute:Qt,BufferGeometry:Yt,BufferGeometryLoader:wG,ByteType:gR,Cache:Vc,Camera:vx,CameraHelper:Rbe,CanvasTexture:lxe,CapsuleGeometry:mM,CatmullRomCurve3:$6,CineonToneMapping:s6,CircleGeometry:gM,ClampToEdgeWrapping:Sa,Clock:rN,Color:ut,ColorKeyframeTrack:YR,ColorManagement:Nn,CompressedArrayTexture:axe,CompressedCubeTexture:oxe,CompressedTexture:hM,CompressedTextureLoader:Vxe,ConeGeometry:vM,ConstantAlphaFactor:JV,ConstantColorFactor:ZV,Controls:Dbe,CubeCamera:N6,CubeReflectionMapping:tu,CubeRefractionMapping:Id,CubeTexture:yx,CubeTextureLoader:Gxe,CubeUVReflectionMapping:ov,CubicBezierCurve:VR,CubicBezierCurve3:X6,CubicInterpolant:dG,CullFaceBack:$C,CullFaceFront:OV,CullFaceFrontBack:Fhe,CullFaceNone:LV,Curve:qo,CurvePath:K6,CustomBlending:jV,CustomToneMapping:a6,CylinderGeometry:dv,Cylindrical:xbe,Data3DTexture:PR,DataArrayTexture:aM,DataTexture:Pl,DataTextureLoader:Wxe,DataUtils:Kpe,DecrementStencilOp:Yhe,DecrementWrapStencilOp:Qhe,DefaultLoadingManager:pG,DepthFormat:Ih,DepthStencilFormat:qh,DepthTexture:LR,DetachedBindMode:c6,DirectionalLight:tN,DirectionalLightHelper:Pbe,DiscreteInterpolant:fG,DisplayP3ColorSpace:sM,DodecahedronGeometry:yM,DoubleSide:_a,DstAlphaFactor:$V,DstColorFactor:qV,DynamicCopyUsage:fpe,DynamicDrawUsage:M6,DynamicReadUsage:cpe,EdgesGeometry:Y6,EllipseCurve:pM,EqualCompare:x6,EqualDepth:hw,EqualStencilFunc:npe,EquirectangularReflectionMapping:ky,EquirectangularRefractionMapping:Iy,Euler:ls,EventDispatcher:Gl,ExtrudeGeometry:bM,FileLoader:Wo,Float16BufferAttribute:tme,Float32BufferAttribute:Ot,FloatType:ea,Fog:cM,FogExp2:lM,FramebufferTexture:sxe,FrontSide:Ul,Frustum:xx,GLBufferAttribute:aP,GLSL1:ppe,GLSL3:QC,GreaterCompare:b6,GreaterDepth:mw,GreaterEqualCompare:w6,GreaterEqualDepth:pw,GreaterEqualStencilFunc:ape,GreaterStencilFunc:ipe,GridHelper:Tbe,Group:Cs,HalfFloatType:lv,HemisphereLight:gG,HemisphereLightHelper:Abe,IcosahedronGeometry:_M,ImageBitmapLoader:SG,ImageLoader:Wg,ImageUtils:T6,IncrementStencilOp:Khe,IncrementWrapStencilOp:Zhe,InstancedBufferAttribute:Kh,InstancedBufferGeometry:_G,InstancedInterleavedBuffer:ybe,InstancedMesh:FR,Int16BufferAttribute:Jpe,Int32BufferAttribute:eme,Int8BufferAttribute:Ype,IntType:QS,InterleavedBuffer:up,InterleavedBufferAttribute:Fl,Interpolant:fv,InterpolateDiscrete:zg,InterpolateLinear:Bg,InterpolateSmooth:Q_,InvertStencilOp:Jhe,KeepStencilOp:nh,KeyframeTrack:Ko,LOD:V6,LatheGeometry:bx,Layers:Oh,LessCompare:y6,LessDepth:fw,LessEqualCompare:TR,LessEqualDepth:$h,LessEqualStencilFunc:rpe,LessStencilFunc:tpe,Light:Bd,LightProbe:bG,Line:zl,Line3:_be,LineBasicMaterial:$r,LineCurve:GR,LineCurve3:q6,LineDashedMaterial:lG,LineLoop:zR,LineSegments:na,LinearDisplayP3ColorSpace:gx,LinearFilter:Pr,LinearInterpolant:KR,LinearMipMapLinearFilter:Vhe,LinearMipMapNearestFilter:Hhe,LinearMipmapLinearFilter:qa,LinearMipmapNearestFilter:cg,LinearSRGBColorSpace:xi,LinearToneMapping:r6,LinearTransfer:Oy,Loader:ks,LoaderUtils:Cd,LoadingManager:ZR,LoopOnce:u6,LoopPingPong:f6,LoopRepeat:d6,LuminanceAlphaFormat:wR,LuminanceFormat:_R,MOUSE:eh,Material:Gr,MaterialLoader:CM,MathUtils:vr,Matrix2:oN,Matrix3:Xt,Matrix4:Rt,MaxEquation:BV,Mesh:xr,MeshBasicMaterial:Ts,MeshDepthMaterial:OR,MeshDistanceMaterial:DR,MeshLambertMaterial:aG,MeshMatcapMaterial:oG,MeshNormalMaterial:sG,MeshPhongMaterial:rG,MeshPhysicalMaterial:no,MeshStandardMaterial:Sx,MeshToonMaterial:iG,MinEquation:zV,MirroredRepeatWrapping:Ug,MixOperation:t6,MultiplyBlending:KC,MultiplyOperation:px,NearestFilter:ri,NearestMipMapLinearFilter:Bhe,NearestMipMapNearestFilter:zhe,NearestMipmapLinearFilter:ph,NearestMipmapNearestFilter:ZS,NeutralToneMapping:l6,NeverCompare:v6,NeverDepth:uw,NeverStencilFunc:epe,NoBlending:Xc,NoColorSpace:Uc,NoToneMapping:Cl,NormalAnimationBlendMode:iM,NormalBlending:kh,NotEqualCompare:_6,NotEqualDepth:gw,NotEqualStencilFunc:spe,NumberKeyframeTrack:Zh,Object3D:mn,ObjectLoader:Kxe,ObjectSpaceNormalMap:g6,OctahedronGeometry:_x,OneFactor:VV,OneMinusConstantAlphaFactor:e6,OneMinusConstantColorFactor:QV,OneMinusDstAlphaFactor:XV,OneMinusDstColorFactor:KV,OneMinusSrcAlphaFactor:cw,OneMinusSrcColorFactor:WV,OrthographicCamera:qc,P3Primaries:jy,PCFShadowMap:KS,PCFSoftShadowMap:ny,PMREMGenerator:JC,Path:By,PerspectiveCamera:Cr,Plane:Lc,PlaneGeometry:cv,PlaneHelper:Ibe,PointLight:eN,PointLightHelper:Mbe,Points:BR,PointsMaterial:fM,PolarGridHelper:Cbe,PolyhedronGeometry:zd,PositionalAudio:nbe,PropertyBinding:Rn,PropertyMixer:EG,QuadraticBezierCurve:WR,QuadraticBezierCurve3:$R,Quaternion:qt,QuaternionKeyframeTrack:Qh,QuaternionLinearInterpolant:hG,RED_GREEN_RGTC2_Format:Bw,RED_RGTC1_Format:MR,REVISION:kd,RGBADepthPacking:m6,RGBAFormat:ss,RGBAIntegerFormat:rM,RGBA_ASTC_10x10_Format:Ow,RGBA_ASTC_10x5_Format:kw,RGBA_ASTC_10x6_Format:Iw,RGBA_ASTC_10x8_Format:Lw,RGBA_ASTC_12x10_Format:Dw,RGBA_ASTC_12x12_Format:jw,RGBA_ASTC_4x4_Format:Mw,RGBA_ASTC_5x4_Format:Ew,RGBA_ASTC_5x5_Format:Aw,RGBA_ASTC_6x5_Format:Tw,RGBA_ASTC_6x6_Format:Cw,RGBA_ASTC_8x5_Format:Pw,RGBA_ASTC_8x6_Format:Rw,RGBA_ASTC_8x8_Format:Nw,RGBA_BPTC_Format:oy,RGBA_ETC2_EAC_Format:Sw,RGBA_PVRTC_2BPPV1_Format:bw,RGBA_PVRTC_4BPPV1_Format:xw,RGBA_S3TC_DXT1_Format:iy,RGBA_S3TC_DXT3_Format:sy,RGBA_S3TC_DXT5_Format:ay,RGBDepthPacking:Whe,RGBFormat:bR,RGBIntegerFormat:Ghe,RGB_BPTC_SIGNED_Format:Uw,RGB_BPTC_UNSIGNED_Format:Fw,RGB_ETC1_Format:_w,RGB_ETC2_Format:ww,RGB_PVRTC_2BPPV1_Format:yw,RGB_PVRTC_4BPPV1_Format:vw,RGB_S3TC_DXT1_Format:ry,RGDepthPacking:$he,RGFormat:SR,RGIntegerFormat:nM,RawShaderMaterial:nG,Ray:lp,Raycaster:TG,Rec709Primaries:Dy,RectAreaLight:yG,RedFormat:tM,RedIntegerFormat:mx,ReinhardToneMapping:i6,RenderTarget:C6,RepeatWrapping:Ld,ReplaceStencilOp:qhe,ReverseSubtractEquation:FV,RingGeometry:wM,SIGNED_RED_GREEN_RGTC2_Format:Hw,SIGNED_RED_RGTC1_Format:zw,SRGBColorSpace:Fi,SRGBTransfer:er,Scene:jR,ShaderChunk:fn,ShaderLib:jo,ShaderMaterial:Qa,ShadowMaterial:tG,Shape:Dh,ShapeGeometry:SM,ShapePath:Obe,ShapeUtils:Rl,ShortType:vR,Skeleton:Fd,SkeletonHelper:Sbe,SkinnedMesh:uM,Source:vh,Sphere:Hi,SphereGeometry:wx,Spherical:lP,SphericalHarmonics3:xG,SplineCurve:XR,SpotLight:JR,SpotLightHelper:wbe,Sprite:H6,SpriteMaterial:UR,SrcAlphaFactor:lw,SrcAlphaSaturateFactor:YV,SrcColorFactor:GV,StaticCopyUsage:dpe,StaticDrawUsage:Uy,StaticReadUsage:lpe,StereoCamera:Qxe,StreamCopyUsage:hpe,StreamDrawUsage:ope,StreamReadUsage:upe,StringKeyframeTrack:fp,SubtractEquation:UV,SubtractiveBlending:qC,TOUCH:th,TangentSpaceNormalMap:uu,TetrahedronGeometry:MM,Texture:fr,TextureLoader:mG,TextureUtils:Uye,TorusGeometry:EM,TorusKnotGeometry:AM,Triangle:Zs,TriangleFanDrawMode:Vw,TriangleStripDrawMode:AR,TrianglesDrawMode:h6,TubeGeometry:TM,UVMapping:YS,Uint16BufferAttribute:RR,Uint32BufferAttribute:NR,Uint8BufferAttribute:Zpe,Uint8ClampedBufferAttribute:Qpe,Uniform:aN,UniformsGroup:vbe,UniformsLib:ht,UniformsUtils:kR,UnsignedByteType:Vo,UnsignedInt248Type:Xh,UnsignedInt5999Type:yR,UnsignedIntType:nu,UnsignedShort4444Type:JS,UnsignedShort5551Type:eM,UnsignedShortType:Fg,VSMShadowMap:Oo,Vector2:He,Vector3:q,Vector4:On,VectorKeyframeTrack:Jh,VideoTexture:ixe,WebGL3DRenderTarget:Fpe,WebGLArrayRenderTarget:Upe,WebGLCoordinateSystem:El,WebGLCubeRenderTarget:k6,WebGLMultipleRenderTargets:jbe,WebGLRenderTarget:Go,WebGLRenderer:z6,WebGLUtils:U6,WebGPUCoordinateSystem:Fy,WireframeGeometry:eG,WrapAroundEnding:Ly,ZeroCurvatureEnding:mh,ZeroFactor:HV,ZeroSlopeEnding:gh,ZeroStencilOp:Xhe,createCanvasElement:A6},Symbol.toStringTag,{value:"Module"}));var WA={exports:{}},rd={};/**
|
||
* @license React
|
||
* react-reconciler-constants.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 Pj;function Fbe(){return Pj||(Pj=1,rd.ConcurrentRoot=1,rd.ContinuousEventPriority=4,rd.DefaultEventPriority=16,rd.DiscreteEventPriority=1,rd.IdleEventPriority=536870912,rd.LegacyRoot=0),rd}var Rj;function zbe(){return Rj||(Rj=1,WA.exports=Fbe()),WA.exports}var ng=zbe();function Bbe(t){let e;const n=new Set,r=(c,d)=>{const f=typeof c=="function"?c(e):c;if(f!==e){const p=e;e=d?f:Object.assign({},e,f),n.forEach(y=>y(e,p))}},i=()=>e,s=(c,d=i,f=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let p=d(e);function y(){const x=d(e);if(!f(p,x)){const S=p;c(p=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 Hbe=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),Nj=Hbe?P.useEffect:P.useLayoutEffect;function Vbe(t){const e=typeof t=="function"?Bbe(t):t,n=(r=e.getState,i=Object.is)=>{const[,s]=P.useReducer(w=>w+1,0),a=e.getState(),o=P.useRef(a),l=P.useRef(r),c=P.useRef(i),d=P.useRef(!1),f=P.useRef();f.current===void 0&&(f.current=r(a));let p,y=!1;(o.current!==a||l.current!==r||c.current!==i||d.current)&&(p=r(a),y=!i(f.current,p)),Nj(()=>{y&&(f.current=p),o.current=a,l.current=r,c.current=i,d.current=!1});const x=P.useRef(a);Nj(()=>{const w=()=>{try{const M=e.getState(),T=l.current(M);c.current(f.current,T)||(o.current=M,f.current=T,s())}catch{d.current=!0,s()}},b=e.subscribe(w);return e.getState()!==x.current&&w(),b},[]);const S=y?p:f.current;return P.useDebugValue(S),S};return Object.assign(n,e),n[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const r=[n,e];return{next(){const i=r.length<=0;return{value:r.shift(),done:i}}}},n}var $A={exports:{}},XA={exports:{}},qA={};/**
|
||
* @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 kj;function Gbe(){return kj||(kj=1,(function(t){function e(B,J){var Z=B.length;B.push(J);e:for(;0<Z;){var G=Z-1>>>1,W=B[G];if(0<i(W,J))B[G]=J,B[Z]=W,Z=G;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var J=B[0],Z=B.pop();if(Z!==J){B[0]=Z;e:for(var G=0,W=B.length,oe=W>>>1;G<oe;){var se=2*(G+1)-1,le=B[se],Me=se+1,Se=B[Me];if(0>i(le,Z))Me<W&&0>i(Se,le)?(B[G]=Se,B[Me]=Z,G=Me):(B[G]=le,B[se]=Z,G=se);else if(Me<W&&0>i(Se,Z))B[G]=Se,B[Me]=Z,G=Me;else break e}}return J}function i(B,J){var Z=B.sortIndex-J.sortIndex;return Z!==0?Z:B.id-J.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();t.unstable_now=function(){return a.now()-o}}var l=[],c=[],d=1,f=null,p=3,y=!1,x=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(B){for(var 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,ee(L);else{var J=n(c);J!==null&&ce(C,J.startTime-B)}}function L(B,J){x=!1,S&&(S=!1,b(F),F=-1),y=!0;var Z=p;try{for(T(J),f=n(l);f!==null&&(!(f.expirationTime>J)||B&&!U());){var G=f.callback;if(typeof G=="function"){f.callback=null,p=f.priorityLevel;var W=G(f.expirationTime<=J);J=t.unstable_now(),typeof W=="function"?f.callback=W:f===n(l)&&r(l),T(J)}else r(l);f=n(l)}if(f!==null)var oe=!0;else{var se=n(c);se!==null&&ce(C,se.startTime-J),oe=!1}return oe}finally{f=null,p=Z,y=!1}}var N=!1,D=null,F=-1,V=5,I=-1;function U(){return!(t.unstable_now()-I<V)}function X(){if(D!==null){var B=t.unstable_now();I=B;var J=!0;try{J=D(!0,B)}finally{J?te():(N=!1,D=null)}}else N=!1}var te;if(typeof M=="function")te=function(){M(X)};else if(typeof MessageChannel<"u"){var re=new MessageChannel,pe=re.port2;re.port1.onmessage=X,te=function(){pe.postMessage(null)}}else te=function(){w(X,0)};function ee(B){D=B,N||(N=!0,te())}function ce(B,J){F=w(function(){B(t.unstable_now())},J)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(B){B.callback=null},t.unstable_continueExecution=function(){x||y||(x=!0,ee(L))},t.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<B?Math.floor(1e3/B):5},t.unstable_getCurrentPriorityLevel=function(){return p},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(B){switch(p){case 1:case 2:case 3:var J=3;break;default:J=p}var Z=p;p=J;try{return B()}finally{p=Z}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(B,J){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var Z=p;p=B;try{return J()}finally{p=Z}},t.unstable_scheduleCallback=function(B,J,Z){var G=t.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?G+Z:G):Z=G,B){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=Z+W,B={id:d++,callback:J,priorityLevel:B,startTime:Z,expirationTime:W,sortIndex:-1},Z>G?(B.sortIndex=Z,e(c,B),n(l)===null&&B===n(c)&&(S?(b(F),F=-1):S=!0,ce(C,Z-G))):(B.sortIndex=W,e(l,B),x||y||(x=!0,ee(L))),B},t.unstable_shouldYield=U,t.unstable_wrapCallback=function(B){var J=p;return function(){var Z=p;p=J;try{return B.apply(this,arguments)}finally{p=Z}}}})(qA)),qA}var Ij;function Wbe(){return Ij||(Ij=1,XA.exports=Gbe()),XA.exports}/**
|
||
* @license React
|
||
* react-reconciler.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 KA,Lj;function $be(){return Lj||(Lj=1,KA=function(e){var n={},r=ep(),i=Wbe(),s=Object.assign;function a(m){for(var v="https://reactjs.org/docs/error-decoder.html?invariant="+m,E=1;E<arguments.length;E++)v+="&args[]="+encodeURIComponent(arguments[E]);return"Minified React error #"+m+"; visit "+v+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var o=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,l=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),y=Symbol.for("react.provider"),x=Symbol.for("react.context"),S=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),b=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),C=Symbol.for("react.offscreen"),L=Symbol.iterator;function N(m){return m===null||typeof m!="object"?null:(m=L&&m[L]||m["@@iterator"],typeof m=="function"?m:null)}function D(m){if(m==null)return null;if(typeof m=="function")return m.displayName||m.name||null;if(typeof m=="string")return m;switch(m){case d:return"Fragment";case c:return"Portal";case p:return"Profiler";case f:return"StrictMode";case w:return"Suspense";case b:return"SuspenseList"}if(typeof m=="object")switch(m.$$typeof){case x:return(m.displayName||"Context")+".Consumer";case y:return(m._context.displayName||"Context")+".Provider";case S:var v=m.render;return m=m.displayName,m||(m=v.displayName||v.name||"",m=m!==""?"ForwardRef("+m+")":"ForwardRef"),m;case M:return v=m.displayName||null,v!==null?v:D(m.type)||"Memo";case T:v=m._payload,m=m._init;try{return D(m(v))}catch{}}return null}function F(m){var v=m.type;switch(m.tag){case 24:return"Cache";case 9:return(v.displayName||"Context")+".Consumer";case 10:return(v._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return m=v.render,m=m.displayName||m.name||"",v.displayName||(m!==""?"ForwardRef("+m+")":"ForwardRef");case 7:return"Fragment";case 5:return v;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return D(v);case 8:return v===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 v=="function")return v.displayName||v.name||null;if(typeof v=="string")return v}return null}function V(m){var v=m,E=m;if(m.alternate)for(;v.return;)v=v.return;else{m=v;do v=m,(v.flags&4098)!==0&&(E=v.return),m=v.return;while(m)}return v.tag===3?E:null}function I(m){if(V(m)!==m)throw Error(a(188))}function U(m){var v=m.alternate;if(!v){if(v=V(m),v===null)throw Error(a(188));return v!==m?null:m}for(var E=m,R=v;;){var O=E.return;if(O===null)break;var z=O.alternate;if(z===null){if(R=O.return,R!==null){E=R;continue}break}if(O.child===z.child){for(z=O.child;z;){if(z===E)return I(O),m;if(z===R)return I(O),v;z=z.sibling}throw Error(a(188))}if(E.return!==R.return)E=O,R=z;else{for(var ie=!1,ye=O.child;ye;){if(ye===E){ie=!0,E=O,R=z;break}if(ye===R){ie=!0,R=O,E=z;break}ye=ye.sibling}if(!ie){for(ye=z.child;ye;){if(ye===E){ie=!0,E=z,R=O;break}if(ye===R){ie=!0,R=z,E=O;break}ye=ye.sibling}if(!ie)throw Error(a(189))}}if(E.alternate!==R)throw Error(a(190))}if(E.tag!==3)throw Error(a(188));return E.stateNode.current===E?m:v}function X(m){return m=U(m),m!==null?te(m):null}function te(m){if(m.tag===5||m.tag===6)return m;for(m=m.child;m!==null;){var v=te(m);if(v!==null)return v;m=m.sibling}return null}function re(m){if(m.tag===5||m.tag===6)return m;for(m=m.child;m!==null;){if(m.tag!==4){var v=re(m);if(v!==null)return v}m=m.sibling}return null}var pe=Array.isArray,ee=e.getPublicInstance,ce=e.getRootHostContext,B=e.getChildHostContext,J=e.prepareForCommit,Z=e.resetAfterCommit,G=e.createInstance,W=e.appendInitialChild,oe=e.finalizeInitialChildren,se=e.prepareUpdate,le=e.shouldSetTextContent,Me=e.createTextInstance,Se=e.scheduleTimeout,$e=e.cancelTimeout,Ee=e.noTimeout,Ge=e.isPrimaryRenderer,Xe=e.supportsMutation,fe=e.supportsPersistence,Q=e.supportsHydration,Ve=e.getInstanceFromNode,Le=e.preparePortalMount,We=e.getCurrentEventPriority,Je=e.detachDeletedInstance,de=e.supportsMicrotasks,De=e.scheduleMicrotask,K=e.supportsTestSelectors,H=e.findFiberRoot,xe=e.getBoundingRect,je=e.getTextContent,Oe=e.isHiddenSubtree,Fe=e.matchAccessibilityRole,xt=e.setFocusIfFocusable,rt=e.setupIntersectionObserver,ft=e.appendChild,zt=e.appendChildToContainer,Ye=e.commitTextUpdate,ne=e.commitMount,tt=e.commitUpdate,Mt=e.insertBefore,vt=e.insertInContainerBefore,Zt=e.removeChild,he=e.removeChildFromContainer,Ke=e.resetTextContent,ue=e.hideInstance,Ze=e.hideTextInstance,Pe=e.unhideInstance,Be=e.unhideTextInstance,at=e.clearContainer,pt=e.cloneInstance,Jt=e.createContainerChildSet,pn=e.appendChildToContainerChildSet,Fn=e.finalizeContainerChildren,en=e.replaceContainerChildren,Vn=e.cloneHiddenInstance,pr=e.cloneHiddenTextInstance,Mi=e.canHydrateInstance,ro=e.canHydrateTextInstance,Ei=e.canHydrateSuspenseInstance,Yo=e.isSuspenseInstancePending,Is=e.isSuspenseInstanceFallback,io=e.registerSuspenseInstanceRetry,Ai=e.getNextHydratableSibling,Ca=e.getFirstHydratableChild,so=e.getFirstHydratableChildWithinContainer,du=e.getFirstHydratableChildWithinSuspenseInstance,fu=e.hydrateInstance,Pa=e.hydrateTextInstance,hu=e.hydrateSuspenseInstance,Wl=e.getNextHydratableInstanceAfterSuspenseInstance,Y=e.commitHydratedContainer,be=e.commitHydratedSuspenseInstance,Te=e.clearSuspenseBoundary,Ne=e.clearSuspenseBoundaryFromContainer,we=e.shouldDeleteUnhydratedTailInstances,it=e.didNotMatchHydratedContainerTextInstance,yt=e.didNotMatchHydratedTextInstance,ct;function Et(m){if(ct===void 0)try{throw Error()}catch(E){var v=E.stack.trim().match(/\n( *(at )?)/);ct=v&&v[1]||""}return`
|
||
`+ct+m}var Ut=!1;function Ht(m,v){if(!m||Ut)return"";Ut=!0;var E=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(v)if(v=function(){throw Error()},Object.defineProperty(v.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(v,[])}catch(st){var R=st}Reflect.construct(m,[],v)}else{try{v.call()}catch(st){R=st}m.call(v.prototype)}else{try{throw Error()}catch(st){R=st}m()}}catch(st){if(st&&R&&typeof st.stack=="string"){for(var O=st.stack.split(`
|
||
`),z=R.stack.split(`
|
||
`),ie=O.length-1,ye=z.length-1;1<=ie&&0<=ye&&O[ie]!==z[ye];)ye--;for(;1<=ie&&0<=ye;ie--,ye--)if(O[ie]!==z[ye]){if(ie!==1||ye!==1)do if(ie--,ye--,0>ye||O[ie]!==z[ye]){var ze=`
|
||
`+O[ie].replace(" at new "," at ");return m.displayName&&ze.includes("<anonymous>")&&(ze=ze.replace("<anonymous>",m.displayName)),ze}while(1<=ie&&0<=ye);break}}}finally{Ut=!1,Error.prepareStackTrace=E}return(m=m?m.displayName||m.name:"")?Et(m):""}var Nt=Object.prototype.hasOwnProperty,Sn=[],Mn=-1;function yn(m){return{current:m}}function Kt(m){0>Mn||(m.current=Sn[Mn],Sn[Mn]=null,Mn--)}function jt(m,v){Mn++,Sn[Mn]=m.current,m.current=v}var mt={},xn=yn(mt),tn=yn(!1),Rr=mt;function li(m,v){var E=m.type.contextTypes;if(!E)return mt;var R=m.stateNode;if(R&&R.__reactInternalMemoizedUnmaskedChildContext===v)return R.__reactInternalMemoizedMaskedChildContext;var O={},z;for(z in E)O[z]=v[z];return R&&(m=m.stateNode,m.__reactInternalMemoizedUnmaskedChildContext=v,m.__reactInternalMemoizedMaskedChildContext=O),O}function In(m){return m=m.childContextTypes,m!=null}function Ls(){Kt(tn),Kt(xn)}function Gn(m,v,E){if(xn.current!==mt)throw Error(a(168));jt(xn,v),jt(tn,E)}function ra(m,v,E){var R=m.stateNode;if(v=v.childContextTypes,typeof R.getChildContext!="function")return E;R=R.getChildContext();for(var O in R)if(!(O in v))throw Error(a(108,F(m)||"Unknown",O));return s({},E,R)}function Zo(m){return m=(m=m.stateNode)&&m.__reactInternalMemoizedMergedChildContext||mt,Rr=xn.current,jt(xn,m),jt(tn,tn.current),!0}function Xr(m,v,E){var R=m.stateNode;if(!R)throw Error(a(169));E?(m=ra(m,v,Rr),R.__reactInternalMemoizedMergedChildContext=m,Kt(tn),Kt(xn),jt(xn,m)):Kt(tn),jt(tn,E)}var ci=Math.clz32?Math.clz32:PM,Hd=Math.log,Qo=Math.LN2;function PM(m){return m>>>=0,m===0?32:31-(Hd(m)/Qo|0)|0}var pu=64,Cn=4194304;function mu(m){switch(m&-m){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return m&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return m&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return m}}function Vd(m,v){var E=m.pendingLanes;if(E===0)return 0;var R=0,O=m.suspendedLanes,z=m.pingedLanes,ie=E&268435455;if(ie!==0){var ye=ie&~O;ye!==0?R=mu(ye):(z&=ie,z!==0&&(R=mu(z)))}else ie=E&~O,ie!==0?R=mu(ie):z!==0&&(R=mu(z));if(R===0)return 0;if(v!==0&&v!==R&&(v&O)===0&&(O=R&-R,z=v&-v,O>=z||O===16&&(z&4194240)!==0))return v;if((R&4)!==0&&(R|=E&16),v=m.entangledLanes,v!==0)for(m=m.entanglements,v&=R;0<v;)E=31-ci(v),O=1<<E,R|=m[E],v&=~O;return R}function hv(m,v){switch(m){case 1:case 2:case 4:return v+250;case 8:case 16:case 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 v+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ex(m,v){for(var E=m.suspendedLanes,R=m.pingedLanes,O=m.expirationTimes,z=m.pendingLanes;0<z;){var ie=31-ci(z),ye=1<<ie,ze=O[ie];ze===-1?((ye&E)===0||(ye&R)!==0)&&(O[ie]=hv(ye,v)):ze<=v&&(m.expiredLanes|=ye),z&=~ye}}function hp(m){return m=m.pendingLanes&-1073741825,m!==0?m:m&1073741824?1073741824:0}function pp(m){for(var v=[],E=0;31>E;E++)v.push(m);return v}function $l(m,v,E){m.pendingLanes|=v,v!==536870912&&(m.suspendedLanes=0,m.pingedLanes=0),m=m.eventTimes,v=31-ci(v),m[v]=E}function mp(m,v){var E=m.pendingLanes&~v;m.pendingLanes=v,m.suspendedLanes=0,m.pingedLanes=0,m.expiredLanes&=v,m.mutableReadLanes&=v,m.entangledLanes&=v,v=m.entanglements;var R=m.eventTimes;for(m=m.expirationTimes;0<E;){var O=31-ci(E),z=1<<O;v[O]=0,R[O]=-1,m[O]=-1,E&=~z}}function Ra(m,v){var E=m.entangledLanes|=v;for(m=m.entanglements;E;){var R=31-ci(E),O=1<<R;O&v|m[R]&v&&(m[R]|=v),E&=~O}}var un=0;function ao(m){return m&=-m,1<m?4<m?(m&268435455)!==0?16:536870912:4:1}var Xl=i.unstable_scheduleCallback,gu=i.unstable_cancelCallback,Jo=i.unstable_shouldYield,RM=i.unstable_requestPaint,Nr=i.unstable_now,ql=i.unstable_ImmediatePriority,NM=i.unstable_UserBlockingPriority,gp=i.unstable_NormalPriority,vp=i.unstable_IdlePriority,Gd=null,Na=null;function Wd(m){if(Na&&typeof Na.onCommitFiberRoot=="function")try{Na.onCommitFiberRoot(Gd,m,void 0,(m.current.flags&128)===128)}catch{}}function $d(m,v){return m===v&&(m!==0||1/m===1/v)||m!==m&&v!==v}var Ti=typeof Object.is=="function"?Object.is:$d,Os=null,yp=!1,pv=!1;function xp(m){Os===null?Os=[m]:Os.push(m)}function bp(m){yp=!0,xp(m)}function Ds(){if(!pv&&Os!==null){pv=!0;var m=0,v=un;try{var E=Os;for(un=1;m<E.length;m++){var R=E[m];do R=R(!0);while(R!==null)}Os=null,yp=!1}catch(O){throw Os!==null&&(Os=Os.slice(m+1)),Xl(ql,Ds),O}finally{un=v,pv=!1}}return null}var Ax=o.ReactCurrentBatchConfig;function ia(m,v){if(Ti(m,v))return!0;if(typeof m!="object"||m===null||typeof v!="object"||v===null)return!1;var E=Object.keys(m),R=Object.keys(v);if(E.length!==R.length)return!1;for(R=0;R<E.length;R++){var O=E[R];if(!Nt.call(v,O)||!Ti(m[O],v[O]))return!1}return!0}function mv(m){switch(m.tag){case 5:return Et(m.type);case 16:return Et("Lazy");case 13:return Et("Suspense");case 19:return Et("SuspenseList");case 0:case 2:case 15:return m=Ht(m.type,!1),m;case 11:return m=Ht(m.type.render,!1),m;case 1:return m=Ht(m.type,!0),m;default:return""}}function $i(m,v){if(m&&m.defaultProps){v=s({},v),m=m.defaultProps;for(var E in m)v[E]===void 0&&(v[E]=m[E]);return v}return v}var Xd=yn(null),Kl=null,oo=null,_p=null;function Ci(){_p=oo=Kl=null}function Yl(m,v,E){Ge?(jt(Xd,v._currentValue),v._currentValue=E):(jt(Xd,v._currentValue2),v._currentValue2=E)}function qd(m){var v=Xd.current;Kt(Xd),Ge?m._currentValue=v:m._currentValue2=v}function Zl(m,v,E){for(;m!==null;){var R=m.alternate;if((m.childLanes&v)!==v?(m.childLanes|=v,R!==null&&(R.childLanes|=v)):R!==null&&(R.childLanes&v)!==v&&(R.childLanes|=v),m===E)break;m=m.return}}function vu(m,v){Kl=m,_p=oo=null,m=m.dependencies,m!==null&&m.firstContext!==null&&((m.lanes&v)!==0&&(Fr=!0),m.firstContext=null)}function Xi(m){var v=Ge?m._currentValue:m._currentValue2;if(_p!==m)if(m={context:m,memoizedValue:v,next:null},oo===null){if(Kl===null)throw Error(a(308));oo=m,Kl.dependencies={lanes:0,firstContext:m}}else oo=oo.next=m;return v}var js=null,Us=!1;function yu(m){m.updateQueue={baseState:m.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function gv(m,v){m=m.updateQueue,v.updateQueue===m&&(v.updateQueue={baseState:m.baseState,firstBaseUpdate:m.firstBaseUpdate,lastBaseUpdate:m.lastBaseUpdate,shared:m.shared,effects:m.effects})}function lo(m,v){return{eventTime:m,lane:v,tag:0,payload:null,callback:null,next:null}}function el(m,v){var E=m.updateQueue;E!==null&&(E=E.shared,gr!==null&&(m.mode&1)!==0&&(on&2)===0?(m=E.interleaved,m===null?(v.next=v,js===null?js=[E]:js.push(E)):(v.next=m.next,m.next=v),E.interleaved=v):(m=E.pending,m===null?v.next=v:(v.next=m.next,m.next=v),E.pending=v))}function wp(m,v,E){if(v=v.updateQueue,v!==null&&(v=v.shared,(E&4194240)!==0)){var R=v.lanes;R&=m.pendingLanes,E|=R,v.lanes=E,Ra(m,E)}}function Sp(m,v){var E=m.updateQueue,R=m.alternate;if(R!==null&&(R=R.updateQueue,E===R)){var O=null,z=null;if(E=E.firstBaseUpdate,E!==null){do{var ie={eventTime:E.eventTime,lane:E.lane,tag:E.tag,payload:E.payload,callback:E.callback,next:null};z===null?O=z=ie:z=z.next=ie,E=E.next}while(E!==null);z===null?O=z=v:z=z.next=v}else O=z=v;E={baseState:R.baseState,firstBaseUpdate:O,lastBaseUpdate:z,shared:R.shared,effects:R.effects},m.updateQueue=E;return}m=E.lastBaseUpdate,m===null?E.firstBaseUpdate=v:m.next=v,E.lastBaseUpdate=v}function Mp(m,v,E,R){var O=m.updateQueue;Us=!1;var z=O.firstBaseUpdate,ie=O.lastBaseUpdate,ye=O.shared.pending;if(ye!==null){O.shared.pending=null;var ze=ye,st=ze.next;ze.next=null,ie===null?z=st:ie.next=st,ie=ze;var St=m.alternate;St!==null&&(St=St.updateQueue,ye=St.lastBaseUpdate,ye!==ie&&(ye===null?St.firstBaseUpdate=st:ye.next=st,St.lastBaseUpdate=ze))}if(z!==null){var rn=O.baseState;ie=0,St=st=ze=null,ye=z;do{var Bt=ye.lane,ln=ye.eventTime;if((R&Bt)===Bt){St!==null&&(St=St.next={eventTime:ln,lane:0,tag:ye.tag,payload:ye.payload,callback:ye.callback,next:null});e:{var bt=m,Jr=ye;switch(Bt=v,ln=E,Jr.tag){case 1:if(bt=Jr.payload,typeof bt=="function"){rn=bt.call(ln,rn,Bt);break e}rn=bt;break e;case 3:bt.flags=bt.flags&-65537|128;case 0:if(bt=Jr.payload,Bt=typeof bt=="function"?bt.call(ln,rn,Bt):bt,Bt==null)break e;rn=s({},rn,Bt);break e;case 2:Us=!0}}ye.callback!==null&&ye.lane!==0&&(m.flags|=64,Bt=O.effects,Bt===null?O.effects=[ye]:Bt.push(ye))}else ln={eventTime:ln,lane:Bt,tag:ye.tag,payload:ye.payload,callback:ye.callback,next:null},St===null?(st=St=ln,ze=rn):St=St.next=ln,ie|=Bt;if(ye=ye.next,ye===null){if(ye=O.shared.pending,ye===null)break;Bt=ye,ye=Bt.next,Bt.next=null,O.lastBaseUpdate=Bt,O.shared.pending=null}}while(!0);if(St===null&&(ze=rn),O.baseState=ze,O.firstBaseUpdate=st,O.lastBaseUpdate=St,v=O.shared.interleaved,v!==null){O=v;do ie|=O.lane,O=O.next;while(O!==v)}else z===null&&(O.shared.lanes=0);Oa|=ie,m.lanes=ie,m.memoizedState=rn}}function Tx(m,v,E){if(m=v.effects,v.effects=null,m!==null)for(v=0;v<m.length;v++){var R=m[v],O=R.callback;if(O!==null){if(R.callback=null,R=E,typeof O!="function")throw Error(a(191,O));O.call(R)}}}var Cx=new r.Component().refs;function vv(m,v,E,R){v=m.memoizedState,E=E(R,v),E=E==null?v:s({},v,E),m.memoizedState=E,m.lanes===0&&(m.updateQueue.baseState=E)}var Ep={isMounted:function(m){return(m=m._reactInternals)?V(m)===m:!1},enqueueSetState:function(m,v,E){m=m._reactInternals;var R=Pn(),O=da(m),z=lo(R,O);z.payload=v,E!=null&&(z.callback=E),el(m,z),v=fi(m,O,R),v!==null&&wp(v,m,O)},enqueueReplaceState:function(m,v,E){m=m._reactInternals;var R=Pn(),O=da(m),z=lo(R,O);z.tag=1,z.payload=v,E!=null&&(z.callback=E),el(m,z),v=fi(m,O,R),v!==null&&wp(v,m,O)},enqueueForceUpdate:function(m,v){m=m._reactInternals;var E=Pn(),R=da(m),O=lo(E,R);O.tag=2,v!=null&&(O.callback=v),el(m,O),v=fi(m,R,E),v!==null&&wp(v,m,R)}};function yv(m,v,E,R,O,z,ie){return m=m.stateNode,typeof m.shouldComponentUpdate=="function"?m.shouldComponentUpdate(R,z,ie):v.prototype&&v.prototype.isPureReactComponent?!ia(E,R)||!ia(O,z):!0}function Px(m,v,E){var R=!1,O=mt,z=v.contextType;return typeof z=="object"&&z!==null?z=Xi(z):(O=In(v)?Rr:xn.current,R=v.contextTypes,z=(R=R!=null)?li(m,O):mt),v=new v(E,z),m.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=Ep,m.stateNode=v,v._reactInternals=m,R&&(m=m.stateNode,m.__reactInternalMemoizedUnmaskedChildContext=O,m.__reactInternalMemoizedMaskedChildContext=z),v}function Rx(m,v,E,R){m=v.state,typeof v.componentWillReceiveProps=="function"&&v.componentWillReceiveProps(E,R),typeof v.UNSAFE_componentWillReceiveProps=="function"&&v.UNSAFE_componentWillReceiveProps(E,R),v.state!==m&&Ep.enqueueReplaceState(v,v.state,null)}function xv(m,v,E,R){var O=m.stateNode;O.props=E,O.state=m.memoizedState,O.refs=Cx,yu(m);var z=v.contextType;typeof z=="object"&&z!==null?O.context=Xi(z):(z=In(v)?Rr:xn.current,O.context=li(m,z)),O.state=m.memoizedState,z=v.getDerivedStateFromProps,typeof z=="function"&&(vv(m,v,z,E),O.state=m.memoizedState),typeof v.getDerivedStateFromProps=="function"||typeof O.getSnapshotBeforeUpdate=="function"||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(v=O.state,typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount(),v!==O.state&&Ep.enqueueReplaceState(O,O.state,null),Mp(m,E,O,R),O.state=m.memoizedState),typeof O.componentDidMount=="function"&&(m.flags|=4194308)}var xu=[],tl=0,Ap=null,Tp=0,Fs=[],us=0,Ql=null,co=1,uo="";function Jl(m,v){xu[tl++]=Tp,xu[tl++]=Ap,Ap=m,Tp=v}function Nx(m,v,E){Fs[us++]=co,Fs[us++]=uo,Fs[us++]=Ql,Ql=m;var R=co;m=uo;var O=32-ci(R)-1;R&=~(1<<O),E+=1;var z=32-ci(v)+O;if(30<z){var ie=O-O%5;z=(R&(1<<ie)-1).toString(32),R>>=ie,O-=ie,co=1<<32-ci(v)+O|E<<O|R,uo=z+m}else co=1<<z|E<<O|R,uo=m}function bv(m){m.return!==null&&(Jl(m,1),Nx(m,1,0))}function _v(m){for(;m===Ap;)Ap=xu[--tl],xu[tl]=null,Tp=xu[--tl],xu[tl]=null;for(;m===Ql;)Ql=Fs[--us],Fs[us]=null,uo=Fs[--us],Fs[us]=null,co=Fs[--us],Fs[us]=null}var Pi=null,qr=null,Qn=!1,bu=!1,zs=null;function wv(m,v){var E=vs(5,null,null,0);E.elementType="DELETED",E.stateNode=v,E.return=m,v=m.deletions,v===null?(m.deletions=[E],m.flags|=16):v.push(E)}function Sv(m,v){switch(m.tag){case 5:return v=Mi(v,m.type,m.pendingProps),v!==null?(m.stateNode=v,Pi=m,qr=Ca(v),!0):!1;case 6:return v=ro(v,m.pendingProps),v!==null?(m.stateNode=v,Pi=m,qr=null,!0):!1;case 13:if(v=Ei(v),v!==null){var E=Ql!==null?{id:co,overflow:uo}:null;return m.memoizedState={dehydrated:v,treeContext:E,retryLane:1073741824},E=vs(18,null,null,0),E.stateNode=v,E.return=m,m.child=E,Pi=m,qr=null,!0}return!1;default:return!1}}function Cp(m){return(m.mode&1)!==0&&(m.flags&128)===0}function nl(m){if(Qn){var v=qr;if(v){var E=v;if(!Sv(m,v)){if(Cp(m))throw Error(a(418));v=Ai(E);var R=Pi;v&&Sv(m,v)?wv(R,E):(m.flags=m.flags&-4097|2,Qn=!1,Pi=m)}}else{if(Cp(m))throw Error(a(418));m.flags=m.flags&-4097|2,Qn=!1,Pi=m}}}function kx(m){for(m=m.return;m!==null&&m.tag!==5&&m.tag!==3&&m.tag!==13;)m=m.return;Pi=m}function Kd(m){if(!Q||m!==Pi)return!1;if(!Qn)return kx(m),Qn=!0,!1;if(m.tag!==3&&(m.tag!==5||we(m.type)&&!le(m.type,m.memoizedProps))){var v=qr;if(v){if(Cp(m)){for(m=qr;m;)m=Ai(m);throw Error(a(418))}for(;v;)wv(m,v),v=Ai(v)}}if(kx(m),m.tag===13){if(!Q)throw Error(a(316));if(m=m.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(a(317));qr=Wl(m)}else qr=Pi?Ai(m.stateNode):null;return!0}function _u(){Q&&(qr=Pi=null,bu=Qn=!1)}function Pp(m){zs===null?zs=[m]:zs.push(m)}function wu(m,v,E){if(m=E.ref,m!==null&&typeof m!="function"&&typeof m!="object"){if(E._owner){if(E=E._owner,E){if(E.tag!==1)throw Error(a(309));var R=E.stateNode}if(!R)throw Error(a(147,m));var O=R,z=""+m;return v!==null&&v.ref!==null&&typeof v.ref=="function"&&v.ref._stringRef===z?v.ref:(v=function(ie){var ye=O.refs;ye===Cx&&(ye=O.refs={}),ie===null?delete ye[z]:ye[z]=ie},v._stringRef=z,v)}if(typeof m!="string")throw Error(a(284));if(!E._owner)throw Error(a(290,m))}return m}function rl(m,v){throw m=Object.prototype.toString.call(v),Error(a(31,m==="[object Object]"?"object with keys {"+Object.keys(v).join(", ")+"}":m))}function Su(m){var v=m._init;return v(m._payload)}function Ix(m){function v(Re,_e){if(m){var Ue=Re.deletions;Ue===null?(Re.deletions=[_e],Re.flags|=16):Ue.push(_e)}}function E(Re,_e){if(!m)return null;for(;_e!==null;)v(Re,_e),_e=_e.sibling;return null}function R(Re,_e){for(Re=new Map;_e!==null;)_e.key!==null?Re.set(_e.key,_e):Re.set(_e.index,_e),_e=_e.sibling;return Re}function O(Re,_e){return Re=Eo(Re,_e),Re.index=0,Re.sibling=null,Re}function z(Re,_e,Ue){return Re.index=Ue,m?(Ue=Re.alternate,Ue!==null?(Ue=Ue.index,Ue<_e?(Re.flags|=2,_e):Ue):(Re.flags|=2,_e)):(Re.flags|=1048576,_e)}function ie(Re){return m&&Re.alternate===null&&(Re.flags|=2),Re}function ye(Re,_e,Ue,gt){return _e===null||_e.tag!==6?(_e=nm(Ue,Re.mode,gt),_e.return=Re,_e):(_e=O(_e,Ue),_e.return=Re,_e)}function ze(Re,_e,Ue,gt){var Lt=Ue.type;return Lt===d?St(Re,_e,Ue.props.children,gt,Ue.key):_e!==null&&(_e.elementType===Lt||typeof Lt=="object"&&Lt!==null&&Lt.$$typeof===T&&Su(Lt)===_e.type)?(gt=O(_e,Ue.props),gt.ref=wu(Re,_e,Ue),gt.return=Re,gt):(gt=tm(Ue.type,Ue.key,Ue.props,null,Re.mode,gt),gt.ref=wu(Re,_e,Ue),gt.return=Re,gt)}function st(Re,_e,Ue,gt){return _e===null||_e.tag!==4||_e.stateNode.containerInfo!==Ue.containerInfo||_e.stateNode.implementation!==Ue.implementation?(_e=rm(Ue,Re.mode,gt),_e.return=Re,_e):(_e=O(_e,Ue.children||[]),_e.return=Re,_e)}function St(Re,_e,Ue,gt,Lt){return _e===null||_e.tag!==7?(_e=_c(Ue,Re.mode,gt,Lt),_e.return=Re,_e):(_e=O(_e,Ue),_e.return=Re,_e)}function rn(Re,_e,Ue){if(typeof _e=="string"&&_e!==""||typeof _e=="number")return _e=nm(""+_e,Re.mode,Ue),_e.return=Re,_e;if(typeof _e=="object"&&_e!==null){switch(_e.$$typeof){case l:return Ue=tm(_e.type,_e.key,_e.props,null,Re.mode,Ue),Ue.ref=wu(Re,null,_e),Ue.return=Re,Ue;case c:return _e=rm(_e,Re.mode,Ue),_e.return=Re,_e;case T:var gt=_e._init;return rn(Re,gt(_e._payload),Ue)}if(pe(_e)||N(_e))return _e=_c(_e,Re.mode,Ue,null),_e.return=Re,_e;rl(Re,_e)}return null}function Bt(Re,_e,Ue,gt){var Lt=_e!==null?_e.key:null;if(typeof Ue=="string"&&Ue!==""||typeof Ue=="number")return Lt!==null?null:ye(Re,_e,""+Ue,gt);if(typeof Ue=="object"&&Ue!==null){switch(Ue.$$typeof){case l:return Ue.key===Lt?ze(Re,_e,Ue,gt):null;case c:return Ue.key===Lt?st(Re,_e,Ue,gt):null;case T:return Lt=Ue._init,Bt(Re,_e,Lt(Ue._payload),gt)}if(pe(Ue)||N(Ue))return Lt!==null?null:St(Re,_e,Ue,gt,null);rl(Re,Ue)}return null}function ln(Re,_e,Ue,gt,Lt){if(typeof gt=="string"&>!==""||typeof gt=="number")return Re=Re.get(Ue)||null,ye(_e,Re,""+gt,Lt);if(typeof gt=="object"&>!==null){switch(gt.$$typeof){case l:return Re=Re.get(gt.key===null?Ue:gt.key)||null,ze(_e,Re,gt,Lt);case c:return Re=Re.get(gt.key===null?Ue:gt.key)||null,st(_e,Re,gt,Lt);case T:var an=gt._init;return ln(Re,_e,Ue,an(gt._payload),Lt)}if(pe(gt)||N(gt))return Re=Re.get(Ue)||null,St(_e,Re,gt,Lt,null);rl(_e,gt)}return null}function bt(Re,_e,Ue,gt){for(var Lt=null,an=null,sn=_e,En=_e=0,_r=null;sn!==null&&En<Ue.length;En++){sn.index>En?(_r=sn,sn=null):_r=sn.sibling;var bn=Bt(Re,sn,Ue[En],gt);if(bn===null){sn===null&&(sn=_r);break}m&&sn&&bn.alternate===null&&v(Re,sn),_e=z(bn,_e,En),an===null?Lt=bn:an.sibling=bn,an=bn,sn=_r}if(En===Ue.length)return E(Re,sn),Qn&&Jl(Re,En),Lt;if(sn===null){for(;En<Ue.length;En++)sn=rn(Re,Ue[En],gt),sn!==null&&(_e=z(sn,_e,En),an===null?Lt=sn:an.sibling=sn,an=sn);return Qn&&Jl(Re,En),Lt}for(sn=R(Re,sn);En<Ue.length;En++)_r=ln(sn,Re,En,Ue[En],gt),_r!==null&&(m&&_r.alternate!==null&&sn.delete(_r.key===null?En:_r.key),_e=z(_r,_e,En),an===null?Lt=_r:an.sibling=_r,an=_r);return m&&sn.forEach(function(Ao){return v(Re,Ao)}),Qn&&Jl(Re,En),Lt}function Jr(Re,_e,Ue,gt){var Lt=N(Ue);if(typeof Lt!="function")throw Error(a(150));if(Ue=Lt.call(Ue),Ue==null)throw Error(a(151));for(var an=Lt=null,sn=_e,En=_e=0,_r=null,bn=Ue.next();sn!==null&&!bn.done;En++,bn=Ue.next()){sn.index>En?(_r=sn,sn=null):_r=sn.sibling;var Ao=Bt(Re,sn,bn.value,gt);if(Ao===null){sn===null&&(sn=_r);break}m&&sn&&Ao.alternate===null&&v(Re,sn),_e=z(Ao,_e,En),an===null?Lt=Ao:an.sibling=Ao,an=Ao,sn=_r}if(bn.done)return E(Re,sn),Qn&&Jl(Re,En),Lt;if(sn===null){for(;!bn.done;En++,bn=Ue.next())bn=rn(Re,bn.value,gt),bn!==null&&(_e=z(bn,_e,En),an===null?Lt=bn:an.sibling=bn,an=bn);return Qn&&Jl(Re,En),Lt}for(sn=R(Re,sn);!bn.done;En++,bn=Ue.next())bn=ln(sn,Re,En,bn.value,gt),bn!==null&&(m&&bn.alternate!==null&&sn.delete(bn.key===null?En:bn.key),_e=z(bn,_e,En),an===null?Lt=bn:an.sibling=bn,an=bn);return m&&sn.forEach(function(e0){return v(Re,e0)}),Qn&&Jl(Re,En),Lt}function ys(Re,_e,Ue,gt){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 Lt=Ue.key,an=_e;an!==null;){if(an.key===Lt){if(Lt=Ue.type,Lt===d){if(an.tag===7){E(Re,an.sibling),_e=O(an,Ue.props.children),_e.return=Re,Re=_e;break e}}else if(an.elementType===Lt||typeof Lt=="object"&&Lt!==null&&Lt.$$typeof===T&&Su(Lt)===an.type){E(Re,an.sibling),_e=O(an,Ue.props),_e.ref=wu(Re,an,Ue),_e.return=Re,Re=_e;break e}E(Re,an);break}else v(Re,an);an=an.sibling}Ue.type===d?(_e=_c(Ue.props.children,Re.mode,gt,Ue.key),_e.return=Re,Re=_e):(gt=tm(Ue.type,Ue.key,Ue.props,null,Re.mode,gt),gt.ref=wu(Re,_e,Ue),gt.return=Re,Re=gt)}return ie(Re);case c:e:{for(an=Ue.key;_e!==null;){if(_e.key===an)if(_e.tag===4&&_e.stateNode.containerInfo===Ue.containerInfo&&_e.stateNode.implementation===Ue.implementation){E(Re,_e.sibling),_e=O(_e,Ue.children||[]),_e.return=Re,Re=_e;break e}else{E(Re,_e);break}else v(Re,_e);_e=_e.sibling}_e=rm(Ue,Re.mode,gt),_e.return=Re,Re=_e}return ie(Re);case T:return an=Ue._init,ys(Re,_e,an(Ue._payload),gt)}if(pe(Ue))return bt(Re,_e,Ue,gt);if(N(Ue))return Jr(Re,_e,Ue,gt);rl(Re,Ue)}return typeof Ue=="string"&&Ue!==""||typeof Ue=="number"?(Ue=""+Ue,_e!==null&&_e.tag===6?(E(Re,_e.sibling),_e=O(_e,Ue),_e.return=Re,Re=_e):(E(Re,_e),_e=nm(Ue,Re.mode,gt),_e.return=Re,Re=_e),ie(Re)):E(Re,_e)}return ys}var fo=Ix(!0),Lx=Ix(!1),Mu={},qi=yn(Mu),ec=yn(Mu),tc=yn(Mu);function sa(m){if(m===Mu)throw Error(a(174));return m}function Rp(m,v){jt(tc,v),jt(ec,m),jt(qi,Mu),m=ce(v),Kt(qi),jt(qi,m)}function Eu(){Kt(qi),Kt(ec),Kt(tc)}function Ox(m){var v=sa(tc.current),E=sa(qi.current);v=B(E,m.type,v),E!==v&&(jt(ec,m),jt(qi,v))}function Mv(m){ec.current===m&&(Kt(qi),Kt(ec))}var nr=yn(0);function Np(m){for(var v=m;v!==null;){if(v.tag===13){var E=v.memoizedState;if(E!==null&&(E=E.dehydrated,E===null||Yo(E)||Is(E)))return v}else if(v.tag===19&&v.memoizedProps.revealOrder!==void 0){if((v.flags&128)!==0)return v}else if(v.child!==null){v.child.return=v,v=v.child;continue}if(v===m)break;for(;v.sibling===null;){if(v.return===null||v.return===m)return null;v=v.return}v.sibling.return=v.return,v=v.sibling}return null}var ds=[];function nc(){for(var m=0;m<ds.length;m++){var v=ds[m];Ge?v._workInProgressVersionPrimary=null:v._workInProgressVersionSecondary=null}ds.length=0}var Yd=o.ReactCurrentDispatcher,fs=o.ReactCurrentBatchConfig,rc=0,rr=null,Dr=null,jr=null,kp=!1,ka=!1,ic=0,Zd=0;function Ur(){throw Error(a(321))}function Ip(m,v){if(v===null)return!1;for(var E=0;E<v.length&&E<m.length;E++)if(!Ti(m[E],v[E]))return!1;return!0}function Au(m,v,E,R,O,z){if(rc=z,rr=v,v.memoizedState=null,v.updateQueue=null,v.lanes=0,Yd.current=m===null||m.memoizedState===null?Rv:Nv,m=E(R,O),ka){z=0;do{if(ka=!1,ic=0,25<=z)throw Error(a(301));z+=1,jr=Dr=null,v.updateQueue=null,Yd.current=kv,m=E(R,O)}while(ka)}if(Yd.current=Ru,v=Dr!==null&&Dr.next!==null,rc=0,jr=Dr=rr=null,kp=!1,v)throw Error(a(300));return m}function il(){var m=ic!==0;return ic=0,m}function aa(){var m={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jr===null?rr.memoizedState=jr=m:jr=jr.next=m,jr}function oa(){if(Dr===null){var m=rr.alternate;m=m!==null?m.memoizedState:null}else m=Dr.next;var v=jr===null?rr.memoizedState:jr.next;if(v!==null)jr=v,Dr=m;else{if(m===null)throw Error(a(310));Dr=m,m={memoizedState:Dr.memoizedState,baseState:Dr.baseState,baseQueue:Dr.baseQueue,queue:Dr.queue,next:null},jr===null?rr.memoizedState=jr=m:jr=jr.next=m}return jr}function Ia(m,v){return typeof v=="function"?v(m):v}function Qd(m){var v=oa(),E=v.queue;if(E===null)throw Error(a(311));E.lastRenderedReducer=m;var R=Dr,O=R.baseQueue,z=E.pending;if(z!==null){if(O!==null){var ie=O.next;O.next=z.next,z.next=ie}R.baseQueue=O=z,E.pending=null}if(O!==null){z=O.next,R=R.baseState;var ye=ie=null,ze=null,st=z;do{var St=st.lane;if((rc&St)===St)ze!==null&&(ze=ze.next={lane:0,action:st.action,hasEagerState:st.hasEagerState,eagerState:st.eagerState,next:null}),R=st.hasEagerState?st.eagerState:m(R,st.action);else{var rn={lane:St,action:st.action,hasEagerState:st.hasEagerState,eagerState:st.eagerState,next:null};ze===null?(ye=ze=rn,ie=R):ze=ze.next=rn,rr.lanes|=St,Oa|=St}st=st.next}while(st!==null&&st!==z);ze===null?ie=R:ze.next=ye,Ti(R,v.memoizedState)||(Fr=!0),v.memoizedState=R,v.baseState=ie,v.baseQueue=ze,E.lastRenderedState=R}if(m=E.interleaved,m!==null){O=m;do z=O.lane,rr.lanes|=z,Oa|=z,O=O.next;while(O!==m)}else O===null&&(E.lanes=0);return[v.memoizedState,E.dispatch]}function Jd(m){var v=oa(),E=v.queue;if(E===null)throw Error(a(311));E.lastRenderedReducer=m;var R=E.dispatch,O=E.pending,z=v.memoizedState;if(O!==null){E.pending=null;var ie=O=O.next;do z=m(z,ie.action),ie=ie.next;while(ie!==O);Ti(z,v.memoizedState)||(Fr=!0),v.memoizedState=z,v.baseQueue===null&&(v.baseState=z),E.lastRenderedState=z}return[z,R]}function Ev(){}function Av(m,v){var E=rr,R=oa(),O=v(),z=!Ti(R.memoizedState,O);if(z&&(R.memoizedState=O,Fr=!0),R=R.queue,Tu(ho.bind(null,E,R,m),[m]),R.getSnapshot!==v||z||jr!==null&&jr.memoizedState.tag&1){if(E.flags|=2048,tf(9,Cv.bind(null,E,R,O,v),void 0,null),gr===null)throw Error(a(349));(rc&30)!==0||Tv(E,v,O)}return O}function Tv(m,v,E){m.flags|=16384,m={getSnapshot:v,value:E},v=rr.updateQueue,v===null?(v={lastEffect:null,stores:null},rr.updateQueue=v,v.stores=[m]):(E=v.stores,E===null?v.stores=[m]:E.push(m))}function Cv(m,v,E,R){v.value=E,v.getSnapshot=R,Lp(v)&&fi(m,1,-1)}function ho(m,v,E){return E(function(){Lp(v)&&fi(m,1,-1)})}function Lp(m){var v=m.getSnapshot;m=m.value;try{var E=v();return!Ti(m,E)}catch{return!0}}function ef(m){var v=aa();return typeof m=="function"&&(m=m()),v.memoizedState=v.baseState=m,m={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ia,lastRenderedState:m},v.queue=m,m=m.dispatch=kM.bind(null,rr,m),[v.memoizedState,m]}function tf(m,v,E,R){return m={tag:m,create:v,destroy:E,deps:R,next:null},v=rr.updateQueue,v===null?(v={lastEffect:null,stores:null},rr.updateQueue=v,v.lastEffect=m.next=m):(E=v.lastEffect,E===null?v.lastEffect=m.next=m:(R=E.next,E.next=m,m.next=R,v.lastEffect=m)),m}function Dx(){return oa().memoizedState}function sl(m,v,E,R){var O=aa();rr.flags|=m,O.memoizedState=tf(1|v,E,void 0,R===void 0?null:R)}function Op(m,v,E,R){var O=oa();R=R===void 0?null:R;var z=void 0;if(Dr!==null){var ie=Dr.memoizedState;if(z=ie.destroy,R!==null&&Ip(R,ie.deps)){O.memoizedState=tf(v,E,z,R);return}}rr.flags|=m,O.memoizedState=tf(1|v,E,z,R)}function Dp(m,v){return sl(8390656,8,m,v)}function Tu(m,v){return Op(2048,8,m,v)}function $n(m,v){return Op(4,2,m,v)}function jp(m,v){return Op(4,4,m,v)}function nf(m,v){if(typeof v=="function")return m=m(),v(m),function(){v(null)};if(v!=null)return m=m(),v.current=m,function(){v.current=null}}function Cu(m,v,E){return E=E!=null?E.concat([m]):null,Op(4,4,nf.bind(null,v,m),E)}function Up(){}function Fp(m,v){var E=oa();v=v===void 0?null:v;var R=E.memoizedState;return R!==null&&v!==null&&Ip(v,R[1])?R[0]:(E.memoizedState=[m,v],m)}function Pu(m,v){var E=oa();v=v===void 0?null:v;var R=E.memoizedState;return R!==null&&v!==null&&Ip(v,R[1])?R[0]:(m=m(),E.memoizedState=[m,v],m)}function zp(m,v){var E=un;un=E!==0&&4>E?E:4,m(!0);var R=fs.transition;fs.transition={};try{m(!1),v()}finally{un=E,fs.transition=R}}function sc(){return oa().memoizedState}function jx(m,v,E){var R=da(m);E={lane:R,action:E,hasEagerState:!1,eagerState:null,next:null},Ux(m)?Pv(v,E):(rf(m,v,E),E=Pn(),m=fi(m,R,E),m!==null&&sf(m,v,R))}function kM(m,v,E){var R=da(m),O={lane:R,action:E,hasEagerState:!1,eagerState:null,next:null};if(Ux(m))Pv(v,O);else{rf(m,v,O);var z=m.alternate;if(m.lanes===0&&(z===null||z.lanes===0)&&(z=v.lastRenderedReducer,z!==null))try{var ie=v.lastRenderedState,ye=z(ie,E);if(O.hasEagerState=!0,O.eagerState=ye,Ti(ye,ie))return}catch{}finally{}E=Pn(),m=fi(m,R,E),m!==null&&sf(m,v,R)}}function Ux(m){var v=m.alternate;return m===rr||v!==null&&v===rr}function Pv(m,v){ka=kp=!0;var E=m.pending;E===null?v.next=v:(v.next=E.next,E.next=v),m.pending=v}function rf(m,v,E){gr!==null&&(m.mode&1)!==0&&(on&2)===0?(m=v.interleaved,m===null?(E.next=E,js===null?js=[v]:js.push(v)):(E.next=m.next,m.next=E),v.interleaved=E):(m=v.pending,m===null?E.next=E:(E.next=m.next,m.next=E),v.pending=E)}function sf(m,v,E){if((E&4194240)!==0){var R=v.lanes;R&=m.pendingLanes,E|=R,v.lanes=E,Ra(m,E)}}var Ru={readContext:Xi,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},Rv={readContext:Xi,useCallback:function(m,v){return aa().memoizedState=[m,v===void 0?null:v],m},useContext:Xi,useEffect:Dp,useImperativeHandle:function(m,v,E){return E=E!=null?E.concat([m]):null,sl(4194308,4,nf.bind(null,v,m),E)},useLayoutEffect:function(m,v){return sl(4194308,4,m,v)},useInsertionEffect:function(m,v){return sl(4,2,m,v)},useMemo:function(m,v){var E=aa();return v=v===void 0?null:v,m=m(),E.memoizedState=[m,v],m},useReducer:function(m,v,E){var R=aa();return v=E!==void 0?E(v):v,R.memoizedState=R.baseState=v,m={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:m,lastRenderedState:v},R.queue=m,m=m.dispatch=jx.bind(null,rr,m),[R.memoizedState,m]},useRef:function(m){var v=aa();return m={current:m},v.memoizedState=m},useState:ef,useDebugValue:Up,useDeferredValue:function(m){var v=ef(m),E=v[0],R=v[1];return Dp(function(){var O=fs.transition;fs.transition={};try{R(m)}finally{fs.transition=O}},[m]),E},useTransition:function(){var m=ef(!1),v=m[0];return m=zp.bind(null,m[1]),aa().memoizedState=m,[v,m]},useMutableSource:function(){},useSyncExternalStore:function(m,v,E){var R=rr,O=aa();if(Qn){if(E===void 0)throw Error(a(407));E=E()}else{if(E=v(),gr===null)throw Error(a(349));(rc&30)!==0||Tv(R,v,E)}O.memoizedState=E;var z={value:E,getSnapshot:v};return O.queue=z,Dp(ho.bind(null,R,z,m),[m]),R.flags|=2048,tf(9,Cv.bind(null,R,z,E,v),void 0,null),E},useId:function(){var m=aa(),v=gr.identifierPrefix;if(Qn){var E=uo,R=co;E=(R&~(1<<32-ci(R)-1)).toString(32)+E,v=":"+v+"R"+E,E=ic++,0<E&&(v+="H"+E.toString(32)),v+=":"}else E=Zd++,v=":"+v+"r"+E.toString(32)+":";return m.memoizedState=v},unstable_isNewReconciler:!1},Nv={readContext:Xi,useCallback:Fp,useContext:Xi,useEffect:Tu,useImperativeHandle:Cu,useInsertionEffect:$n,useLayoutEffect:jp,useMemo:Pu,useReducer:Qd,useRef:Dx,useState:function(){return Qd(Ia)},useDebugValue:Up,useDeferredValue:function(m){var v=Qd(Ia),E=v[0],R=v[1];return Tu(function(){var O=fs.transition;fs.transition={};try{R(m)}finally{fs.transition=O}},[m]),E},useTransition:function(){var m=Qd(Ia)[0],v=oa().memoizedState;return[m,v]},useMutableSource:Ev,useSyncExternalStore:Av,useId:sc,unstable_isNewReconciler:!1},kv={readContext:Xi,useCallback:Fp,useContext:Xi,useEffect:Tu,useImperativeHandle:Cu,useInsertionEffect:$n,useLayoutEffect:jp,useMemo:Pu,useReducer:Jd,useRef:Dx,useState:function(){return Jd(Ia)},useDebugValue:Up,useDeferredValue:function(m){var v=Jd(Ia),E=v[0],R=v[1];return Tu(function(){var O=fs.transition;fs.transition={};try{R(m)}finally{fs.transition=O}},[m]),E},useTransition:function(){var m=Jd(Ia)[0],v=oa().memoizedState;return[m,v]},useMutableSource:Ev,useSyncExternalStore:Av,useId:sc,unstable_isNewReconciler:!1};function Iv(m,v){try{var E="",R=v;do E+=mv(R),R=R.return;while(R);var O=E}catch(z){O=`
|
||
Error generating stack: `+z.message+`
|
||
`+z.stack}return{value:m,source:v,stack:O}}function Bp(m,v){try{console.error(v.value)}catch(E){setTimeout(function(){throw E})}}var IM=typeof WeakMap=="function"?WeakMap:Map;function Fx(m,v,E){E=lo(-1,E),E.tag=3,E.payload={element:null};var R=v.value;return E.callback=function(){Du||(Du=!0,Yn=R),Bp(m,v)},E}function Hp(m,v,E){E=lo(-1,E),E.tag=3;var R=m.type.getDerivedStateFromError;if(typeof R=="function"){var O=v.value;E.payload=function(){return R(O)},E.callback=function(){Bp(m,v)}}var z=m.stateNode;return z!==null&&typeof z.componentDidCatch=="function"&&(E.callback=function(){Bp(m,v),typeof R!="function"&&(ua===null?ua=new Set([this]):ua.add(this));var ie=v.stack;this.componentDidCatch(v.value,{componentStack:ie!==null?ie:""})}),E}function po(m,v,E){var R=m.pingCache;if(R===null){R=m.pingCache=new IM;var O=new Set;R.set(v,O)}else O=R.get(v),O===void 0&&(O=new Set,R.set(v,O));O.has(E)||(O.add(E),m=Zv.bind(null,m,v,E),v.then(m,m))}function Lv(m){do{var v;if((v=m.tag===13)&&(v=m.memoizedState,v=v!==null?v.dehydrated!==null:!0),v)return m;m=m.return}while(m!==null);return null}function ac(m,v,E,R,O){return(m.mode&1)===0?(m===v?m.flags|=65536:(m.flags|=128,E.flags|=131072,E.flags&=-52805,E.tag===1&&(E.alternate===null?E.tag=17:(v=lo(-1,1),v.tag=2,el(E,v))),E.lanes|=1),m):(m.flags|=65536,m.lanes=O,m)}function kr(m){m.flags|=4}function Nu(m,v){if(m!==null&&m.child===v.child)return!0;if((v.flags&16)!==0)return!1;for(m=v.child;m!==null;){if((m.flags&12854)!==0||(m.subtreeFlags&12854)!==0)return!1;m=m.sibling}return!0}var hs,oc,Vp,Gp;if(Xe)hs=function(m,v){for(var E=v.child;E!==null;){if(E.tag===5||E.tag===6)W(m,E.stateNode);else if(E.tag!==4&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===v)break;for(;E.sibling===null;){if(E.return===null||E.return===v)return;E=E.return}E.sibling.return=E.return,E=E.sibling}},oc=function(){},Vp=function(m,v,E,R,O){if(m=m.memoizedProps,m!==R){var z=v.stateNode,ie=sa(qi.current);E=se(z,E,m,R,O,ie),(v.updateQueue=E)&&kr(v)}},Gp=function(m,v,E,R){E!==R&&kr(v)};else if(fe){hs=function(m,v,E,R){for(var O=v.child;O!==null;){if(O.tag===5){var z=O.stateNode;E&&R&&(z=Vn(z,O.type,O.memoizedProps,O)),W(m,z)}else if(O.tag===6)z=O.stateNode,E&&R&&(z=pr(z,O.memoizedProps,O)),W(m,z);else if(O.tag!==4){if(O.tag===22&&O.memoizedState!==null)z=O.child,z!==null&&(z.return=O),hs(m,O,!0,!0);else if(O.child!==null){O.child.return=O,O=O.child;continue}}if(O===v)break;for(;O.sibling===null;){if(O.return===null||O.return===v)return;O=O.return}O.sibling.return=O.return,O=O.sibling}};var al=function(m,v,E,R){for(var O=v.child;O!==null;){if(O.tag===5){var z=O.stateNode;E&&R&&(z=Vn(z,O.type,O.memoizedProps,O)),pn(m,z)}else if(O.tag===6)z=O.stateNode,E&&R&&(z=pr(z,O.memoizedProps,O)),pn(m,z);else if(O.tag!==4){if(O.tag===22&&O.memoizedState!==null)z=O.child,z!==null&&(z.return=O),al(m,O,!0,!0);else if(O.child!==null){O.child.return=O,O=O.child;continue}}if(O===v)break;for(;O.sibling===null;){if(O.return===null||O.return===v)return;O=O.return}O.sibling.return=O.return,O=O.sibling}};oc=function(m,v){var E=v.stateNode;if(!Nu(m,v)){m=E.containerInfo;var R=Jt(m);al(R,v,!1,!1),E.pendingChildren=R,kr(v),Fn(m,R)}},Vp=function(m,v,E,R,O){var z=m.stateNode,ie=m.memoizedProps;if((m=Nu(m,v))&&ie===R)v.stateNode=z;else{var ye=v.stateNode,ze=sa(qi.current),st=null;ie!==R&&(st=se(ye,E,ie,R,O,ze)),m&&st===null?v.stateNode=z:(z=pt(z,st,E,ie,R,v,m,ye),oe(z,E,R,O,ze)&&kr(v),v.stateNode=z,m?kr(v):hs(z,v,!1,!1))}},Gp=function(m,v,E,R){E!==R?(m=sa(tc.current),E=sa(qi.current),v.stateNode=Me(R,m,E,v),kr(v)):v.stateNode=m.stateNode}}else oc=function(){},Vp=function(){},Gp=function(){};function mo(m,v){if(!Qn)switch(m.tailMode){case"hidden":v=m.tail;for(var E=null;v!==null;)v.alternate!==null&&(E=v),v=v.sibling;E===null?m.tail=null:E.sibling=null;break;case"collapsed":E=m.tail;for(var R=null;E!==null;)E.alternate!==null&&(R=E),E=E.sibling;R===null?v||m.tail===null?m.tail=null:m.tail.sibling=null:R.sibling=null}}function mr(m){var v=m.alternate!==null&&m.alternate.child===m.child,E=0,R=0;if(v)for(var O=m.child;O!==null;)E|=O.lanes|O.childLanes,R|=O.subtreeFlags&14680064,R|=O.flags&14680064,O.return=m,O=O.sibling;else for(O=m.child;O!==null;)E|=O.lanes|O.childLanes,R|=O.subtreeFlags,R|=O.flags,O.return=m,O=O.sibling;return m.subtreeFlags|=R,m.childLanes=E,v}function Wp(m,v,E){var R=v.pendingProps;switch(_v(v),v.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mr(v),null;case 1:return In(v.type)&&Ls(),mr(v),null;case 3:return R=v.stateNode,Eu(),Kt(tn),Kt(xn),nc(),R.pendingContext&&(R.context=R.pendingContext,R.pendingContext=null),(m===null||m.child===null)&&(Kd(v)?kr(v):m===null||m.memoizedState.isDehydrated&&(v.flags&256)===0||(v.flags|=1024,zs!==null&&(yf(zs),zs=null))),oc(m,v),mr(v),null;case 5:Mv(v),E=sa(tc.current);var O=v.type;if(m!==null&&v.stateNode!=null)Vp(m,v,O,R,E),m.ref!==v.ref&&(v.flags|=512,v.flags|=2097152);else{if(!R){if(v.stateNode===null)throw Error(a(166));return mr(v),null}if(m=sa(qi.current),Kd(v)){if(!Q)throw Error(a(175));m=fu(v.stateNode,v.type,v.memoizedProps,E,m,v,!bu),v.updateQueue=m,m!==null&&kr(v)}else{var z=G(O,R,E,m,v);hs(z,v,!1,!1),v.stateNode=z,oe(z,O,R,E,m)&&kr(v)}v.ref!==null&&(v.flags|=512,v.flags|=2097152)}return mr(v),null;case 6:if(m&&v.stateNode!=null)Gp(m,v,m.memoizedProps,R);else{if(typeof R!="string"&&v.stateNode===null)throw Error(a(166));if(m=sa(tc.current),E=sa(qi.current),Kd(v)){if(!Q)throw Error(a(176));if(m=v.stateNode,R=v.memoizedProps,(E=Pa(m,R,v,!bu))&&(O=Pi,O!==null))switch(z=(O.mode&1)!==0,O.tag){case 3:it(O.stateNode.containerInfo,m,R,z);break;case 5:yt(O.type,O.memoizedProps,O.stateNode,m,R,z)}E&&kr(v)}else v.stateNode=Me(R,m,E,v)}return mr(v),null;case 13:if(Kt(nr),R=v.memoizedState,Qn&&qr!==null&&(v.mode&1)!==0&&(v.flags&128)===0){for(m=qr;m;)m=Ai(m);return _u(),v.flags|=98560,v}if(R!==null&&R.dehydrated!==null){if(R=Kd(v),m===null){if(!R)throw Error(a(318));if(!Q)throw Error(a(344));if(m=v.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(a(317));hu(m,v)}else _u(),(v.flags&128)===0&&(v.memoizedState=null),v.flags|=4;return mr(v),null}return zs!==null&&(yf(zs),zs=null),(v.flags&128)!==0?(v.lanes=E,v):(R=R!==null,E=!1,m===null?Kd(v):E=m.memoizedState!==null,R&&!E&&(v.child.flags|=8192,(v.mode&1)!==0&&(m===null||(nr.current&1)!==0?cr===0&&(cr=3):Qp())),v.updateQueue!==null&&(v.flags|=4),mr(v),null);case 4:return Eu(),oc(m,v),m===null&&Le(v.stateNode.containerInfo),mr(v),null;case 10:return qd(v.type._context),mr(v),null;case 17:return In(v.type)&&Ls(),mr(v),null;case 19:if(Kt(nr),O=v.memoizedState,O===null)return mr(v),null;if(R=(v.flags&128)!==0,z=O.rendering,z===null)if(R)mo(O,!1);else{if(cr!==0||m!==null&&(m.flags&128)!==0)for(m=v.child;m!==null;){if(z=Np(m),z!==null){for(v.flags|=128,mo(O,!1),m=z.updateQueue,m!==null&&(v.updateQueue=m,v.flags|=4),v.subtreeFlags=0,m=E,R=v.child;R!==null;)E=R,O=m,E.flags&=14680066,z=E.alternate,z===null?(E.childLanes=0,E.lanes=O,E.child=null,E.subtreeFlags=0,E.memoizedProps=null,E.memoizedState=null,E.updateQueue=null,E.dependencies=null,E.stateNode=null):(E.childLanes=z.childLanes,E.lanes=z.lanes,E.child=z.child,E.subtreeFlags=0,E.deletions=null,E.memoizedProps=z.memoizedProps,E.memoizedState=z.memoizedState,E.updateQueue=z.updateQueue,E.type=z.type,O=z.dependencies,E.dependencies=O===null?null:{lanes:O.lanes,firstContext:O.firstContext}),R=R.sibling;return jt(nr,nr.current&1|2),v.child}m=m.sibling}O.tail!==null&&Nr()>cl&&(v.flags|=128,R=!0,mo(O,!1),v.lanes=4194304)}else{if(!R)if(m=Np(z),m!==null){if(v.flags|=128,R=!0,m=m.updateQueue,m!==null&&(v.updateQueue=m,v.flags|=4),mo(O,!0),O.tail===null&&O.tailMode==="hidden"&&!z.alternate&&!Qn)return mr(v),null}else 2*Nr()-O.renderingStartTime>cl&&E!==1073741824&&(v.flags|=128,R=!0,mo(O,!1),v.lanes=4194304);O.isBackwards?(z.sibling=v.child,v.child=z):(m=O.last,m!==null?m.sibling=z:v.child=z,O.last=z)}return O.tail!==null?(v=O.tail,O.rendering=v,O.tail=v.sibling,O.renderingStartTime=Nr(),v.sibling=null,m=nr.current,jt(nr,R?m&1|2:m&1),v):(mr(v),null);case 22:case 23:return xf(),R=v.memoizedState!==null,m!==null&&m.memoizedState!==null!==R&&(v.flags|=8192),R&&(v.mode&1)!==0?(di&1073741824)!==0&&(mr(v),Xe&&v.subtreeFlags&6&&(v.flags|=8192)):mr(v),null;case 24:return null;case 25:return null}throw Error(a(156,v.tag))}var Ov=o.ReactCurrentOwner,Fr=!1;function lr(m,v,E,R){v.child=m===null?Lx(v,null,E,R):fo(v,m.child,E,R)}function Xn(m,v,E,R,O){E=E.render;var z=v.ref;return vu(v,O),R=Au(m,v,E,R,z,O),E=il(),m!==null&&!Fr?(v.updateQueue=m.updateQueue,v.flags&=-2053,m.lanes&=~O,Ki(m,v,O)):(Qn&&E&&bv(v),v.flags|=1,lr(m,v,R,O),v.child)}function Wn(m,v,E,R,O){if(m===null){var z=E.type;return typeof z=="function"&&!em(z)&&z.defaultProps===void 0&&E.compare===null&&E.defaultProps===void 0?(v.tag=15,v.type=z,go(m,v,z,R,O)):(m=tm(E.type,null,R,v,v.mode,O),m.ref=v.ref,m.return=v,v.child=m)}if(z=m.child,(m.lanes&O)===0){var ie=z.memoizedProps;if(E=E.compare,E=E!==null?E:ia,E(ie,R)&&m.ref===v.ref)return Ki(m,v,O)}return v.flags|=1,m=Eo(z,R),m.ref=v.ref,m.return=v,v.child=m}function go(m,v,E,R,O){if(m!==null&&ia(m.memoizedProps,R)&&m.ref===v.ref)if(Fr=!1,(m.lanes&O)!==0)(m.flags&131072)!==0&&(Fr=!0);else return v.lanes=m.lanes,Ki(m,v,O);return vo(m,v,E,R,O)}function Kr(m,v,E){var R=v.pendingProps,O=R.children,z=m!==null?m.memoizedState:null;if(R.mode==="hidden")if((v.mode&1)===0)v.memoizedState={baseLanes:0,cachePool:null},jt(gc,di),di|=E;else if((E&1073741824)!==0)v.memoizedState={baseLanes:0,cachePool:null},R=z!==null?z.baseLanes:E,jt(gc,di),di|=R;else return m=z!==null?z.baseLanes|E:E,v.lanes=v.childLanes=1073741824,v.memoizedState={baseLanes:m,cachePool:null},v.updateQueue=null,jt(gc,di),di|=m,null;else z!==null?(R=z.baseLanes|E,v.memoizedState=null):R=E,jt(gc,di),di|=R;return lr(m,v,O,E),v.child}function Ri(m,v){var E=v.ref;(m===null&&E!==null||m!==null&&m.ref!==E)&&(v.flags|=512,v.flags|=2097152)}function vo(m,v,E,R,O){var z=In(E)?Rr:xn.current;return z=li(v,z),vu(v,O),E=Au(m,v,E,R,z,O),R=il(),m!==null&&!Fr?(v.updateQueue=m.updateQueue,v.flags&=-2053,m.lanes&=~O,Ki(m,v,O)):(Qn&&R&&bv(v),v.flags|=1,lr(m,v,E,O),v.child)}function lc(m,v,E,R,O){if(In(E)){var z=!0;Zo(v)}else z=!1;if(vu(v,O),v.stateNode===null)m!==null&&(m.alternate=null,v.alternate=null,v.flags|=2),Px(v,E,R),xv(v,E,R,O),R=!0;else if(m===null){var ie=v.stateNode,ye=v.memoizedProps;ie.props=ye;var ze=ie.context,st=E.contextType;typeof st=="object"&&st!==null?st=Xi(st):(st=In(E)?Rr:xn.current,st=li(v,st));var St=E.getDerivedStateFromProps,rn=typeof St=="function"||typeof ie.getSnapshotBeforeUpdate=="function";rn||typeof ie.UNSAFE_componentWillReceiveProps!="function"&&typeof ie.componentWillReceiveProps!="function"||(ye!==R||ze!==st)&&Rx(v,ie,R,st),Us=!1;var Bt=v.memoizedState;ie.state=Bt,Mp(v,R,ie,O),ze=v.memoizedState,ye!==R||Bt!==ze||tn.current||Us?(typeof St=="function"&&(vv(v,E,St,R),ze=v.memoizedState),(ye=Us||yv(v,E,ye,R,Bt,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=R,v.memoizedState=ze),ie.props=R,ie.state=ze,ie.context=st,R=ye):(typeof ie.componentDidMount=="function"&&(v.flags|=4194308),R=!1)}else{ie=v.stateNode,gv(m,v),ye=v.memoizedProps,st=v.type===v.elementType?ye:$i(v.type,ye),ie.props=st,rn=v.pendingProps,Bt=ie.context,ze=E.contextType,typeof ze=="object"&&ze!==null?ze=Xi(ze):(ze=In(E)?Rr:xn.current,ze=li(v,ze));var ln=E.getDerivedStateFromProps;(St=typeof ln=="function"||typeof ie.getSnapshotBeforeUpdate=="function")||typeof ie.UNSAFE_componentWillReceiveProps!="function"&&typeof ie.componentWillReceiveProps!="function"||(ye!==rn||Bt!==ze)&&Rx(v,ie,R,ze),Us=!1,Bt=v.memoizedState,ie.state=Bt,Mp(v,R,ie,O);var bt=v.memoizedState;ye!==rn||Bt!==bt||tn.current||Us?(typeof ln=="function"&&(vv(v,E,ln,R),bt=v.memoizedState),(st=Us||yv(v,E,st,R,Bt,bt,ze)||!1)?(St||typeof ie.UNSAFE_componentWillUpdate!="function"&&typeof ie.componentWillUpdate!="function"||(typeof ie.componentWillUpdate=="function"&&ie.componentWillUpdate(R,bt,ze),typeof ie.UNSAFE_componentWillUpdate=="function"&&ie.UNSAFE_componentWillUpdate(R,bt,ze)),typeof ie.componentDidUpdate=="function"&&(v.flags|=4),typeof ie.getSnapshotBeforeUpdate=="function"&&(v.flags|=1024)):(typeof ie.componentDidUpdate!="function"||ye===m.memoizedProps&&Bt===m.memoizedState||(v.flags|=4),typeof ie.getSnapshotBeforeUpdate!="function"||ye===m.memoizedProps&&Bt===m.memoizedState||(v.flags|=1024),v.memoizedProps=R,v.memoizedState=bt),ie.props=R,ie.state=bt,ie.context=ze,R=st):(typeof ie.componentDidUpdate!="function"||ye===m.memoizedProps&&Bt===m.memoizedState||(v.flags|=4),typeof ie.getSnapshotBeforeUpdate!="function"||ye===m.memoizedProps&&Bt===m.memoizedState||(v.flags|=1024),R=!1)}return ui(m,v,E,R,z,O)}function ui(m,v,E,R,O,z){Ri(m,v);var ie=(v.flags&128)!==0;if(!R&&!ie)return O&&Xr(v,E,!1),Ki(m,v,z);R=v.stateNode,Ov.current=v;var ye=ie&&typeof E.getDerivedStateFromError!="function"?null:R.render();return v.flags|=1,m!==null&&ie?(v.child=fo(v,m.child,null,z),v.child=fo(v,null,ye,z)):lr(m,v,ye,z),v.memoizedState=R.state,O&&Xr(v,E,!0),v.child}function af(m){var v=m.stateNode;v.pendingContext?Gn(m,v.pendingContext,v.pendingContext!==v.context):v.context&&Gn(m,v.context,!1),Rp(m,v.containerInfo)}function Dv(m,v,E,R,O){return _u(),Pp(O),v.flags|=256,lr(m,v,E,R),v.child}var of={dehydrated:null,treeContext:null,retryLane:0};function cc(m){return{baseLanes:m,cachePool:null}}function jv(m,v,E){var R=v.pendingProps,O=nr.current,z=!1,ie=(v.flags&128)!==0,ye;if((ye=ie)||(ye=m!==null&&m.memoizedState===null?!1:(O&2)!==0),ye?(z=!0,v.flags&=-129):(m===null||m.memoizedState!==null)&&(O|=1),jt(nr,O&1),m===null)return nl(v),m=v.memoizedState,m!==null&&(m=m.dehydrated,m!==null)?((v.mode&1)===0?v.lanes=1:Is(m)?v.lanes=8:v.lanes=1073741824,null):(O=R.children,m=R.fallback,z?(R=v.mode,z=v.child,O={mode:"hidden",children:O},(R&1)===0&&z!==null?(z.childLanes=0,z.pendingProps=O):z=wf(O,R,0,null),m=_c(m,R,E,null),z.return=v,m.return=v,z.sibling=m,v.child=z,v.child.memoizedState=cc(E),v.memoizedState=of,m):la(v,O));if(O=m.memoizedState,O!==null){if(ye=O.dehydrated,ye!==null){if(ie)return v.flags&256?(v.flags&=-257,cf(m,v,E,Error(a(422)))):v.memoizedState!==null?(v.child=m.child,v.flags|=128,null):(z=R.fallback,O=v.mode,R=wf({mode:"visible",children:R.children},O,0,null),z=_c(z,O,E,null),z.flags|=2,R.return=v,z.return=v,R.sibling=z,v.child=R,(v.mode&1)!==0&&fo(v,m.child,null,E),v.child.memoizedState=cc(E),v.memoizedState=of,z);if((v.mode&1)===0)v=cf(m,v,E,null);else if(Is(ye))v=cf(m,v,E,Error(a(419)));else if(R=(E&m.childLanes)!==0,Fr||R){if(R=gr,R!==null){switch(E&-E){case 4:z=2;break;case 16:z=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:z=32;break;case 536870912:z=268435456;break;default:z=0}R=(z&(R.suspendedLanes|E))!==0?0:z,R!==0&&R!==O.retryLane&&(O.retryLane=R,fi(m,R,-1))}Qp(),v=cf(m,v,E,Error(a(421)))}else Yo(ye)?(v.flags|=128,v.child=m.child,v=Gx.bind(null,m),io(ye,v),v=null):(E=O.treeContext,Q&&(qr=du(ye),Pi=v,Qn=!0,zs=null,bu=!1,E!==null&&(Fs[us++]=co,Fs[us++]=uo,Fs[us++]=Ql,co=E.id,uo=E.overflow,Ql=v)),v=la(v,v.pendingProps.children),v.flags|=4096);return v}return z?(R=$p(m,v,R.children,R.fallback,E),z=v.child,O=m.child.memoizedState,z.memoizedState=O===null?cc(E):{baseLanes:O.baseLanes|E,cachePool:null},z.childLanes=m.childLanes&~E,v.memoizedState=of,R):(E=lf(m,v,R.children,E),v.memoizedState=null,E)}return z?(R=$p(m,v,R.children,R.fallback,E),z=v.child,O=m.child.memoizedState,z.memoizedState=O===null?cc(E):{baseLanes:O.baseLanes|E,cachePool:null},z.childLanes=m.childLanes&~E,v.memoizedState=of,R):(E=lf(m,v,R.children,E),v.memoizedState=null,E)}function la(m,v){return v=wf({mode:"visible",children:v},m.mode,0,null),v.return=m,m.child=v}function lf(m,v,E,R){var O=m.child;return m=O.sibling,E=Eo(O,{mode:"visible",children:E}),(v.mode&1)===0&&(E.lanes=R),E.return=v,E.sibling=null,m!==null&&(R=v.deletions,R===null?(v.deletions=[m],v.flags|=16):R.push(m)),v.child=E}function $p(m,v,E,R,O){var z=v.mode;m=m.child;var ie=m.sibling,ye={mode:"hidden",children:E};return(z&1)===0&&v.child!==m?(E=v.child,E.childLanes=0,E.pendingProps=ye,v.deletions=null):(E=Eo(m,ye),E.subtreeFlags=m.subtreeFlags&14680064),ie!==null?R=Eo(ie,R):(R=_c(R,z,O,null),R.flags|=2),R.return=v,E.return=v,E.sibling=R,v.child=E,R}function cf(m,v,E,R){return R!==null&&Pp(R),fo(v,m.child,null,E),m=la(v,v.pendingProps.children),m.flags|=2,v.memoizedState=null,m}function zx(m,v,E){m.lanes|=v;var R=m.alternate;R!==null&&(R.lanes|=v),Zl(m.return,v,E)}function La(m,v,E,R,O){var z=m.memoizedState;z===null?m.memoizedState={isBackwards:v,rendering:null,renderingStartTime:0,last:R,tail:E,tailMode:O}:(z.isBackwards=v,z.rendering=null,z.renderingStartTime=0,z.last=R,z.tail=E,z.tailMode=O)}function uc(m,v,E){var R=v.pendingProps,O=R.revealOrder,z=R.tail;if(lr(m,v,R.children,E),R=nr.current,(R&2)!==0)R=R&1|2,v.flags|=128;else{if(m!==null&&(m.flags&128)!==0)e:for(m=v.child;m!==null;){if(m.tag===13)m.memoizedState!==null&&zx(m,E,v);else if(m.tag===19)zx(m,E,v);else if(m.child!==null){m.child.return=m,m=m.child;continue}if(m===v)break e;for(;m.sibling===null;){if(m.return===null||m.return===v)break e;m=m.return}m.sibling.return=m.return,m=m.sibling}R&=1}if(jt(nr,R),(v.mode&1)===0)v.memoizedState=null;else switch(O){case"forwards":for(E=v.child,O=null;E!==null;)m=E.alternate,m!==null&&Np(m)===null&&(O=E),E=E.sibling;E=O,E===null?(O=v.child,v.child=null):(O=E.sibling,E.sibling=null),La(v,!1,O,E,z);break;case"backwards":for(E=null,O=v.child,v.child=null;O!==null;){if(m=O.alternate,m!==null&&Np(m)===null){v.child=O;break}m=O.sibling,O.sibling=E,E=O,O=m}La(v,!0,E,null,z);break;case"together":La(v,!1,null,null,void 0);break;default:v.memoizedState=null}return v.child}function Ki(m,v,E){if(m!==null&&(v.dependencies=m.dependencies),Oa|=v.lanes,(E&v.childLanes)===0)return null;if(m!==null&&v.child!==m.child)throw Error(a(153));if(v.child!==null){for(m=v.child,E=Eo(m,m.pendingProps),v.child=E,E.return=v;m.sibling!==null;)m=m.sibling,E=E.sibling=Eo(m,m.pendingProps),E.return=v;E.sibling=null}return v.child}function Xp(m,v,E){switch(v.tag){case 3:af(v),_u();break;case 5:Ox(v);break;case 1:In(v.type)&&Zo(v);break;case 4:Rp(v,v.stateNode.containerInfo);break;case 10:Yl(v,v.type._context,v.memoizedProps.value);break;case 13:var R=v.memoizedState;if(R!==null)return R.dehydrated!==null?(jt(nr,nr.current&1),v.flags|=128,null):(E&v.child.childLanes)!==0?jv(m,v,E):(jt(nr,nr.current&1),m=Ki(m,v,E),m!==null?m.sibling:null);jt(nr,nr.current&1);break;case 19:if(R=(E&v.childLanes)!==0,(m.flags&128)!==0){if(R)return uc(m,v,E);v.flags|=128}var O=v.memoizedState;if(O!==null&&(O.rendering=null,O.tail=null,O.lastEffect=null),jt(nr,nr.current),R)break;return null;case 22:case 23:return v.lanes=0,Kr(m,v,E)}return Ki(m,v,E)}function qp(m,v){switch(_v(v),v.tag){case 1:return In(v.type)&&Ls(),m=v.flags,m&65536?(v.flags=m&-65537|128,v):null;case 3:return Eu(),Kt(tn),Kt(xn),nc(),m=v.flags,(m&65536)!==0&&(m&128)===0?(v.flags=m&-65537|128,v):null;case 5:return Mv(v),null;case 13:if(Kt(nr),m=v.memoizedState,m!==null&&m.dehydrated!==null){if(v.alternate===null)throw Error(a(340));_u()}return m=v.flags,m&65536?(v.flags=m&-65537|128,v):null;case 19:return Kt(nr),null;case 4:return Eu(),null;case 10:return qd(v.type._context),null;case 22:case 23:return xf(),null;case 24:return null;default:return null}}var Ni=!1,zr=!1,dc=typeof WeakSet=="function"?WeakSet:Set,dt=null;function Bs(m,v){var E=m.ref;if(E!==null)if(typeof E=="function")try{E(null)}catch(R){Ii(m,v,R)}else E.current=null}function yo(m,v,E){try{E()}catch(R){Ii(m,v,R)}}var Uv=!1;function Fv(m,v){for(J(m.containerInfo),dt=v;dt!==null;)if(m=dt,v=m.child,(m.subtreeFlags&1028)!==0&&v!==null)v.return=m,dt=v;else for(;dt!==null;){m=dt;try{var E=m.alternate;if((m.flags&1024)!==0)switch(m.tag){case 0:case 11:case 15:break;case 1:if(E!==null){var R=E.memoizedProps,O=E.memoizedState,z=m.stateNode,ie=z.getSnapshotBeforeUpdate(m.elementType===m.type?R:$i(m.type,R),O);z.__reactInternalSnapshotBeforeUpdate=ie}break;case 3:Xe&&at(m.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(ye){Ii(m,m.return,ye)}if(v=m.sibling,v!==null){v.return=m.return,dt=v;break}dt=m.return}return E=Uv,Uv=!1,E}function xo(m,v,E){var R=v.updateQueue;if(R=R!==null?R.lastEffect:null,R!==null){var O=R=R.next;do{if((O.tag&m)===m){var z=O.destroy;O.destroy=void 0,z!==void 0&&yo(v,E,z)}O=O.next}while(O!==R)}}function Yr(m,v){if(v=v.updateQueue,v=v!==null?v.lastEffect:null,v!==null){var E=v=v.next;do{if((E.tag&m)===m){var R=E.create;E.destroy=R()}E=E.next}while(E!==v)}}function ki(m){var v=m.ref;if(v!==null){var E=m.stateNode;switch(m.tag){case 5:m=ee(E);break;default:m=E}typeof v=="function"?v(m):v.current=m}}function Kn(m,v,E){if(Na&&typeof Na.onCommitFiberUnmount=="function")try{Na.onCommitFiberUnmount(Gd,v)}catch{}switch(v.tag){case 0:case 11:case 14:case 15:if(m=v.updateQueue,m!==null&&(m=m.lastEffect,m!==null)){var R=m=m.next;do{var O=R,z=O.destroy;O=O.tag,z!==void 0&&((O&2)!==0||(O&4)!==0)&&yo(v,E,z),R=R.next}while(R!==m)}break;case 1:if(Bs(v,E),m=v.stateNode,typeof m.componentWillUnmount=="function")try{m.props=v.memoizedProps,m.state=v.memoizedState,m.componentWillUnmount()}catch(ie){Ii(v,E,ie)}break;case 5:Bs(v,E);break;case 4:Xe?Hv(m,v,E):fe&&fe&&(v=v.stateNode.containerInfo,E=Jt(v),en(v,E))}}function Hs(m,v,E){for(var R=v;;)if(Kn(m,R,E),R.child===null||Xe&&R.tag===4){if(R===v)break;for(;R.sibling===null;){if(R.return===null||R.return===v)return;R=R.return}R.sibling.return=R.return,R=R.sibling}else R.child.return=R,R=R.child}function zv(m){var v=m.alternate;v!==null&&(m.alternate=null,zv(v)),m.child=null,m.deletions=null,m.sibling=null,m.tag===5&&(v=m.stateNode,v!==null&&Je(v)),m.stateNode=null,m.return=null,m.dependencies=null,m.memoizedProps=null,m.memoizedState=null,m.pendingProps=null,m.stateNode=null,m.updateQueue=null}function Bv(m){return m.tag===5||m.tag===3||m.tag===4}function Kp(m){e:for(;;){for(;m.sibling===null;){if(m.return===null||Bv(m.return))return null;m=m.return}for(m.sibling.return=m.return,m=m.sibling;m.tag!==5&&m.tag!==6&&m.tag!==18;){if(m.flags&2||m.child===null||m.tag===4)continue e;m.child.return=m,m=m.child}if(!(m.flags&2))return m.stateNode}}function Yp(m){if(Xe){e:{for(var v=m.return;v!==null;){if(Bv(v))break e;v=v.return}throw Error(a(160))}var E=v;switch(E.tag){case 5:v=E.stateNode,E.flags&32&&(Ke(v),E.flags&=-33),E=Kp(m),ku(m,E,v);break;case 3:case 4:v=E.stateNode.containerInfo,E=Kp(m),Zp(m,E,v);break;default:throw Error(a(161))}}}function Zp(m,v,E){var R=m.tag;if(R===5||R===6)m=m.stateNode,v?vt(E,m,v):zt(E,m);else if(R!==4&&(m=m.child,m!==null))for(Zp(m,v,E),m=m.sibling;m!==null;)Zp(m,v,E),m=m.sibling}function ku(m,v,E){var R=m.tag;if(R===5||R===6)m=m.stateNode,v?Mt(E,m,v):ft(E,m);else if(R!==4&&(m=m.child,m!==null))for(ku(m,v,E),m=m.sibling;m!==null;)ku(m,v,E),m=m.sibling}function Hv(m,v,E){for(var R=v,O=!1,z,ie;;){if(!O){O=R.return;e:for(;;){if(O===null)throw Error(a(160));switch(z=O.stateNode,O.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}O=O.return}O=!0}if(R.tag===5||R.tag===6)Hs(m,R,E),ie?he(z,R.stateNode):Zt(z,R.stateNode);else if(R.tag===18)ie?Ne(z,R.stateNode):Te(z,R.stateNode);else if(R.tag===4){if(R.child!==null){z=R.stateNode.containerInfo,ie=!0,R.child.return=R,R=R.child;continue}}else if(Kn(m,R,E),R.child!==null){R.child.return=R,R=R.child;continue}if(R===v)break;for(;R.sibling===null;){if(R.return===null||R.return===v)return;R=R.return,R.tag===4&&(O=!1)}R.sibling.return=R.return,R=R.sibling}}function ol(m,v){if(Xe){switch(v.tag){case 0:case 11:case 14:case 15:xo(3,v,v.return),Yr(3,v),xo(5,v,v.return);return;case 1:return;case 5:var E=v.stateNode;if(E!=null){var R=v.memoizedProps;m=m!==null?m.memoizedProps:R;var O=v.type,z=v.updateQueue;v.updateQueue=null,z!==null&&tt(E,z,O,m,R,v)}return;case 6:if(v.stateNode===null)throw Error(a(162));E=v.memoizedProps,Ye(v.stateNode,m!==null?m.memoizedProps:E,E);return;case 3:Q&&m!==null&&m.memoizedState.isDehydrated&&Y(v.stateNode.containerInfo);return;case 12:return;case 13:Iu(v);return;case 19:Iu(v);return;case 17:return}throw Error(a(163))}switch(v.tag){case 0:case 11:case 14:case 15:xo(3,v,v.return),Yr(3,v),xo(5,v,v.return);return;case 12:return;case 13:Iu(v);return;case 19:Iu(v);return;case 3:Q&&m!==null&&m.memoizedState.isDehydrated&&Y(v.stateNode.containerInfo);break;case 22:case 23:return}e:if(fe){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(a(163))}}function Iu(m){var v=m.updateQueue;if(v!==null){m.updateQueue=null;var E=m.stateNode;E===null&&(E=m.stateNode=new dc),v.forEach(function(R){var O=Wx.bind(null,m,R);E.has(R)||(E.add(R),R.then(O,O))})}}function LM(m,v){for(dt=v;dt!==null;){v=dt;var E=v.deletions;if(E!==null)for(var R=0;R<E.length;R++){var O=E[R];try{var z=m;Xe?Hv(z,O,v):Hs(z,O,v);var ie=O.alternate;ie!==null&&(ie.return=null),O.return=null}catch(Lt){Ii(O,v,Lt)}}if(E=v.child,(v.subtreeFlags&12854)!==0&&E!==null)E.return=v,dt=E;else for(;dt!==null;){v=dt;try{var ye=v.flags;if(ye&32&&Xe&&Ke(v.stateNode),ye&512){var ze=v.alternate;if(ze!==null){var st=ze.ref;st!==null&&(typeof st=="function"?st(null):st.current=null)}}if(ye&8192)switch(v.tag){case 13:if(v.memoizedState!==null){var St=v.alternate;(St===null||St.memoizedState===null)&&(gf=Nr())}break;case 22:var rn=v.memoizedState!==null,Bt=v.alternate,ln=Bt!==null&&Bt.memoizedState!==null;if(E=v,Xe){e:if(R=E,O=rn,z=null,Xe)for(var bt=R;;){if(bt.tag===5){if(z===null){z=bt;var Jr=bt.stateNode;O?ue(Jr):Pe(bt.stateNode,bt.memoizedProps)}}else if(bt.tag===6){if(z===null){var ys=bt.stateNode;O?Ze(ys):Be(ys,bt.memoizedProps)}}else if((bt.tag!==22&&bt.tag!==23||bt.memoizedState===null||bt===R)&&bt.child!==null){bt.child.return=bt,bt=bt.child;continue}if(bt===R)break;for(;bt.sibling===null;){if(bt.return===null||bt.return===R)break e;z===bt&&(z=null),bt=bt.return}z===bt&&(z=null),bt.sibling.return=bt.return,bt=bt.sibling}}if(rn&&!ln&&(E.mode&1)!==0){dt=E;for(var Re=E.child;Re!==null;){for(E=dt=Re;dt!==null;){R=dt;var _e=R.child;switch(R.tag){case 0:case 11:case 14:case 15:xo(4,R,R.return);break;case 1:Bs(R,R.return);var Ue=R.stateNode;if(typeof Ue.componentWillUnmount=="function"){var gt=R.return;try{Ue.props=R.memoizedProps,Ue.state=R.memoizedState,Ue.componentWillUnmount()}catch(Lt){Ii(R,gt,Lt)}}break;case 5:Bs(R,R.return);break;case 22:if(R.memoizedState!==null){Gv(E);continue}}_e!==null?(_e.return=R,dt=_e):Gv(E)}Re=Re.sibling}}}switch(ye&4102){case 2:Yp(v),v.flags&=-3;break;case 6:Yp(v),v.flags&=-3,ol(v.alternate,v);break;case 4096:v.flags&=-4097;break;case 4100:v.flags&=-4097,ol(v.alternate,v);break;case 4:ol(v.alternate,v)}}catch(Lt){Ii(v,v.return,Lt)}if(E=v.sibling,E!==null){E.return=v.return,dt=E;break}dt=v.return}}}function uf(m,v,E){dt=m,df(m)}function df(m,v,E){for(var R=(m.mode&1)!==0;dt!==null;){var O=dt,z=O.child;if(O.tag===22&&R){var ie=O.memoizedState!==null||Ni;if(!ie){var ye=O.alternate,ze=ye!==null&&ye.memoizedState!==null||zr;ye=Ni;var st=zr;if(Ni=ie,(zr=ze)&&!st)for(dt=O;dt!==null;)ie=dt,ze=ie.child,ie.tag===22&&ie.memoizedState!==null?fc(O):ze!==null?(ze.return=ie,dt=ze):fc(O);for(;z!==null;)dt=z,df(z),z=z.sibling;dt=O,Ni=ye,zr=st}Vv(m)}else(O.subtreeFlags&8772)!==0&&z!==null?(z.return=O,dt=z):Vv(m)}}function Vv(m){for(;dt!==null;){var v=dt;if((v.flags&8772)!==0){var E=v.alternate;try{if((v.flags&8772)!==0)switch(v.tag){case 0:case 11:case 15:zr||Yr(5,v);break;case 1:var R=v.stateNode;if(v.flags&4&&!zr)if(E===null)R.componentDidMount();else{var O=v.elementType===v.type?E.memoizedProps:$i(v.type,E.memoizedProps);R.componentDidUpdate(O,E.memoizedState,R.__reactInternalSnapshotBeforeUpdate)}var z=v.updateQueue;z!==null&&Tx(v,z,R);break;case 3:var ie=v.updateQueue;if(ie!==null){if(E=null,v.child!==null)switch(v.child.tag){case 5:E=ee(v.child.stateNode);break;case 1:E=v.child.stateNode}Tx(v,ie,E)}break;case 5:var ye=v.stateNode;E===null&&v.flags&4&&ne(ye,v.type,v.memoizedProps,v);break;case 6:break;case 4:break;case 12:break;case 13:if(Q&&v.memoizedState===null){var ze=v.alternate;if(ze!==null){var st=ze.memoizedState;if(st!==null){var St=st.dehydrated;St!==null&&be(St)}}}break;case 19:case 17:case 21:case 22:case 23:break;default:throw Error(a(163))}zr||v.flags&512&&ki(v)}catch(rn){Ii(v,v.return,rn)}}if(v===m){dt=null;break}if(E=v.sibling,E!==null){E.return=v.return,dt=E;break}dt=v.return}}function Gv(m){for(;dt!==null;){var v=dt;if(v===m){dt=null;break}var E=v.sibling;if(E!==null){E.return=v.return,dt=E;break}dt=v.return}}function fc(m){for(;dt!==null;){var v=dt;try{switch(v.tag){case 0:case 11:case 15:var E=v.return;try{Yr(4,v)}catch(ze){Ii(v,E,ze)}break;case 1:var R=v.stateNode;if(typeof R.componentDidMount=="function"){var O=v.return;try{R.componentDidMount()}catch(ze){Ii(v,O,ze)}}var z=v.return;try{ki(v)}catch(ze){Ii(v,z,ze)}break;case 5:var ie=v.return;try{ki(v)}catch(ze){Ii(v,ie,ze)}}}catch(ze){Ii(v,v.return,ze)}if(v===m){dt=null;break}var ye=v.sibling;if(ye!==null){ye.return=v.return,dt=ye;break}dt=v.return}}var ff=0,hc=1,pc=2,bo=3,Lu=4;if(typeof Symbol=="function"&&Symbol.for){var mc=Symbol.for;ff=mc("selector.component"),hc=mc("selector.has_pseudo_class"),pc=mc("selector.role"),bo=mc("selector.test_id"),Lu=mc("selector.text")}function hf(m){var v=Ve(m);if(v!=null){if(typeof v.memoizedProps["data-testname"]!="string")throw Error(a(364));return v}if(m=H(m),m===null)throw Error(a(362));return m.stateNode.current}function pf(m,v){switch(v.$$typeof){case ff:if(m.type===v.value)return!0;break;case hc:e:{v=v.value,m=[m,0];for(var E=0;E<m.length;){var R=m[E++],O=m[E++],z=v[O];if(R.tag!==5||!Oe(R)){for(;z!=null&&pf(R,z);)O++,z=v[O];if(O===v.length){v=!0;break e}else for(R=R.child;R!==null;)m.push(R,O),R=R.sibling}}v=!1}return v;case pc:if(m.tag===5&&Fe(m.stateNode,v.value))return!0;break;case Lu:if((m.tag===5||m.tag===6)&&(m=je(m),m!==null&&0<=m.indexOf(v.value)))return!0;break;case bo:if(m.tag===5&&(m=m.memoizedProps["data-testname"],typeof m=="string"&&m.toLowerCase()===v.value.toLowerCase()))return!0;break;default:throw Error(a(365))}return!1}function ll(m){switch(m.$$typeof){case ff:return"<"+(D(m.value)||"Unknown")+">";case hc:return":has("+(ll(m)||"")+")";case pc:return'[role="'+m.value+'"]';case Lu:return'"'+m.value+'"';case bo:return'[data-testname="'+m.value+'"]';default:throw Error(a(365))}}function ps(m,v){var E=[];m=[m,0];for(var R=0;R<m.length;){var O=m[R++],z=m[R++],ie=v[z];if(O.tag!==5||!Oe(O)){for(;ie!=null&&pf(O,ie);)z++,ie=v[z];if(z===v.length)E.push(O);else for(O=O.child;O!==null;)m.push(O,z),O=O.sibling}}return E}function _o(m,v){if(!K)throw Error(a(363));m=hf(m),m=ps(m,v),v=[],m=Array.from(m);for(var E=0;E<m.length;){var R=m[E++];if(R.tag===5)Oe(R)||v.push(R.stateNode);else for(R=R.child;R!==null;)m.push(R),R=R.sibling}return v}var Wv=Math.ceil,mf=o.ReactCurrentDispatcher,ca=o.ReactCurrentOwner,zn=o.ReactCurrentBatchConfig,on=0,gr=null,Bn=null,Jn=0,di=0,gc=yn(0),cr=0,Ou=null,Oa=0,ms=0,vc=0,wo=null,br=null,gf=0,cl=1/0;function yc(){cl=Nr()+500}var Du=!1,Yn=null,ua=null,ju=!1,Da=null,xc=0,bc=0,So=null,qn=-1,ur=0;function Pn(){return(on&6)!==0?Nr():qn!==-1?qn:qn=Nr()}function da(m){return(m.mode&1)===0?1:(on&2)!==0&&Jn!==0?Jn&-Jn:Ax.transition!==null?(ur===0&&(m=pu,pu<<=1,(pu&4194240)===0&&(pu=64),ur=m),ur):(m=un,m!==0?m:We())}function fi(m,v,E){if(50<bc)throw bc=0,So=null,Error(a(185));var R=ul(m,v);return R===null?null:($l(R,v,E),((on&2)===0||R!==gr)&&(R===gr&&((on&2)===0&&(ms|=v),cr===4&&Qr(R,Jn)),Yi(R,E),v===1&&on===0&&(m.mode&1)===0&&(yc(),yp&&Ds())),R)}function ul(m,v){m.lanes|=v;var E=m.alternate;for(E!==null&&(E.lanes|=v),E=m,m=m.return;m!==null;)m.childLanes|=v,E=m.alternate,E!==null&&(E.childLanes|=v),E=m,m=m.return;return E.tag===3?E.stateNode:null}function Yi(m,v){var E=m.callbackNode;Ex(m,v);var R=Vd(m,m===gr?Jn:0);if(R===0)E!==null&&gu(E),m.callbackNode=null,m.callbackPriority=0;else if(v=R&-R,m.callbackPriority!==v){if(E!=null&&gu(E),v===1)m.tag===0?bp(gs.bind(null,m)):xp(gs.bind(null,m)),de?De(function(){on===0&&Ds()}):Xl(ql,Ds),E=null;else{switch(ao(R)){case 1:E=ql;break;case 4:E=NM;break;case 16:E=gp;break;case 536870912:E=vp;break;default:E=gp}E=Jp(E,Zr.bind(null,m))}m.callbackPriority=v,m.callbackNode=E}}function Zr(m,v){if(qn=-1,ur=0,(on&6)!==0)throw Error(a(327));var E=m.callbackNode;if(ja()&&m.callbackNode!==E)return null;var R=Vd(m,m===gr?Jn:0);if(R===0)return null;if((R&30)!==0||(R&m.expiredLanes)!==0||v)v=bf(m,R);else{v=R;var O=on;on|=2;var z=qv();(gr!==m||Jn!==v)&&(yc(),Mo(m,v));do try{Hx();break}catch(ye){Xv(m,ye)}while(!0);Ci(),mf.current=z,on=O,Bn!==null?v=0:(gr=null,Jn=0,v=cr)}if(v!==0){if(v===2&&(O=hp(m),O!==0&&(R=O,v=vf(m,O))),v===1)throw E=Ou,Mo(m,0),Qr(m,R),Yi(m,Nr()),E;if(v===6)Qr(m,R);else{if(O=m.current.alternate,(R&30)===0&&!$v(O)&&(v=bf(m,R),v===2&&(z=hp(m),z!==0&&(R=z,v=vf(m,z))),v===1))throw E=Ou,Mo(m,0),Qr(m,R),Yi(m,Nr()),E;switch(m.finishedWork=O,m.finishedLanes=R,v){case 0:case 1:throw Error(a(345));case 2:fa(m,br);break;case 3:if(Qr(m,R),(R&130023424)===R&&(v=gf+500-Nr(),10<v)){if(Vd(m,0)!==0)break;if(O=m.suspendedLanes,(O&R)!==R){Pn(),m.pingedLanes|=m.suspendedLanes&O;break}m.timeoutHandle=Se(fa.bind(null,m,br),v);break}fa(m,br);break;case 4:if(Qr(m,R),(R&4194240)===R)break;for(v=m.eventTimes,O=-1;0<R;){var ie=31-ci(R);z=1<<ie,ie=v[ie],ie>O&&(O=ie),R&=~z}if(R=O,R=Nr()-R,R=(120>R?120:480>R?480:1080>R?1080:1920>R?1920:3e3>R?3e3:4320>R?4320:1960*Wv(R/1960))-R,10<R){m.timeoutHandle=Se(fa.bind(null,m,br),R);break}fa(m,br);break;case 5:fa(m,br);break;default:throw Error(a(329))}}}return Yi(m,Nr()),m.callbackNode===E?Zr.bind(null,m):null}function vf(m,v){var E=wo;return m.current.memoizedState.isDehydrated&&(Mo(m,v).flags|=256),m=bf(m,v),m!==2&&(v=br,br=E,v!==null&&yf(v)),m}function yf(m){br===null?br=m:br.push.apply(br,m)}function $v(m){for(var v=m;;){if(v.flags&16384){var E=v.updateQueue;if(E!==null&&(E=E.stores,E!==null))for(var R=0;R<E.length;R++){var O=E[R],z=O.getSnapshot;O=O.value;try{if(!Ti(z(),O))return!1}catch{return!1}}}if(E=v.child,v.subtreeFlags&16384&&E!==null)E.return=v,v=E;else{if(v===m)break;for(;v.sibling===null;){if(v.return===null||v.return===m)return!0;v=v.return}v.sibling.return=v.return,v=v.sibling}}return!0}function Qr(m,v){for(v&=~vc,v&=~ms,m.suspendedLanes|=v,m.pingedLanes&=~v,m=m.expirationTimes;0<v;){var E=31-ci(v),R=1<<E;m[E]=-1,v&=~R}}function gs(m){if((on&6)!==0)throw Error(a(327));ja();var v=Vd(m,0);if((v&1)===0)return Yi(m,Nr()),null;var E=bf(m,v);if(m.tag!==0&&E===2){var R=hp(m);R!==0&&(v=R,E=vf(m,R))}if(E===1)throw E=Ou,Mo(m,0),Qr(m,v),Yi(m,Nr()),E;if(E===6)throw Error(a(345));return m.finishedWork=m.current.alternate,m.finishedLanes=v,fa(m,br),Yi(m,Nr()),null}function Uu(m){Da!==null&&Da.tag===0&&(on&6)===0&&ja();var v=on;on|=1;var E=zn.transition,R=un;try{if(zn.transition=null,un=1,m)return m()}finally{un=R,zn.transition=E,on=v,(on&6)===0&&Ds()}}function xf(){di=gc.current,Kt(gc)}function Mo(m,v){m.finishedWork=null,m.finishedLanes=0;var E=m.timeoutHandle;if(E!==Ee&&(m.timeoutHandle=Ee,$e(E)),Bn!==null)for(E=Bn.return;E!==null;){var R=E;switch(_v(R),R.tag){case 1:R=R.type.childContextTypes,R!=null&&Ls();break;case 3:Eu(),Kt(tn),Kt(xn),nc();break;case 5:Mv(R);break;case 4:Eu();break;case 13:Kt(nr);break;case 19:Kt(nr);break;case 10:qd(R.type._context);break;case 22:case 23:xf()}E=E.return}if(gr=m,Bn=m=Eo(m.current,null),Jn=di=v,cr=0,Ou=null,vc=ms=Oa=0,br=wo=null,js!==null){for(v=0;v<js.length;v++)if(E=js[v],R=E.interleaved,R!==null){E.interleaved=null;var O=R.next,z=E.pending;if(z!==null){var ie=z.next;z.next=O,R.next=ie}E.pending=R}js=null}return m}function Xv(m,v){do{var E=Bn;try{if(Ci(),Yd.current=Ru,kp){for(var R=rr.memoizedState;R!==null;){var O=R.queue;O!==null&&(O.pending=null),R=R.next}kp=!1}if(rc=0,jr=Dr=rr=null,ka=!1,ic=0,ca.current=null,E===null||E.return===null){cr=1,Ou=v,Bn=null;break}e:{var z=m,ie=E.return,ye=E,ze=v;if(v=Jn,ye.flags|=32768,ze!==null&&typeof ze=="object"&&typeof ze.then=="function"){var st=ze,St=ye,rn=St.tag;if((St.mode&1)===0&&(rn===0||rn===11||rn===15)){var Bt=St.alternate;Bt?(St.updateQueue=Bt.updateQueue,St.memoizedState=Bt.memoizedState,St.lanes=Bt.lanes):(St.updateQueue=null,St.memoizedState=null)}var ln=Lv(ie);if(ln!==null){ln.flags&=-257,ac(ln,ie,ye,z,v),ln.mode&1&&po(z,st,v),v=ln,ze=st;var bt=v.updateQueue;if(bt===null){var Jr=new Set;Jr.add(ze),v.updateQueue=Jr}else bt.add(ze);break e}else{if((v&1)===0){po(z,st,v),Qp();break e}ze=Error(a(426))}}else if(Qn&&ye.mode&1){var ys=Lv(ie);if(ys!==null){(ys.flags&65536)===0&&(ys.flags|=256),ac(ys,ie,ye,z,v),Pp(ze);break e}}z=ze,cr!==4&&(cr=2),wo===null?wo=[z]:wo.push(z),ze=Iv(ze,ye),ye=ie;do{switch(ye.tag){case 3:ye.flags|=65536,v&=-v,ye.lanes|=v;var Re=Fx(ye,ze,v);Sp(ye,Re);break e;case 1:z=ze;var _e=ye.type,Ue=ye.stateNode;if((ye.flags&128)===0&&(typeof _e.getDerivedStateFromError=="function"||Ue!==null&&typeof Ue.componentDidCatch=="function"&&(ua===null||!ua.has(Ue)))){ye.flags|=65536,v&=-v,ye.lanes|=v;var gt=Hp(ye,z,v);Sp(ye,gt);break e}}ye=ye.return}while(ye!==null)}Yv(E)}catch(Lt){v=Lt,Bn===E&&E!==null&&(Bn=E=E.return);continue}break}while(!0)}function qv(){var m=mf.current;return mf.current=Ru,m===null?Ru:m}function Qp(){(cr===0||cr===3||cr===2)&&(cr=4),gr===null||(Oa&268435455)===0&&(ms&268435455)===0||Qr(gr,Jn)}function bf(m,v){var E=on;on|=2;var R=qv();gr===m&&Jn===v||Mo(m,v);do try{Bx();break}catch(O){Xv(m,O)}while(!0);if(Ci(),on=E,mf.current=R,Bn!==null)throw Error(a(261));return gr=null,Jn=0,cr}function Bx(){for(;Bn!==null;)Kv(Bn)}function Hx(){for(;Bn!==null&&!Jo();)Kv(Bn)}function Kv(m){var v=Jv(m.alternate,m,di);m.memoizedProps=m.pendingProps,v===null?Yv(m):Bn=v,ca.current=null}function Yv(m){var v=m;do{var E=v.alternate;if(m=v.return,(v.flags&32768)===0){if(E=Wp(E,v,di),E!==null){Bn=E;return}}else{if(E=qp(E,v),E!==null){E.flags&=32767,Bn=E;return}if(m!==null)m.flags|=32768,m.subtreeFlags=0,m.deletions=null;else{cr=6,Bn=null;return}}if(v=v.sibling,v!==null){Bn=v;return}Bn=v=m}while(v!==null);cr===0&&(cr=5)}function fa(m,v){var E=un,R=zn.transition;try{zn.transition=null,un=1,Vx(m,v,E)}finally{zn.transition=R,un=E}return null}function Vx(m,v,E){do ja();while(Da!==null);if((on&6)!==0)throw Error(a(327));var R=m.finishedWork,O=m.finishedLanes;if(R===null)return null;if(m.finishedWork=null,m.finishedLanes=0,R===m.current)throw Error(a(177));m.callbackNode=null,m.callbackPriority=0;var z=R.lanes|R.childLanes;if(mp(m,z),m===gr&&(Bn=gr=null,Jn=0),(R.subtreeFlags&2064)===0&&(R.flags&2064)===0||ju||(ju=!0,Jp(gp,function(){return ja(),null})),z=(R.flags&15990)!==0,(R.subtreeFlags&15990)!==0||z){z=zn.transition,zn.transition=null;var ie=un;un=1;var ye=on;on|=4,ca.current=null,Fv(m,R),LM(m,R),Z(m.containerInfo),m.current=R,uf(R),RM(),on=ye,un=ie,zn.transition=z}else m.current=R;if(ju&&(ju=!1,Da=m,xc=O),z=m.pendingLanes,z===0&&(ua=null),Wd(R.stateNode),Yi(m,Nr()),v!==null)for(E=m.onRecoverableError,R=0;R<v.length;R++)E(v[R]);if(Du)throw Du=!1,m=Yn,Yn=null,m;return(xc&1)!==0&&m.tag!==0&&ja(),z=m.pendingLanes,(z&1)!==0?m===So?bc++:(bc=0,So=m):bc=0,Ds(),null}function ja(){if(Da!==null){var m=ao(xc),v=zn.transition,E=un;try{if(zn.transition=null,un=16>m?16:m,Da===null)var R=!1;else{if(m=Da,Da=null,xc=0,(on&6)!==0)throw Error(a(331));var O=on;for(on|=4,dt=m.current;dt!==null;){var z=dt,ie=z.child;if((dt.flags&16)!==0){var ye=z.deletions;if(ye!==null){for(var ze=0;ze<ye.length;ze++){var st=ye[ze];for(dt=st;dt!==null;){var St=dt;switch(St.tag){case 0:case 11:case 15:xo(8,St,z)}var rn=St.child;if(rn!==null)rn.return=St,dt=rn;else for(;dt!==null;){St=dt;var Bt=St.sibling,ln=St.return;if(zv(St),St===st){dt=null;break}if(Bt!==null){Bt.return=ln,dt=Bt;break}dt=ln}}}var bt=z.alternate;if(bt!==null){var Jr=bt.child;if(Jr!==null){bt.child=null;do{var ys=Jr.sibling;Jr.sibling=null,Jr=ys}while(Jr!==null)}}dt=z}}if((z.subtreeFlags&2064)!==0&&ie!==null)ie.return=z,dt=ie;else e:for(;dt!==null;){if(z=dt,(z.flags&2048)!==0)switch(z.tag){case 0:case 11:case 15:xo(9,z,z.return)}var Re=z.sibling;if(Re!==null){Re.return=z.return,dt=Re;break e}dt=z.return}}var _e=m.current;for(dt=_e;dt!==null;){ie=dt;var Ue=ie.child;if((ie.subtreeFlags&2064)!==0&&Ue!==null)Ue.return=ie,dt=Ue;else e:for(ie=_e;dt!==null;){if(ye=dt,(ye.flags&2048)!==0)try{switch(ye.tag){case 0:case 11:case 15:Yr(9,ye)}}catch(Lt){Ii(ye,ye.return,Lt)}if(ye===ie){dt=null;break e}var gt=ye.sibling;if(gt!==null){gt.return=ye.return,dt=gt;break e}dt=ye.return}}if(on=O,Ds(),Na&&typeof Na.onPostCommitFiberRoot=="function")try{Na.onPostCommitFiberRoot(Gd,m)}catch{}R=!0}return R}finally{un=E,zn.transition=v}}return!1}function _f(m,v,E){v=Iv(E,v),v=Fx(m,v,1),el(m,v),v=Pn(),m=ul(m,1),m!==null&&($l(m,1,v),Yi(m,v))}function Ii(m,v,E){if(m.tag===3)_f(m,m,E);else for(;v!==null;){if(v.tag===3){_f(v,m,E);break}else if(v.tag===1){var R=v.stateNode;if(typeof v.type.getDerivedStateFromError=="function"||typeof R.componentDidCatch=="function"&&(ua===null||!ua.has(R))){m=Iv(E,m),m=Hp(v,m,1),el(v,m),m=Pn(),v=ul(v,1),v!==null&&($l(v,1,m),Yi(v,m));break}}v=v.return}}function Zv(m,v,E){var R=m.pingCache;R!==null&&R.delete(v),v=Pn(),m.pingedLanes|=m.suspendedLanes&E,gr===m&&(Jn&E)===E&&(cr===4||cr===3&&(Jn&130023424)===Jn&&500>Nr()-gf?Mo(m,0):vc|=E),Yi(m,v)}function Qv(m,v){v===0&&((m.mode&1)===0?v=1:(v=Cn,Cn<<=1,(Cn&130023424)===0&&(Cn=4194304)));var E=Pn();m=ul(m,v),m!==null&&($l(m,v,E),Yi(m,E))}function Gx(m){var v=m.memoizedState,E=0;v!==null&&(E=v.retryLane),Qv(m,E)}function Wx(m,v){var E=0;switch(m.tag){case 13:var R=m.stateNode,O=m.memoizedState;O!==null&&(E=O.retryLane);break;case 19:R=m.stateNode;break;default:throw Error(a(314))}R!==null&&R.delete(v),Qv(m,E)}var Jv;Jv=function(m,v,E){if(m!==null)if(m.memoizedProps!==v.pendingProps||tn.current)Fr=!0;else{if((m.lanes&E)===0&&(v.flags&128)===0)return Fr=!1,Xp(m,v,E);Fr=(m.flags&131072)!==0}else Fr=!1,Qn&&(v.flags&1048576)!==0&&Nx(v,Tp,v.index);switch(v.lanes=0,v.tag){case 2:var R=v.type;m!==null&&(m.alternate=null,v.alternate=null,v.flags|=2),m=v.pendingProps;var O=li(v,xn.current);vu(v,E),O=Au(null,v,R,m,O,E);var z=il();return v.flags|=1,typeof O=="object"&&O!==null&&typeof O.render=="function"&&O.$$typeof===void 0?(v.tag=1,v.memoizedState=null,v.updateQueue=null,In(R)?(z=!0,Zo(v)):z=!1,v.memoizedState=O.state!==null&&O.state!==void 0?O.state:null,yu(v),O.updater=Ep,v.stateNode=O,O._reactInternals=v,xv(v,R,m,E),v=ui(null,v,R,!0,z,E)):(v.tag=0,Qn&&z&&bv(v),lr(null,v,O,E),v=v.child),v;case 16:R=v.elementType;e:{switch(m!==null&&(m.alternate=null,v.alternate=null,v.flags|=2),m=v.pendingProps,O=R._init,R=O(R._payload),v.type=R,O=v.tag=OM(R),m=$i(R,m),O){case 0:v=vo(null,v,R,m,E);break e;case 1:v=lc(null,v,R,m,E);break e;case 11:v=Xn(null,v,R,m,E);break e;case 14:v=Wn(null,v,R,$i(R.type,m),E);break e}throw Error(a(306,R,""))}return v;case 0:return R=v.type,O=v.pendingProps,O=v.elementType===R?O:$i(R,O),vo(m,v,R,O,E);case 1:return R=v.type,O=v.pendingProps,O=v.elementType===R?O:$i(R,O),lc(m,v,R,O,E);case 3:e:{if(af(v),m===null)throw Error(a(387));R=v.pendingProps,z=v.memoizedState,O=z.element,gv(m,v),Mp(v,R,null,E);var ie=v.memoizedState;if(R=ie.element,Q&&z.isDehydrated)if(z={element:R,isDehydrated:!1,cache:ie.cache,transitions:ie.transitions},v.updateQueue.baseState=z,v.memoizedState=z,v.flags&256){O=Error(a(423)),v=Dv(m,v,R,E,O);break e}else if(R!==O){O=Error(a(424)),v=Dv(m,v,R,E,O);break e}else for(Q&&(qr=so(v.stateNode.containerInfo),Pi=v,Qn=!0,zs=null,bu=!1),E=Lx(v,null,R,E),v.child=E;E;)E.flags=E.flags&-3|4096,E=E.sibling;else{if(_u(),R===O){v=Ki(m,v,E);break e}lr(m,v,R,E)}v=v.child}return v;case 5:return Ox(v),m===null&&nl(v),R=v.type,O=v.pendingProps,z=m!==null?m.memoizedProps:null,ie=O.children,le(R,O)?ie=null:z!==null&&le(R,z)&&(v.flags|=32),Ri(m,v),lr(m,v,ie,E),v.child;case 6:return m===null&&nl(v),null;case 13:return jv(m,v,E);case 4:return Rp(v,v.stateNode.containerInfo),R=v.pendingProps,m===null?v.child=fo(v,null,R,E):lr(m,v,R,E),v.child;case 11:return R=v.type,O=v.pendingProps,O=v.elementType===R?O:$i(R,O),Xn(m,v,R,O,E);case 7:return lr(m,v,v.pendingProps,E),v.child;case 8:return lr(m,v,v.pendingProps.children,E),v.child;case 12:return lr(m,v,v.pendingProps.children,E),v.child;case 10:e:{if(R=v.type._context,O=v.pendingProps,z=v.memoizedProps,ie=O.value,Yl(v,R,ie),z!==null)if(Ti(z.value,ie)){if(z.children===O.children&&!tn.current){v=Ki(m,v,E);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===R){if(z.tag===1){ze=lo(-1,E&-E),ze.tag=2;var st=z.updateQueue;if(st!==null){st=st.shared;var St=st.pending;St===null?ze.next=ze:(ze.next=St.next,St.next=ze),st.pending=ze}}z.lanes|=E,ze=z.alternate,ze!==null&&(ze.lanes|=E),Zl(z.return,E,v),ye.lanes|=E;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(a(341));ie.lanes|=E,ye=ie.alternate,ye!==null&&(ye.lanes|=E),Zl(ie,E,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}lr(m,v,O.children,E),v=v.child}return v;case 9:return O=v.type,R=v.pendingProps.children,vu(v,E),O=Xi(O),R=R(O),v.flags|=1,lr(m,v,R,E),v.child;case 14:return R=v.type,O=$i(R,v.pendingProps),O=$i(R.type,O),Wn(m,v,R,O,E);case 15:return go(m,v,v.type,v.pendingProps,E);case 17:return R=v.type,O=v.pendingProps,O=v.elementType===R?O:$i(R,O),m!==null&&(m.alternate=null,v.alternate=null,v.flags|=2),v.tag=1,In(R)?(m=!0,Zo(v)):m=!1,vu(v,E),Px(v,R,O),xv(v,R,O,E),ui(null,v,R,!0,m,E);case 19:return uc(m,v,E);case 22:return Kr(m,v,E)}throw Error(a(156,v.tag))};function Jp(m,v){return Xl(m,v)}function $x(m,v,E,R){this.tag=m,this.key=E,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=v,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=R,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vs(m,v,E,R){return new $x(m,v,E,R)}function em(m){return m=m.prototype,!(!m||!m.isReactComponent)}function OM(m){if(typeof m=="function")return em(m)?1:0;if(m!=null){if(m=m.$$typeof,m===S)return 11;if(m===M)return 14}return 2}function Eo(m,v){var E=m.alternate;return E===null?(E=vs(m.tag,v,m.key,m.mode),E.elementType=m.elementType,E.type=m.type,E.stateNode=m.stateNode,E.alternate=m,m.alternate=E):(E.pendingProps=v,E.type=m.type,E.flags=0,E.subtreeFlags=0,E.deletions=null),E.flags=m.flags&14680064,E.childLanes=m.childLanes,E.lanes=m.lanes,E.child=m.child,E.memoizedProps=m.memoizedProps,E.memoizedState=m.memoizedState,E.updateQueue=m.updateQueue,v=m.dependencies,E.dependencies=v===null?null:{lanes:v.lanes,firstContext:v.firstContext},E.sibling=m.sibling,E.index=m.index,E.ref=m.ref,E}function tm(m,v,E,R,O,z){var ie=2;if(R=m,typeof m=="function")em(m)&&(ie=1);else if(typeof m=="string")ie=5;else e:switch(m){case d:return _c(E.children,O,z,v);case f:ie=8,O|=8;break;case p:return m=vs(12,E,v,O|2),m.elementType=p,m.lanes=z,m;case w:return m=vs(13,E,v,O),m.elementType=w,m.lanes=z,m;case b:return m=vs(19,E,v,O),m.elementType=b,m.lanes=z,m;case C:return wf(E,O,z,v);default:if(typeof m=="object"&&m!==null)switch(m.$$typeof){case y:ie=10;break e;case x:ie=9;break e;case S:ie=11;break e;case M:ie=14;break e;case T:ie=16,R=null;break e}throw Error(a(130,m==null?m:typeof m,""))}return v=vs(ie,E,v,O),v.elementType=m,v.type=R,v.lanes=z,v}function _c(m,v,E,R){return m=vs(7,m,R,v),m.lanes=E,m}function wf(m,v,E,R){return m=vs(22,m,R,v),m.elementType=C,m.lanes=E,m.stateNode={},m}function nm(m,v,E){return m=vs(6,m,null,v),m.lanes=E,m}function rm(m,v,E){return v=vs(4,m.children!==null?m.children:[],m.key,v),v.lanes=E,v.stateNode={containerInfo:m.containerInfo,pendingChildren:null,implementation:m.implementation},v}function im(m,v,E,R,O){this.tag=v,this.containerInfo=m,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Ee,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=pp(0),this.expirationTimes=pp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=pp(0),this.identifierPrefix=R,this.onRecoverableError=O,Q&&(this.mutableSourceEagerHydrationData=null)}function Xx(m,v,E,R,O,z,ie,ye,ze){return m=new im(m,v,E,ye,ze),v===1?(v=1,z===!0&&(v|=8)):v=0,z=vs(3,null,null,v),m.current=z,z.stateNode=m,z.memoizedState={element:R,isDehydrated:E,cache:null,transitions:null},yu(z),m}function qx(m){if(!m)return mt;m=m._reactInternals;e:{if(V(m)!==m||m.tag!==1)throw Error(a(170));var v=m;do{switch(v.tag){case 3:v=v.stateNode.context;break e;case 1:if(In(v.type)){v=v.stateNode.__reactInternalMemoizedMergedChildContext;break e}}v=v.return}while(v!==null);throw Error(a(171))}if(m.tag===1){var E=m.type;if(In(E))return ra(m,E,v)}return v}function Kx(m){var v=m._reactInternals;if(v===void 0)throw typeof m.render=="function"?Error(a(188)):(m=Object.keys(m).join(","),Error(a(268,m)));return m=X(v),m===null?null:m.stateNode}function Vs(m,v){if(m=m.memoizedState,m!==null&&m.dehydrated!==null){var E=m.retryLane;m.retryLane=E!==0&&E<v?E:v}}function Sf(m,v){Vs(m,v),(m=m.alternate)&&Vs(m,v)}function sm(m){return m=X(m),m===null?null:m.stateNode}function Yx(){return null}return n.attemptContinuousHydration=function(m){if(m.tag===13){var v=Pn();fi(m,134217728,v),Sf(m,134217728)}},n.attemptHydrationAtCurrentPriority=function(m){if(m.tag===13){var v=Pn(),E=da(m);fi(m,E,v),Sf(m,E)}},n.attemptSynchronousHydration=function(m){switch(m.tag){case 3:var v=m.stateNode;if(v.current.memoizedState.isDehydrated){var E=mu(v.pendingLanes);E!==0&&(Ra(v,E|1),Yi(v,Nr()),(on&6)===0&&(yc(),Ds()))}break;case 13:var R=Pn();Uu(function(){return fi(m,1,R)}),Sf(m,1)}},n.batchedUpdates=function(m,v){var E=on;on|=1;try{return m(v)}finally{on=E,on===0&&(yc(),yp&&Ds())}},n.createComponentSelector=function(m){return{$$typeof:ff,value:m}},n.createContainer=function(m,v,E,R,O,z,ie){return Xx(m,v,!1,null,E,R,O,z,ie)},n.createHasPseudoClassSelector=function(m){return{$$typeof:hc,value:m}},n.createHydrationContainer=function(m,v,E,R,O,z,ie,ye,ze){return m=Xx(E,R,!0,m,O,z,ie,ye,ze),m.context=qx(null),E=m.current,R=Pn(),O=da(E),z=lo(R,O),z.callback=v??null,el(E,z),m.current.lanes=O,$l(m,O,R),Yi(m,R),m},n.createPortal=function(m,v,E){var R=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:R==null?null:""+R,children:m,containerInfo:v,implementation:E}},n.createRoleSelector=function(m){return{$$typeof:pc,value:m}},n.createTestNameSelector=function(m){return{$$typeof:bo,value:m}},n.createTextSelector=function(m){return{$$typeof:Lu,value:m}},n.deferredUpdates=function(m){var v=un,E=zn.transition;try{return zn.transition=null,un=16,m()}finally{un=v,zn.transition=E}},n.discreteUpdates=function(m,v,E,R,O){var z=un,ie=zn.transition;try{return zn.transition=null,un=1,m(v,E,R,O)}finally{un=z,zn.transition=ie,on===0&&yc()}},n.findAllNodes=_o,n.findBoundingRects=function(m,v){if(!K)throw Error(a(363));v=_o(m,v),m=[];for(var E=0;E<v.length;E++)m.push(xe(v[E]));for(v=m.length-1;0<v;v--){E=m[v];for(var R=E.x,O=R+E.width,z=E.y,ie=z+E.height,ye=v-1;0<=ye;ye--)if(v!==ye){var ze=m[ye],st=ze.x,St=st+ze.width,rn=ze.y,Bt=rn+ze.height;if(R>=st&&z>=rn&&O<=St&&ie<=Bt){m.splice(v,1);break}else if(R!==st||E.width!==ze.width||Bt<z||rn>ie){if(!(z!==rn||E.height!==ze.height||St<R||st>O)){st>R&&(ze.width+=st-R,ze.x=R),St<O&&(ze.width=O-st),m.splice(v,1);break}}else{rn>z&&(ze.height+=rn-z,ze.y=z),Bt<ie&&(ze.height=ie-rn),m.splice(v,1);break}}}return m},n.findHostInstance=Kx,n.findHostInstanceWithNoPortals=function(m){return m=U(m),m=m!==null?re(m):null,m===null?null:m.stateNode},n.findHostInstanceWithWarning=function(m){return Kx(m)},n.flushControlled=function(m){var v=on;on|=1;var E=zn.transition,R=un;try{zn.transition=null,un=1,m()}finally{un=R,zn.transition=E,on=v,on===0&&(yc(),Ds())}},n.flushPassiveEffects=ja,n.flushSync=Uu,n.focusWithin=function(m,v){if(!K)throw Error(a(363));for(m=hf(m),v=ps(m,v),v=Array.from(v),m=0;m<v.length;){var E=v[m++];if(!Oe(E)){if(E.tag===5&&xt(E.stateNode))return!0;for(E=E.child;E!==null;)v.push(E),E=E.sibling}}return!1},n.getCurrentUpdatePriority=function(){return un},n.getFindAllNodesFailureDescription=function(m,v){if(!K)throw Error(a(363));var E=0,R=[];m=[hf(m),0];for(var O=0;O<m.length;){var z=m[O++],ie=m[O++],ye=v[ie];if((z.tag!==5||!Oe(z))&&(pf(z,ye)&&(R.push(ll(ye)),ie++,ie>E&&(E=ie)),ie<v.length))for(z=z.child;z!==null;)m.push(z,ie),z=z.sibling}if(E<v.length){for(m=[];E<v.length;E++)m.push(ll(v[E]));return`findAllNodes was able to match part of the selector:
|
||
`+(R.join(" > ")+`
|
||
|
||
No matching component was found for:
|
||
`)+m.join(" > ")}return null},n.getPublicRootInstance=function(m){if(m=m.current,!m.child)return null;switch(m.child.tag){case 5:return ee(m.child.stateNode);default:return m.child.stateNode}},n.injectIntoDevTools=function(m){if(m={bundleType:m.bundleType,version:m.version,rendererPackageName:m.rendererPackageName,rendererConfig:m.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:o.ReactCurrentDispatcher,findHostInstanceByFiber:sm,findFiberByHostInstance:m.findFiberByHostInstance||Yx,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")m=!1;else{var v=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(v.isDisabled||!v.supportsFiber)m=!0;else{try{Gd=v.inject(m),Na=v}catch{}m=!!v.checkDCE}}return m},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(m,v,E,R){if(!K)throw Error(a(363));m=_o(m,v);var O=rt(m,E,R).disconnect;return{disconnect:function(){O()}}},n.registerMutableSourceForHydration=function(m,v){var E=v._getVersion;E=E(v._source),m.mutableSourceEagerHydrationData==null?m.mutableSourceEagerHydrationData=[v,E]:m.mutableSourceEagerHydrationData.push(v,E)},n.runWithPriority=function(m,v){var E=un;try{return un=m,v()}finally{un=E}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(m,v,E,R){var O=v.current,z=Pn(),ie=da(O);return E=qx(E),v.context===null?v.context=E:v.pendingContext=E,v=lo(z,ie),v.payload={element:m},R=R===void 0?null:R,R!==null&&(v.callback=R),el(O,v),m=fi(O,ie,z),m!==null&&wp(m,O,ie),ie},n}),KA}var Oj;function Xbe(){return Oj||(Oj=1,$A.exports=$be()),$A.exports}var qbe=Xbe();const Kbe=Qw(qbe);var YA={exports:{}},ZA={};/**
|
||
* @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 Dj;function Ybe(){return Dj||(Dj=1,(function(t){function e(B,J){var Z=B.length;B.push(J);e:for(;0<Z;){var G=Z-1>>>1,W=B[G];if(0<i(W,J))B[G]=J,B[Z]=W,Z=G;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var J=B[0],Z=B.pop();if(Z!==J){B[0]=Z;e:for(var G=0,W=B.length,oe=W>>>1;G<oe;){var se=2*(G+1)-1,le=B[se],Me=se+1,Se=B[Me];if(0>i(le,Z))Me<W&&0>i(Se,le)?(B[G]=Se,B[Me]=Z,G=Me):(B[G]=le,B[se]=Z,G=se);else if(Me<W&&0>i(Se,Z))B[G]=Se,B[Me]=Z,G=Me;else break e}}return J}function i(B,J){var Z=B.sortIndex-J.sortIndex;return Z!==0?Z:B.id-J.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();t.unstable_now=function(){return a.now()-o}}var l=[],c=[],d=1,f=null,p=3,y=!1,x=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(B){for(var 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,ee(L);else{var J=n(c);J!==null&&ce(C,J.startTime-B)}}function L(B,J){x=!1,S&&(S=!1,b(F),F=-1),y=!0;var Z=p;try{for(T(J),f=n(l);f!==null&&(!(f.expirationTime>J)||B&&!U());){var G=f.callback;if(typeof G=="function"){f.callback=null,p=f.priorityLevel;var W=G(f.expirationTime<=J);J=t.unstable_now(),typeof W=="function"?f.callback=W:f===n(l)&&r(l),T(J)}else r(l);f=n(l)}if(f!==null)var oe=!0;else{var se=n(c);se!==null&&ce(C,se.startTime-J),oe=!1}return oe}finally{f=null,p=Z,y=!1}}var N=!1,D=null,F=-1,V=5,I=-1;function U(){return!(t.unstable_now()-I<V)}function X(){if(D!==null){var B=t.unstable_now();I=B;var J=!0;try{J=D(!0,B)}finally{J?te():(N=!1,D=null)}}else N=!1}var te;if(typeof M=="function")te=function(){M(X)};else if(typeof MessageChannel<"u"){var re=new MessageChannel,pe=re.port2;re.port1.onmessage=X,te=function(){pe.postMessage(null)}}else te=function(){w(X,0)};function ee(B){D=B,N||(N=!0,te())}function ce(B,J){F=w(function(){B(t.unstable_now())},J)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(B){B.callback=null},t.unstable_continueExecution=function(){x||y||(x=!0,ee(L))},t.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<B?Math.floor(1e3/B):5},t.unstable_getCurrentPriorityLevel=function(){return p},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(B){switch(p){case 1:case 2:case 3:var J=3;break;default:J=p}var Z=p;p=J;try{return B()}finally{p=Z}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(B,J){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var Z=p;p=B;try{return J()}finally{p=Z}},t.unstable_scheduleCallback=function(B,J,Z){var G=t.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?G+Z:G):Z=G,B){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=Z+W,B={id:d++,callback:J,priorityLevel:B,startTime:Z,expirationTime:W,sortIndex:-1},Z>G?(B.sortIndex=Z,e(c,B),n(l)===null&&B===n(c)&&(S?(b(F),F=-1):S=!0,ce(C,Z-G))):(B.sortIndex=W,e(l,B),x||y||(x=!0,ee(L))),B},t.unstable_shouldYield=U,t.unstable_wrapCallback=function(B){var J=p;return function(){var Z=p;p=J;try{return B.apply(this,arguments)}finally{p=Z}}}})(ZA)),ZA}var jj;function Zbe(){return jj||(jj=1,YA.exports=Ybe()),YA.exports}var Uj=Zbe();const lN={},Qbe=t=>void Object.assign(lN,t);function Jbe(t,e){function n(d,{args:f=[],attach:p,...y},x){let S=`${d[0].toUpperCase()}${d.slice(1)}`,w;if(d==="primitive"){if(y.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const b=y.object;w=Xm(b,{type:d,root:x,attach:p,primitive:!0})}else{const b=lN[S];if(!b)throw new Error(`R3F: ${S} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(f))throw new Error("R3F: The args prop must be an array!");w=Xm(new b(...f),{type:d,root:x,attach:p,memoizedProps:{args:f}})}return w.__r3f.attach===void 0&&(w.isBufferGeometry?w.__r3f.attach="geometry":w.isMaterial&&(w.__r3f.attach="material")),S!=="inject"&&eT(w,y),w}function r(d,f){let p=!1;if(f){var y,x;(y=f.__r3f)!=null&&y.attach?JA(d,f,f.__r3f.attach):f.isObject3D&&d.isObject3D&&(d.add(f),p=!0),p||(x=d.__r3f)==null||x.objects.push(f),f.__r3f||Xm(f,{}),f.__r3f.parent=d,uP(f),qm(f)}}function i(d,f,p){let y=!1;if(f){var x,S;if((x=f.__r3f)!=null&&x.attach)JA(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){f.parent=d,f.dispatchEvent({type:"added"}),d.dispatchEvent({type:"childadded",child:f});const w=d.children.filter(M=>M!==f),b=w.indexOf(p);d.children=[...w.slice(0,b),f,...w.slice(b)],y=!0}y||(S=d.__r3f)==null||S.objects.push(f),f.__r3f||Xm(f,{}),f.__r3f.parent=d,uP(f),qm(f)}}function s(d,f,p=!1){d&&[...d].forEach(y=>a(f,y,p))}function a(d,f,p){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)Vj(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){var w;d.remove(f),(w=f.__r3f)!=null&&w.root&&a_e(t1(f),f)}const M=(S=f.__r3f)==null?void 0:S.primitive,T=!M&&(p===void 0?f.dispose!==null:p);if(!M){var b;s((b=f.__r3f)==null?void 0:b.objects,f,T),s(f.children,f,T)}if(delete f.__r3f,T&&f.dispose&&f.type!=="Scene"){const C=()=>{try{f.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?Uj.unstable_scheduleCallback(Uj.unstable_IdlePriority,C):C()}qm(d)}}function o(d,f,p,y){var x;const S=(x=d.__r3f)==null?void 0:x.parent;if(!S)return;const w=n(f,p,d.__r3f.root);if(d.children){for(const b of d.children)b.__r3f&&r(w,b);d.children=d.children.filter(b=>!b.__r3f)}d.__r3f.objects.forEach(b=>r(w,b)),d.__r3f.objects=[],d.__r3f.autoRemovedBeforeAppend||a(S,d),w.parent&&(w.__r3f.autoRemovedBeforeAppend=!0),r(S,w),w.raycast&&w.__r3f.eventCount&&t1(w).getState().internal.interaction.push(w),[y,y.alternate].forEach(b=>{b!==null&&(b.stateNode=w,b.ref&&(typeof b.ref=="function"?b.ref(w):b.ref.current=w))})}const l=()=>{};return{reconciler:Kbe({createInstance:n,removeChild:a,appendChild:r,appendInitialChild:r,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(d,f)=>{if(!f)return;const p=d.getState().scene;p.__r3f&&(p.__r3f.root=d,r(p,f))},removeChildFromContainer:(d,f)=>{f&&a(d.getState().scene,f)},insertInContainerBefore:(d,f,p)=>{if(!f||!p)return;const y=d.getState().scene;y.__r3f&&i(y,f,p)},getRootHostContext:()=>null,getChildHostContext:d=>d,finalizeInitialChildren(d){var f;return!!((f=d==null?void 0:d.__r3f)!=null?f:{}).handlers},prepareUpdate(d,f,p,y){var x;if(((x=d==null?void 0:d.__r3f)!=null?x:{}).primitive&&y.object&&y.object!==d)return[!0];{const{args:w=[],children:b,...M}=y,{args:T=[],children:C,...L}=p;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=DG(d,M,L,!0);return N.changes.length?[!1,N]:null}},commitUpdate(d,[f,p],y,x,S,w){f?o(d,y,S,w):eT(d,p)},commitMount(d,f,p,y){var x;const S=(x=d.__r3f)!=null?x:{};d.raycast&&S.handlers&&S.eventCount&&t1(d).getState().internal.interaction.push(d)},getPublicInstance:d=>d,prepareForCommit:()=>null,preparePortalMount:d=>Xm(d.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(d){var f;const{attach:p,parent:y}=(f=d.__r3f)!=null?f:{};p&&y&&Vj(y,d,p),d.isObject3D&&(d.visible=!1),qm(d)},unhideInstance(d,f){var p;const{attach:y,parent:x}=(p=d.__r3f)!=null?p:{};y&&x&&JA(x,d,y),(d.isObject3D&&f.visible==null||f.visible)&&(d.visible=!0),qm(d)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():ng.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&sr.fun(performance.now)?performance.now:sr.fun(Date.now)?Date.now:()=>0,scheduleTimeout:sr.fun(setTimeout)?setTimeout:void 0,cancelTimeout:sr.fun(clearTimeout)?clearTimeout:void 0}),applyProps:eT}}var Fj,zj;const QA=t=>"colorSpace"in t||"outputColorSpace"in t,RG=()=>{var t;return(t=lN.ColorManagement)!=null?t:null},NG=t=>t&&t.isOrthographicCamera,e_e=t=>t&&t.hasOwnProperty("current"),Mx=typeof window<"u"&&((Fj=window.document)!=null&&Fj.createElement||((zj=window.navigator)==null?void 0:zj.product)==="ReactNative")?P.useLayoutEffect:P.useEffect;function kG(t){const e=P.useRef(t);return Mx(()=>void(e.current=t),[t]),e}function t_e({set:t}){return Mx(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}class IG extends P.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}IG.getDerivedStateFromError=()=>({error:!0});const LG="__default",Bj=new Map,n_e=t=>t&&!!t.memoized&&!!t.changes;function OG(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 O0=t=>{var e;return(e=t.__r3f)==null?void 0:e.root.getState()};function t1(t){let e=t.__r3f.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const sr={obj:t=>t===Object(t)&&!sr.arr(t)&&typeof t!="function",fun:t=>typeof t=="function",str:t=>typeof t=="string",num:t=>typeof t=="number",boo:t=>typeof t=="boolean",und:t=>t===void 0,arr:t=>Array.isArray(t),equ(t,e,{arrays:n="shallow",objects:r="reference",strict:i=!0}={}){if(typeof t!=typeof e||!!t!=!!e)return!1;if(sr.str(t)||sr.num(t)||sr.boo(t))return t===e;const s=sr.obj(t);if(s&&r==="reference")return t===e;const a=sr.arr(t);if(a&&n==="reference")return t===e;if((a||s)&&t===e)return!0;let o;for(o in t)if(!(o in e))return!1;if(s&&n==="shallow"&&r==="shallow"){for(o in i?e:t)if(!sr.equ(t[o],e[o],{strict:i,objects:"reference"}))return!1}else for(o in i?e:t)if(t[o]!==e[o])return!1;if(sr.und(o)){if(a&&t.length===0&&e.length===0||s&&Object.keys(t).length===0&&Object.keys(e).length===0)return!0;if(t!==e)return!1}return!0}};function r_e(t){t.dispose&&t.type!=="Scene"&&t.dispose();for(const e in t)e.dispose==null||e.dispose(),delete t[e]}function Xm(t,e){const n=t;return n.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},t}function cP(t,e){let n=t;if(e.includes("-")){const r=e.split("-"),i=r.pop();return n=r.reduce((s,a)=>s[a],t),{target:n,key:i}}else return{target:n,key:e}}const Hj=/-\d+$/;function JA(t,e,n){if(sr.str(n)){if(Hj.test(n)){const s=n.replace(Hj,""),{target:a,key:o}=cP(t,s);Array.isArray(a[o])||(a[o]=[])}const{target:r,key:i}=cP(t,n);e.__r3f.previousAttach=r[i],r[i]=e}else e.__r3f.previousAttach=n(t,e)}function Vj(t,e,n){var r,i;if(sr.str(n)){const{target:s,key:a}=cP(t,n),o=e.__r3f.previousAttach;o===void 0?delete s[a]:s[a]=o}else(r=e.__r3f)==null||r.previousAttach==null||r.previousAttach(t,e);(i=e.__r3f)==null||delete i.previousAttach}function DG(t,{children:e,key:n,ref:r,...i},{children:s,key:a,ref:o,...l}={},c=!1){const d=t.__r3f,f=Object.entries(i),p=[];if(c){const x=Object.keys(l);for(let S=0;S<x.length;S++)i.hasOwnProperty(x[S])||f.unshift([x[S],LG+"remove"])}f.forEach(([x,S])=>{var w;if((w=t.__r3f)!=null&&w.primitive&&x==="object"||sr.equ(S,l[x]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(x))return p.push([x,S,!0,[]]);let b=[];x.includes("-")&&(b=x.split("-")),p.push([x,S,!1,b]);for(const M in i){const T=i[M];M.startsWith(`${x}-`)&&p.push([M,T,!1,M.split("-")])}});const y={...i};return d!=null&&d.memoizedProps&&d!=null&&d.memoizedProps.args&&(y.args=d.memoizedProps.args),d!=null&&d.memoizedProps&&d!=null&&d.memoizedProps.attach&&(y.attach=d.memoizedProps.attach),{memoized:y,changes:p}}function eT(t,e){var n;const r=t.__r3f,i=r==null?void 0:r.root,s=i==null||i.getState==null?void 0:i.getState(),{memoized:a,changes:o}=n_e(e)?e:DG(t,e),l=r==null?void 0:r.eventCount;t.__r3f&&(t.__r3f.memoizedProps=a);for(let p=0;p<o.length;p++){let[y,x,S,w]=o[p];if(QA(t)){const C="srgb",L="srgb-linear";y==="encoding"?(y="colorSpace",x=x===3001?C:L):y==="outputEncoding"&&(y="outputColorSpace",x=x===3001?C:L)}let b=t,M=b[y];if(w.length&&(M=w.reduce((T,C)=>T[C],t),!(M&&M.set))){const[T,...C]=w.reverse();b=C.reverse().reduce((L,N)=>L[N],t),y=T}if(x===LG+"remove")if(b.constructor){let T=Bj.get(b.constructor);T||(T=new b.constructor,Bj.set(b.constructor,T)),x=T[y]}else x=0;if(S&&r)x?r.handlers[y]=x:delete r.handlers[y],r.eventCount=Object.keys(r.handlers).length;else if(M&&M.set&&(M.copy||M instanceof Oh)){if(Array.isArray(x))M.fromArray?M.fromArray(x):M.set(...x);else if(M.copy&&x&&x.constructor&&M.constructor===x.constructor)M.copy(x);else if(x!==void 0){var c;const T=(c=M)==null?void 0:c.isColor;!T&&M.setScalar?M.setScalar(x):M instanceof Oh&&x instanceof Oh?M.mask=x.mask:M.set(x),!RG()&&s&&!s.linear&&T&&M.convertSRGBToLinear()}}else{var d;if(b[y]=x,(d=b[y])!=null&&d.isTexture&&b[y].format===ss&&b[y].type===Vo&&s){const T=b[y];QA(T)&&QA(s.gl)?T.colorSpace=s.gl.outputColorSpace:T.encoding=s.gl.outputEncoding}}qm(t)}if(r&&r.parent&&t.raycast&&l!==r.eventCount){const p=t1(t).getState().internal,y=p.interaction.indexOf(t);y>-1&&p.interaction.splice(y,1),r.eventCount&&p.interaction.push(t)}return!(o.length===1&&o[0][0]==="onUpdate")&&o.length&&(n=t.__r3f)!=null&&n.parent&&uP(t),t}function qm(t){var e,n;const r=(e=t.__r3f)==null||(n=e.root)==null||n.getState==null?void 0:n.getState();r&&r.internal.frames===0&&r.invalidate()}function uP(t){t.onUpdate==null||t.onUpdate(t)}function i_e(t,e){t.manual||(NG(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 D_(t){return(t.eventObject||t.object).uuid+"/"+t.index+t.instanceId}function s_e(){var t;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return ng.DefaultEventPriority;switch((t=e.event)==null?void 0:t.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return ng.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return ng.ContinuousEventPriority;default:return ng.DefaultEventPriority}}function jG(t,e,n,r){const i=n.get(e);i&&(n.delete(e),n.size===0&&(t.delete(r),i.target.releasePointerCapture(r)))}function a_e(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)=>{jG(n.capturedMap,e,r,i)})}function o_e(t){function e(l){const{internal:c}=t.getState(),d=l.offsetX-c.initialClick[0],f=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(d*d+f*f))}function n(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(d=>{var f;return(f=c.__r3f)==null?void 0:f.handlers["onPointer"+d]}))}function r(l,c){const d=t.getState(),f=new Set,p=[],y=c?c(d.internal.interaction):d.internal.interaction;for(let b=0;b<y.length;b++){const M=O0(y[b]);M&&(M.raycaster.camera=void 0)}d.previousRoot||d.events.compute==null||d.events.compute(l,d);function x(b){const M=O0(b);if(!M||!M.events.enabled||M.raycaster.camera===null)return[];if(M.raycaster.camera===void 0){var T;M.events.compute==null||M.events.compute(l,M,(T=M.previousRoot)==null?void 0:T.getState()),M.raycaster.camera===void 0&&(M.raycaster.camera=null)}return M.raycaster.camera?M.raycaster.intersectObject(b,!0):[]}let S=y.flatMap(x).sort((b,M)=>{const T=O0(b.object),C=O0(M.object);return!T||!C?b.distance-M.distance:C.events.priority-T.events.priority||b.distance-M.distance}).filter(b=>{const M=D_(b);return f.has(M)?!1:(f.add(M),!0)});d.events.filter&&(S=d.events.filter(S,d));for(const b of S){let M=b.object;for(;M;){var w;(w=M.__r3f)!=null&&w.eventCount&&p.push({...b,eventObject:M}),M=M.parent}}if("pointerId"in l&&d.internal.capturedMap.has(l.pointerId))for(let b of d.internal.capturedMap.get(l.pointerId).values())f.has(D_(b.intersection))||p.push(b.intersection);return p}function i(l,c,d,f){const p=t.getState();if(l.length){const y={stopped:!1};for(const x of l){const S=O0(x.object)||p,{raycaster:w,pointer:b,camera:M,internal:T}=S,C=new q(b.x,b.y,0).unproject(M),L=I=>{var U,X;return(U=(X=T.capturedMap.get(I))==null?void 0:X.has(x.eventObject))!=null?U:!1},N=I=>{const U={intersection:x,target:c.target};T.capturedMap.has(I)?T.capturedMap.get(I).set(x.eventObject,U):T.capturedMap.set(I,new Map([[x.eventObject,U]])),c.target.setPointerCapture(I)},D=I=>{const U=T.capturedMap.get(I);U&&jG(T.capturedMap,x.eventObject,U,I)};let F={};for(let I in c){let U=c[I];typeof U!="function"&&(F[I]=U)}let V={...x,...F,pointer:b,intersections:l,stopped:y.stopped,delta:d,unprojectedPoint:C,ray:w.ray,camera:M,stopPropagation(){const I="pointerId"in c&&T.capturedMap.get(c.pointerId);if((!I||I.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:L,setPointerCapture:N,releasePointerCapture:D},currentTarget:{hasPointerCapture:L,setPointerCapture:N,releasePointerCapture:D},nativeEvent:c};if(f(V),y.stopped===!0)break}}return l}function s(l){const{internal:c}=t.getState();for(const d of c.hovered.values())if(!l.length||!l.find(f=>f.object===d.object&&f.index===d.index&&f.instanceId===d.instanceId)){const p=d.eventObject.__r3f,y=p==null?void 0:p.handlers;if(c.hovered.delete(D_(d)),p!=null&&p.eventCount){const x={...d,intersections:l};y.onPointerOut==null||y.onPointerOut(x),y.onPointerLeave==null||y.onPointerLeave(x)}}}function a(l,c){for(let d=0;d<c.length;d++){const f=c[d].__r3f;f==null||f.handlers.onPointerMissed==null||f.handlers.onPointerMissed(l)}}function o(l){switch(l){case"onPointerLeave":case"onPointerCancel":return()=>s([]);case"onLostPointerCapture":return c=>{const{internal:d}=t.getState();"pointerId"in c&&d.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{d.capturedMap.has(c.pointerId)&&(d.capturedMap.delete(c.pointerId),s([]))})}}return function(d){const{onPointerMissed:f,internal:p}=t.getState();p.lastEvent.current=d;const y=l==="onPointerMove",x=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",w=r(d,y?n:void 0),b=x?e(d):0;l==="onPointerDown"&&(p.initialClick=[d.offsetX,d.offsetY],p.initialHits=w.map(T=>T.eventObject)),x&&!w.length&&b<=2&&(a(d,p.interaction),f&&f(d)),y&&s(w);function M(T){const C=T.eventObject,L=C.__r3f,N=L==null?void 0:L.handlers;if(L!=null&&L.eventCount)if(y){if(N.onPointerOver||N.onPointerEnter||N.onPointerOut||N.onPointerLeave){const D=D_(T),F=p.hovered.get(D);F?F.stopped&&T.stopPropagation():(p.hovered.set(D,T),N.onPointerOver==null||N.onPointerOver(T),N.onPointerEnter==null||N.onPointerEnter(T))}N.onPointerMove==null||N.onPointerMove(T)}else{const D=N[l];D?(!x||p.initialHits.includes(C))&&(a(d,p.interaction.filter(F=>!p.initialHits.includes(F))),D(T)):x&&p.initialHits.includes(C)&&a(d,p.interaction.filter(F=>!p.initialHits.includes(F)))}}i(w,d,b,M)}}return{handlePointer:o}}const UG=t=>!!(t!=null&&t.render),FG=P.createContext(null),l_e=(t,e)=>{const n=Vbe((o,l)=>{const c=new q,d=new q,f=new q;function p(b=l().camera,M=d,T=l().size){const{width:C,height:L,top:N,left:D}=T,F=C/L;M.isVector3?f.copy(M):f.set(...M);const V=b.getWorldPosition(c).distanceTo(f);if(NG(b))return{width:C/b.zoom,height:L/b.zoom,top:N,left:D,factor:1,distance:V,aspect:F};{const I=b.fov*Math.PI/180,U=2*Math.tan(I/2)*V,X=U*(C/L);return{width:X,height:U,top:N,left:D,factor:C/X,distance:V,aspect:F}}}let y;const x=b=>o(M=>({performance:{...M.performance,current:b}})),S=new He;return{set:o,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(b=1)=>t(l(),b),advance:(b,M)=>e(b,M,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new rN,pointer:S,mouse:S,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const b=l();y&&clearTimeout(y),b.performance.current!==b.performance.min&&x(b.performance.min),y=setTimeout(()=>x(l().performance.max),b.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:p},setEvents:b=>o(M=>({...M,events:{...M.events,...b}})),setSize:(b,M,T,C,L)=>{const N=l().camera,D={width:b,height:M,top:C||0,left:L||0,updateStyle:T};o(F=>({size:D,viewport:{...F.viewport,...p(N,d,D)}}))},setDpr:b=>o(M=>{const T=OG(b);return{viewport:{...M.viewport,dpr:T,initialDpr:M.viewport.initialDpr||T}}}),setFrameloop:(b="always")=>{const M=l().clock;M.stop(),M.elapsedTime=0,b!=="never"&&(M.start(),M.elapsedTime=0),o(()=>({frameloop:b}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:P.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(b,M,T)=>{const C=l().internal;return C.priority=C.priority+(M>0?1:0),C.subscribers.push({ref:b,priority:M,store:T}),C.subscribers=C.subscribers.sort((L,N)=>L.priority-N.priority),()=>{const L=l().internal;L!=null&&L.subscribers&&(L.priority=L.priority-(M>0?1:0),L.subscribers=L.subscribers.filter(N=>N.ref!==b))}}}}}),r=n.getState();let i=r.size,s=r.viewport.dpr,a=r.camera;return n.subscribe(()=>{const{camera:o,size:l,viewport:c,gl:d,set:f}=n.getState();if(l.width!==i.width||l.height!==i.height||c.dpr!==s){var p;i=l,s=c.dpr,i_e(o,l),d.setPixelRatio(c.dpr);const y=(p=l.updateStyle)!=null?p:typeof HTMLCanvasElement<"u"&&d.domElement instanceof HTMLCanvasElement;d.setSize(l.width,l.height,y)}o!==a&&(a=o,f(y=>({viewport:{...y.viewport,...y.viewport.getCurrentViewport(o)}})))}),n.subscribe(o=>t(o)),n};let j_,c_e=new Set,u_e=new Set,d_e=new Set;function tT(t,e){if(t.size)for(const{callback:n}of t.values())n(e)}function D0(t,e){switch(t){case"before":return tT(c_e,e);case"after":return tT(u_e,e);case"tail":return tT(d_e,e)}}let nT,rT;function iT(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),nT=e.internal.subscribers,j_=0;j_<nT.length;j_++)rT=nT[j_],rT.ref.current(rT.store.getState(),r,n);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}function f_e(t){let e=!1,n=!1,r,i,s;function a(c){i=requestAnimationFrame(a),e=!0,r=0,D0("before",c),n=!0;for(const f of t.values()){var d;s=f.store.getState(),s.internal.active&&(s.frameloop==="always"||s.internal.frames>0)&&!((d=s.gl.xr)!=null&&d.isPresenting)&&(r+=iT(c,s))}if(n=!1,D0("after",c),r===0)return D0("tail",c),e=!1,cancelAnimationFrame(i)}function o(c,d=1){var f;if(!c)return t.forEach(p=>o(p.store.getState(),d));(f=c.gl.xr)!=null&&f.isPresenting||!c.internal.active||c.frameloop==="never"||(d>1?c.internal.frames=Math.min(60,c.internal.frames+d):n?c.internal.frames=2:c.internal.frames=1,e||(e=!0,requestAnimationFrame(a)))}function l(c,d=!0,f,p){if(d&&D0("before",c),f)iT(c,f,p);else for(const y of t.values())iT(c,y.store.getState());d&&D0("after",c)}return{loop:a,invalidate:o,advance:l}}function zG(){const t=P.useContext(FG);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function id(t=n=>n,e){return zG()(t,e)}function BG(t,e=0){const n=zG(),r=n.getState().internal.subscribe,i=kG(t);return Mx(()=>r(i,e,n),[e,r,n]),null}const $g=new Map,{invalidate:Gj,advance:Wj}=f_e($g),{reconciler:Xw,applyProps:Fm}=Jbe($g,s_e),zm={objects:"shallow",strict:!1},h_e=(t,e)=>{const n=typeof t=="function"?t(e):t;return UG(n)?n:new z6({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...t})};function p_e(t,e){const n=typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement;if(e){const{width:r,height:i,top:s,left:a,updateStyle:o=n}=e;return{width:r,height:i,top:s,left:a,updateStyle:o}}else if(typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&t.parentElement){const{width:r,height:i,top:s,left:a}=t.parentElement.getBoundingClientRect();return{width:r,height:i,top:s,left:a,updateStyle:n}}else if(typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)return{width:t.width,height:t.height,top:0,left:0,updateStyle:n};return{width:0,height:0,top:0,left:0}}function m_e(t){const e=$g.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||l_e(Gj,Wj),a=n||Xw.createContainer(s,ng.ConcurrentRoot,null,!1,null,"",i,null);e||$g.set(t,{fiber:a,store:s});let o,l=!1,c;return{configure(d={}){let{gl:f,size:p,scene:y,events:x,onCreated:S,shadows:w=!1,linear:b=!1,flat:M=!1,legacy:T=!1,orthographic:C=!1,frameloop:L="always",dpr:N=[1,2],performance:D,raycaster:F,camera:V,onPointerMissed:I}=d,U=s.getState(),X=U.gl;U.gl||U.set({gl:X=h_e(f,t)});let te=U.raycaster;te||U.set({raycaster:te=new TG});const{params:re,...pe}=F||{};if(sr.equ(pe,te,zm)||Fm(te,{...pe}),sr.equ(re,te.params,zm)||Fm(te,{params:{...te.params,...re}}),!U.camera||U.camera===c&&!sr.equ(c,V,zm)){c=V;const Z=V instanceof vx,G=Z?V:C?new qc(0,0,0,0,.1,1e3):new Cr(75,0,.1,1e3);Z||(G.position.z=5,V&&(Fm(G,V),("aspect"in V||"left"in V||"right"in V||"bottom"in V||"top"in V)&&(G.manual=!0,G.updateProjectionMatrix())),!U.camera&&!(V!=null&&V.rotation)&&G.lookAt(0,0,0)),U.set({camera:G}),te.camera=G}if(!U.scene){let Z;y!=null&&y.isScene?Z=y:(Z=new jR,y&&Fm(Z,y)),U.set({scene:Xm(Z)})}if(!U.xr){var ee;const Z=(oe,se)=>{const le=s.getState();le.frameloop!=="never"&&Wj(oe,!0,le,se)},G=()=>{const oe=s.getState();oe.gl.xr.enabled=oe.gl.xr.isPresenting,oe.gl.xr.setAnimationLoop(oe.gl.xr.isPresenting?Z:null),oe.gl.xr.isPresenting||Gj(oe)},W={connect(){const oe=s.getState().gl;oe.xr.addEventListener("sessionstart",G),oe.xr.addEventListener("sessionend",G)},disconnect(){const oe=s.getState().gl;oe.xr.removeEventListener("sessionstart",G),oe.xr.removeEventListener("sessionend",G)}};typeof((ee=X.xr)==null?void 0:ee.addEventListener)=="function"&&W.connect(),U.set({xr:W})}if(X.shadowMap){const Z=X.shadowMap.enabled,G=X.shadowMap.type;if(X.shadowMap.enabled=!!w,sr.boo(w))X.shadowMap.type=ny;else if(sr.str(w)){var ce;const W={basic:DV,percentage:KS,soft:ny,variance:Oo};X.shadowMap.type=(ce=W[w])!=null?ce:ny}else sr.obj(w)&&Object.assign(X.shadowMap,w);(Z!==X.shadowMap.enabled||G!==X.shadowMap.type)&&(X.shadowMap.needsUpdate=!0)}const B=RG();B&&("enabled"in B?B.enabled=!T:"legacyMode"in B&&(B.legacyMode=T)),l||Fm(X,{outputEncoding:b?3e3:3001,toneMapping:M?Cl:mR}),U.legacy!==T&&U.set(()=>({legacy:T})),U.linear!==b&&U.set(()=>({linear:b})),U.flat!==M&&U.set(()=>({flat:M})),f&&!sr.fun(f)&&!UG(f)&&!sr.equ(f,X,zm)&&Fm(X,f),x&&!U.events.handlers&&U.set({events:x(s)});const J=p_e(t,p);return sr.equ(J,U.size,zm)||U.setSize(J.width,J.height,J.updateStyle,J.top,J.left),N&&U.viewport.dpr!==OG(N)&&U.setDpr(N),U.frameloop!==L&&U.setFrameloop(L),U.onPointerMissed||U.set({onPointerMissed:I}),D&&!sr.equ(D,U.performance,zm)&&U.set(Z=>({performance:{...Z.performance,...D}})),o=S,l=!0,this},render(d){return l||this.configure(),Xw.updateContainer(g.jsx(g_e,{store:s,children:d,onCreated:o,rootElement:t}),a,null,()=>{}),s},unmount(){HG(t)}}}function g_e({store:t,children:e,onCreated:n,rootElement:r}){return Mx(()=>{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(FG.Provider,{value:t,children:e})}function HG(t,e){const n=$g.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),Xw.updateContainer(null,r,null,()=>{i&&setTimeout(()=>{try{var s,a,o,l;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(a=s.renderLists)==null||a.dispose==null||a.dispose(),(o=i.gl)==null||o.forceContextLoss==null||o.forceContextLoss(),(l=i.gl)!=null&&l.xr&&i.xr.disconnect(),r_e(i),$g.delete(t)}catch{}},500)})}}Xw.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:P.version});const sT={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 v_e(t){const{handlePointer:e}=o_e(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(sT).reduce((n,r)=>({...n,[r]:e(r)}),{}),update:()=>{var n;const{events:r,internal:i}=t.getState();(n=i.lastEvent)!=null&&n.current&&r.handlers&&r.handlers.onPointerMove(i.lastEvent.current)},connect:n=>{var r;const{set:i,events:s}=t.getState();s.disconnect==null||s.disconnect(),i(a=>({events:{...a.events,connected:n}})),Object.entries((r=s.handlers)!=null?r:[]).forEach(([a,o])=>{const[l,c]=sT[a];n.addEventListener(l,o,{passive:c})})},disconnect:()=>{const{set:n,events:r}=t.getState();if(r.connected){var i;Object.entries((i=r.handlers)!=null?i:[]).forEach(([s,a])=>{if(r&&r.connected instanceof HTMLElement){const[o]=sT[s];r.connected.removeEventListener(o,a)}}),n(s=>({events:{...s.events,connected:void 0}}))}}}}function $j(t,e){let n;return(...r)=>{window.clearTimeout(n),n=window.setTimeout(()=>t(...r),e)}}function y_e({debounce:t,scroll:e,polyfill:n,offsetSize:r}={debounce:0,scroll:!1,offsetSize:!1}){const i=n||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,a]=P.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),o=P.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),l=t?typeof t=="number"?t:t.scroll:null,c=t?typeof t=="number"?t:t.resize:null,d=P.useRef(!1);P.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[f,p,y]=P.useMemo(()=>{const b=()=>{if(!o.current.element)return;const{left:M,top:T,width:C,height:L,bottom:N,right:D,x:F,y:V}=o.current.element.getBoundingClientRect(),I={left:M,top:T,width:C,height:L,bottom:N,right:D,x:F,y:V};o.current.element instanceof HTMLElement&&r&&(I.height=o.current.element.offsetHeight,I.width=o.current.element.offsetWidth),Object.freeze(I),d.current&&!w_e(o.current.lastBounds,I)&&a(o.current.lastBounds=I)};return[b,c?$j(b,c):b,l?$j(b,l):b]},[a,r,l,c]);function x(){o.current.scrollContainers&&(o.current.scrollContainers.forEach(b=>b.removeEventListener("scroll",y,!0)),o.current.scrollContainers=null),o.current.resizeObserver&&(o.current.resizeObserver.disconnect(),o.current.resizeObserver=null),o.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",o.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",o.current.orientationHandler))}function S(){o.current.element&&(o.current.resizeObserver=new i(y),o.current.resizeObserver.observe(o.current.element),e&&o.current.scrollContainers&&o.current.scrollContainers.forEach(b=>b.addEventListener("scroll",y,{capture:!0,passive:!0})),o.current.orientationHandler=()=>{y()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",o.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",o.current.orientationHandler))}const w=b=>{!b||b===o.current.element||(x(),o.current.element=b,o.current.scrollContainers=VG(b),S())};return b_e(y,!!e),x_e(p),P.useEffect(()=>{x(),S()},[e,y,p]),P.useEffect(()=>x,[]),[w,s,f]}function x_e(t){P.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function b_e(t,e){P.useEffect(()=>{if(e){const n=t;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[t,e])}function VG(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,...VG(t.parentElement)]}const __e=["x","y","top","bottom","left","right","width","height"],w_e=(t,e)=>__e.every(n=>t[n]===e[n]);var S_e=Object.defineProperty,M_e=Object.defineProperties,E_e=Object.getOwnPropertyDescriptors,Xj=Object.getOwnPropertySymbols,A_e=Object.prototype.hasOwnProperty,T_e=Object.prototype.propertyIsEnumerable,qj=(t,e,n)=>e in t?S_e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Kj=(t,e)=>{for(var n in e||(e={}))A_e.call(e,n)&&qj(t,n,e[n]);if(Xj)for(var n of Xj(e))T_e.call(e,n)&&qj(t,n,e[n]);return t},C_e=(t,e)=>M_e(t,E_e(e)),Yj,Zj;typeof window<"u"&&((Yj=window.document)!=null&&Yj.createElement||((Zj=window.navigator)==null?void 0:Zj.product)==="ReactNative")?P.useLayoutEffect:P.useEffect;function GG(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=t.child;for(;r;){const i=GG(r,e,n);if(i)return i;r=r.sibling}}function WG(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const Qj=console.error;console.error=function(){const t=[...arguments].join("");if(t!=null&&t.startsWith("Warning:")&&t.includes("useContext")){console.error=Qj;return}return Qj.apply(this,arguments)};const cN=WG(P.createContext(null));class $G extends P.Component{render(){return P.createElement(cN.Provider,{value:this._reactInternals},this.props.children)}}function P_e(){const t=P.useContext(cN);if(t===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=P.useId();return P.useMemo(()=>{for(const r of[t,t==null?void 0:t.alternate]){if(!r)continue;const i=GG(r,!1,s=>{let a=s.memoizedState;for(;a;){if(a.memoizedState===e)return!0;a=a.next}});if(i)return i}},[t,e])}function R_e(){const t=P_e(),[e]=P.useState(()=>new Map);e.clear();let n=t;for(;n;){if(n.type&&typeof n.type=="object"){const i=n.type._context===void 0&&n.type.Provider===n.type?n.type:n.type._context;i&&i!==cN&&!e.has(i)&&e.set(i,P.useContext(WG(i)))}n=n.return}return e}function N_e(){const t=R_e();return P.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>r=>P.createElement(e,null,P.createElement(n.Provider,C_e(Kj({},r),{value:t.get(n)}))),e=>P.createElement($G,Kj({},e))),[t])}const k_e=P.forwardRef(function({children:e,fallback:n,resize:r,style:i,gl:s,events:a=v_e,eventSource:o,eventPrefix:l,shadows:c,linear:d,flat:f,legacy:p,orthographic:y,frameloop:x,dpr:S,performance:w,raycaster:b,camera:M,scene:T,onPointerMissed:C,onCreated:L,...N},D){P.useMemo(()=>Qbe(Ube),[]);const F=N_e(),[V,I]=y_e({scroll:!0,debounce:{scroll:50,resize:0},...r}),U=P.useRef(null),X=P.useRef(null);P.useImperativeHandle(D,()=>U.current);const te=kG(C),[re,pe]=P.useState(!1),[ee,ce]=P.useState(!1);if(re)throw re;if(ee)throw ee;const B=P.useRef(null);Mx(()=>{const Z=U.current;I.width>0&&I.height>0&&Z&&(B.current||(B.current=m_e(Z)),B.current.configure({gl:s,events:a,shadows:c,linear:d,flat:f,legacy:p,orthographic:y,frameloop:x,dpr:S,performance:w,raycaster:b,camera:M,scene:T,size:I,onPointerMissed:(...G)=>te.current==null?void 0:te.current(...G),onCreated:G=>{G.events.connect==null||G.events.connect(o?e_e(o)?o.current:o:X.current),l&&G.setEvents({compute:(W,oe)=>{const se=W[l+"X"],le=W[l+"Y"];oe.pointer.set(se/oe.size.width*2-1,-(le/oe.size.height)*2+1),oe.raycaster.setFromCamera(oe.pointer,oe.camera)}}),L==null||L(G)}}),B.current.render(g.jsx(F,{children:g.jsx(IG,{set:ce,children:g.jsx(P.Suspense,{fallback:g.jsx(t_e,{set:pe}),children:e??null})})})))}),P.useEffect(()=>{const Z=U.current;if(Z)return()=>HG(Z)},[]);const J=o?"none":"auto";return g.jsx("div",{ref:X,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:J,...i},...N,children:g.jsx("div",{ref:V,style:{width:"100%",height:"100%"},children:g.jsx("canvas",{ref:U,style:{display:"block"},children:n})})})}),I_e=P.forwardRef(function(e,n){return g.jsx($G,{children:g.jsx(k_e,{...e,ref:n})})});function dP(){return dP=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},dP.apply(null,arguments)}var L_e=Object.defineProperty,O_e=(t,e,n)=>e in t?L_e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,D_e=(t,e,n)=>(O_e(t,e+"",n),n);class j_e{constructor(){D_e(this,"_listeners")}addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(n);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}}var U_e=Object.defineProperty,F_e=(t,e,n)=>e in t?U_e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,$t=(t,e,n)=>(F_e(t,typeof e!="symbol"?e+"":e,n),n);const U_=new lp,Jj=new Lc,z_e=Math.cos(70*(Math.PI/180)),eU=(t,e)=>(t%e+e)%e;let B_e=class extends j_e{constructor(e,n){super(),$t(this,"object"),$t(this,"domElement"),$t(this,"enabled",!0),$t(this,"target",new q),$t(this,"minDistance",0),$t(this,"maxDistance",1/0),$t(this,"minZoom",0),$t(this,"maxZoom",1/0),$t(this,"minPolarAngle",0),$t(this,"maxPolarAngle",Math.PI),$t(this,"minAzimuthAngle",-1/0),$t(this,"maxAzimuthAngle",1/0),$t(this,"enableDamping",!1),$t(this,"dampingFactor",.05),$t(this,"enableZoom",!0),$t(this,"zoomSpeed",1),$t(this,"enableRotate",!0),$t(this,"rotateSpeed",1),$t(this,"enablePan",!0),$t(this,"panSpeed",1),$t(this,"screenSpacePanning",!0),$t(this,"keyPanSpeed",7),$t(this,"zoomToCursor",!1),$t(this,"autoRotate",!1),$t(this,"autoRotateSpeed",2),$t(this,"reverseOrbit",!1),$t(this,"reverseHorizontalOrbit",!1),$t(this,"reverseVerticalOrbit",!1),$t(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),$t(this,"mouseButtons",{LEFT:eh.ROTATE,MIDDLE:eh.DOLLY,RIGHT:eh.PAN}),$t(this,"touches",{ONE:th.ROTATE,TWO:th.DOLLY_PAN}),$t(this,"target0"),$t(this,"position0"),$t(this,"zoom0"),$t(this,"_domElementKeyEvents",null),$t(this,"getPolarAngle"),$t(this,"getAzimuthalAngle"),$t(this,"setPolarAngle"),$t(this,"setAzimuthalAngle"),$t(this,"getDistance"),$t(this,"getZoomScale"),$t(this,"listenToKeyEvents"),$t(this,"stopListenToKeyEvents"),$t(this,"saveState"),$t(this,"reset"),$t(this,"update"),$t(this,"connect"),$t(this,"dispose"),$t(this,"dollyIn"),$t(this,"dollyOut"),$t(this,"getScale"),$t(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=he=>{let Ke=eU(he,2*Math.PI),ue=d.phi;ue<0&&(ue+=2*Math.PI),Ke<0&&(Ke+=2*Math.PI);let Ze=Math.abs(Ke-ue);2*Math.PI-Ze<Ze&&(Ke<ue?Ke+=2*Math.PI:ue+=2*Math.PI),f.phi=Ke-ue,r.update()},this.setAzimuthalAngle=he=>{let Ke=eU(he,2*Math.PI),ue=d.theta;ue<0&&(ue+=2*Math.PI),Ke<0&&(Ke+=2*Math.PI);let Ze=Math.abs(Ke-ue);2*Math.PI-Ze<Ze&&(Ke<ue?Ke+=2*Math.PI:ue+=2*Math.PI),f.theta=Ke-ue,r.update()},this.getDistance=()=>r.object.position.distanceTo(r.target),this.listenToKeyEvents=he=>{he.addEventListener("keydown",ft),this._domElementKeyEvents=he},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",ft),this._domElementKeyEvents=null},this.saveState=()=>{r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=()=>{r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(i),r.update(),l=o.NONE},this.update=(()=>{const he=new q,Ke=new q(0,1,0),ue=new qt().setFromUnitVectors(e.up,Ke),Ze=ue.clone().invert(),Pe=new q,Be=new qt,at=2*Math.PI;return function(){const Jt=r.object.position;ue.setFromUnitVectors(e.up,Ke),Ze.copy(ue).invert(),he.copy(Jt).sub(r.target),he.applyQuaternion(ue),d.setFromVector3(he),r.autoRotate&&l===o.NONE&&re(X()),r.enableDamping?(d.theta+=f.theta*r.dampingFactor,d.phi+=f.phi*r.dampingFactor):(d.theta+=f.theta,d.phi+=f.phi);let pn=r.minAzimuthAngle,Fn=r.maxAzimuthAngle;isFinite(pn)&&isFinite(Fn)&&(pn<-Math.PI?pn+=at:pn>Math.PI&&(pn-=at),Fn<-Math.PI?Fn+=at:Fn>Math.PI&&(Fn-=at),pn<=Fn?d.theta=Math.max(pn,Math.min(Fn,d.theta)):d.theta=d.theta>(pn+Fn)/2?Math.max(pn,d.theta):Math.min(Fn,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=oe(d.radius):d.radius=oe(d.radius*p),he.setFromSpherical(d),he.applyQuaternion(Ze),Jt.copy(r.target).add(he),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 Vn=null;if(r.object instanceof Cr&&r.object.isPerspectiveCamera){const pr=he.length();Vn=oe(pr*p);const Mi=pr-Vn;r.object.position.addScaledVector(D,Mi),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const pr=new q(F.x,F.y,0);pr.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/p)),r.object.updateProjectionMatrix(),en=!0;const Mi=new q(F.x,F.y,0);Mi.unproject(r.object),r.object.position.sub(Mi).add(pr),r.object.updateMatrixWorld(),Vn=he.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;Vn!==null&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(Vn).add(r.object.position):(U_.origin.copy(r.object.position),U_.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(U_.direction))<z_e?e.lookAt(r.target):(Jj.setFromNormalAndCoplanarPoint(r.object.up,r.target),U_.intersectPlane(Jj,r.target))))}else r.object instanceof qc&&r.object.isOrthographicCamera&&(en=p!==1,en&&(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/p)),r.object.updateProjectionMatrix()));return p=1,V=!1,en||Pe.distanceToSquared(r.object.position)>c||8*(1-Be.dot(r.object.quaternion))>c?(r.dispatchEvent(i),Pe.copy(r.object.position),Be.copy(r.object.quaternion),en=!1,!0):!1}})(),this.connect=he=>{r.domElement=he,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",ne),r.domElement.addEventListener("pointerdown",xe),r.domElement.addEventListener("pointercancel",Oe),r.domElement.addEventListener("wheel",rt)},this.dispose=()=>{var he,Ke,ue,Ze,Pe,Be;r.domElement&&(r.domElement.style.touchAction="auto"),(he=r.domElement)==null||he.removeEventListener("contextmenu",ne),(Ke=r.domElement)==null||Ke.removeEventListener("pointerdown",xe),(ue=r.domElement)==null||ue.removeEventListener("pointercancel",Oe),(Ze=r.domElement)==null||Ze.removeEventListener("wheel",rt),(Pe=r.domElement)==null||Pe.ownerDocument.removeEventListener("pointermove",je),(Be=r.domElement)==null||Be.ownerDocument.removeEventListener("pointerup",Oe),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",ft)};const r=this,i={type:"change"},s={type:"start"},a={type:"end"},o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=o.NONE;const c=1e-6,d=new lP,f=new lP;let p=1;const y=new q,x=new He,S=new He,w=new He,b=new He,M=new He,T=new He,C=new He,L=new He,N=new He,D=new q,F=new He;let V=!1;const I=[],U={};function X(){return 2*Math.PI/60/60*r.autoRotateSpeed}function te(){return Math.pow(.95,r.zoomSpeed)}function re(he){r.reverseOrbit||r.reverseHorizontalOrbit?f.theta+=he:f.theta-=he}function pe(he){r.reverseOrbit||r.reverseVerticalOrbit?f.phi+=he:f.phi-=he}const ee=(()=>{const he=new q;return function(ue,Ze){he.setFromMatrixColumn(Ze,0),he.multiplyScalar(-ue),y.add(he)}})(),ce=(()=>{const he=new q;return function(ue,Ze){r.screenSpacePanning===!0?he.setFromMatrixColumn(Ze,1):(he.setFromMatrixColumn(Ze,0),he.crossVectors(r.object.up,he)),he.multiplyScalar(ue),y.add(he)}})(),B=(()=>{const he=new q;return function(ue,Ze){const Pe=r.domElement;if(Pe&&r.object instanceof Cr&&r.object.isPerspectiveCamera){const Be=r.object.position;he.copy(Be).sub(r.target);let at=he.length();at*=Math.tan(r.object.fov/2*Math.PI/180),ee(2*ue*at/Pe.clientHeight,r.object.matrix),ce(2*Ze*at/Pe.clientHeight,r.object.matrix)}else Pe&&r.object instanceof qc&&r.object.isOrthographicCamera?(ee(ue*(r.object.right-r.object.left)/r.object.zoom/Pe.clientWidth,r.object.matrix),ce(Ze*(r.object.top-r.object.bottom)/r.object.zoom/Pe.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function J(he){r.object instanceof Cr&&r.object.isPerspectiveCamera||r.object instanceof qc&&r.object.isOrthographicCamera?p=he:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function Z(he){J(p/he)}function G(he){J(p*he)}function W(he){if(!r.zoomToCursor||!r.domElement)return;V=!0;const Ke=r.domElement.getBoundingClientRect(),ue=he.clientX-Ke.left,Ze=he.clientY-Ke.top,Pe=Ke.width,Be=Ke.height;F.x=ue/Pe*2-1,F.y=-(Ze/Be)*2+1,D.set(F.x,F.y,1).unproject(r.object).sub(r.object.position).normalize()}function oe(he){return Math.max(r.minDistance,Math.min(r.maxDistance,he))}function se(he){x.set(he.clientX,he.clientY)}function le(he){W(he),C.set(he.clientX,he.clientY)}function Me(he){b.set(he.clientX,he.clientY)}function Se(he){S.set(he.clientX,he.clientY),w.subVectors(S,x).multiplyScalar(r.rotateSpeed);const Ke=r.domElement;Ke&&(re(2*Math.PI*w.x/Ke.clientHeight),pe(2*Math.PI*w.y/Ke.clientHeight)),x.copy(S),r.update()}function $e(he){L.set(he.clientX,he.clientY),N.subVectors(L,C),N.y>0?Z(te()):N.y<0&&G(te()),C.copy(L),r.update()}function Ee(he){M.set(he.clientX,he.clientY),T.subVectors(M,b).multiplyScalar(r.panSpeed),B(T.x,T.y),b.copy(M),r.update()}function Ge(he){W(he),he.deltaY<0?G(te()):he.deltaY>0&&Z(te()),r.update()}function Xe(he){let Ke=!1;switch(he.code){case r.keys.UP:B(0,r.keyPanSpeed),Ke=!0;break;case r.keys.BOTTOM:B(0,-r.keyPanSpeed),Ke=!0;break;case r.keys.LEFT:B(r.keyPanSpeed,0),Ke=!0;break;case r.keys.RIGHT:B(-r.keyPanSpeed,0),Ke=!0;break}Ke&&(he.preventDefault(),r.update())}function fe(){if(I.length==1)x.set(I[0].pageX,I[0].pageY);else{const he=.5*(I[0].pageX+I[1].pageX),Ke=.5*(I[0].pageY+I[1].pageY);x.set(he,Ke)}}function Q(){if(I.length==1)b.set(I[0].pageX,I[0].pageY);else{const he=.5*(I[0].pageX+I[1].pageX),Ke=.5*(I[0].pageY+I[1].pageY);b.set(he,Ke)}}function Ve(){const he=I[0].pageX-I[1].pageX,Ke=I[0].pageY-I[1].pageY,ue=Math.sqrt(he*he+Ke*Ke);C.set(0,ue)}function Le(){r.enableZoom&&Ve(),r.enablePan&&Q()}function We(){r.enableZoom&&Ve(),r.enableRotate&&fe()}function Je(he){if(I.length==1)S.set(he.pageX,he.pageY);else{const ue=Zt(he),Ze=.5*(he.pageX+ue.x),Pe=.5*(he.pageY+ue.y);S.set(Ze,Pe)}w.subVectors(S,x).multiplyScalar(r.rotateSpeed);const Ke=r.domElement;Ke&&(re(2*Math.PI*w.x/Ke.clientHeight),pe(2*Math.PI*w.y/Ke.clientHeight)),x.copy(S)}function de(he){if(I.length==1)M.set(he.pageX,he.pageY);else{const Ke=Zt(he),ue=.5*(he.pageX+Ke.x),Ze=.5*(he.pageY+Ke.y);M.set(ue,Ze)}T.subVectors(M,b).multiplyScalar(r.panSpeed),B(T.x,T.y),b.copy(M)}function De(he){const Ke=Zt(he),ue=he.pageX-Ke.x,Ze=he.pageY-Ke.y,Pe=Math.sqrt(ue*ue+Ze*Ze);L.set(0,Pe),N.set(0,Math.pow(L.y/C.y,r.zoomSpeed)),Z(N.y),C.copy(L)}function K(he){r.enableZoom&&De(he),r.enablePan&&de(he)}function H(he){r.enableZoom&&De(he),r.enableRotate&&Je(he)}function xe(he){var Ke,ue;r.enabled!==!1&&(I.length===0&&((Ke=r.domElement)==null||Ke.ownerDocument.addEventListener("pointermove",je),(ue=r.domElement)==null||ue.ownerDocument.addEventListener("pointerup",Oe)),tt(he),he.pointerType==="touch"?zt(he):Fe(he))}function je(he){r.enabled!==!1&&(he.pointerType==="touch"?Ye(he):xt(he))}function Oe(he){var Ke,ue,Ze;Mt(he),I.length===0&&((Ke=r.domElement)==null||Ke.releasePointerCapture(he.pointerId),(ue=r.domElement)==null||ue.ownerDocument.removeEventListener("pointermove",je),(Ze=r.domElement)==null||Ze.ownerDocument.removeEventListener("pointerup",Oe)),r.dispatchEvent(a),l=o.NONE}function Fe(he){let Ke;switch(he.button){case 0:Ke=r.mouseButtons.LEFT;break;case 1:Ke=r.mouseButtons.MIDDLE;break;case 2:Ke=r.mouseButtons.RIGHT;break;default:Ke=-1}switch(Ke){case eh.DOLLY:if(r.enableZoom===!1)return;le(he),l=o.DOLLY;break;case eh.ROTATE:if(he.ctrlKey||he.metaKey||he.shiftKey){if(r.enablePan===!1)return;Me(he),l=o.PAN}else{if(r.enableRotate===!1)return;se(he),l=o.ROTATE}break;case eh.PAN:if(he.ctrlKey||he.metaKey||he.shiftKey){if(r.enableRotate===!1)return;se(he),l=o.ROTATE}else{if(r.enablePan===!1)return;Me(he),l=o.PAN}break;default:l=o.NONE}l!==o.NONE&&r.dispatchEvent(s)}function xt(he){if(r.enabled!==!1)switch(l){case o.ROTATE:if(r.enableRotate===!1)return;Se(he);break;case o.DOLLY:if(r.enableZoom===!1)return;$e(he);break;case o.PAN:if(r.enablePan===!1)return;Ee(he);break}}function rt(he){r.enabled===!1||r.enableZoom===!1||l!==o.NONE&&l!==o.ROTATE||(he.preventDefault(),r.dispatchEvent(s),Ge(he),r.dispatchEvent(a))}function ft(he){r.enabled===!1||r.enablePan===!1||Xe(he)}function zt(he){switch(vt(he),I.length){case 1:switch(r.touches.ONE){case th.ROTATE:if(r.enableRotate===!1)return;fe(),l=o.TOUCH_ROTATE;break;case th.PAN:if(r.enablePan===!1)return;Q(),l=o.TOUCH_PAN;break;default:l=o.NONE}break;case 2:switch(r.touches.TWO){case th.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Le(),l=o.TOUCH_DOLLY_PAN;break;case th.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;We(),l=o.TOUCH_DOLLY_ROTATE;break;default:l=o.NONE}break;default:l=o.NONE}l!==o.NONE&&r.dispatchEvent(s)}function Ye(he){switch(vt(he),l){case o.TOUCH_ROTATE:if(r.enableRotate===!1)return;Je(he),r.update();break;case o.TOUCH_PAN:if(r.enablePan===!1)return;de(he),r.update();break;case o.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;K(he),r.update();break;case o.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;H(he),r.update();break;default:l=o.NONE}}function ne(he){r.enabled!==!1&&he.preventDefault()}function tt(he){I.push(he)}function Mt(he){delete U[he.pointerId];for(let Ke=0;Ke<I.length;Ke++)if(I[Ke].pointerId==he.pointerId){I.splice(Ke,1);return}}function vt(he){let Ke=U[he.pointerId];Ke===void 0&&(Ke=new He,U[he.pointerId]=Ke),Ke.set(he.pageX,he.pageY)}function Zt(he){const Ke=he.pointerId===I[0].pointerId?I[1]:I[0];return U[Ke.pointerId]}this.dollyIn=(he=te())=>{G(he),r.update()},this.dollyOut=(he=te())=>{Z(he),r.update()},this.getScale=()=>p,this.setScale=he=>{J(he),r.update()},this.getZoomScale=()=>te(),n!==void 0&&this.connect(n),this.update()}};const H_e=P.forwardRef(({makeDefault:t,camera:e,regress:n,domElement:r,enableDamping:i=!0,keyEvents:s=!1,onChange:a,onStart:o,onEnd:l,...c},d)=>{const f=id(N=>N.invalidate),p=id(N=>N.camera),y=id(N=>N.gl),x=id(N=>N.events),S=id(N=>N.setEvents),w=id(N=>N.set),b=id(N=>N.get),M=id(N=>N.performance),T=e||p,C=r||x.connected||y.domElement,L=P.useMemo(()=>new B_e(T),[T]);return BG(()=>{L.enabled&&L.update()},-1),P.useEffect(()=>(s&&L.connect(s===!0?C:s),L.connect(C),()=>void L.dispose()),[s,C,n,L,f]),P.useEffect(()=>{const N=V=>{f(),n&&M.regress(),a&&a(V)},D=V=>{o&&o(V)},F=V=>{l&&l(V)};return L.addEventListener("change",N),L.addEventListener("start",D),L.addEventListener("end",F),()=>{L.removeEventListener("start",D),L.removeEventListener("end",F),L.removeEventListener("change",N)}},[a,o,l,L,f,S]),P.useEffect(()=>{if(t){const N=b().controls;return w({controls:L}),()=>w({controls:N})}},[t,L]),P.createElement("primitive",dP({ref:d,object:L,enableDamping:i},c))});function tU(t,e){if(e===h6)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===Vw||e===AR){let n=t.getIndex();if(n===null){const a=[],o=t.getAttribute("position");if(o!==void 0){for(let l=0;l<o.count;l++)a.push(l);t.setIndex(a),n=t.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t}const r=n.count-2,i=[];if(e===Vw)for(let a=1;a<=r;a++)i.push(n.getX(0)),i.push(n.getX(a)),i.push(n.getX(a+1));else for(let a=0;a<r;a++)a%2===0?(i.push(n.getX(a)),i.push(n.getX(a+1)),i.push(n.getX(a+2))):(i.push(n.getX(a+2)),i.push(n.getX(a+1)),i.push(n.getX(a)));i.length/3!==r&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=t.clone();return s.setIndex(i),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),t}class V_e extends ks{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(n){return new q_e(n)}),this.register(function(n){return new K_e(n)}),this.register(function(n){return new i1e(n)}),this.register(function(n){return new s1e(n)}),this.register(function(n){return new a1e(n)}),this.register(function(n){return new Z_e(n)}),this.register(function(n){return new Q_e(n)}),this.register(function(n){return new J_e(n)}),this.register(function(n){return new e1e(n)}),this.register(function(n){return new X_e(n)}),this.register(function(n){return new t1e(n)}),this.register(function(n){return new Y_e(n)}),this.register(function(n){return new r1e(n)}),this.register(function(n){return new n1e(n)}),this.register(function(n){return new W_e(n)}),this.register(function(n){return new o1e(n)}),this.register(function(n){return new l1e(n)})}load(e,n,r,i){const s=this;let a;if(this.resourcePath!=="")a=this.resourcePath;else if(this.path!==""){const c=Cd.extractUrlBase(e);a=Cd.resolveURL(c,this.path)}else a=Cd.extractUrlBase(e);this.manager.itemStart(e);const o=function(c){i?i(c):console.error(c),s.manager.itemError(e),s.manager.itemEnd(e)},l=new Wo(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{s.parse(c,a,function(d){n(d),s.manager.itemEnd(e)},o)}catch(d){o(d)}},r,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,n,r,i){let s;const a={},o={},l=new TextDecoder;if(typeof e=="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(l.decode(new Uint8Array(e,0,4))===XG){try{a[vn.KHR_BINARY_GLTF]=new c1e(e)}catch(f){i&&i(f);return}s=JSON.parse(a[vn.KHR_BINARY_GLTF].content)}else s=JSON.parse(l.decode(e));else s=e;if(s.asset===void 0||s.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new w1e(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<this.pluginCallbacks.length;d++){const f=this.pluginCallbacks[d](c);f.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[f.name]=f,a[f.name]=!0}if(s.extensionsUsed)for(let d=0;d<s.extensionsUsed.length;++d){const f=s.extensionsUsed[d],p=s.extensionsRequired||[];switch(f){case vn.KHR_MATERIALS_UNLIT:a[f]=new $_e;break;case vn.KHR_DRACO_MESH_COMPRESSION:a[f]=new u1e(s,this.dracoLoader);break;case vn.KHR_TEXTURE_TRANSFORM:a[f]=new d1e;break;case vn.KHR_MESH_QUANTIZATION:a[f]=new f1e;break;default:p.indexOf(f)>=0&&o[f]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}c.setExtensions(a),c.setPlugins(o),c.parse(r,i)}parseAsync(e,n){const r=this;return new Promise(function(i,s){r.parse(e,n,i,s)})}}function G_e(){let t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const vn={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class W_e{constructor(e){this.parser=e,this.name=vn.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,n=this.parser.json.nodes||[];for(let r=0,i=n.length;r<i;r++){const s=n[r];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const n=this.parser,r="light:"+e;let i=n.cache.get(r);if(i)return i;const s=n.json,l=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e];let c;const d=new ut(16777215);l.color!==void 0&&d.setRGB(l.color[0],l.color[1],l.color[2],xi);const f=l.range!==void 0?l.range:0;switch(l.type){case"directional":c=new tN(d),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new eN(d),c.distance=f;break;case"spot":c=new JR(d),c.distance=f,l.spot=l.spot||{},l.spot.innerConeAngle=l.spot.innerConeAngle!==void 0?l.spot.innerConeAngle:0,l.spot.outerConeAngle=l.spot.outerConeAngle!==void 0?l.spot.outerConeAngle:Math.PI/4,c.angle=l.spot.outerConeAngle,c.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return c.position.set(0,0,0),c.decay=2,kc(c,l),l.intensity!==void 0&&(c.intensity=l.intensity),c.name=n.createUniqueName(l.name||"light_"+e),i=Promise.resolve(c),n.cache.add(r,i),i}getDependency(e,n){if(e==="light")return this._loadLight(n)}createNodeAttachment(e){const n=this,r=this.parser,s=r.json.nodes[e],o=(s.extensions&&s.extensions[this.name]||{}).light;return o===void 0?null:this._loadLight(o).then(function(l){return r._getNodeRef(n.cache,o,l)})}}class $_e{constructor(){this.name=vn.KHR_MATERIALS_UNLIT}getMaterialType(){return Ts}extendParams(e,n,r){const i=[];e.color=new ut(1,1,1),e.opacity=1;const s=n.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const a=s.baseColorFactor;e.color.setRGB(a[0],a[1],a[2],xi),e.opacity=a[3]}s.baseColorTexture!==void 0&&i.push(r.assignTexture(e,"map",s.baseColorTexture,Fi))}return Promise.all(i)}}class X_e{constructor(e){this.parser=e,this.name=vn.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,n){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=i.extensions[this.name].emissiveStrength;return s!==void 0&&(n.emissiveIntensity=s),Promise.resolve()}}class q_e{constructor(e){this.parser=e,this.name=vn.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:no}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];if(a.clearcoatFactor!==void 0&&(n.clearcoat=a.clearcoatFactor),a.clearcoatTexture!==void 0&&s.push(r.assignTexture(n,"clearcoatMap",a.clearcoatTexture)),a.clearcoatRoughnessFactor!==void 0&&(n.clearcoatRoughness=a.clearcoatRoughnessFactor),a.clearcoatRoughnessTexture!==void 0&&s.push(r.assignTexture(n,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),a.clearcoatNormalTexture!==void 0&&(s.push(r.assignTexture(n,"clearcoatNormalMap",a.clearcoatNormalTexture)),a.clearcoatNormalTexture.scale!==void 0)){const o=a.clearcoatNormalTexture.scale;n.clearcoatNormalScale=new He(o,o)}return Promise.all(s)}}class K_e{constructor(e){this.parser=e,this.name=vn.KHR_MATERIALS_DISPERSION}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:no}extendMaterialParams(e,n){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=i.extensions[this.name];return n.dispersion=s.dispersion!==void 0?s.dispersion:0,Promise.resolve()}}class Y_e{constructor(e){this.parser=e,this.name=vn.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:no}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];return a.iridescenceFactor!==void 0&&(n.iridescence=a.iridescenceFactor),a.iridescenceTexture!==void 0&&s.push(r.assignTexture(n,"iridescenceMap",a.iridescenceTexture)),a.iridescenceIor!==void 0&&(n.iridescenceIOR=a.iridescenceIor),n.iridescenceThicknessRange===void 0&&(n.iridescenceThicknessRange=[100,400]),a.iridescenceThicknessMinimum!==void 0&&(n.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),a.iridescenceThicknessMaximum!==void 0&&(n.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),a.iridescenceThicknessTexture!==void 0&&s.push(r.assignTexture(n,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(s)}}class Z_e{constructor(e){this.parser=e,this.name=vn.KHR_MATERIALS_SHEEN}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:no}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[];n.sheenColor=new ut(0,0,0),n.sheenRoughness=0,n.sheen=1;const a=i.extensions[this.name];if(a.sheenColorFactor!==void 0){const o=a.sheenColorFactor;n.sheenColor.setRGB(o[0],o[1],o[2],xi)}return a.sheenRoughnessFactor!==void 0&&(n.sheenRoughness=a.sheenRoughnessFactor),a.sheenColorTexture!==void 0&&s.push(r.assignTexture(n,"sheenColorMap",a.sheenColorTexture,Fi)),a.sheenRoughnessTexture!==void 0&&s.push(r.assignTexture(n,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(s)}}class Q_e{constructor(e){this.parser=e,this.name=vn.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:no}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];return a.transmissionFactor!==void 0&&(n.transmission=a.transmissionFactor),a.transmissionTexture!==void 0&&s.push(r.assignTexture(n,"transmissionMap",a.transmissionTexture)),Promise.all(s)}}class J_e{constructor(e){this.parser=e,this.name=vn.KHR_MATERIALS_VOLUME}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:no}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];n.thickness=a.thicknessFactor!==void 0?a.thicknessFactor:0,a.thicknessTexture!==void 0&&s.push(r.assignTexture(n,"thicknessMap",a.thicknessTexture)),n.attenuationDistance=a.attenuationDistance||1/0;const o=a.attenuationColor||[1,1,1];return n.attenuationColor=new ut().setRGB(o[0],o[1],o[2],xi),Promise.all(s)}}class e1e{constructor(e){this.parser=e,this.name=vn.KHR_MATERIALS_IOR}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:no}extendMaterialParams(e,n){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=i.extensions[this.name];return n.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}}class t1e{constructor(e){this.parser=e,this.name=vn.KHR_MATERIALS_SPECULAR}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:no}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];n.specularIntensity=a.specularFactor!==void 0?a.specularFactor:1,a.specularTexture!==void 0&&s.push(r.assignTexture(n,"specularIntensityMap",a.specularTexture));const o=a.specularColorFactor||[1,1,1];return n.specularColor=new ut().setRGB(o[0],o[1],o[2],xi),a.specularColorTexture!==void 0&&s.push(r.assignTexture(n,"specularColorMap",a.specularColorTexture,Fi)),Promise.all(s)}}class n1e{constructor(e){this.parser=e,this.name=vn.EXT_MATERIALS_BUMP}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:no}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];return n.bumpScale=a.bumpFactor!==void 0?a.bumpFactor:1,a.bumpTexture!==void 0&&s.push(r.assignTexture(n,"bumpMap",a.bumpTexture)),Promise.all(s)}}class r1e{constructor(e){this.parser=e,this.name=vn.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:no}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];return a.anisotropyStrength!==void 0&&(n.anisotropy=a.anisotropyStrength),a.anisotropyRotation!==void 0&&(n.anisotropyRotation=a.anisotropyRotation),a.anisotropyTexture!==void 0&&s.push(r.assignTexture(n,"anisotropyMap",a.anisotropyTexture)),Promise.all(s)}}class i1e{constructor(e){this.parser=e,this.name=vn.KHR_TEXTURE_BASISU}loadTexture(e){const n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const s=i.extensions[this.name],a=n.options.ktx2Loader;if(!a){if(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return n.loadTextureImage(e,s.source,a)}}class s1e{constructor(e){this.parser=e,this.name=vn.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[n])return null;const a=s.extensions[n],o=i.images[a.source];let l=r.textureLoader;if(o.uri){const c=r.options.manager.getHandler(o.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,a.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class a1e{constructor(e){this.parser=e,this.name=vn.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[n])return null;const a=s.extensions[n],o=i.images[a.source];let l=r.textureLoader;if(o.uri){const c=r.options.manager.getHandler(o.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,a.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class o1e{constructor(e){this.name=vn.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const n=this.parser.json,r=n.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const i=r.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(o){const l=i.byteOffset||0,c=i.byteLength||0,d=i.count,f=i.byteStride,p=new Uint8Array(o,l,c);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(d,f,p,i.mode,i.filter).then(function(y){return y.buffer}):a.ready.then(function(){const y=new ArrayBuffer(d*f);return a.decodeGltfBuffer(new Uint8Array(y),d,f,p,i.mode,i.filter),y})})}else return null}}class l1e{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!==Va.TRIANGLES&&c.mode!==Va.TRIANGLE_STRIP&&c.mode!==Va.TRIANGLE_FAN&&c.mode!==void 0)return null;const a=r.extensions[this.name].attributes,o=[],l={};for(const c in a)o.push(this.parser.getDependency("accessor",a[c]).then(d=>(l[c]=d,l[c])));return o.length<1?null:(o.push(this.parser.createNodeMesh(e)),Promise.all(o).then(c=>{const d=c.pop(),f=d.isGroup?d.children:[d],p=c[0].count,y=[];for(const x of f){const S=new Rt,w=new q,b=new qt,M=new q(1,1,1),T=new FR(x.geometry,x.material,p);for(let C=0;C<p;C++)l.TRANSLATION&&w.fromBufferAttribute(l.TRANSLATION,C),l.ROTATION&&b.fromBufferAttribute(l.ROTATION,C),l.SCALE&&M.fromBufferAttribute(l.SCALE,C),T.setMatrixAt(C,S.compose(w,b,M));for(const C in l)if(C==="_COLOR_0"){const L=l[C];T.instanceColor=new Kh(L.array,L.itemSize,L.normalized)}else C!=="TRANSLATION"&&C!=="ROTATION"&&C!=="SCALE"&&x.geometry.setAttribute(C,l[C]);mn.prototype.copy.call(T,x),this.parser.assignFinalMaterial(T),y.push(T)}return d.isGroup?(d.clear(),d.add(...y),d):y[0]}))}}const XG="glTF",j0=12,nU={JSON:1313821514,BIN:5130562};class c1e{constructor(e){this.name=vn.KHR_BINARY_GLTF,this.content=null,this.body=null;const n=new DataView(e,0,j0),r=new TextDecoder;if(this.header={magic:r.decode(new Uint8Array(e.slice(0,4))),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==XG)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-j0,s=new DataView(e,j0);let a=0;for(;a<i;){const o=s.getUint32(a,!0);a+=4;const l=s.getUint32(a,!0);if(a+=4,l===nU.JSON){const c=new Uint8Array(e,j0+a,o);this.content=r.decode(c)}else if(l===nU.BIN){const c=j0+a;this.body=e.slice(c,c+o)}a+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class u1e{constructor(e,n){if(!n)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=vn.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=n,this.dracoLoader.preload()}decodePrimitive(e,n){const r=this.json,i=this.dracoLoader,s=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},l={},c={};for(const d in a){const f=fP[d]||d.toLowerCase();o[f]=a[d]}for(const d in e.attributes){const f=fP[d]||d.toLowerCase();if(a[d]!==void 0){const p=r.accessors[e.attributes[d]],y=dg[p.componentType];c[f]=y.name,l[f]=p.normalized===!0}}return n.getDependency("bufferView",s).then(function(d){return new Promise(function(f,p){i.decodeDracoFile(d,function(y){for(const x in y.attributes){const S=y.attributes[x],w=l[x];w!==void 0&&(S.normalized=w)}f(y)},o,c,xi,p)})})}}class d1e{constructor(){this.name=vn.KHR_TEXTURE_TRANSFORM}extendTexture(e,n){return(n.texCoord===void 0||n.texCoord===e.channel)&&n.offset===void 0&&n.rotation===void 0&&n.scale===void 0||(e=e.clone(),n.texCoord!==void 0&&(e.channel=n.texCoord),n.offset!==void 0&&e.offset.fromArray(n.offset),n.rotation!==void 0&&(e.rotation=n.rotation),n.scale!==void 0&&e.repeat.fromArray(n.scale),e.needsUpdate=!0),e}}class f1e{constructor(){this.name=vn.KHR_MESH_QUANTIZATION}}class qG extends fv{constructor(e,n,r,i){super(e,n,r,i)}copySampleValue_(e){const n=this.resultBuffer,r=this.sampleValues,i=this.valueSize,s=e*i*3+i;for(let a=0;a!==i;a++)n[a]=r[s+a];return n}interpolate_(e,n,r,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=o*2,c=o*3,d=i-n,f=(r-n)/d,p=f*f,y=p*f,x=e*c,S=x-c,w=-2*y+3*p,b=y-p,M=1-w,T=b-p+f;for(let C=0;C!==o;C++){const L=a[S+C+o],N=a[S+C+l]*d,D=a[x+C+o],F=a[x+C]*d;s[C]=M*L+T*N+w*D+b*F}return s}}const h1e=new qt;class p1e extends qG{interpolate_(e,n,r,i){const s=super.interpolate_(e,n,r,i);return h1e.fromArray(s).normalize().toArray(s),s}}const Va={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},dg={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},rU={9728:ri,9729:Pr,9984:ZS,9985:cg,9986:ph,9987:qa},iU={33071:Sa,33648:Ug,10497:Ld},aT={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},fP={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},sd={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},m1e={CUBICSPLINE:void 0,LINEAR:Bg,STEP:zg},oT={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function g1e(t){return t.DefaultMaterial===void 0&&(t.DefaultMaterial=new Sx({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Ul})),t.DefaultMaterial}function $f(t,e,n){for(const r in n.extensions)t[r]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[r]=n.extensions[r])}function kc(t,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(t.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function v1e(t,e,n){let r=!1,i=!1,s=!1;for(let c=0,d=e.length;c<d;c++){const f=e[c];if(f.POSITION!==void 0&&(r=!0),f.NORMAL!==void 0&&(i=!0),f.COLOR_0!==void 0&&(s=!0),r&&i&&s)break}if(!r&&!i&&!s)return Promise.resolve(t);const a=[],o=[],l=[];for(let c=0,d=e.length;c<d;c++){const f=e[c];if(r){const p=f.POSITION!==void 0?n.getDependency("accessor",f.POSITION):t.attributes.position;a.push(p)}if(i){const p=f.NORMAL!==void 0?n.getDependency("accessor",f.NORMAL):t.attributes.normal;o.push(p)}if(s){const p=f.COLOR_0!==void 0?n.getDependency("accessor",f.COLOR_0):t.attributes.color;l.push(p)}}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(l)]).then(function(c){const d=c[0],f=c[1],p=c[2];return r&&(t.morphAttributes.position=d),i&&(t.morphAttributes.normal=f),s&&(t.morphAttributes.color=p),t.morphTargetsRelative=!0,t})}function y1e(t,e){if(t.updateMorphTargets(),e.weights!==void 0)for(let n=0,r=e.weights.length;n<r;n++)t.morphTargetInfluences[n]=e.weights[n];if(e.extras&&Array.isArray(e.extras.targetNames)){const n=e.extras.targetNames;if(t.morphTargetInfluences.length===n.length){t.morphTargetDictionary={};for(let r=0,i=n.length;r<i;r++)t.morphTargetDictionary[n[r]]=r}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function x1e(t){let e;const n=t.extensions&&t.extensions[vn.KHR_DRACO_MESH_COMPRESSION];if(n?e="draco:"+n.bufferView+":"+n.indices+":"+lT(n.attributes):e=t.indices+":"+lT(t.attributes)+":"+t.mode,t.targets!==void 0)for(let r=0,i=t.targets.length;r<i;r++)e+=":"+lT(t.targets[r]);return e}function lT(t){let e="";const n=Object.keys(t).sort();for(let r=0,i=n.length;r<i;r++)e+=n[r]+":"+t[n[r]]+";";return e}function hP(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function b1e(t){return t.search(/\.jpe?g($|\?)/i)>0||t.search(/^data\:image\/jpeg/)===0?"image/jpeg":t.search(/\.webp($|\?)/i)>0||t.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const _1e=new Rt;class w1e{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new G_e,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,i=-1,s=!1,a=-1;if(typeof navigator<"u"){const o=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(o)===!0;const l=o.match(/Version\/(\d+)/);i=r&&l?parseInt(l[1],10):-1,s=o.indexOf("Firefox")>-1,a=s?o.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||r&&i<17||s&&a<98?this.textureLoader=new mG(this.options.manager):this.textureLoader=new SG(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Wo(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,n){const r=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(a){const o={scene:a[0][i.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:i.asset,parser:r,userData:{}};return $f(s,o,i),kc(o,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(o)})).then(function(){for(const l of o.scenes)l.updateMatrixWorld();e(o)})}).catch(n)}_markDefs(){const e=this.json.nodes||[],n=this.json.skins||[],r=this.json.meshes||[];for(let i=0,s=n.length;i<s;i++){const a=n[i].joints;for(let o=0,l=a.length;o<l;o++)e[a[o]].isBone=!0}for(let i=0,s=e.length;i<s;i++){const a=e[i];a.mesh!==void 0&&(this._addNodeRef(this.meshCache,a.mesh),a.skin!==void 0&&(r[a.mesh].isSkinnedMesh=!0)),a.camera!==void 0&&this._addNodeRef(this.cameraCache,a.camera)}}_addNodeRef(e,n){n!==void 0&&(e.refs[n]===void 0&&(e.refs[n]=e.uses[n]=0),e.refs[n]++)}_getNodeRef(e,n,r){if(e.refs[n]<=1)return r;const i=r.clone(),s=(a,o)=>{const l=this.associations.get(a);l!=null&&this.associations.set(o,l);for(const[c,d]of a.children.entries())s(d,o.children[c])};return s(r,i),i.name+="_instance_"+e.uses[n]++,i}_invokeOne(e){const n=Object.values(this.plugins);n.push(this);for(let r=0;r<n.length;r++){const i=e(n[r]);if(i)return i}return null}_invokeAll(e){const n=Object.values(this.plugins);n.unshift(this);const r=[];for(let i=0;i<n.length;i++){const s=e(n[i]);s&&r.push(s)}return r}getDependency(e,n){const r=e+":"+n;let i=this.cache.get(r);if(!i){switch(e){case"scene":i=this.loadScene(n);break;case"node":i=this._invokeOne(function(s){return s.loadNode&&s.loadNode(n)});break;case"mesh":i=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(n)});break;case"accessor":i=this.loadAccessor(n);break;case"bufferView":i=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(n)});break;case"buffer":i=this.loadBuffer(n);break;case"material":i=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(n)});break;case"texture":i=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(n)});break;case"skin":i=this.loadSkin(n);break;case"animation":i=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(n)});break;case"camera":i=this.loadCamera(n);break;default:if(i=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,n)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(r,i)}return i}getDependencies(e){let n=this.cache.get(e);if(!n){const r=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];n=Promise.all(i.map(function(s,a){return r.getDependency(e,a)})),this.cache.add(e,n)}return n}loadBuffer(e){const n=this.json.buffers[e],r=this.fileLoader;if(n.type&&n.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+n.type+" buffer type is not supported.");if(n.uri===void 0&&e===0)return Promise.resolve(this.extensions[vn.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(s,a){r.load(Cd.resolveURL(n.uri,i.path),s,void 0,function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+n.uri+'".'))})})}loadBufferView(e){const n=this.json.bufferViews[e];return this.getDependency("buffer",n.buffer).then(function(r){const i=n.byteLength||0,s=n.byteOffset||0;return r.slice(s,s+i)})}loadAccessor(e){const n=this,r=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){const a=aT[i.type],o=dg[i.componentType],l=i.normalized===!0,c=new o(i.count*a);return Promise.resolve(new Qt(c,a,l))}const s=[];return i.bufferView!==void 0?s.push(this.getDependency("bufferView",i.bufferView)):s.push(null),i.sparse!==void 0&&(s.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(s).then(function(a){const o=a[0],l=aT[i.type],c=dg[i.componentType],d=c.BYTES_PER_ELEMENT,f=d*l,p=i.byteOffset||0,y=i.bufferView!==void 0?r.bufferViews[i.bufferView].byteStride:void 0,x=i.normalized===!0;let S,w;if(y&&y!==f){const b=Math.floor(p/y),M="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+b+":"+i.count;let T=n.cache.get(M);T||(S=new c(o,b*y,i.count*y/d),T=new up(S,y/d),n.cache.add(M,T)),w=new Fl(T,l,p%y/d,x)}else o===null?S=new c(i.count*l):S=new c(o,p,i.count*l),w=new Qt(S,l,x);if(i.sparse!==void 0){const b=aT.SCALAR,M=dg[i.sparse.indices.componentType],T=i.sparse.indices.byteOffset||0,C=i.sparse.values.byteOffset||0,L=new M(a[1],T,i.sparse.count*b),N=new c(a[2],C,i.sparse.count*l);o!==null&&(w=new Qt(w.array.slice(),w.itemSize,w.normalized)),w.normalized=!1;for(let D=0,F=L.length;D<F;D++){const V=L[D];if(w.setX(V,N[D*l]),l>=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,a=n.images[s];let o=this.textureLoader;if(a.uri){const l=r.manager.getHandler(a.uri);l!==null&&(o=l)}return this.loadTextureImage(e,s,o)}loadTextureImage(e,n,r){const i=this,s=this.json,a=s.textures[e],o=s.images[n],l=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(n,r).then(function(d){d.flipY=!1,d.name=a.name||o.name||"",d.name===""&&typeof o.uri=="string"&&o.uri.startsWith("data:image/")===!1&&(d.name=o.uri);const p=(s.samplers||{})[a.sampler]||{};return d.magFilter=rU[p.magFilter]||Pr,d.minFilter=rU[p.minFilter]||qa,d.wrapS=iU[p.wrapS]||Ld,d.wrapT=iU[p.wrapT]||Ld,i.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,n){const r=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(f=>f.clone());const a=i.images[e],o=self.URL||self.webkitURL;let l=a.uri||"",c=!1;if(a.bufferView!==void 0)l=r.getDependency("bufferView",a.bufferView).then(function(f){c=!0;const p=new Blob([f],{type:a.mimeType});return l=o.createObjectURL(p),l});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(l).then(function(f){return new Promise(function(p,y){let x=p;n.isImageBitmapLoader===!0&&(x=function(S){const w=new fr(S);w.needsUpdate=!0,p(w)}),n.load(Cd.resolveURL(f,s.path),x,void 0,y)})}).then(function(f){return c===!0&&o.revokeObjectURL(l),kc(f,a),f.userData.mimeType=a.mimeType||b1e(a.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),f});return this.sourceCache[e]=d,d}assignTexture(e,n,r,i){const s=this;return this.getDependency("texture",r.index).then(function(a){if(!a)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(a=a.clone(),a.channel=r.texCoord),s.extensions[vn.KHR_TEXTURE_TRANSFORM]){const o=r.extensions!==void 0?r.extensions[vn.KHR_TEXTURE_TRANSFORM]:void 0;if(o){const l=s.associations.get(a);a=s.extensions[vn.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),s.associations.set(a,l)}}return i!==void 0&&(a.colorSpace=i),e[n]=a,a})}assignFinalMaterial(e){const n=e.geometry;let r=e.material;const i=n.attributes.tangent===void 0,s=n.attributes.color!==void 0,a=n.attributes.normal===void 0;if(e.isPoints){const o="PointsMaterial:"+r.uuid;let l=this.cache.get(o);l||(l=new fM,Gr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(o,l)),r=l}else if(e.isLine){const o="LineBasicMaterial:"+r.uuid;let l=this.cache.get(o);l||(l=new $r,Gr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(o,l)),r=l}if(i||s||a){let o="ClonedMaterial:"+r.uuid+":";i&&(o+="derivative-tangents:"),s&&(o+="vertex-colors:"),a&&(o+="flat-shading:");let l=this.cache.get(o);l||(l=r.clone(),s&&(l.vertexColors=!0),a&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(o,l),this.associations.set(l,this.associations.get(r))),r=l}e.material=r}getMaterialType(){return Sx}loadMaterial(e){const n=this,r=this.json,i=this.extensions,s=r.materials[e];let a;const o={},l=s.extensions||{},c=[];if(l[vn.KHR_MATERIALS_UNLIT]){const f=i[vn.KHR_MATERIALS_UNLIT];a=f.getMaterialType(),c.push(f.extendParams(o,s,n))}else{const f=s.pbrMetallicRoughness||{};if(o.color=new ut(1,1,1),o.opacity=1,Array.isArray(f.baseColorFactor)){const p=f.baseColorFactor;o.color.setRGB(p[0],p[1],p[2],xi),o.opacity=p[3]}f.baseColorTexture!==void 0&&c.push(n.assignTexture(o,"map",f.baseColorTexture,Fi)),o.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,o.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(c.push(n.assignTexture(o,"metalnessMap",f.metallicRoughnessTexture)),c.push(n.assignTexture(o,"roughnessMap",f.metallicRoughnessTexture))),a=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,o)})))}s.doubleSided===!0&&(o.side=_a);const d=s.alphaMode||oT.OPAQUE;if(d===oT.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,d===oT.MASK&&(o.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&a!==Ts&&(c.push(n.assignTexture(o,"normalMap",s.normalTexture)),o.normalScale=new He(1,1),s.normalTexture.scale!==void 0)){const f=s.normalTexture.scale;o.normalScale.set(f,f)}if(s.occlusionTexture!==void 0&&a!==Ts&&(c.push(n.assignTexture(o,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&a!==Ts){const f=s.emissiveFactor;o.emissive=new ut().setRGB(f[0],f[1],f[2],xi)}return s.emissiveTexture!==void 0&&a!==Ts&&c.push(n.assignTexture(o,"emissiveMap",s.emissiveTexture,Fi)),Promise.all(c).then(function(){const f=new a(o);return s.name&&(f.name=s.name),kc(f,s),n.associations.set(f,{materials:e}),s.extensions&&$f(i,f,s),f})}createUniqueName(e){const n=Rn.sanitizeNodeName(e||"");return n in this.nodeNamesUsed?n+"_"+ ++this.nodeNamesUsed[n]:(this.nodeNamesUsed[n]=0,n)}loadGeometries(e){const n=this,r=this.extensions,i=this.primitiveCache;function s(o){return r[vn.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,n).then(function(l){return sU(l,o,n)})}const a=[];for(let o=0,l=e.length;o<l;o++){const c=e[o],d=x1e(c),f=i[d];if(f)a.push(f.promise);else{let p;c.extensions&&c.extensions[vn.KHR_DRACO_MESH_COMPRESSION]?p=s(c):p=sU(new Yt,c,n),i[d]={primitive:c,promise:p},a.push(p)}}return Promise.all(a)}loadMesh(e){const n=this,r=this.json,i=this.extensions,s=r.meshes[e],a=s.primitives,o=[];for(let l=0,c=a.length;l<c;l++){const d=a[l].material===void 0?g1e(this.cache):this.getDependency("material",a[l].material);o.push(d)}return o.push(n.loadGeometries(a)),Promise.all(o).then(function(l){const c=l.slice(0,l.length-1),d=l[l.length-1],f=[];for(let y=0,x=d.length;y<x;y++){const S=d[y],w=a[y];let b;const M=c[y];if(w.mode===Va.TRIANGLES||w.mode===Va.TRIANGLE_STRIP||w.mode===Va.TRIANGLE_FAN||w.mode===void 0)b=s.isSkinnedMesh===!0?new uM(S,M):new xr(S,M),b.isSkinnedMesh===!0&&b.normalizeSkinWeights(),w.mode===Va.TRIANGLE_STRIP?b.geometry=tU(b.geometry,AR):w.mode===Va.TRIANGLE_FAN&&(b.geometry=tU(b.geometry,Vw));else if(w.mode===Va.LINES)b=new na(S,M);else if(w.mode===Va.LINE_STRIP)b=new zl(S,M);else if(w.mode===Va.LINE_LOOP)b=new zR(S,M);else if(w.mode===Va.POINTS)b=new BR(S,M);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+w.mode);Object.keys(b.geometry.morphAttributes).length>0&&y1e(b,s),b.name=n.createUniqueName(s.name||"mesh_"+e),kc(b,s),w.extensions&&$f(i,b,w),n.assignFinalMaterial(b),f.push(b)}for(let y=0,x=f.length;y<x;y++)n.associations.set(f[y],{meshes:e,primitives:y});if(f.length===1)return s.extensions&&$f(i,f[0],s),f[0];const p=new Cs;s.extensions&&$f(i,p,s),n.associations.set(p,{meshes:e});for(let y=0,x=f.length;y<x;y++)p.add(f[y]);return p})}loadCamera(e){let n;const r=this.json.cameras[e],i=r[r.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return r.type==="perspective"?n=new Cr(vr.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):r.type==="orthographic"&&(n=new qc(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),r.name&&(n.name=this.createUniqueName(r.name)),kc(n,r),Promise.resolve(n)}loadSkin(e){const n=this.json.skins[e],r=[];for(let i=0,s=n.joints.length;i<s;i++)r.push(this._loadNodeShallow(n.joints[i]));return n.inverseBindMatrices!==void 0?r.push(this.getDependency("accessor",n.inverseBindMatrices)):r.push(null),Promise.all(r).then(function(i){const s=i.pop(),a=i,o=[],l=[];for(let c=0,d=a.length;c<d;c++){const f=a[c];if(f){o.push(f);const p=new Rt;s!==null&&p.fromArray(s.array,c*16),l.push(p)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',n.joints[c])}return new Fd(o,l)})}loadAnimation(e){const n=this.json,r=this,i=n.animations[e],s=i.name?i.name:"animation_"+e,a=[],o=[],l=[],c=[],d=[];for(let f=0,p=i.channels.length;f<p;f++){const y=i.channels[f],x=i.samplers[y.sampler],S=y.target,w=S.node,b=i.parameters!==void 0?i.parameters[x.input]:x.input,M=i.parameters!==void 0?i.parameters[x.output]:x.output;S.node!==void 0&&(a.push(this.getDependency("node",w)),o.push(this.getDependency("accessor",b)),l.push(this.getDependency("accessor",M)),c.push(x),d.push(S))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(l),Promise.all(c),Promise.all(d)]).then(function(f){const p=f[0],y=f[1],x=f[2],S=f[3],w=f[4],b=[];for(let M=0,T=p.length;M<T;M++){const C=p[M],L=y[M],N=x[M],D=S[M],F=w[M];if(C===void 0)continue;C.updateMatrix&&C.updateMatrix();const V=r._createAnimationTracks(C,L,N,D,F);if(V)for(let I=0;I<V.length;I++)b.push(V[I])}return new Gg(s,void 0,b)})}createNodeMesh(e){const n=this.json,r=this,i=n.nodes[e];return i.mesh===void 0?null:r.getDependency("mesh",i.mesh).then(function(s){const a=r._getNodeRef(r.meshCache,i.mesh,s);return i.weights!==void 0&&a.traverse(function(o){if(o.isMesh)for(let l=0,c=i.weights.length;l<c;l++)o.morphTargetInfluences[l]=i.weights[l]}),a})}loadNode(e){const n=this.json,r=this,i=n.nodes[e],s=r._loadNodeShallow(e),a=[],o=i.children||[];for(let c=0,d=o.length;c<d;c++)a.push(r.getDependency("node",o[c]));const l=i.skin===void 0?Promise.resolve(null):r.getDependency("skin",i.skin);return Promise.all([s,Promise.all(a),l]).then(function(c){const d=c[0],f=c[1],p=c[2];p!==null&&d.traverse(function(y){y.isSkinnedMesh&&y.bind(p,_1e)});for(let y=0,x=f.length;y<x;y++)d.add(f[y]);return d})}_loadNodeShallow(e){const n=this.json,r=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const s=n.nodes[e],a=s.name?i.createUniqueName(s.name):"",o=[],l=i._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return l&&o.push(l),s.camera!==void 0&&o.push(i.getDependency("camera",s.camera).then(function(c){return i._getNodeRef(i.cameraCache,s.camera,c)})),i._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){o.push(c)}),this.nodeCache[e]=Promise.all(o).then(function(c){let d;if(s.isBone===!0?d=new dM:c.length>1?d=new Cs:c.length===1?d=c[0]:d=new mn,d!==c[0])for(let f=0,p=c.length;f<p;f++)d.add(c[f]);if(s.name&&(d.userData.name=s.name,d.name=a),kc(d,s),s.extensions&&$f(r,d,s),s.matrix!==void 0){const f=new Rt;f.fromArray(s.matrix),d.applyMatrix4(f)}else s.translation!==void 0&&d.position.fromArray(s.translation),s.rotation!==void 0&&d.quaternion.fromArray(s.rotation),s.scale!==void 0&&d.scale.fromArray(s.scale);return i.associations.has(d)||i.associations.set(d,{}),i.associations.get(d).nodes=e,d}),this.nodeCache[e]}loadScene(e){const n=this.extensions,r=this.json.scenes[e],i=this,s=new Cs;r.name&&(s.name=i.createUniqueName(r.name)),kc(s,r),r.extensions&&$f(n,s,r);const a=r.nodes||[],o=[];for(let l=0,c=a.length;l<c;l++)o.push(i.getDependency("node",a[l]));return Promise.all(o).then(function(l){for(let d=0,f=l.length;d<f;d++)s.add(l[d]);const c=d=>{const f=new Map;for(const[p,y]of i.associations)(p instanceof Gr||p instanceof fr)&&f.set(p,y);return d.traverse(p=>{const y=i.associations.get(p);y!=null&&f.set(p,y)}),f};return i.associations=c(s),s})}_createAnimationTracks(e,n,r,i,s){const a=[],o=e.name?e.name:e.uuid,l=[];sd[s.path]===sd.weights?e.traverse(function(p){p.morphTargetInfluences&&l.push(p.name?p.name:p.uuid)}):l.push(o);let c;switch(sd[s.path]){case sd.weights:c=Zh;break;case sd.rotation:c=Qh;break;case sd.position:case sd.scale:c=Jh;break;default:switch(r.itemSize){case 1:c=Zh;break;case 2:case 3:default:c=Jh;break}break}const d=i.interpolation!==void 0?m1e[i.interpolation]:Bg,f=this._getArrayFromAccessor(r);for(let p=0,y=l.length;p<y;p++){const x=new c(l[p]+"."+sd[s.path],n.array,f,d);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(x),a.push(x)}return a}_getArrayFromAccessor(e){let n=e.array;if(e.normalized){const r=hP(n.constructor),i=new Float32Array(n.length);for(let s=0,a=n.length;s<a;s++)i[s]=n[s]*r;n=i}return n}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(r){const i=this instanceof Qh?p1e:qG;return new i(this.times,this.values,this.getValueSize()/3,r)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function S1e(t,e,n){const r=e.attributes,i=new os;if(r.POSITION!==void 0){const o=n.json.accessors[r.POSITION],l=o.min,c=o.max;if(l!==void 0&&c!==void 0){if(i.set(new q(l[0],l[1],l[2]),new q(c[0],c[1],c[2])),o.normalized){const d=hP(dg[o.componentType]);i.min.multiplyScalar(d),i.max.multiplyScalar(d)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const o=new q,l=new q;for(let c=0,d=s.length;c<d;c++){const f=s[c];if(f.POSITION!==void 0){const p=n.json.accessors[f.POSITION],y=p.min,x=p.max;if(y!==void 0&&x!==void 0){if(l.setX(Math.max(Math.abs(y[0]),Math.abs(x[0]))),l.setY(Math.max(Math.abs(y[1]),Math.abs(x[1]))),l.setZ(Math.max(Math.abs(y[2]),Math.abs(x[2]))),p.normalized){const S=hP(dg[p.componentType]);l.multiplyScalar(S)}o.max(l)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(o)}t.boundingBox=i;const a=new Hi;i.getCenter(a.center),a.radius=i.min.distanceTo(i.max)/2,t.boundingSphere=a}function sU(t,e,n){const r=e.attributes,i=[];function s(a,o){return n.getDependency("accessor",a).then(function(l){t.setAttribute(o,l)})}for(const a in r){const o=fP[a]||a.toLowerCase();o in t.attributes||i.push(s(r[a],o))}if(e.indices!==void 0&&!t.index){const a=n.getDependency("accessor",e.indices).then(function(o){t.setIndex(o)});i.push(a)}return Nn.workingColorSpace!==xi&&"COLOR_0"in r&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Nn.workingColorSpace}" not supported.`),kc(t,e),S1e(t,e,n),Promise.all(i).then(function(){return e.targets!==void 0?v1e(t,e.targets,n):t})}/*!
|
||
* @pixiv/three-vrm v3.5.4
|
||
* VRM file loader for three.js.
|
||
*
|
||
* Copyright (c) 2019-2026 pixiv Inc.
|
||
* @pixiv/three-vrm is distributed under MIT License
|
||
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
||
*/var F_=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{o(n.next(l))}catch(c){i(c)}},a=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,a);o((n=n.apply(t,e)).next())}),jn=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{o(n.next(l))}catch(c){i(c)}},a=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,a);o((n=n.apply(t,e)).next())}),aU=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<this.outputWeight?1:0:this.overrideBlink==="blend"?this.outputWeight:0}get overrideLookAtAmount(){return this.overrideLookAt==="block"?0<this.outputWeight?1:0:this.overrideLookAt==="blend"?this.outputWeight:0}get overrideMouthAmount(){return this.overrideMouth==="block"?0<this.outputWeight?1:0:this.overrideMouth==="blend"?this.outputWeight:0}get outputWeight(){return this.isBinary?this.weight>.5?1:0:this.weight}addBind(t){this._binds.push(t)}deleteBind(t){const e=this._binds.indexOf(t);e>=0&&this._binds.splice(e,1)}applyWeight(t){var e;let n=this.outputWeight;n*=(e=t==null?void 0:t.multiplier)!=null?e:1,this.isBinary&&n<1&&(n=0),this._binds.forEach(r=>r.applyWeight(n))}clearAppliedWeight(){this._binds.forEach(t=>t.clearAppliedWeight())}};function KG(t,e,n){var r,i;const s=t.parser.json,a=(r=s.nodes)==null?void 0:r[e];if(a==null)return console.warn(`extractPrimitivesInternal: Attempt to use nodes[${e}] of glTF but the node doesn't exist`),null;const o=a.mesh;if(o==null)return null;const l=(i=s.meshes)==null?void 0:i[o];if(l==null)return console.warn(`extractPrimitivesInternal: Attempt to use meshes[${o}] of glTF but the mesh doesn't exist`),null;const c=l.primitives.length,d=[];return n.traverse(f=>{d.length<c&&f.isMesh&&d.push(f)}),d}function oU(t,e){return jn(this,null,function*(){const n=yield t.parser.getDependency("node",e);return KG(t,e,n)})}function lU(t){return jn(this,null,function*(){const e=yield t.parser.getDependencies("node"),n=new Map;return e.forEach((r,i)=>{const s=KG(t,i,r);s!=null&&n.set(i,s)}),n})}var pP={Aa:"aa",Ih:"ih",Ou:"ou",Ee:"ee",Oh:"oh",Blink:"blink",Happy:"happy",Angry:"angry",Sad:"sad",Relaxed:"relaxed",LookUp:"lookUp",Surprised:"surprised",LookDown:"lookDown",LookLeft:"lookLeft",LookRight:"lookRight",BlinkLeft:"blinkLeft",BlinkRight:"blinkRight",Neutral:"neutral"};function YG(t){return Math.max(Math.min(t,1),0)}var cU=class ZG{constructor(){this.blinkExpressionNames=["blink","blinkLeft","blinkRight"],this.lookAtExpressionNames=["lookLeft","lookRight","lookUp","lookDown"],this.mouthExpressionNames=["aa","ee","ih","oh","ou"],this._expressions=[],this._expressionMap={}}get expressions(){return this._expressions.concat()}get expressionMap(){return Object.assign({},this._expressionMap)}get presetExpressionMap(){const e={},n=new Set(Object.values(pP));return Object.entries(this._expressionMap).forEach(([r,i])=>{n.has(r)&&(e[r]=i)}),e}get customExpressionMap(){const e={},n=new Set(Object.values(pP));return Object.entries(this._expressionMap).forEach(([r,i])=>{n.has(r)||(e[r]=i)}),e}copy(e){return this._expressions.concat().forEach(r=>{this.unregisterExpression(r)}),e._expressions.forEach(r=>{this.registerExpression(r)}),this.blinkExpressionNames=e.blinkExpressionNames.concat(),this.lookAtExpressionNames=e.lookAtExpressionNames.concat(),this.mouthExpressionNames=e.mouthExpressionNames.concat(),this}clone(){return new ZG().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=YG(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}}},U0={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",RimColor:"rimColor",OutlineColor:"outlineColor"},M1e={_Color:U0.Color,_EmissionColor:U0.EmissionColor,_ShadeColor:U0.ShadeColor,_RimColor:U0.RimColor,_OutlineColor:U0.OutlineColor},E1e=new ut,QG=class JG{constructor({material:e,type:n,targetValue:r,targetAlpha:i}){this.material=e,this.type=n,this.targetValue=r,this.targetAlpha=i??1;const s=this._initColorBindState(),a=this._initAlphaBindState();this._state={color:s,alpha:a}}applyWeight(e){const{color:n,alpha:r}=this._state;if(n!=null){const{propertyName:i,deltaValue:s}=n,a=this.material[i];a!=null&&a.add(E1e.copy(s).multiplyScalar(e))}if(r!=null){const{propertyName:i,deltaValue:s}=r;this.material[i]!=null&&(this.material[i]+=s*e)}}clearAppliedWeight(){const{color:e,alpha:n}=this._state;if(e!=null){const{propertyName:r,initialValue:i}=e,s=this.material[r];s!=null&&s.copy(i)}if(n!=null){const{propertyName:r,initialValue:i}=n;this.material[r]!=null&&(this.material[r]=i)}}_initColorBindState(){var e,n,r;const{material:i,type:s,targetValue:a}=this,o=this._getPropertyNameMap(),l=(n=(e=o==null?void 0:o[s])==null?void 0:e[0])!=null?n:null;if(l==null)return console.warn(`Tried to add a material color bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type is not supported.`),null;const d=i[l].clone(),f=new ut(a.r-d.r,a.g-d.g,a.b-d.b);return{propertyName:l,initialValue:d,deltaValue:f}}_initAlphaBindState(){var e,n,r;const{material:i,type:s,targetAlpha:a}=this,o=this._getPropertyNameMap(),l=(n=(e=o==null?void 0:o[s])==null?void 0:e[1])!=null?n:null;if(l==null&&a!==1)return console.warn(`Tried to add a material alpha bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type does not support alpha.`),null;if(l==null)return null;const c=i[l],d=a-c;return{propertyName:l,initialValue:c,deltaValue:d}}_getPropertyNameMap(){var e,n;return(n=(e=Object.entries(JG._propertyNameMapMap).find(([r])=>this.material[r]===!0))==null?void 0:e[1])!=null?n:null}};QG._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 uU=QG,qw=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)})}},dU=new He,e8=class t8{constructor({material:e,scale:n,offset:r}){var i,s;this.material=e,this.scale=n,this.offset=r;const a=(i=Object.entries(t8._propertyNamesMap).find(([o])=>e[o]===!0))==null?void 0:i[1];a==null?(console.warn(`Tried to add a texture transform bind to the material ${(s=e.name)!=null?s:"(no name)"} but the material is not supported.`),this._properties=[]):(this._properties=[],a.forEach(o=>{var l;const c=(l=e[o])==null?void 0:l.clone();if(!c)return null;e[o]=c;const d=c.offset.clone(),f=c.repeat.clone(),p=r.clone().sub(d),y=n.clone().sub(f);this._properties.push({name:o,initialOffset:d,deltaOffset:p,initialScale:f,deltaScale:y})}))}applyWeight(e){this._properties.forEach(n=>{const r=this.material[n.name];r!==void 0&&(r.offset.add(dU.copy(n.deltaOffset).multiplyScalar(e)),r.repeat.add(dU.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))})}};e8._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};var fU=e8,A1e=new Set(["1.0","1.0-beta"]),n8=class r8{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 a=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!a)return null;const o=a.specVersion;if(!A1e.has(o))return console.warn(`VRMExpressionLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const l=a.expressions;if(!l)return null;const c=new Set(Object.values(pP)),d=new Map;l.preset!=null&&Object.entries(l.preset).forEach(([p,y])=>{if(y!=null){if(!c.has(p)){console.warn(`VRMExpressionLoaderPlugin: Unknown preset name "${p}" detected. Ignoring the expression`);return}d.set(p,y)}}),l.custom!=null&&Object.entries(l.custom).forEach(([p,y])=>{if(c.has(p)){console.warn(`VRMExpressionLoaderPlugin: Custom expression cannot have preset name "${p}". Ignoring the expression`);return}d.set(p,y)});const f=new cU;return yield Promise.all(Array.from(d.entries()).map(p=>jn(this,[p],function*([y,x]){var S,w,b,M,T,C,L;const N=new aU(y);if(e.scene.add(N),N.isBinary=(S=x.isBinary)!=null?S:!1,N.overrideBlink=(w=x.overrideBlink)!=null?w:"none",N.overrideLookAt=(b=x.overrideLookAt)!=null?b:"none",N.overrideMouth=(M=x.overrideMouth)!=null?M:"none",(T=x.morphTargetBinds)==null||T.forEach(D=>jn(this,null,function*(){var F;if(D.node===void 0||D.index===void 0)return;const V=yield oU(e,D.node),I=D.index;if(!V.every(U=>Array.isArray(U.morphTargetInfluences)&&I<U.morphTargetInfluences.length)){console.warn(`VRMExpressionLoaderPlugin: ${x.name} attempts to index morph #${I} but not found.`);return}N.addBind(new qw({primitives:V,index:I,weight:(F=D.weight)!=null?F:1}))})),x.materialColorBinds||x.textureTransformBinds){const D=[];e.scene.traverse(F=>{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(I=>{var U;const X=(U=this.parser.associations.get(I))==null?void 0:U.materials;return F.material===X}).forEach(I=>{N.addBind(new uU({material:I,type:F.type,targetValue:new ut().fromArray(F.targetValue),targetAlpha:F.targetValue[3]}))})})),(L=x.textureTransformBinds)==null||L.forEach(F=>jn(this,null,function*(){D.filter(I=>{var U;const X=(U=this.parser.associations.get(I))==null?void 0:U.materials;return F.material===X}).forEach(I=>{var U,X;N.addBind(new fU({material:I,offset:new He().fromArray((U=F.offset)!=null?U:[0,0]),scale:new He().fromArray((X=F.scale)!=null?X:[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 a=new cU,o=s.blendShapeGroups;if(!o)return a;const l=new Set;return yield Promise.all(o.map(c=>jn(this,null,function*(){var d;const f=c.presetName,p=f!=null&&r8.v0v1PresetNameMap[f]||null,y=p??c.name;if(y==null){console.warn("VRMExpressionLoaderPlugin: One of custom expressions has no name. Ignoring the expression");return}if(l.has(y)){console.warn(`VRMExpressionLoaderPlugin: An expression preset ${f} has duplicated entries. Ignoring the expression`);return}l.add(y);const x=new aU(y);e.scene.add(x),x.isBinary=(d=c.isBinary)!=null?d:!1,c.binds&&c.binds.forEach(w=>jn(this,null,function*(){var b;if(w.mesh===void 0||w.index===void 0)return;const M=[];if((b=r.nodes)==null||b.forEach((C,L)=>{C.mesh===w.mesh&&M.push(L)}),M.length===0){console.warn(`VRMExpressionLoaderPlugin: ${c.name} attempts to bind a morph target to the mesh #${w.mesh} but the mesh is not found or not used in the scene. Ignoring the bind.`);return}const T=w.index;yield Promise.all(M.map(C=>jn(this,null,function*(){var L;const N=yield oU(e,C);if(!N.every(D=>Array.isArray(D.morphTargetInfluences)&&T<D.morphTargetInfluences.length)){console.warn(`VRMExpressionLoaderPlugin: ${c.name} attempts to index ${T}th morph but not found.`);return}x.addBind(new qw({primitives:N,index:T,weight:.01*((L=w.weight)!=null?L:100)}))})))}));const S=c.materialValues;S&&S.length!==0&&S.forEach(w=>{if(w.materialName===void 0||w.propertyName===void 0||w.targetValue===void 0)return;const b=[];e.scene.traverse(T=>{if(T.material){const C=T.material;Array.isArray(C)?b.push(...C.filter(L=>(L.name===w.materialName||L.name===w.materialName+" (Outline)")&&b.indexOf(L)===-1)):C.name===w.materialName&&b.indexOf(C)===-1&&b.push(C)}});const M=w.propertyName;b.forEach(T=>{if(M==="_MainTex_ST"){const L=new He(w.targetValue[0],w.targetValue[1]),N=new He(w.targetValue[2],w.targetValue[3]);N.y=1-N.y-L.y,x.addBind(new fU({material:T,scale:L,offset:N}));return}const C=M1e[M];if(C){x.addBind(new uU({material:T,type:C,targetValue:new ut().fromArray(w.targetValue),targetAlpha:w.targetValue[3]}));return}console.warn(M+" is not supported")})}),a.registerExpression(x)}))),a})}};n8.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 T1e=n8,uN=class Km{constructor(e,n){this._firstPersonOnlyLayer=Km.DEFAULT_FIRSTPERSON_ONLY_LAYER,this._thirdPersonOnlyLayer=Km.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 Km(this.humanoid,this.meshAnnotations).copy(this)}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}setup({firstPersonOnlyLayer:e=Km.DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:n=Km.DEFAULT_THIRDPERSON_ONLY_LAYER}={}){this._initializedLayers||(this._firstPersonOnlyLayer=e,this._thirdPersonOnlyLayer=n,this.meshAnnotations.forEach(r=>{r.meshes.forEach(i=>{r.type==="firstPersonOnly"?(i.layers.set(this._firstPersonOnlyLayer),i.traverse(s=>s.layers.set(this._firstPersonOnlyLayer))):r.type==="thirdPersonOnly"?(i.layers.set(this._thirdPersonOnlyLayer),i.traverse(s=>s.layers.set(this._thirdPersonOnlyLayer))):r.type==="auto"&&this._createHeadlessModel(i)})}),this._initializedLayers=!0)}_excludeTriangles(e,n,r,i){let s=0;if(n!=null&&n.length>0)for(let a=0;a<e.length;a+=3){const o=e[a],l=e[a+1],c=e[a+2],d=n[o],f=r[o];if(d[0]>0&&i.includes(f[0])||d[1]>0&&i.includes(f[1])||d[2]>0&&i.includes(f[2])||d[3]>0&&i.includes(f[3]))continue;const p=n[l],y=r[l];if(p[0]>0&&i.includes(y[0])||p[1]>0&&i.includes(y[1])||p[2]>0&&i.includes(y[2])||p[3]>0&&i.includes(y[3]))continue;const 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++]=o,e[s++]=l,e[s++]=c)}return s}_createErasedMesh(e,n){const r=new uM(e.geometry.clone(),e.material);r.name=`${e.name}(erase)`,r.frustumCulled=e.frustumCulled,r.layers.set(this._firstPersonOnlyLayer);const i=r.geometry,s=i.getAttribute("skinIndex"),a=s instanceof aP?[]:s.array,o=[];for(let S=0;S<a.length;S+=4)o.push([a[S],a[S+1],a[S+2],a[S+3]]);const l=i.getAttribute("skinWeight"),c=l instanceof aP?[]:l.array,d=[];for(let S=0;S<c.length;S+=4)d.push([c[S],c[S+1],c[S+2],c[S+3]]);const f=i.getIndex();if(!f)throw new Error("The geometry doesn't have an index buffer");const p=Array.from(f.array),y=this._excludeTriangles(p,d,o,n),x=[];for(let S=0;S<y;S++)x[S]=p[S];return i.setIndex(x),e.onBeforeRender&&(r.onBeforeRender=e.onBeforeRender),r.bind(new Fd(e.skeleton.bones,e.skeleton.boneInverses),new Rt),r}_createHeadlessModelForSkinnedMesh(e,n){const r=[];if(n.skeleton.bones.forEach((s,a)=>{this._isEraseTarget(s)&&r.push(a)}),!r.length){n.layers.enable(this._thirdPersonOnlyLayer),n.layers.enable(this._firstPersonOnlyLayer);return}n.layers.set(this._thirdPersonOnlyLayer);const i=this._createErasedMesh(n,r);e.add(i)}_createHeadlessModel(e){if(e.type==="Group")if(e.layers.set(this._thirdPersonOnlyLayer),this._isEraseTarget(e))e.traverse(n=>n.layers.set(this._thirdPersonOnlyLayer));else{const n=new Cs;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}};uN.DEFAULT_FIRSTPERSON_ONLY_LAYER=9;uN.DEFAULT_THIRDPERSON_ONLY_LAYER=10;var hU=uN,C1e=new Set(["1.0","1.0-beta"]),P1e=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 a=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!a)return null;const o=a.specVersion;if(!C1e.has(o))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const l=a.firstPerson,c=[],d=yield lU(t);return Array.from(d.entries()).forEach(([f,p])=>{var y,x;const S=(y=l==null?void 0:l.meshAnnotations)==null?void 0:y.find(w=>w.node===f);c.push({meshes:p,type:(x=S==null?void 0:S.type)!=null?x:"auto"})}),new hU(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 a=[],o=yield lU(t);return Array.from(o.entries()).forEach(([l,c])=>{const d=r.nodes[l],f=s.meshAnnotations?s.meshAnnotations.find(p=>p.mesh===d.mesh):void 0;a.push({meshes:c,type:this._convertV0FlagToV1Type(f==null?void 0:f.firstPersonFlag)})}),new hU(e,a)})}_convertV0FlagToV1Type(t){return t==="FirstPersonOnly"?"firstPersonOnly":t==="ThirdPersonOnly"?"thirdPersonOnly":t==="Both"?"both":"auto"}},pU=new q,mU=new q,R1e=new qt,gU=class extends Cs{constructor(t){super(),this.vrmHumanoid=t,this._boneAxesMap=new Map,Object.values(t.humanBones).forEach(e=>{const n=new PG(1);n.matrixAutoUpdate=!1,n.material.depthTest=!1,n.material.depthWrite=!1,this.add(n),this._boneAxesMap.set(e,n)})}dispose(){Array.from(this._boneAxesMap.values()).forEach(t=>{t.geometry.dispose(),t.material.dispose()})}updateMatrixWorld(t){Array.from(this._boneAxesMap.entries()).forEach(([e,n])=>{e.node.updateWorldMatrix(!0,!1),e.node.matrixWorld.decompose(pU,R1e,mU);const r=pU.set(.1,.1,.1).divide(mU);n.matrix.copy(e.node.matrixWorld).scale(r)}),super.updateMatrixWorld(t)}},cT=["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"],N1e={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 i8(t){return t.invert?t.invert():t.inverse(),t}var Xf=new q,qf=new qt,mP=class{constructor(t){this.humanBones=t,this.restPose=this.getAbsolutePose()}getAbsolutePose(){const t={};return Object.keys(this.humanBones).forEach(e=>{const n=e,r=this.getBoneNode(n);r&&(Xf.copy(r.position),qf.copy(r.quaternion),t[n]={position:Xf.toArray(),rotation:qf.toArray()})}),t}getPose(){const t={};return Object.keys(this.humanBones).forEach(e=>{const n=e,r=this.getBoneNode(n);if(!r)return;Xf.set(0,0,0),qf.identity();const i=this.restPose[n];i!=null&&i.position&&Xf.fromArray(i.position).negate(),i!=null&&i.rotation&&i8(qf.fromArray(i.rotation)),Xf.add(r.position),qf.premultiply(r.quaternion),t[n]={position:Xf.toArray(),rotation:qf.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(Xf.fromArray(s.position))),n!=null&&n.rotation&&(i.quaternion.fromArray(n.rotation),s.rotation&&i.quaternion.multiply(qf.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}},uT=new q,k1e=new qt,I1e=new q,vU=class s8 extends mP{static _setupTransforms(e){const n=new mn;n.name="VRMHumanoidRig";const r={},i={},s={};cT.forEach(o=>{var l;const c=e.getBoneNode(o);if(c){const d=new q,f=new qt;c.updateWorldMatrix(!0,!1),c.matrixWorld.decompose(d,f,uT),r[o]=d,i[o]=c.quaternion.clone();const p=new qt;(l=c.parent)==null||l.matrixWorld.decompose(uT,p,uT),s[o]=p}});const a={};return cT.forEach(o=>{var l;const c=e.getBoneNode(o);if(c){const d=r[o];let f=o,p;for(;p==null&&(f=N1e[f],f!=null);)p=r[f];const y=new mn;y.name="Normalized_"+c.name,(f?(l=a[f])==null?void 0:l.node:n).add(y),y.position.copy(d),p&&y.position.sub(p),a[o]={node:y}}}),{rigBones:a,root:n,parentWorldRotations:s,boneRotations:i}}constructor(e){const{rigBones:n,root:r,parentWorldRotations:i,boneRotations:s}=s8._setupTransforms(e);super(n),this.original=e,this.root=r,this._parentWorldRotations=i,this._boneRotations=s}update(){cT.forEach(e=>{const n=this.original.getBoneNode(e);if(n!=null){const r=this.getBoneNode(e),i=this._parentWorldRotations[e],s=k1e.copy(i).invert(),a=this._boneRotations[e];if(n.quaternion.copy(r.quaternion).multiply(i).premultiply(s).multiply(a),e==="hips"){const o=r.getWorldPosition(I1e);n.parent.updateWorldMatrix(!0,!1);const l=n.parent.matrixWorld,c=o.applyMatrix4(l.invert());n.position.copy(c)}}})}},yU=class a8{get restPose(){return console.warn("VRMHumanoid: restPose is deprecated. Use either rawRestPose or normalizedRestPose instead."),this.rawRestPose}get rawRestPose(){return this._rawHumanBones.restPose}get normalizedRestPose(){return this._normalizedHumanBones.restPose}get humanBones(){return this._rawHumanBones.humanBones}get rawHumanBones(){return this._rawHumanBones.humanBones}get normalizedHumanBones(){return this._normalizedHumanBones.humanBones}get normalizedHumanBonesRoot(){return this._normalizedHumanBones.root}constructor(e,n){var r;this.autoUpdateHumanBones=(r=n==null?void 0:n.autoUpdateHumanBones)!=null?r:!0,this._rawHumanBones=new mP(e),this._normalizedHumanBones=new vU(this._rawHumanBones)}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new mP(e.humanBones),this._normalizedHumanBones=new vU(this._rawHumanBones),this}clone(){return new a8(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()}},L1e={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"},O1e=new Set(["1.0","1.0-beta"]),xU={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"},D1e=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 a=s.specVersion;if(!O1e.has(a))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const o=s.humanoid;if(!o)return null;const l=o.humanBones.leftThumbIntermediate!=null||o.humanBones.rightThumbIntermediate!=null,c={};o.humanBones!=null&&(yield Promise.all(Object.entries(o.humanBones).map(f=>jn(this,[f],function*([p,y]){let x=p;const S=y.node;if(l){const b=xU[x];b!=null&&(x=b)}const w=yield this.parser.getDependency("node",S);if(w==null){console.warn(`A glTF node bound to the humanoid bone ${x} (index = ${S}) does not exist`);return}c[x]={node:w}}))));const d=new yU(this._ensureRequiredBonesExist(c),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(t.scene.add(d.normalizedHumanBonesRoot),this.helperRoot){const f=new gU(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(o=>jn(this,null,function*(){const l=o.bone,c=o.node;if(l==null||c==null)return;if(c<0){console.warn(`A glTF node index for the humanoid bone ${l} is negative (${c}), ignoring this bone.`);return}const d=yield this.parser.getDependency("node",c);if(d==null){console.warn(`A glTF node bound to the humanoid bone ${l} (index = ${c}) does not exist`);return}const f=xU[l],p=f??l;if(s[p]!=null){console.warn(`Multiple bone entries for ${p} detected (index = ${c}), ignoring duplicated entries.`);return}s[p]={node:d}}))));const a=new yU(this._ensureRequiredBonesExist(s),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(t.scene.add(a.normalizedHumanBonesRoot),this.helperRoot){const o=new gU(a);this.helperRoot.add(o),o.renderOrder=this.helperRoot.renderOrder}return a})}_ensureRequiredBonesExist(t){const e=Object.values(L1e).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}},bU=class extends Yt{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new Qt(new Float32Array(195),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(new Uint16Array(189),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentTheta!==this.theta&&(this._currentTheta=this.theta,t=!0),this._currentRadius!==this.radius&&(this._currentRadius=this.radius,t=!0),t&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,0,0,0);for(let t=0;t<64;t++){const e=t/63*this._currentTheta;this._attrPos.setXYZ(t+1,this._currentRadius*Math.sin(e),0,this._currentRadius*Math.cos(e))}this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<63;t++)this._attrIndex.setXYZ(t*3,0,t+1,t+2);this._attrIndex.needsUpdate=!0}},j1e=class extends Yt{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new q,this._currentTail=new q,this._attrPos=new Qt(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentRadius!==this.radius&&(this._currentRadius=this.radius,t=!0),this._currentTail.equals(this.tail)||(this._currentTail.copy(this.tail),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(64+t*2,32+t,32+e),this._attrIndex.setXY(128+t*2,64+t,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},z_=new qt,_U=new qt,F0=new q,wU=new q,SU=Math.sqrt(2)/2,U1e=new qt(0,0,-SU,SU),F1e=new q(0,1,0),z1e=class extends Cs{constructor(t){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=t;{const e=new bU;e.radius=.5;const n=new Ts({color:65280,transparent:!0,opacity:.5,side:_a,depthTest:!1,depthWrite:!1});this._meshPitch=new xr(e,n),this.add(this._meshPitch)}{const e=new bU;e.radius=.5;const n=new Ts({color:16711680,transparent:!0,opacity:.5,side:_a,depthTest:!1,depthWrite:!1});this._meshYaw=new xr(e,n),this.add(this._meshYaw)}{const e=new j1e;e.radius=.1;const n=new $r({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new na(e,n),this._lineTarget.frustumCulled=!1,this.add(this._lineTarget)}}dispose(){this._meshYaw.geometry.dispose(),this._meshYaw.material.dispose(),this._meshPitch.geometry.dispose(),this._meshPitch.material.dispose(),this._lineTarget.geometry.dispose(),this._lineTarget.material.dispose()}updateMatrixWorld(t){const e=vr.DEG2RAD*this.vrmLookAt.yaw;this._meshYaw.geometry.theta=e,this._meshYaw.geometry.update();const n=vr.DEG2RAD*this.vrmLookAt.pitch;this._meshPitch.geometry.theta=n,this._meshPitch.geometry.update(),this.vrmLookAt.getLookAtWorldPosition(F0),this.vrmLookAt.getLookAtWorldQuaternion(z_),z_.multiply(this.vrmLookAt.getFaceFrontQuaternion(_U)),this._meshYaw.position.copy(F0),this._meshYaw.quaternion.copy(z_),this._meshPitch.position.copy(F0),this._meshPitch.quaternion.copy(z_),this._meshPitch.quaternion.multiply(_U.setFromAxisAngle(F1e,e)),this._meshPitch.quaternion.multiply(U1e);const{target:r,autoUpdate:i}=this.vrmLookAt;r!=null&&i&&(r.getWorldPosition(wU).sub(F0),this._lineTarget.geometry.tail.copy(wU),this._lineTarget.geometry.update(),this._lineTarget.position.copy(F0)),super.updateMatrixWorld(t)}},B1e=new q,H1e=new q;function gP(t,e){return t.matrixWorld.decompose(B1e,e,H1e),e}function n1(t){return[Math.atan2(-t.z,t.x),Math.atan2(t.y,Math.sqrt(t.x*t.x+t.z*t.z))]}function MU(t){const e=Math.round(t/2/Math.PI);return t-2*Math.PI*e}var EU=new q(0,0,1),V1e=new q,G1e=new q,W1e=new q,$1e=new qt,dT=new qt,AU=new qt,X1e=new qt,fT=new ls,o8=class l8{constructor(e,n){this.offsetFromHeadBone=new q,this.autoUpdate=!0,this.faceFront=new q(0,0,1),this.humanoid=e,this.applier=n,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new qt)}get yaw(){return this._yaw}set yaw(e){this._yaw=e,this._needsUpdate=!0}get pitch(){return this._pitch}set pitch(e){this._pitch=e,this._needsUpdate=!0}get euler(){return console.warn("VRMLookAt: euler is deprecated. use getEuler() instead."),this.getEuler(new ls)}getEuler(e){return e.set(vr.DEG2RAD*this._pitch,vr.DEG2RAD*this._yaw,0,"YXZ")}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMLookAt: humanoid must be same in order to copy");return this.offsetFromHeadBone.copy(e.offsetFromHeadBone),this.applier=e.applier,this.autoUpdate=e.autoUpdate,this.target=e.target,this.faceFront.copy(e.faceFront),this}clone(){return new l8(this.humanoid,this.applier).copy(this)}reset(){this._yaw=0,this._pitch=0,this._needsUpdate=!0}getLookAtWorldPosition(e){const n=this.humanoid.getRawBoneNode("head");return e.copy(this.offsetFromHeadBone).applyMatrix4(n.matrixWorld)}getLookAtWorldQuaternion(e){const n=this.humanoid.getRawBoneNode("head");return gP(n,e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(EU)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[n,r]=n1(this.faceFront);return fT.set(0,.5*Math.PI+n,r,"YZX"),e.setFromEuler(fT).premultiply(X1e.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(dT),this.getFaceFrontQuaternion(AU),e.copy(EU).applyQuaternion(dT).applyQuaternion(AU).applyEuler(this.getEuler(fT))}lookAt(e){const n=$1e.copy(this._restHeadWorldQuaternion).multiply(i8(this.getLookAtWorldQuaternion(dT))),r=this.getLookAtWorldPosition(G1e),i=W1e.copy(e).sub(r).applyQuaternion(n).normalize(),[s,a]=n1(this.faceFront),[o,l]=n1(i),c=MU(o-s),d=MU(a-l);this._yaw=vr.RAD2DEG*c,this._pitch=vr.RAD2DEG*d,this._needsUpdate=!0}update(e){this.target!=null&&this.autoUpdate&&this.lookAt(this.target.getWorldPosition(V1e)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};o8.EULER_ORDER="YXZ";var q1e=o8,K1e=new q(0,0,1),gl=new qt,Bm=new qt,Ba=new ls(0,0,0,"YXZ"),r1=class{constructor(t,e,n,r,i){this.humanoid=t,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=n,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i,this.faceFront=new q(0,0,1),this._restQuatLeftEye=new qt,this._restQuatRightEye=new qt,this._restLeftEyeParentWorldQuat=new qt,this._restRightEyeParentWorldQuat=new qt;const s=this.humanoid.getRawBoneNode("leftEye"),a=this.humanoid.getRawBoneNode("rightEye");s&&(this._restQuatLeftEye.copy(s.quaternion),gP(s.parent,this._restLeftEyeParentWorldQuat)),a&&(this._restQuatRightEye.copy(a.quaternion),gP(a.parent,this._restRightEyeParentWorldQuat))}applyYawPitch(t,e){const n=this.humanoid.getRawBoneNode("leftEye"),r=this.humanoid.getRawBoneNode("rightEye"),i=this.humanoid.getNormalizedBoneNode("leftEye"),s=this.humanoid.getNormalizedBoneNode("rightEye");n&&(e<0?Ba.x=-vr.DEG2RAD*this.rangeMapVerticalDown.map(-e):Ba.x=vr.DEG2RAD*this.rangeMapVerticalUp.map(e),t<0?Ba.y=-vr.DEG2RAD*this.rangeMapHorizontalInner.map(-t):Ba.y=vr.DEG2RAD*this.rangeMapHorizontalOuter.map(t),gl.setFromEuler(Ba),this._getWorldFaceFrontQuat(Bm),i.quaternion.copy(Bm).multiply(gl).multiply(Bm.invert()),gl.copy(this._restLeftEyeParentWorldQuat),n.quaternion.copy(i.quaternion).multiply(gl).premultiply(gl.invert()).multiply(this._restQuatLeftEye)),r&&(e<0?Ba.x=-vr.DEG2RAD*this.rangeMapVerticalDown.map(-e):Ba.x=vr.DEG2RAD*this.rangeMapVerticalUp.map(e),t<0?Ba.y=-vr.DEG2RAD*this.rangeMapHorizontalOuter.map(-t):Ba.y=vr.DEG2RAD*this.rangeMapHorizontalInner.map(t),gl.setFromEuler(Ba),this._getWorldFaceFrontQuat(Bm),s.quaternion.copy(Bm).multiply(gl).multiply(Bm.invert()),gl.copy(this._restRightEyeParentWorldQuat),r.quaternion.copy(s.quaternion).multiply(gl).premultiply(gl.invert()).multiply(this._restQuatRightEye))}lookAt(t){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=vr.RAD2DEG*t.y,n=vr.RAD2DEG*t.x;this.applyYawPitch(e,n)}_getWorldFaceFrontQuat(t){if(this.faceFront.distanceToSquared(K1e)<.01)return t.identity();const[e,n]=n1(this.faceFront);return Ba.set(0,.5*Math.PI+e,n,"YZX"),t.setFromEuler(Ba)}};r1.type="bone";var vP=class{constructor(t,e,n,r,i){this.expressions=t,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=n,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i}applyYawPitch(t,e){e<0?(this.expressions.setValue("lookDown",0),this.expressions.setValue("lookUp",this.rangeMapVerticalUp.map(-e))):(this.expressions.setValue("lookUp",0),this.expressions.setValue("lookDown",this.rangeMapVerticalDown.map(e))),t<0?(this.expressions.setValue("lookLeft",0),this.expressions.setValue("lookRight",this.rangeMapHorizontalOuter.map(-t))):(this.expressions.setValue("lookRight",0),this.expressions.setValue("lookLeft",this.rangeMapHorizontalOuter.map(t)))}lookAt(t){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=vr.RAD2DEG*t.y,n=vr.RAD2DEG*t.x;this.applyYawPitch(e,n)}};vP.type="expression";var TU=class{constructor(t,e){this.inputMaxValue=t,this.outputScale=e}map(t){return this.outputScale*YG(t/this.inputMaxValue)}},Y1e=new Set(["1.0","1.0-beta"]),B_=.01,Z1e=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 a=this.parser.json;if(!(((r=a.extensionsUsed)==null?void 0:r.indexOf("VRMC_vrm"))!==-1))return null;const l=(i=a.extensions)==null?void 0:i.VRMC_vrm;if(!l)return null;const c=l.specVersion;if(!Y1e.has(c))return console.warn(`VRMLookAtLoaderPlugin: Unknown VRMC_vrm specVersion "${c}"`),null;const d=l.lookAt;if(!d)return null;const f=d.type==="expression"?1:10,p=this._v1ImportRangeMap(d.rangeMapHorizontalInner,f),y=this._v1ImportRangeMap(d.rangeMapHorizontalOuter,f),x=this._v1ImportRangeMap(d.rangeMapVerticalDown,f),S=this._v1ImportRangeMap(d.rangeMapVerticalUp,f);let w;d.type==="expression"?w=new vP(n,p,y,x,S):w=new r1(e,p,y,x,S);const b=this._importLookAt(e,w);return b.offsetFromHeadBone.fromArray((s=d.offsetFromHeadBone)!=null?s:[0,.06,0]),b})}_v1ImportRangeMap(t,e){var n,r;let i=(n=t==null?void 0:t.inputMaxValue)!=null?n:90;const s=(r=t==null?void 0:t.outputScale)!=null?r:e;return i<B_&&(console.warn("VRMLookAtLoaderPlugin: inputMaxValue of a range map is too small. Consider reviewing the range map!"),i=B_),new TU(i,s)}_v0Import(t,e,n){return jn(this,null,function*(){var r,i,s,a;const l=(r=this.parser.json.extensions)==null?void 0:r.VRM;if(!l)return null;const c=l.firstPerson;if(!c)return null;const d=c.lookAtTypeName==="BlendShape"?1:10,f=this._v0ImportDegreeMap(c.lookAtHorizontalInner,d),p=this._v0ImportDegreeMap(c.lookAtHorizontalOuter,d),y=this._v0ImportDegreeMap(c.lookAtVerticalDown,d),x=this._v0ImportDegreeMap(c.lookAtVerticalUp,d);let S;c.lookAtTypeName==="BlendShape"?S=new vP(n,f,p,y,x):S=new r1(e,f,p,y,x);const w=this._importLookAt(e,S);return c.firstPersonBoneOffset?w.offsetFromHeadBone.set((i=c.firstPersonBoneOffset.x)!=null?i:0,(s=c.firstPersonBoneOffset.y)!=null?s:.06,-((a=c.firstPersonBoneOffset.z)!=null?a:0)):w.offsetFromHeadBone.set(0,.06,0),w.faceFront.set(0,0,-1),S instanceof r1&&S.faceFront.set(0,0,-1),w})}_v0ImportDegreeMap(t,e){var n,r;const i=t==null?void 0:t.curve;JSON.stringify(i)!=="[0,0,0,1,1,1,1,0]"&&console.warn("Curves of LookAtDegreeMap defined in VRM 0.0 are not supported");let s=(n=t==null?void 0:t.xRange)!=null?n:90;const a=(r=t==null?void 0:t.yRange)!=null?r:e;return s<B_&&(console.warn("VRMLookAtLoaderPlugin: xRange of a degree map is too small. Consider reviewing the degree map!"),s=B_),new TU(s,a)}_importLookAt(t,e){const n=new q1e(t,e);if(this.helperRoot){const r=new z1e(n);this.helperRoot.add(r),r.renderOrder=this.helperRoot.renderOrder}return n}};function Q1e(t,e){return typeof t!="string"||t===""?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}var J1e=new Set(["1.0","1.0-beta"]),ewe=class{get name(){return"VRMMetaLoaderPlugin"}constructor(t,e){var n,r,i;this.parser=t,this.needThumbnailImage=(n=e==null?void 0:e.needThumbnailImage)!=null?n:!1,this.acceptLicenseUrls=(r=e==null?void 0:e.acceptLicenseUrls)!=null?r:["https://vrm.dev/licenses/1.0/"],this.acceptV0Meta=(i=e==null?void 0:e.acceptV0Meta)!=null?i:!0}afterRoot(t){return jn(this,null,function*(){t.userData.vrmMeta=yield this._import(t)})}_import(t){return jn(this,null,function*(){const e=yield this._v1Import(t);if(e!=null)return e;const n=yield this._v0Import(t);return n??null})}_v1Import(t){return jn(this,null,function*(){var e,n,r;const i=this.parser.json;if(!(((e=i.extensionsUsed)==null?void 0:e.indexOf("VRMC_vrm"))!==-1))return null;const a=(n=i.extensions)==null?void 0:n.VRMC_vrm;if(a==null)return null;const o=a.specVersion;if(!J1e.has(o))return console.warn(`VRMMetaLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const l=a.meta;if(!l)return null;const c=l.licenseUrl;if(!new Set(this.acceptLicenseUrls).has(c))throw new Error(`VRMMetaLoaderPlugin: The license url "${c}" is not accepted`);let f;return this.needThumbnailImage&&l.thumbnailImage!=null&&(f=(r=yield this._extractGLTFImage(l.thumbnailImage))!=null?r:void 0),{metaVersion:"1",name:l.name,version:l.version,authors:l.authors,copyrightInformation:l.copyrightInformation,contactInformation:l.contactInformation,references:l.references,thirdPartyLicenses:l.thirdPartyLicenses,thumbnailImage:f,licenseUrl:l.licenseUrl,avatarPermission:l.avatarPermission,allowExcessivelyViolentUsage:l.allowExcessivelyViolentUsage,allowExcessivelySexualUsage:l.allowExcessivelySexualUsage,commercialUsage:l.commercialUsage,allowPoliticalOrReligiousUsage:l.allowPoliticalOrReligiousUsage,allowAntisocialOrHateUsage:l.allowAntisocialOrHateUsage,creditNotation:l.creditNotation,allowRedistribution:l.allowRedistribution,modification:l.modification,otherLicenseUrl:l.otherLicenseUrl}})}_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.meta;if(!i)return null;if(!this.acceptV0Meta)throw new Error("VRMMetaLoaderPlugin: Attempted to load VRM0.0 meta but acceptV0Meta is false");let s;return this.needThumbnailImage&&i.texture!=null&&i.texture!==-1&&(s=yield this.parser.getDependency("texture",i.texture)),{metaVersion:"0",allowedUserName:i.allowedUserName,author:i.author,commercialUssageName:i.commercialUssageName,contactInformation:i.contactInformation,licenseName:i.licenseName,otherLicenseUrl:i.otherLicenseUrl,otherPermissionUrl:i.otherPermissionUrl,reference:i.reference,sexualUssageName:i.sexualUssageName,texture:s??void 0,title:i.title,version:i.version,violentUssageName:i.violentUssageName}})}_extractGLTFImage(t){return jn(this,null,function*(){var e;const r=(e=this.parser.json.images)==null?void 0:e[t];if(r==null)return console.warn(`VRMMetaLoaderPlugin: Attempt to use images[${t}] of glTF as a thumbnail but the image doesn't exist`),null;let i=r.uri;if(r.bufferView!=null){const a=yield this.parser.getDependency("bufferView",r.bufferView),o=new Blob([a],{type:r.mimeType});i=URL.createObjectURL(o)}return i==null?(console.warn(`VRMMetaLoaderPlugin: Attempt to use images[${t}] of glTF as a thumbnail but the image couldn't load properly`),null):yield new Wg().loadAsync(Q1e(i,this.parser.options.path)).catch(a=>(console.error(a),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null))})}},twe=class{constructor(t){this.scene=t.scene,this.meta=t.meta,this.humanoid=t.humanoid,this.expressionManager=t.expressionManager,this.firstPerson=t.firstPerson,this.lookAt=t.lookAt}update(t){this.humanoid.update(),this.lookAt&&this.lookAt.update(t),this.expressionManager&&this.expressionManager.update()}},nwe=class extends twe{constructor(t){super(t),this.materials=t.materials,this.springBoneManager=t.springBoneManager,this.nodeConstraintManager=t.nodeConstraintManager}update(t){super.update(t),this.nodeConstraintManager&&this.nodeConstraintManager.update(),this.springBoneManager&&this.springBoneManager.update(t),this.materials&&this.materials.forEach(e=>{e.update&&e.update(t)})}},rwe=Object.defineProperty,CU=Object.getOwnPropertySymbols,iwe=Object.prototype.hasOwnProperty,swe=Object.prototype.propertyIsEnumerable,PU=(t,e,n)=>e in t?rwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,RU=(t,e)=>{for(var n in e||(e={}))iwe.call(e,n)&&PU(t,n,e[n]);if(CU)for(var n of CU(e))swe.call(e,n)&&PU(t,n,e[n]);return t},xh=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{o(n.next(l))}catch(c){i(c)}},a=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,a);o((n=n.apply(t,e)).next())}),awe={"":3e3,srgb:3001};function owe(t,e){parseInt(kd,10)>=152?t.colorSpace=e:t.encoding=awe[e]}var lwe=class{get pending(){return Promise.all(this._pendings)}constructor(t,e){this._parser=t,this._materialParams=e,this._pendings=[]}assignPrimitive(t,e){e!=null&&(this._materialParams[t]=e)}assignColor(t,e,n){if(e!=null){const r=new ut().fromArray(e);n&&r.convertSRGBToLinear(),this._materialParams[t]=r}}assignTexture(t,e,n){return xh(this,null,function*(){const r=xh(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&&owe(i,"srgb")}});return this._pendings.push(r),r})}assignTextureByIndex(t,e,n){return xh(this,null,function*(){return this.assignTexture(t,e!=null?{index:e}:void 0,n)})}},cwe=`// #define PHONG
|
||
|
||
varying vec3 vViewPosition;
|
||
|
||
#ifndef FLAT_SHADED
|
||
varying vec3 vNormal;
|
||
#endif
|
||
|
||
#include <common>
|
||
|
||
// #include <uv_pars_vertex>
|
||
#ifdef MTOON_USE_UV
|
||
varying vec2 vUv;
|
||
|
||
// COMPAT: pre-r151 uses a common uvTransform
|
||
#if THREE_VRM_THREE_REVISION < 151
|
||
uniform mat3 uvTransform;
|
||
#endif
|
||
#endif
|
||
|
||
// #include <uv2_pars_vertex>
|
||
// COMAPT: pre-r151 uses uv2 for lightMap and aoMap
|
||
#if THREE_VRM_THREE_REVISION < 151
|
||
#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
|
||
attribute vec2 uv2;
|
||
varying vec2 vUv2;
|
||
uniform mat3 uv2Transform;
|
||
#endif
|
||
#endif
|
||
|
||
// #include <displacementmap_pars_vertex>
|
||
// #include <envmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
|
||
#ifdef USE_OUTLINEWIDTHMULTIPLYTEXTURE
|
||
uniform sampler2D outlineWidthMultiplyTexture;
|
||
uniform mat3 outlineWidthMultiplyTextureUvTransform;
|
||
#endif
|
||
|
||
uniform float outlineWidthFactor;
|
||
|
||
void main() {
|
||
|
||
// #include <uv_vertex>
|
||
#ifdef MTOON_USE_UV
|
||
// COMPAT: pre-r151 uses a common uvTransform
|
||
#if THREE_VRM_THREE_REVISION >= 151
|
||
vUv = uv;
|
||
#else
|
||
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
||
#endif
|
||
#endif
|
||
|
||
// #include <uv2_vertex>
|
||
// COMAPT: pre-r151 uses uv2 for lightMap and aoMap
|
||
#if THREE_VRM_THREE_REVISION < 151
|
||
#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
|
||
vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
|
||
#endif
|
||
#endif
|
||
|
||
#include <color_vertex>
|
||
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
|
||
// we need this to compute the outline properly
|
||
objectNormal = normalize( objectNormal );
|
||
|
||
#include <defaultnormal_vertex>
|
||
|
||
#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED
|
||
vNormal = normalize( transformedNormal );
|
||
#endif
|
||
|
||
#include <begin_vertex>
|
||
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
// #include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
|
||
vViewPosition = - mvPosition.xyz;
|
||
|
||
#ifdef OUTLINE
|
||
float worldNormalLength = length( transformedNormal );
|
||
vec3 outlineOffset = outlineWidthFactor * worldNormalLength * objectNormal;
|
||
|
||
#ifdef USE_OUTLINEWIDTHMULTIPLYTEXTURE
|
||
vec2 outlineWidthMultiplyTextureUv = ( outlineWidthMultiplyTextureUvTransform * vec3( vUv, 1 ) ).xy;
|
||
float outlineTex = texture2D( outlineWidthMultiplyTexture, outlineWidthMultiplyTextureUv ).g;
|
||
outlineOffset *= outlineTex;
|
||
#endif
|
||
|
||
#ifdef OUTLINE_WIDTH_SCREEN
|
||
outlineOffset *= vViewPosition.z / projectionMatrix[ 1 ].y;
|
||
#endif
|
||
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( outlineOffset + transformed, 1.0 );
|
||
|
||
gl_Position.z += 1E-6 * gl_Position.w; // anti-artifact magic
|
||
#endif
|
||
|
||
#include <worldpos_vertex>
|
||
// #include <envmap_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
|
||
}`,uwe=`// #define PHONG
|
||
|
||
uniform vec3 litFactor;
|
||
|
||
uniform float opacity;
|
||
|
||
uniform vec3 shadeColorFactor;
|
||
#ifdef USE_SHADEMULTIPLYTEXTURE
|
||
uniform sampler2D shadeMultiplyTexture;
|
||
uniform mat3 shadeMultiplyTextureUvTransform;
|
||
#endif
|
||
|
||
uniform float shadingShiftFactor;
|
||
uniform float shadingToonyFactor;
|
||
|
||
#ifdef USE_SHADINGSHIFTTEXTURE
|
||
uniform sampler2D shadingShiftTexture;
|
||
uniform mat3 shadingShiftTextureUvTransform;
|
||
uniform float shadingShiftTextureScale;
|
||
#endif
|
||
|
||
uniform float giEqualizationFactor;
|
||
|
||
uniform vec3 parametricRimColorFactor;
|
||
#ifdef USE_RIMMULTIPLYTEXTURE
|
||
uniform sampler2D rimMultiplyTexture;
|
||
uniform mat3 rimMultiplyTextureUvTransform;
|
||
#endif
|
||
uniform float rimLightingMixFactor;
|
||
uniform float parametricRimFresnelPowerFactor;
|
||
uniform float parametricRimLiftFactor;
|
||
|
||
#ifdef USE_MATCAPTEXTURE
|
||
uniform vec3 matcapFactor;
|
||
uniform sampler2D matcapTexture;
|
||
uniform mat3 matcapTextureUvTransform;
|
||
#endif
|
||
|
||
uniform vec3 emissive;
|
||
uniform float emissiveIntensity;
|
||
|
||
uniform vec3 outlineColorFactor;
|
||
uniform float outlineLightingMixFactor;
|
||
|
||
#ifdef USE_UVANIMATIONMASKTEXTURE
|
||
uniform sampler2D uvAnimationMaskTexture;
|
||
uniform mat3 uvAnimationMaskTextureUvTransform;
|
||
#endif
|
||
|
||
uniform float uvAnimationScrollXOffset;
|
||
uniform float uvAnimationScrollYOffset;
|
||
uniform float uvAnimationRotationPhase;
|
||
|
||
#include <common>
|
||
#include <packing>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
|
||
// #include <uv_pars_fragment>
|
||
#if ( defined( MTOON_USE_UV ) && !defined( MTOON_UVS_VERTEX_ONLY ) )
|
||
varying vec2 vUv;
|
||
#endif
|
||
|
||
// #include <uv2_pars_fragment>
|
||
// COMAPT: pre-r151 uses uv2 for lightMap and aoMap
|
||
#if THREE_VRM_THREE_REVISION < 151
|
||
#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
|
||
varying vec2 vUv2;
|
||
#endif
|
||
#endif
|
||
|
||
#include <map_pars_fragment>
|
||
|
||
#ifdef USE_MAP
|
||
uniform mat3 mapUvTransform;
|
||
#endif
|
||
|
||
// #include <alphamap_pars_fragment>
|
||
|
||
#include <alphatest_pars_fragment>
|
||
|
||
#include <aomap_pars_fragment>
|
||
// #include <lightmap_pars_fragment>
|
||
#include <emissivemap_pars_fragment>
|
||
|
||
#ifdef USE_EMISSIVEMAP
|
||
uniform mat3 emissiveMapUvTransform;
|
||
#endif
|
||
|
||
// #include <envmap_common_pars_fragment>
|
||
// #include <envmap_pars_fragment>
|
||
// #include <cube_uv_reflection_fragment>
|
||
#include <fog_pars_fragment>
|
||
|
||
// #include <bsdfs>
|
||
// COMPAT: pre-r151 doesn't have BRDF_Lambert in <common>
|
||
#if THREE_VRM_THREE_REVISION < 151
|
||
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
|
||
return RECIPROCAL_PI * diffuseColor;
|
||
}
|
||
#endif
|
||
|
||
#include <lights_pars_begin>
|
||
|
||
#include <normal_pars_fragment>
|
||
|
||
// #include <lights_phong_pars_fragment>
|
||
varying vec3 vViewPosition;
|
||
|
||
struct MToonMaterial {
|
||
vec3 diffuseColor;
|
||
vec3 shadeColor;
|
||
float shadingShift;
|
||
};
|
||
|
||
float linearstep( float a, float b, float t ) {
|
||
return clamp( ( t - a ) / ( b - a ), 0.0, 1.0 );
|
||
}
|
||
|
||
/**
|
||
* Convert NdotL into toon shading factor using shadingShift and shadingToony
|
||
*/
|
||
float getShading(
|
||
const in float dotNL,
|
||
const in float shadow,
|
||
const in float shadingShift
|
||
) {
|
||
float shading = dotNL;
|
||
shading = shading + shadingShift;
|
||
shading = linearstep( -1.0 + shadingToonyFactor, 1.0 - shadingToonyFactor, shading );
|
||
shading *= shadow;
|
||
return shading;
|
||
}
|
||
|
||
/**
|
||
* Mix diffuseColor and shadeColor using shading factor and light color
|
||
*/
|
||
vec3 getDiffuse(
|
||
const in MToonMaterial material,
|
||
const in float shading,
|
||
in vec3 lightColor
|
||
) {
|
||
#ifdef DEBUG_LITSHADERATE
|
||
return vec3( BRDF_Lambert( shading * lightColor ) );
|
||
#endif
|
||
|
||
vec3 col = lightColor * BRDF_Lambert( mix( material.shadeColor, material.diffuseColor, shading ) );
|
||
|
||
// The "comment out if you want to PBR absolutely" line
|
||
#ifdef V0_COMPAT_SHADE
|
||
col = min( col, material.diffuseColor );
|
||
#endif
|
||
|
||
return col;
|
||
}
|
||
|
||
// COMPAT: pre-r156 uses a struct GeometricContext
|
||
#if THREE_VRM_THREE_REVISION >= 157
|
||
void RE_Direct_MToon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in MToonMaterial material, const in float shadow, inout ReflectedLight reflectedLight ) {
|
||
float dotNL = clamp( dot( geometryNormal, directLight.direction ), -1.0, 1.0 );
|
||
vec3 irradiance = directLight.color;
|
||
|
||
// directSpecular will be used for rim lighting, not an actual specular
|
||
reflectedLight.directSpecular += irradiance;
|
||
|
||
irradiance *= dotNL;
|
||
|
||
float shading = getShading( dotNL, shadow, material.shadingShift );
|
||
|
||
// toon shaded diffuse
|
||
reflectedLight.directDiffuse += getDiffuse( material, shading, directLight.color );
|
||
}
|
||
|
||
void RE_IndirectDiffuse_MToon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in MToonMaterial material, inout ReflectedLight reflectedLight ) {
|
||
// indirect diffuse will use diffuseColor, no shadeColor involved
|
||
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
|
||
// directSpecular will be used for rim lighting, not an actual specular
|
||
reflectedLight.directSpecular += irradiance;
|
||
}
|
||
#else
|
||
void RE_Direct_MToon( const in IncidentLight directLight, const in GeometricContext geometry, const in MToonMaterial material, const in float shadow, inout ReflectedLight reflectedLight ) {
|
||
float dotNL = clamp( dot( geometry.normal, directLight.direction ), -1.0, 1.0 );
|
||
vec3 irradiance = directLight.color;
|
||
|
||
// directSpecular will be used for rim lighting, not an actual specular
|
||
reflectedLight.directSpecular += irradiance;
|
||
|
||
irradiance *= dotNL;
|
||
|
||
float shading = getShading( dotNL, shadow, material.shadingShift );
|
||
|
||
// toon shaded diffuse
|
||
reflectedLight.directDiffuse += getDiffuse( material, shading, directLight.color );
|
||
}
|
||
|
||
void RE_IndirectDiffuse_MToon( const in vec3 irradiance, const in GeometricContext geometry, const in MToonMaterial material, inout ReflectedLight reflectedLight ) {
|
||
// indirect diffuse will use diffuseColor, no shadeColor involved
|
||
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
|
||
// directSpecular will be used for rim lighting, not an actual specular
|
||
reflectedLight.directSpecular += irradiance;
|
||
}
|
||
#endif
|
||
|
||
#define RE_Direct RE_Direct_MToon
|
||
#define RE_IndirectDiffuse RE_IndirectDiffuse_MToon
|
||
#define Material_LightProbeLOD( material ) (0)
|
||
|
||
#include <shadowmap_pars_fragment>
|
||
// #include <bumpmap_pars_fragment>
|
||
|
||
// #include <normalmap_pars_fragment>
|
||
#ifdef USE_NORMALMAP
|
||
|
||
uniform sampler2D normalMap;
|
||
uniform mat3 normalMapUvTransform;
|
||
uniform vec2 normalScale;
|
||
|
||
#endif
|
||
|
||
// COMPAT: pre-r151
|
||
// USE_NORMALMAP_OBJECTSPACE used to be OBJECTSPACE_NORMALMAP in pre-r151
|
||
#if defined( USE_NORMALMAP_OBJECTSPACE ) || defined( OBJECTSPACE_NORMALMAP )
|
||
|
||
uniform mat3 normalMatrix;
|
||
|
||
#endif
|
||
|
||
// COMPAT: pre-r151
|
||
// USE_NORMALMAP_TANGENTSPACE used to be TANGENTSPACE_NORMALMAP in pre-r151
|
||
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( TANGENTSPACE_NORMALMAP ) )
|
||
|
||
// Per-Pixel Tangent Space Normal Mapping
|
||
// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html
|
||
|
||
// three-vrm specific change: it requires \`uv\` as an input in order to support uv scrolls
|
||
|
||
// Temporary compat against shader change @ Three.js r126, r151
|
||
#if THREE_VRM_THREE_REVISION >= 151
|
||
|
||
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 );
|
||
|
||
}
|
||
|
||
#else
|
||
|
||
vec3 perturbNormal2Arb( vec2 uv, vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {
|
||
|
||
vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );
|
||
vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );
|
||
vec2 st0 = dFdx( uv.st );
|
||
vec2 st1 = dFdy( uv.st );
|
||
|
||
vec3 N = normalize( 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;
|
||
|
||
// three-vrm specific change: Workaround for the issue that happens when delta of uv = 0.0
|
||
// TODO: Is this still required? Or shall I make a PR about it?
|
||
if ( length( T ) == 0.0 || length( B ) == 0.0 ) {
|
||
return surf_norm;
|
||
}
|
||
|
||
float det = max( dot( T, T ), dot( B, B ) );
|
||
float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );
|
||
|
||
return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );
|
||
|
||
}
|
||
|
||
#endif
|
||
|
||
#endif
|
||
|
||
// #include <specularmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
|
||
// == post correction ==========================================================
|
||
void postCorrection() {
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}
|
||
|
||
// == main procedure ===========================================================
|
||
void main() {
|
||
#include <clipping_planes_fragment>
|
||
|
||
vec2 uv = vec2(0.5, 0.5);
|
||
|
||
#if ( defined( MTOON_USE_UV ) && !defined( MTOON_UVS_VERTEX_ONLY ) )
|
||
uv = vUv;
|
||
|
||
float uvAnimMask = 1.0;
|
||
#ifdef USE_UVANIMATIONMASKTEXTURE
|
||
vec2 uvAnimationMaskTextureUv = ( uvAnimationMaskTextureUvTransform * vec3( uv, 1 ) ).xy;
|
||
uvAnimMask = texture2D( uvAnimationMaskTexture, uvAnimationMaskTextureUv ).b;
|
||
#endif
|
||
|
||
float uvRotCos = cos( uvAnimationRotationPhase * uvAnimMask );
|
||
float uvRotSin = sin( uvAnimationRotationPhase * uvAnimMask );
|
||
uv = mat2( uvRotCos, -uvRotSin, uvRotSin, uvRotCos ) * ( uv - 0.5 ) + 0.5;
|
||
uv = uv + vec2( uvAnimationScrollXOffset, uvAnimationScrollYOffset ) * uvAnimMask;
|
||
#endif
|
||
|
||
#ifdef DEBUG_UV
|
||
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
||
#if ( defined( MTOON_USE_UV ) && !defined( MTOON_UVS_VERTEX_ONLY ) )
|
||
gl_FragColor = vec4( uv, 0.0, 1.0 );
|
||
#endif
|
||
return;
|
||
#endif
|
||
|
||
vec4 diffuseColor = vec4( litFactor, opacity );
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
vec3 totalEmissiveRadiance = emissive * emissiveIntensity;
|
||
|
||
#include <logdepthbuf_fragment>
|
||
|
||
// #include <map_fragment>
|
||
#ifdef USE_MAP
|
||
vec2 mapUv = ( mapUvTransform * vec3( uv, 1 ) ).xy;
|
||
vec4 sampledDiffuseColor = texture2D( map, mapUv );
|
||
#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
|
||
|
||
// #include <color_fragment>
|
||
#if ( defined( USE_COLOR ) && !defined( IGNORE_VERTEX_COLOR ) )
|
||
diffuseColor.rgb *= vColor;
|
||
#endif
|
||
|
||
// #include <alphamap_fragment>
|
||
|
||
#include <alphatest_fragment>
|
||
|
||
// #include <specularmap_fragment>
|
||
|
||
// #include <normal_fragment_begin>
|
||
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
|
||
|
||
#ifdef USE_NORMALMAP
|
||
|
||
vec2 normalMapUv = ( normalMapUvTransform * vec3( uv, 1 ) ).xy;
|
||
|
||
#endif
|
||
|
||
#ifdef USE_NORMALMAP_TANGENTSPACE
|
||
|
||
#ifdef USE_TANGENT
|
||
|
||
mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
|
||
|
||
#else
|
||
|
||
mat3 tbn = getTangentFrame( - vViewPosition, normal, normalMapUv );
|
||
|
||
#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
|
||
|
||
// non perturbed normal for clearcoat among others
|
||
|
||
vec3 nonPerturbedNormal = normal;
|
||
|
||
#ifdef OUTLINE
|
||
normal *= -1.0;
|
||
#endif
|
||
|
||
// #include <normal_fragment_maps>
|
||
|
||
// COMPAT: pre-r151
|
||
// USE_NORMALMAP_OBJECTSPACE used to be OBJECTSPACE_NORMALMAP in pre-r151
|
||
#if defined( USE_NORMALMAP_OBJECTSPACE ) || defined( OBJECTSPACE_NORMALMAP )
|
||
|
||
normal = texture2D( normalMap, normalMapUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals
|
||
|
||
#ifdef FLIP_SIDED
|
||
|
||
normal = - normal;
|
||
|
||
#endif
|
||
|
||
#ifdef DOUBLE_SIDED
|
||
|
||
normal = normal * faceDirection;
|
||
|
||
#endif
|
||
|
||
normal = normalize( normalMatrix * normal );
|
||
|
||
// COMPAT: pre-r151
|
||
// USE_NORMALMAP_TANGENTSPACE used to be TANGENTSPACE_NORMALMAP in pre-r151
|
||
#elif defined( USE_NORMALMAP_TANGENTSPACE ) || defined( TANGENTSPACE_NORMALMAP )
|
||
|
||
vec3 mapN = texture2D( normalMap, normalMapUv ).xyz * 2.0 - 1.0;
|
||
mapN.xy *= normalScale;
|
||
|
||
// COMPAT: pre-r151
|
||
#if THREE_VRM_THREE_REVISION >= 151 || defined( USE_TANGENT )
|
||
|
||
normal = normalize( tbn * mapN );
|
||
|
||
#else
|
||
|
||
normal = perturbNormal2Arb( uv, -vViewPosition, normal, mapN, faceDirection );
|
||
|
||
#endif
|
||
|
||
#endif
|
||
|
||
// #include <emissivemap_fragment>
|
||
#ifdef USE_EMISSIVEMAP
|
||
vec2 emissiveMapUv = ( emissiveMapUvTransform * vec3( uv, 1 ) ).xy;
|
||
totalEmissiveRadiance *= texture2D( emissiveMap, emissiveMapUv ).rgb;
|
||
#endif
|
||
|
||
#ifdef DEBUG_NORMAL
|
||
gl_FragColor = vec4( 0.5 + 0.5 * normal, 1.0 );
|
||
return;
|
||
#endif
|
||
|
||
// -- MToon: lighting --------------------------------------------------------
|
||
// accumulation
|
||
// #include <lights_phong_fragment>
|
||
MToonMaterial material;
|
||
|
||
material.diffuseColor = diffuseColor.rgb;
|
||
|
||
material.shadeColor = shadeColorFactor;
|
||
#ifdef USE_SHADEMULTIPLYTEXTURE
|
||
vec2 shadeMultiplyTextureUv = ( shadeMultiplyTextureUvTransform * vec3( uv, 1 ) ).xy;
|
||
material.shadeColor *= texture2D( shadeMultiplyTexture, shadeMultiplyTextureUv ).rgb;
|
||
#endif
|
||
|
||
#if ( defined( USE_COLOR ) && !defined( IGNORE_VERTEX_COLOR ) )
|
||
material.shadeColor.rgb *= vColor;
|
||
#endif
|
||
|
||
material.shadingShift = shadingShiftFactor;
|
||
#ifdef USE_SHADINGSHIFTTEXTURE
|
||
vec2 shadingShiftTextureUv = ( shadingShiftTextureUvTransform * vec3( uv, 1 ) ).xy;
|
||
material.shadingShift += texture2D( shadingShiftTexture, shadingShiftTextureUv ).r * shadingShiftTextureScale;
|
||
#endif
|
||
|
||
// #include <lights_fragment_begin>
|
||
|
||
// MToon Specific changes:
|
||
// Since we want to take shadows into account of shading instead of irradiance,
|
||
// we had to modify the codes that multiplies the results of shadowmap into color of direct lights.
|
||
|
||
// COMPAT: pre-r156 uses a struct GeometricContext
|
||
#if THREE_VRM_THREE_REVISION >= 157
|
||
vec3 geometryPosition = - vViewPosition;
|
||
vec3 geometryNormal = normal;
|
||
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
||
|
||
vec3 geometryClearcoatNormal;
|
||
|
||
#ifdef USE_CLEARCOAT
|
||
|
||
geometryClearcoatNormal = clearcoatNormal;
|
||
|
||
#endif
|
||
#else
|
||
GeometricContext geometry;
|
||
|
||
geometry.position = - vViewPosition;
|
||
geometry.normal = normal;
|
||
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
||
|
||
#ifdef USE_CLEARCOAT
|
||
|
||
geometry.clearcoatNormal = clearcoatNormal;
|
||
|
||
#endif
|
||
#endif
|
||
|
||
IncidentLight directLight;
|
||
|
||
// since these variables will be used in unrolled loop, we have to define in prior
|
||
float shadow;
|
||
|
||
#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 ];
|
||
|
||
// COMPAT: pre-r156 uses a struct GeometricContext
|
||
#if THREE_VRM_THREE_REVISION >= 157
|
||
getPointLightInfo( pointLight, geometryPosition, directLight );
|
||
#else
|
||
getPointLightInfo( pointLight, geometry, directLight );
|
||
#endif
|
||
|
||
shadow = 1.0;
|
||
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
|
||
pointLightShadow = pointLightShadows[ i ];
|
||
// COMPAT: pre-r166
|
||
// r166 introduced shadowIntensity
|
||
#if THREE_VRM_THREE_REVISION >= 166
|
||
shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
|
||
#else
|
||
shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
|
||
#endif
|
||
#endif
|
||
|
||
// COMPAT: pre-r156 uses a struct GeometricContext
|
||
#if THREE_VRM_THREE_REVISION >= 157
|
||
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, shadow, reflectedLight );
|
||
#else
|
||
RE_Direct( directLight, geometry, material, shadow, reflectedLight );
|
||
#endif
|
||
|
||
}
|
||
#pragma unroll_loop_end
|
||
|
||
#endif
|
||
|
||
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
|
||
|
||
SpotLight spotLight;
|
||
// COMPAT: pre-r144 uses NUM_SPOT_LIGHT_SHADOWS, r144+ uses NUM_SPOT_LIGHT_COORDS
|
||
#if THREE_VRM_THREE_REVISION >= 144
|
||
#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_COORDS > 0
|
||
SpotLightShadow spotLightShadow;
|
||
#endif
|
||
#elif 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 ];
|
||
|
||
// COMPAT: pre-r156 uses a struct GeometricContext
|
||
#if THREE_VRM_THREE_REVISION >= 157
|
||
getSpotLightInfo( spotLight, geometryPosition, directLight );
|
||
#else
|
||
getSpotLightInfo( spotLight, geometry, directLight );
|
||
#endif
|
||
|
||
shadow = 1.0;
|
||
// COMPAT: pre-r144 uses NUM_SPOT_LIGHT_SHADOWS and vSpotShadowCoord, r144+ uses NUM_SPOT_LIGHT_COORDS and vSpotLightCoord
|
||
// COMPAT: pre-r166 does not have shadowIntensity, r166+ has shadowIntensity
|
||
#if THREE_VRM_THREE_REVISION >= 166
|
||
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_COORDS )
|
||
spotLightShadow = spotLightShadows[ i ];
|
||
shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
|
||
#endif
|
||
#elif THREE_VRM_THREE_REVISION >= 144
|
||
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_COORDS )
|
||
spotLightShadow = spotLightShadows[ i ];
|
||
shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
|
||
#endif
|
||
#elif defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
||
spotLightShadow = spotLightShadows[ i ];
|
||
shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
|
||
#endif
|
||
|
||
// COMPAT: pre-r156 uses a struct GeometricContext
|
||
#if THREE_VRM_THREE_REVISION >= 157
|
||
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, shadow, reflectedLight );
|
||
#else
|
||
RE_Direct( directLight, geometry, material, shadow, reflectedLight );
|
||
#endif
|
||
|
||
}
|
||
#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 ];
|
||
|
||
// COMPAT: pre-r156 uses a struct GeometricContext
|
||
#if THREE_VRM_THREE_REVISION >= 157
|
||
getDirectionalLightInfo( directionalLight, directLight );
|
||
#else
|
||
getDirectionalLightInfo( directionalLight, geometry, directLight );
|
||
#endif
|
||
|
||
shadow = 1.0;
|
||
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
|
||
directionalLightShadow = directionalLightShadows[ i ];
|
||
// COMPAT: pre-r166
|
||
// r166 introduced shadowIntensity
|
||
#if THREE_VRM_THREE_REVISION >= 166
|
||
shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
||
#else
|
||
shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
||
#endif
|
||
#endif
|
||
|
||
// COMPAT: pre-r156 uses a struct GeometricContext
|
||
#if THREE_VRM_THREE_REVISION >= 157
|
||
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, shadow, reflectedLight );
|
||
#else
|
||
RE_Direct( directLight, geometry, material, shadow, reflectedLight );
|
||
#endif
|
||
|
||
}
|
||
#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 );
|
||
|
||
// COMPAT: pre-r156 uses a struct GeometricContext
|
||
// COMPAT: pre-r156 doesn't have a define USE_LIGHT_PROBES
|
||
#if THREE_VRM_THREE_REVISION >= 157
|
||
#if defined( USE_LIGHT_PROBES )
|
||
irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
|
||
#endif
|
||
#else
|
||
irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );
|
||
#endif
|
||
|
||
#if ( NUM_HEMI_LIGHTS > 0 )
|
||
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
|
||
|
||
// COMPAT: pre-r156 uses a struct GeometricContext
|
||
#if THREE_VRM_THREE_REVISION >= 157
|
||
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
|
||
#else
|
||
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
|
||
#endif
|
||
|
||
}
|
||
#pragma unroll_loop_end
|
||
|
||
#endif
|
||
|
||
#endif
|
||
|
||
// #if defined( RE_IndirectSpecular )
|
||
|
||
// vec3 radiance = vec3( 0.0 );
|
||
// vec3 clearcoatRadiance = vec3( 0.0 );
|
||
|
||
// #endif
|
||
|
||
#include <lights_fragment_maps>
|
||
#include <lights_fragment_end>
|
||
|
||
// modulation
|
||
#include <aomap_fragment>
|
||
|
||
vec3 col = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
|
||
|
||
#ifdef DEBUG_LITSHADERATE
|
||
gl_FragColor = vec4( col, diffuseColor.a );
|
||
postCorrection();
|
||
return;
|
||
#endif
|
||
|
||
// -- MToon: rim lighting -----------------------------------------
|
||
vec3 viewDir = normalize( vViewPosition );
|
||
|
||
#ifndef PHYSICALLY_CORRECT_LIGHTS
|
||
reflectedLight.directSpecular /= PI;
|
||
#endif
|
||
vec3 rimMix = mix( vec3( 1.0 ), reflectedLight.directSpecular, rimLightingMixFactor );
|
||
|
||
vec3 rim = parametricRimColorFactor * pow( saturate( 1.0 - dot( viewDir, normal ) + parametricRimLiftFactor ), parametricRimFresnelPowerFactor );
|
||
|
||
#ifdef USE_MATCAPTEXTURE
|
||
{
|
||
vec3 x = normalize( vec3( viewDir.z, 0.0, -viewDir.x ) );
|
||
vec3 y = cross( viewDir, x ); // guaranteed to be normalized
|
||
vec2 sphereUv = 0.5 + 0.5 * vec2( dot( x, normal ), -dot( y, normal ) );
|
||
sphereUv = ( matcapTextureUvTransform * vec3( sphereUv, 1 ) ).xy;
|
||
vec3 matcap = texture2D( matcapTexture, sphereUv ).rgb;
|
||
rim += matcapFactor * matcap;
|
||
}
|
||
#endif
|
||
|
||
#ifdef USE_RIMMULTIPLYTEXTURE
|
||
vec2 rimMultiplyTextureUv = ( rimMultiplyTextureUvTransform * vec3( uv, 1 ) ).xy;
|
||
rim *= texture2D( rimMultiplyTexture, rimMultiplyTextureUv ).rgb;
|
||
#endif
|
||
|
||
col += rimMix * rim;
|
||
|
||
// -- MToon: Emission --------------------------------------------------------
|
||
col += totalEmissiveRadiance;
|
||
|
||
// #include <envmap_fragment>
|
||
|
||
// -- Almost done! -----------------------------------------------------------
|
||
#if defined( OUTLINE )
|
||
col = outlineColorFactor.rgb * mix( vec3( 1.0 ), col, outlineLightingMixFactor );
|
||
#endif
|
||
|
||
#ifdef OPAQUE
|
||
diffuseColor.a = 1.0;
|
||
#endif
|
||
|
||
gl_FragColor = vec4( col, diffuseColor.a );
|
||
postCorrection();
|
||
}
|
||
`,dwe={None:"none"},NU={None:"none",ScreenCoordinates:"screenCoordinates"},fwe={3e3:"",3001:"srgb"};function hT(t){return parseInt(kd,10)>=152?t.colorSpace:fwe[t.encoding]}var hwe=class extends Qa{constructor(t={}){var e;super({vertexShader:cwe,fragmentShader:uwe}),this.uvAnimationScrollXSpeedFactor=0,this.uvAnimationScrollYSpeedFactor=0,this.uvAnimationRotationSpeedFactor=0,this.fog=!0,this.normalMapType=uu,this._ignoreVertexColor=!0,this._v0CompatShade=!1,this._debugMode=dwe.None,this._outlineWidthMode=NU.None,this._isOutline=!1,t.transparentWithZWrite&&(t.depthWrite=!0),delete t.transparentWithZWrite,t.fog=!0,t.lights=!0,t.clipping=!0,this.uniforms=kR.merge([ht.common,ht.normalmap,ht.emissivemap,ht.fog,ht.lights,{litFactor:{value:new ut(1,1,1)},mapUvTransform:{value:new Xt},colorAlpha:{value:1},normalMapUvTransform:{value:new Xt},shadeColorFactor:{value:new ut(0,0,0)},shadeMultiplyTexture:{value:null},shadeMultiplyTextureUvTransform:{value:new Xt},shadingShiftFactor:{value:0},shadingShiftTexture:{value:null},shadingShiftTextureUvTransform:{value:new Xt},shadingShiftTextureScale:{value:1},shadingToonyFactor:{value:.9},giEqualizationFactor:{value:.9},matcapFactor:{value:new ut(1,1,1)},matcapTexture:{value:null},matcapTextureUvTransform:{value:new Xt},parametricRimColorFactor:{value:new ut(0,0,0)},rimMultiplyTexture:{value:null},rimMultiplyTextureUvTransform:{value:new Xt},rimLightingMixFactor:{value:1},parametricRimFresnelPowerFactor:{value:5},parametricRimLiftFactor:{value:0},emissive:{value:new ut(0,0,0)},emissiveIntensity:{value:1},emissiveMapUvTransform:{value:new Xt},outlineWidthMultiplyTexture:{value:null},outlineWidthMultiplyTextureUvTransform:{value:new Xt},outlineWidthFactor:{value:0},outlineColorFactor:{value:new ut(0,0,0)},outlineLightingMixFactor:{value:1},uvAnimationMaskTexture:{value:null},uvAnimationMaskTextureUvTransform:{value:new Xt},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:${hT(this.matcapTexture)}`:"",this.shadeMultiplyTexture?`shadeMultiplyTextureColorSpace:${hT(this.shadeMultiplyTexture)}`:"",this.rimMultiplyTexture?`rimMultiplyTextureColorSpace:${hT(this.rimMultiplyTexture)}`:""].join(","),this.onBeforeCompile=n=>{const r=parseInt(kd,10),i=Object.entries(RU(RU({},this._generateDefines()),this.defines)).filter(([s,a])=>!!a).map(([s,a])=>`#define ${s} ${a}`).join(`
|
||
`)+`
|
||
`;n.vertexShader=i+n.vertexShader,n.fragmentShader=i+n.fragmentShader,r<154&&(n.fragmentShader=n.fragmentShader.replace("#include <colorspace_fragment>","#include <encodings_fragment>"))}}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(kd,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===NU.ScreenCoordinates}}_updateTextureMatrix(t,e){t.value&&(t.value.matrixAutoUpdate&&t.value.updateMatrix(),e.value.copy(t.value.matrix))}},pwe=new Set(["1.0","1.0-beta"]),c8=class i1{get name(){return i1.EXTENSION_NAME}constructor(e,n={}){var r,i,s,a;this.parser=e,this.materialType=(r=n.materialType)!=null?r:hwe,this.renderOrderOffset=(i=n.renderOrderOffset)!=null?i:0,this.v0CompatShade=(s=n.v0CompatShade)!=null?s:!1,this.debugMode=(a=n.debugMode)!=null?a:"none",this._mToonMaterialSet=new Set}beforeRoot(){return xh(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(e){return xh(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 xh(this,null,function*(){var n;const r=this.parser,s=(n=r.json.meshes)==null?void 0:n[e];if(s==null)throw new Error(`MToonMaterialLoaderPlugin: Attempt to use meshes[${e}] of glTF but the mesh doesn't exist`);const a=s.primitives,o=yield r.loadMesh(e);if(a.length===1){const l=o,c=a[0].material;c!=null&&this._setupPrimitive(l,c)}else{const l=o;for(let c=0;c<a.length;c++){const d=l.children[c],f=a[c].material;f!=null&&this._setupPrimitive(d,f)}}return o})}_removeUnlitExtensionIfMToonExists(){const r=this.parser.json.materials;r==null||r.map((i,s)=>{var a;this._getMToonExtension(s)&&((a=i.extensions)!=null&&a.KHR_materials_unlit)&&delete i.extensions.KHR_materials_unlit})}_getMToonExtension(e){var n,r;const a=(n=this.parser.json.materials)==null?void 0:n[e];if(a==null){console.warn(`MToonMaterialLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const o=(r=a.extensions)==null?void 0:r[i1.EXTENSION_NAME];if(o==null)return;const l=o.specVersion;if(!pwe.has(l)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${i1.EXTENSION_NAME} specVersion "${l}"`);return}return o}_extendMaterialParams(e,n){return xh(this,null,function*(){var r;delete n.metalness,delete n.roughness;const i=new lwe(this.parser,n);i.assignPrimitive("transparentWithZWrite",e.transparentWithZWrite),i.assignColor("shadeColorFactor",e.shadeColorFactor),i.assignTexture("shadeMultiplyTexture",e.shadeMultiplyTexture,!0),i.assignPrimitive("shadingShiftFactor",e.shadingShiftFactor),i.assignTexture("shadingShiftTexture",e.shadingShiftTexture,!0),i.assignPrimitive("shadingShiftTextureScale",(r=e.shadingShiftTexture)==null?void 0:r.scale),i.assignPrimitive("shadingToonyFactor",e.shadingToonyFactor),i.assignPrimitive("giEqualizationFactor",e.giEqualizationFactor),i.assignColor("matcapFactor",e.matcapFactor),i.assignTexture("matcapTexture",e.matcapTexture,!0),i.assignColor("parametricRimColorFactor",e.parametricRimColorFactor),i.assignTexture("rimMultiplyTexture",e.rimMultiplyTexture,!0),i.assignPrimitive("rimLightingMixFactor",e.rimLightingMixFactor),i.assignPrimitive("parametricRimFresnelPowerFactor",e.parametricRimFresnelPowerFactor),i.assignPrimitive("parametricRimLiftFactor",e.parametricRimLiftFactor),i.assignPrimitive("outlineWidthMode",e.outlineWidthMode),i.assignPrimitive("outlineWidthFactor",e.outlineWidthFactor),i.assignTexture("outlineWidthMultiplyTexture",e.outlineWidthMultiplyTexture,!1),i.assignColor("outlineColorFactor",e.outlineColorFactor),i.assignPrimitive("outlineLightingMixFactor",e.outlineLightingMixFactor),i.assignTexture("uvAnimationMaskTexture",e.uvAnimationMaskTexture,!1),i.assignPrimitive("uvAnimationScrollXSpeedFactor",e.uvAnimationScrollXSpeedFactor),i.assignPrimitive("uvAnimationScrollYSpeedFactor",e.uvAnimationScrollYSpeedFactor),i.assignPrimitive("uvAnimationRotationSpeedFactor",e.uvAnimationRotationSpeedFactor),i.assignPrimitive("v0CompatShade",this.v0CompatShade),i.assignPrimitive("debugMode",this.debugMode),yield i.pending})}_setupPrimitive(e,n){const r=this._getMToonExtension(n);if(r){const i=this._parseRenderOrder(r);e.renderOrder=i+this.renderOrderOffset,this._generateOutline(e),this._addToMaterialSet(e);return}}_shouldGenerateOutline(e){return typeof e.outlineWidthMode=="string"&&e.outlineWidthMode!=="none"&&typeof e.outlineWidthFactor=="number"&&e.outlineWidthFactor>0}_generateOutline(e){const n=e.material;if(!(n instanceof Gr)||!this._shouldGenerateOutline(n))return;e.material=[n];const r=n.clone();r.name+=" (Outline)",r.isOutline=!0,r.side=as,e.material.push(r);const i=e.geometry,s=i.index?i.index.count:i.attributes.position.count/3;i.addGroup(0,s,0),i.addGroup(0,s,1)}_addToMaterialSet(e){const n=e.material,r=new Set;Array.isArray(n)?n.forEach(i=>r.add(i)):r.add(n);for(const i of r)this._mToonMaterialSet.add(i)}_parseRenderOrder(e){var n;return(e.transparentWithZWrite?0:19)+((n=e.renderQueueOffsetNumber)!=null?n:0)}};c8.EXTENSION_NAME="VRMC_materials_mtoon";var mwe=c8,gwe=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{o(n.next(l))}catch(c){i(c)}},a=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,a);o((n=n.apply(t,e)).next())}),u8=class yP{get name(){return yP.EXTENSION_NAME}constructor(e){this.parser=e}extendMaterialParams(e,n){return gwe(this,null,function*(){const r=this._getHDREmissiveMultiplierExtension(e);if(r==null)return;console.warn("VRMMaterialsHDREmissiveMultiplierLoaderPlugin: `VRMC_materials_hdr_emissiveMultiplier` is archived. Use `KHR_materials_emissive_strength` instead.");const i=r.emissiveMultiplier;n.emissiveIntensity=i})}_getHDREmissiveMultiplierExtension(e){var n,r;const a=(n=this.parser.json.materials)==null?void 0:n[e];if(a==null){console.warn(`VRMMaterialsHDREmissiveMultiplierLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const o=(r=a.extensions)==null?void 0:r[yP.EXTENSION_NAME];if(o!=null)return o}};u8.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var vwe=u8,ywe=Object.defineProperty,xwe=Object.defineProperties,bwe=Object.getOwnPropertyDescriptors,kU=Object.getOwnPropertySymbols,_we=Object.prototype.hasOwnProperty,wwe=Object.prototype.propertyIsEnumerable,IU=(t,e,n)=>e in t?ywe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,vl=(t,e)=>{for(var n in e||(e={}))_we.call(e,n)&&IU(t,n,e[n]);if(kU)for(var n of kU(e))wwe.call(e,n)&&IU(t,n,e[n]);return t},LU=(t,e)=>xwe(t,bwe(e)),Swe=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{o(n.next(l))}catch(c){i(c)}},a=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,a);o((n=n.apply(t,e)).next())});function Hm(t){return Math.pow(t,2.2)}var Mwe=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 Swe(this,null,function*(){var t;const e=this.parser.json,n=(t=e.extensions)==null?void 0:t.VRM,r=n==null?void 0:n.materialProperties;r&&(this._populateRenderQueueMap(r),r.forEach((i,s)=>{var a,o;const l=(a=e.materials)==null?void 0:a[s];if(l==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${s}] of glTF but the material doesn't exist`);return}if(i.shader==="VRM/MToon"){const c=this._parseV0MToonProperties(i,l);e.materials[s]=c}else if((o=i.shader)!=null&&o.startsWith("VRM/Unlit")){const c=this._parseV0UnlitProperties(i,l);e.materials[s]=c}else i.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${i.shader}`)}))})}_parseV0MToonProperties(t,e){var n,r,i,s,a,o,l,c,d,f,p,y,x,S,w,b,M,T,C,L,N,D,F,V,I,U,X,te,re,pe,ee,ce,B,J,Z,G,W,oe,se,le,Me,Se,$e,Ee,Ge,Xe,fe,Q,Ve,Le,We,Je,de,De,K;const H=(r=(n=t.keywordMap)==null?void 0:n._ALPHABLEND_ON)!=null?r:!1,je=((i=t.floatProperties)==null?void 0:i._ZWrite)===1&&H,Oe=this._v0ParseRenderQueue(t),Fe=(a=(s=t.keywordMap)==null?void 0:s._ALPHATEST_ON)!=null?a:!1,xt=H?"BLEND":Fe?"MASK":"OPAQUE",rt=Fe?(l=(o=t.floatProperties)==null?void 0:o._Cutoff)!=null?l:.5:void 0,zt=((d=(c=t.floatProperties)==null?void 0:c._CullMode)!=null?d:2)===0,Ye=this._portTextureTransform(t),ne=((p=(f=t.vectorProperties)==null?void 0:f._Color)!=null?p:[1,1,1,1]).map((it,yt)=>yt===3?it:Hm(it)),tt=(y=t.textureProperties)==null?void 0:y._MainTex,Mt=tt!=null?{index:tt,extensions:vl({},Ye)}:void 0,vt=(S=(x=t.floatProperties)==null?void 0:x._BumpScale)!=null?S:1,Zt=(w=t.textureProperties)==null?void 0:w._BumpMap,he=Zt!=null?{index:Zt,scale:vt,extensions:vl({},Ye)}:void 0,Ke=((M=(b=t.vectorProperties)==null?void 0:b._EmissionColor)!=null?M:[0,0,0,1]).map(Hm),ue=(T=t.textureProperties)==null?void 0:T._EmissionMap,Ze=ue!=null?{index:ue,extensions:vl({},Ye)}:void 0,Pe=((L=(C=t.vectorProperties)==null?void 0:C._ShadeColor)!=null?L:[.97,.81,.86,1]).map(Hm),Be=(N=t.textureProperties)==null?void 0:N._ShadeTexture,at=Be!=null?{index:Be,extensions:vl({},Ye)}:void 0;let pt=(F=(D=t.floatProperties)==null?void 0:D._ShadeShift)!=null?F:0,Jt=(I=(V=t.floatProperties)==null?void 0:V._ShadeToony)!=null?I:.9;Jt=vr.lerp(Jt,1,.5+.5*pt),pt=-pt-(1-Jt);const pn=(X=(U=t.floatProperties)==null?void 0:U._IndirectLightIntensity)!=null?X:.1,Fn=pn?1-pn:void 0,en=(te=t.textureProperties)==null?void 0:te._SphereAdd,Vn=en!=null?[1,1,1]:void 0,pr=en!=null?{index:en}:void 0,Mi=(pe=(re=t.floatProperties)==null?void 0:re._RimLightingMix)!=null?pe:0,ro=(ee=t.textureProperties)==null?void 0:ee._RimTexture,Ei=ro!=null?{index:ro,extensions:vl({},Ye)}:void 0,Yo=((B=(ce=t.vectorProperties)==null?void 0:ce._RimColor)!=null?B:[0,0,0,1]).map(Hm),Is=(Z=(J=t.floatProperties)==null?void 0:J._RimFresnelPower)!=null?Z:1,io=(W=(G=t.floatProperties)==null?void 0:G._RimLift)!=null?W:0,Ai=["none","worldCoordinates","screenCoordinates"][(se=(oe=t.floatProperties)==null?void 0:oe._OutlineWidthMode)!=null?se:0];let Ca=(Me=(le=t.floatProperties)==null?void 0:le._OutlineWidth)!=null?Me:0;Ca=.01*Ca;const so=(Se=t.textureProperties)==null?void 0:Se._OutlineWidthTexture,du=so!=null?{index:so,extensions:vl({},Ye)}:void 0,fu=((Ee=($e=t.vectorProperties)==null?void 0:$e._OutlineColor)!=null?Ee:[0,0,0]).map(Hm),hu=((Xe=(Ge=t.floatProperties)==null?void 0:Ge._OutlineColorMode)!=null?Xe:0)===1?(Q=(fe=t.floatProperties)==null?void 0:fe._OutlineLightingMix)!=null?Q:1:0,Wl=(Ve=t.textureProperties)==null?void 0:Ve._UvAnimMaskTexture,Y=Wl!=null?{index:Wl,extensions:vl({},Ye)}:void 0,be=(We=(Le=t.floatProperties)==null?void 0:Le._UvAnimScrollX)!=null?We:0;let Te=(de=(Je=t.floatProperties)==null?void 0:Je._UvAnimScrollY)!=null?de:0;Te!=null&&(Te=-Te);const Ne=(K=(De=t.floatProperties)==null?void 0:De._UvAnimRotation)!=null?K:0,we={specVersion:"1.0",transparentWithZWrite:je,renderQueueOffsetNumber:Oe,shadeColorFactor:Pe,shadeMultiplyTexture:at,shadingShiftFactor:pt,shadingToonyFactor:Jt,giEqualizationFactor:Fn,matcapFactor:Vn,matcapTexture:pr,rimLightingMixFactor:Mi,rimMultiplyTexture:Ei,parametricRimColorFactor:Yo,parametricRimFresnelPowerFactor:Is,parametricRimLiftFactor:io,outlineWidthMode:Ai,outlineWidthFactor:Ca,outlineWidthMultiplyTexture:du,outlineColorFactor:fu,outlineLightingMixFactor:hu,uvAnimationMaskTexture:Y,uvAnimationScrollXSpeedFactor:be,uvAnimationScrollYSpeedFactor:Te,uvAnimationRotationSpeedFactor:Ne};return LU(vl({},e),{pbrMetallicRoughness:{baseColorFactor:ne,baseColorTexture:Mt},normalTexture:he,emissiveTexture:Ze,emissiveFactor:Ke,alphaMode:xt,alphaCutoff:rt,doubleSided:zt,extensions:{VRMC_materials_mtoon:we}})}_parseV0UnlitProperties(t,e){var n,r,i,s,a;const o=t.shader==="VRM/UnlitTransparentZWrite",l=t.shader==="VRM/UnlitTransparent"||o,c=this._v0ParseRenderQueue(t),d=t.shader==="VRM/UnlitCutout",f=l?"BLEND":d?"MASK":"OPAQUE",p=d?(r=(n=t.floatProperties)==null?void 0:n._Cutoff)!=null?r:.5:void 0,y=this._portTextureTransform(t),x=((s=(i=t.vectorProperties)==null?void 0:i._Color)!=null?s:[1,1,1,1]).map(Hm),S=(a=t.textureProperties)==null?void 0:a._MainTex,w=S!=null?{index:S,extensions:vl({},y)}:void 0,b={specVersion:"1.0",transparentWithZWrite:o,renderQueueOffsetNumber:c,shadeColorFactor:x,shadeMultiplyTexture:w};return LU(vl({},e),{pbrMetallicRoughness:{baseColorFactor:x,baseColorTexture:w},alphaMode:f,alphaCutoff:p,extensions:{VRMC_materials_mtoon:b}})}_portTextureTransform(t){var e,n,r,i,s;const a=(e=t.vectorProperties)==null?void 0:e._MainTex;if(a==null)return{};const o=[(n=a==null?void 0:a[0])!=null?n:0,(r=a==null?void 0:a[1])!=null?r:0],l=[(i=a==null?void 0:a[2])!=null?i:1,(s=a==null?void 0:a[3])!=null?s:1];return o[1]=1-l[1]-o[1],{KHR_texture_transform:{offset:o,scale:l}}}_v0ParseRenderQueue(t){var e,n;const r=t.shader==="VRM/UnlitTransparentZWrite",i=((e=t.keywordMap)==null?void 0:e._ALPHABLEND_ON)!=null||t.shader==="VRM/UnlitTransparent"||r,s=((n=t.floatProperties)==null?void 0:n._ZWrite)===1||r;let a=0;if(i){const o=t.renderQueue;o!=null&&(s?a=this._renderQueueMapTransparentZWrite.get(o):a=this._renderQueueMapTransparent.get(o))}return a}_populateRenderQueueMap(t){const e=new Set,n=new Set;t.forEach(r=>{var i,s;const a=r.shader==="VRM/UnlitTransparentZWrite",o=((i=r.keywordMap)==null?void 0:i._ALPHABLEND_ON)!=null||r.shader==="VRM/UnlitTransparent"||a,l=((s=r.floatProperties)==null?void 0:s._ZWrite)===1||a;if(o){const c=r.renderQueue;c!=null&&(l?n.add(c):e.add(c))}}),e.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${e.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),n.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${n.size} render queues for TransparentZWrite materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),Array.from(e).sort().forEach((r,i)=>{const s=Math.min(Math.max(i-e.size+1,-9),0);this._renderQueueMapTransparent.set(r,s)}),Array.from(n).sort().forEach((r,i)=>{const s=Math.min(Math.max(i,0),9);this._renderQueueMapTransparentZWrite.set(r,s)})}},OU=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{o(n.next(l))}catch(c){i(c)}},a=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,a);o((n=n.apply(t,e)).next())}),ad=new q,pT=class extends Cs{constructor(t){super(),this._attrPosition=new Qt(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(M6);const e=new Yt;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){ad.setFromMatrixPosition(this.constraint.destination.matrixWorld),this._attrPosition.setXYZ(0,ad.x,ad.y,ad.z),this.constraint.source&&ad.setFromMatrixPosition(this.constraint.source.matrixWorld),this._attrPosition.setXYZ(1,ad.x,ad.y,ad.z),this._attrPosition.needsUpdate=!0,super.updateMatrixWorld(t)}};function DU(t,e){return e.set(t.elements[12],t.elements[13],t.elements[14])}var Ewe=new q,Awe=new q;function Twe(t,e){return t.decompose(Ewe,e,Awe),e}function Kw(t){return t.invert?t.invert():t.inverse(),t}var dN=class{constructor(t,e){this.destination=t,this.source=e,this.weight=1}},Cwe=new q,Pwe=new q,Rwe=new q,Nwe=new qt,kwe=new qt,Iwe=new qt,Lwe=class extends dN{get aimAxis(){return this._aimAxis}set aimAxis(t){this._aimAxis=t,this._v3AimAxis.set(t==="PositiveX"?1:t==="NegativeX"?-1:0,t==="PositiveY"?1:t==="NegativeY"?-1:0,t==="PositiveZ"?1:t==="NegativeZ"?-1:0)}get dependencies(){const t=new Set([this.source]);return this.destination.parent&&t.add(this.destination.parent),t}constructor(t,e){super(t,e),this._aimAxis="PositiveX",this._v3AimAxis=new q(1,0,0),this._dstRestQuat=new qt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);const t=Nwe.identity(),e=kwe.identity();this.destination.parent&&(Twe(this.destination.parent.matrixWorld,t),Kw(e.copy(t)));const n=Cwe.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(t),r=DU(this.source.matrixWorld,Pwe).sub(DU(this.destination.matrixWorld,Rwe)).normalize(),i=Iwe.setFromUnitVectors(n,r).premultiply(e).multiply(t).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}};function Owe(t,e){const n=[t];let r=t.parent;for(;r!==null;)n.unshift(r),r=r.parent;n.forEach(i=>{e(i)})}var Dwe=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)Owe(s,a=>{const o=this._objectConstraintsMap.get(a);if(o)for(const l of o)this._processConstraint(l,e,n,r)});r(t),n.add(t)}},jwe=new qt,Uwe=new qt,Fwe=class extends dN{get dependencies(){return new Set([this.source])}constructor(t,e){super(t,e),this._dstRestQuat=new qt,this._invSrcRestQuat=new qt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),Kw(this._invSrcRestQuat.copy(this.source.quaternion))}update(){const t=jwe.copy(this._invSrcRestQuat).multiply(this.source.quaternion),e=Uwe.copy(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(e,this.weight)}},zwe=new q,Bwe=new qt,Hwe=new qt,Vwe=class extends dN{get rollAxis(){return this._rollAxis}set rollAxis(t){this._rollAxis=t,this._v3RollAxis.set(t==="X"?1:0,t==="Y"?1:0,t==="Z"?1:0)}get dependencies(){return new Set([this.source])}constructor(t,e){super(t,e),this._rollAxis="X",this._v3RollAxis=new q(1,0,0),this._dstRestQuat=new qt,this._invDstRestQuat=new qt,this._invSrcRestQuatMulDstRestQuat=new qt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),Kw(this._invDstRestQuat.copy(this._dstRestQuat)),Kw(this._invSrcRestQuatMulDstRestQuat.copy(this.source.quaternion)).multiply(this._dstRestQuat)}update(){const t=Bwe.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),e=zwe.copy(this._v3RollAxis).applyQuaternion(t),r=Hwe.setFromUnitVectors(e,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(r,this.weight)}},Gwe=new Set(["1.0","1.0-beta"]),d8=class Z0{get name(){return Z0.EXTENSION_NAME}constructor(e,n){this.parser=e,this.helperRoot=n==null?void 0:n.helperRoot}afterRoot(e){return OU(this,null,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){return OU(this,null,function*(){var n;const r=this.parser.json;if(!(((n=r.extensionsUsed)==null?void 0:n.indexOf(Z0.EXTENSION_NAME))!==-1))return null;const s=new Dwe,a=yield this.parser.getDependencies("node");return a.forEach((o,l)=>{var c;const d=r.nodes[l],f=(c=d==null?void 0:d.extensions)==null?void 0:c[Z0.EXTENSION_NAME];if(f==null)return;const p=f.specVersion;if(!Gwe.has(p)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${Z0.EXTENSION_NAME} specVersion "${p}"`);return}const y=f.constraint;if(y.roll!=null){const x=this._importRollConstraint(o,a,y.roll);s.addConstraint(x)}else if(y.aim!=null){const x=this._importAimConstraint(o,a,y.aim);s.addConstraint(x)}else if(y.rotation!=null){const x=this._importRotationConstraint(o,a,y.rotation);s.addConstraint(x)}}),e.scene.updateMatrixWorld(),s.setInitState(),s})}_importRollConstraint(e,n,r){const{source:i,rollAxis:s,weight:a}=r,o=n[i],l=new Vwe(e,o);if(s!=null&&(l.rollAxis=s),a!=null&&(l.weight=a),this.helperRoot){const c=new pT(l);this.helperRoot.add(c)}return l}_importAimConstraint(e,n,r){const{source:i,aimAxis:s,weight:a}=r,o=n[i],l=new Lwe(e,o);if(s!=null&&(l.aimAxis=s),a!=null&&(l.weight=a),this.helperRoot){const c=new pT(l);this.helperRoot.add(c)}return l}_importRotationConstraint(e,n,r){const{source:i,weight:s}=r,a=n[i],o=new Fwe(e,a);if(s!=null&&(o.weight=s),this.helperRoot){const l=new pT(o);this.helperRoot.add(l)}return o}};d8.EXTENSION_NAME="VRMC_node_constraint";var Wwe=d8,H_=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{o(n.next(l))}catch(c){i(c)}},a=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,a);o((n=n.apply(t,e)).next())}),fN=class{},mT=new q,Kf=new q,f8=class extends fN{get type(){return"capsule"}constructor(t){var e,n,r,i;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new q(0,0,0),this.tail=(n=t==null?void 0:t.tail)!=null?n:new q(0,0,0),this.radius=(r=t==null?void 0:t.radius)!=null?r:0,this.inside=(i=t==null?void 0:t.inside)!=null?i:!1}calculateCollision(t,e,n,r){mT.setFromMatrixPosition(t),Kf.subVectors(this.tail,this.offset).applyMatrix4(t),Kf.sub(mT);const i=Kf.lengthSq();r.copy(e).sub(mT);const s=Kf.dot(r);s<=0||(i<=s||Kf.multiplyScalar(s/i),r.sub(Kf));const a=r.length(),o=this.inside?this.radius-n-a:a-n-this.radius;return o<0&&(r.multiplyScalar(1/a),this.inside&&r.negate()),o}},gT=new q,jU=new Xt,h8=class extends fN{get type(){return"plane"}constructor(t){var e,n;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new q(0,0,0),this.normal=(n=t==null?void 0:t.normal)!=null?n:new q(0,0,1)}calculateCollision(t,e,n,r){r.setFromMatrixPosition(t),r.negate().add(e),jU.getNormalMatrix(t),gT.copy(this.normal).applyNormalMatrix(jU).normalize();const i=r.dot(gT)-n;return r.copy(gT),i}},$we=new q,p8=class extends fN{get type(){return"sphere"}constructor(t){var e,n,r;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new q(0,0,0),this.radius=(n=t==null?void 0:t.radius)!=null?n:0,this.inside=(r=t==null?void 0:t.inside)!=null?r:!1}calculateCollision(t,e,n,r){r.subVectors(e,$we.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}},yl=new q,Xwe=class extends Yt{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new q,this._currentTail=new q,this._shape=t,this._attrPos=new Qt(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0);const n=yl.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(n)>1e-10&&(this._currentTail.copy(n),t=!0),t&&this._buildPosition()}_buildPosition(){yl.copy(this._currentTail).sub(this._currentOffset);const t=yl.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(yl.y,Math.sqrt(yl.x*yl.x+yl.z*yl.z)),n=-Math.atan2(yl.z,yl.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}},qwe=class extends Yt{constructor(t){super(),this.worldScale=1,this._currentOffset=new q,this._currentNormal=new q,this._shape=t,this._attrPos=new Qt(new Float32Array(18),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(new Uint16Array(10),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0),this._currentNormal.equals(this._shape.normal)||(this._currentNormal.copy(this._shape.normal),t=!0),t&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,-.5,-.5,0),this._attrPos.setXYZ(1,.5,-.5,0),this._attrPos.setXYZ(2,.5,.5,0),this._attrPos.setXYZ(3,-.5,.5,0),this._attrPos.setXYZ(4,0,0,0),this._attrPos.setXYZ(5,0,0,.25),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this.lookAt(this._currentNormal),this._attrPos.needsUpdate=!0}_buildIndex(){this._attrIndex.setXY(0,0,1),this._attrIndex.setXY(2,1,2),this._attrIndex.setXY(4,2,3),this._attrIndex.setXY(6,3,0),this._attrIndex.setXY(8,4,5),this._attrIndex.needsUpdate=!0}},Kwe=class extends Yt{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new q,this._shape=t,this._attrPos=new Qt(new Float32Array(288),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(new Uint16Array(192),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(64+t*2,32+t,32+e),this._attrIndex.setXY(128+t*2,64+t,64+e)}this._attrIndex.needsUpdate=!0}},Ywe=new q,vT=class extends Cs{constructor(t){if(super(),this.matrixAutoUpdate=!1,this.collider=t,this.collider.shape instanceof p8)this._geometry=new Kwe(this.collider.shape);else if(this.collider.shape instanceof f8)this._geometry=new Xwe(this.collider.shape);else if(this.collider.shape instanceof h8)this._geometry=new qwe(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 na(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=Ywe.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},Zwe=class extends Yt{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new q,this._springBone=t,this._attrPos=new Qt(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;const e=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(64+t*2,32+t,32+e),this._attrIndex.setXY(128+t*2,64+t,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},Qwe=new q,Jwe=class extends Cs{constructor(t){super(),this.matrixAutoUpdate=!1,this.springBone=t,this._geometry=new Zwe(this.springBone);const e=new $r({color:16776960,depthTest:!1,depthWrite:!1});this._line=new na(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=Qwe.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},yT=class extends mn{constructor(t){super(),this.colliderMatrix=new Rt,this.shape=t}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),eSe(this.colliderMatrix,this.matrixWorld,this.shape.offset)}};function eSe(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 tSe=new Rt;function nSe(t){return t.invert?t.invert():t.getInverse(tSe.copy(t)),t}var rSe=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&&(nSe(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},xT=new Rt,Vm=new q,z0=new q,B0=new q,H0=new q,iSe=new Rt,sSe=class{constructor(t,e,n={},r=[]){this._currentTail=new q,this._prevTail=new q,this._boneAxis=new q,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new Rt,this._initialLocalRotation=new qt,this._initialLocalChildPosition=new q;var i,s,a,o,l,c;this.bone=t,this.bone.matrixAutoUpdate=!1,this.child=e,this.settings={hitRadius:(i=n.hitRadius)!=null?i:0,stiffness:(s=n.stiffness)!=null?s:1,gravityPower:(a=n.gravityPower)!=null?a:0,gravityDir:(l=(o=n.gravityDir)==null?void 0:o.clone())!=null?l:new q(0,-1,0),dragForce:(c=n.dragForce)!=null?c:.4},this.colliderGroups=r}get dependencies(){const t=new Set,e=this.bone.parent;e&&t.add(e);for(let n=0;n<this.colliderGroups.length;n++)for(let r=0;r<this.colliderGroups[n].colliders.length;r++)t.add(this.colliderGroups[n].colliders[r]);return t}get center(){return this._center}set center(t){var e;(e=this._center)!=null&&e.userData.inverseCacheProxy&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=t,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new rSe(this._center.matrixWorld)))}get initialLocalChildPosition(){return this._initialLocalChildPosition}get _parentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:xT}setInitState(){this._initialLocalMatrix.copy(this.bone.matrix),this._initialLocalRotation.copy(this.bone.quaternion),this.child?this._initialLocalChildPosition.copy(this.child.position):this._initialLocalChildPosition.copy(this.bone.position).normalize().multiplyScalar(.07);const t=this._getMatrixWorldToCenter();this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(t),this._prevTail.copy(this._currentTail),this._boneAxis.copy(this._initialLocalChildPosition).normalize()}reset(){this.bone.quaternion.copy(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix);const t=this._getMatrixWorldToCenter();this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(t),this._prevTail.copy(this._currentTail)}update(t){if(t<=0)return;this._calcWorldSpaceBoneLength();const e=z0.copy(this._boneAxis).transformDirection(this._initialLocalMatrix).transformDirection(this._parentMatrixWorld);H0.copy(this._currentTail).add(Vm.subVectors(this._currentTail,this._prevTail).multiplyScalar(1-this.settings.dragForce)).applyMatrix4(this._getMatrixCenterToWorld()).addScaledVector(e,this.settings.stiffness*t).addScaledVector(this.settings.gravityDir,this.settings.gravityPower*t),B0.setFromMatrixPosition(this.bone.matrixWorld),H0.sub(B0).normalize().multiplyScalar(this._worldSpaceBoneLength).add(B0),this._collision(H0),this._prevTail.copy(this._currentTail),this._currentTail.copy(H0).applyMatrix4(this._getMatrixWorldToCenter());const n=iSe.multiplyMatrices(this._parentMatrixWorld,this._initialLocalMatrix).invert();this.bone.quaternion.setFromUnitVectors(this._boneAxis,Vm.copy(H0).applyMatrix4(n).normalize()).premultiply(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix)}_collision(t){for(let e=0;e<this.colliderGroups.length;e++)for(let n=0;n<this.colliderGroups[e].colliders.length;n++){const r=this.colliderGroups[e].colliders[n],i=r.shape.calculateCollision(r.colliderMatrix,t,this.settings.hitRadius,Vm);if(i<0){t.addScaledVector(Vm,-i),t.sub(B0);const s=t.length();t.multiplyScalar(this._worldSpaceBoneLength/s).add(B0)}}}_calcWorldSpaceBoneLength(){Vm.setFromMatrixPosition(this.bone.matrixWorld),this.child?z0.setFromMatrixPosition(this.child.matrixWorld):(z0.copy(this._initialLocalChildPosition),z0.applyMatrix4(this.bone.matrixWorld)),this._worldSpaceBoneLength=Vm.sub(z0).length()}_getMatrixCenterToWorld(){return this._center?this._center.matrixWorld:xT}_getMatrixWorldToCenter(){return this._center?this._center.userData.inverseCacheProxy.inverse:xT}};function aSe(t,e){const n=[];let r=t;for(;r!==null;)n.unshift(r),r=r.parent;n.forEach(i=>{e(i)})}function xP(t,e){t.children.forEach(n=>{e(n)||xP(n,e)})}function oSe(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 UU=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<this._sortedJoints.length;t++){const e=this._sortedJoints[t];e.bone.updateMatrix(),e.bone.updateWorldMatrix(!1,!1),e.setInitState()}}reset(){this._sortJoints();for(let t=0;t<this._sortedJoints.length;t++){const e=this._sortedJoints[t];e.bone.updateMatrix(),e.bone.updateWorldMatrix(!1,!1),e.reset()}}update(t){this._sortJoints();for(let e=0;e<this._ancestors.length;e++)this._ancestors[e].updateWorldMatrix(e===0,!1);for(let e=0;e<this._sortedJoints.length;e++){const n=this._sortedJoints[e];n.bone.updateMatrix(),n.bone.updateWorldMatrix(!1,!1),n.update(t),xP(n.bone,this._relevantChildrenUpdated)}}_sortJoints(){if(!this._isSortedJointsDirty)return;const t=[],e=new Set,n=new Set,r=new Set;for(const s of this._joints)this._insertJointSort(s,e,n,t,r);this._sortedJoints=t;const i=oSe(r);this._ancestors=[],i&&(this._ancestors.push(i),xP(i,s=>{var a,o;return((o=(a=this._objectSpringBonesMap.get(s))==null?void 0:a.size)!=null?o:0)>0?!0:(this._ancestors.push(s),!1)})),this._isSortedJointsDirty=!1}_insertJointSort(t,e,n,r,i){if(n.has(t))return;if(e.has(t)){this._hasWarnedCircularDependency||(console.warn("VRMSpringBoneManager: Circular dependency detected"),this._hasWarnedCircularDependency=!0);return}e.add(t);const s=t.dependencies;for(const a of s){let o=!1,l=null;aSe(a,c=>{const d=this._objectSpringBonesMap.get(c);if(d)for(const f of d)o=!0,this._insertJointSort(f,e,n,r,i);else o||(l=c)}),l&&i.add(l)}r.push(t),n.add(t)}_relevantChildrenUpdated(t){var e,n;return((n=(e=this._objectSpringBonesMap.get(t))==null?void 0:e.size)!=null?n:0)>0?!0:(t.updateWorldMatrix(!1,!1),!1)}},FU="VRMC_springBone_extended_collider",lSe=new Set(["1.0","1.0-beta"]),cSe=new Set(["1.0"]),m8=class Ym{get name(){return Ym.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 H_(this,null,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return H_(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 H_(this,null,function*(){var n,r,i,s,a;const o=e.parser.json;if(!(((n=o.extensionsUsed)==null?void 0:n.indexOf(Ym.EXTENSION_NAME))!==-1))return null;const c=new UU,d=yield e.parser.getDependencies("node"),f=(r=o.extensions)==null?void 0:r[Ym.EXTENSION_NAME];if(!f)return null;const p=f.specVersion;if(!lSe.has(p))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Ym.EXTENSION_NAME} specVersion "${p}"`),null;const y=(i=f.colliders)==null?void 0:i.map((S,w)=>{var b,M,T,C,L,N,D,F,V,I,U,X,te,re,pe;const ee=d[S.node];if(ee==null)return console.warn(`VRMSpringBoneLoaderPlugin: The collider #${w} attempted to reference a node #${S.node} but not found. Skipping the collider`),null;const ce=S.shape,B=(b=S.extensions)==null?void 0:b[FU];if(this.useExtendedColliders&&B!=null){const J=B.specVersion;if(!cSe.has(J))console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${FU} specVersion "${J}". Fallbacking to the ${Ym.EXTENSION_NAME} definition`);else{const Z=B.shape;if(Z.sphere)return this._importSphereCollider(ee,{offset:new q().fromArray((M=Z.sphere.offset)!=null?M:[0,0,0]),radius:(T=Z.sphere.radius)!=null?T:0,inside:(C=Z.sphere.inside)!=null?C:!1});if(Z.capsule)return this._importCapsuleCollider(ee,{offset:new q().fromArray((L=Z.capsule.offset)!=null?L:[0,0,0]),radius:(N=Z.capsule.radius)!=null?N:0,tail:new q().fromArray((D=Z.capsule.tail)!=null?D:[0,0,0]),inside:(F=Z.capsule.inside)!=null?F:!1});if(Z.plane)return this._importPlaneCollider(ee,{offset:new q().fromArray((V=Z.plane.offset)!=null?V:[0,0,0]),normal:new q().fromArray((I=Z.plane.normal)!=null?I:[0,0,1])})}}if(ce.sphere)return this._importSphereCollider(ee,{offset:new q().fromArray((U=ce.sphere.offset)!=null?U:[0,0,0]),radius:(X=ce.sphere.radius)!=null?X:0,inside:!1});if(ce.capsule)return this._importCapsuleCollider(ee,{offset:new q().fromArray((te=ce.capsule.offset)!=null?te:[0,0,0]),radius:(re=ce.capsule.radius)!=null?re:0,tail:new q().fromArray((pe=ce.capsule.tail)!=null?pe:[0,0,0]),inside:!1});console.warn(`VRMSpringBoneLoaderPlugin: The collider #${w} has no valid shape. Skipping the collider`)}),x=(s=f.colliderGroups)==null?void 0:s.map((S,w)=>{var b;return{colliders:((b=S.colliders)!=null?b:[]).map(T=>{const C=y==null?void 0:y[T];return C??(console.warn(`VRMSpringBoneLoaderPlugin: The collider group #${w} attempted to reference a collider #${T} but not found. Skipping the collider`),null)}).filter(T=>T!=null),name:S.name}});return(a=f.springs)==null||a.forEach((S,w)=>{var b;const M=S.joints,T=(b=S.colliderGroups)==null?void 0:b.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 L;M.forEach(N=>{if(L){const D=L.node,F=d[D],V=N.node,I=d[V],U={hitRadius:L.hitRadius,dragForce:L.dragForce,gravityPower:L.gravityPower,stiffness:L.stiffness,gravityDir:L.gravityDir!=null?new q().fromArray(L.gravityDir):void 0},X=this._importJoint(F,I,U,T);C&&(X.center=C),c.addJoint(X)}L=N})}),c.setInitState(),c})}_v0Import(e){return H_(this,null,function*(){var n,r,i;const s=e.parser.json;if(!(((n=s.extensionsUsed)==null?void 0:n.indexOf("VRM"))!==-1))return null;const o=(r=s.extensions)==null?void 0:r.VRM,l=o==null?void 0:o.secondaryAnimation;if(!l)return null;const c=l==null?void 0:l.boneGroups;if(!c)return null;const d=new UU,f=yield e.parser.getDependencies("node"),p=(i=l.colliderGroups)==null?void 0:i.map((y,x)=>{var S;const w=f[y.node];return w==null?(console.warn(`VRMSpringBoneLoaderPlugin: The collider group #${x} attempted to reference a node #${y.node} but not found. Skipping the collider group`),null):{colliders:((S=y.colliders)!=null?S:[]).map((M,T)=>{var C,L,N;const D=new q(0,0,0);return M.offset&&D.set((C=M.offset.x)!=null?C:0,(L=M.offset.y)!=null?L:0,M.offset.z?-M.offset.z:0),this._importSphereCollider(w,{offset:D,radius:(N=M.radius)!=null?N:0,inside:!1})})}});return c==null||c.forEach((y,x)=>{const S=y.bones;S&&S.forEach(w=>{var b,M,T,C;const L=f[w];if(L==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 q;y.gravityDir?N.set((b=y.gravityDir.x)!=null?b:0,(M=y.gravityDir.y)!=null?M:0,(T=y.gravityDir.z)!=null?T:0):N.set(0,-1,0);const 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(I=>{const U=p==null?void 0:p[I];return U??(console.warn(`VRMSpringBoneLoaderPlugin: The spring #${x} attempted to reference a collider group #${I} but not found. Skipping the collider group`),null)}).filter(I=>I!=null);L.traverse(I=>{var U;const X=(U=I.children[0])!=null?U:null,te=this._importJoint(I,X,F,V);D&&(te.center=D),d.addJoint(te)})})}),e.scene.updateMatrixWorld(),d.setInitState(),d})}_importJoint(e,n,r,i){const s=new sSe(e,n,r,i);if(this.jointHelperRoot){const a=new Jwe(s);this.jointHelperRoot.add(a),a.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,n){const r=new p8(n),i=new yT(r);if(e.add(i),this.colliderHelperRoot){const s=new vT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importCapsuleCollider(e,n){const r=new f8(n),i=new yT(r);if(e.add(i),this.colliderHelperRoot){const s=new vT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importPlaneCollider(e,n){const r=new h8(n),i=new yT(r);if(e.add(i),this.colliderHelperRoot){const s=new vT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}};m8.EXTENSION_NAME="VRMC_springBone";var uSe=m8,dSe=class{get name(){return"VRMLoaderPlugin"}constructor(t,e){var n,r,i,s,a,o,l,c,d,f;this.parser=t;const p=e==null?void 0:e.helperRoot,y=e==null?void 0:e.autoUpdateHumanBones;this.expressionPlugin=(n=e==null?void 0:e.expressionPlugin)!=null?n:new T1e(t),this.firstPersonPlugin=(r=e==null?void 0:e.firstPersonPlugin)!=null?r:new P1e(t),this.humanoidPlugin=(i=e==null?void 0:e.humanoidPlugin)!=null?i:new D1e(t,{helperRoot:p,autoUpdateHumanBones:y}),this.lookAtPlugin=(s=e==null?void 0:e.lookAtPlugin)!=null?s:new Z1e(t,{helperRoot:p}),this.metaPlugin=(a=e==null?void 0:e.metaPlugin)!=null?a:new ewe(t),this.mtoonMaterialPlugin=(o=e==null?void 0:e.mtoonMaterialPlugin)!=null?o:new mwe(t),this.materialsHDREmissiveMultiplierPlugin=(l=e==null?void 0:e.materialsHDREmissiveMultiplierPlugin)!=null?l:new vwe(t),this.materialsV0CompatPlugin=(c=e==null?void 0:e.materialsV0CompatPlugin)!=null?c:new Mwe(t),this.springBonePlugin=(d=e==null?void 0:e.springBonePlugin)!=null?d:new uSe(t,{colliderHelperRoot:p,jointHelperRoot:p}),this.nodeConstraintPlugin=(f=e==null?void 0:e.nodeConstraintPlugin)!=null?f:new Wwe(t,{helperRoot:p})}beforeRoot(){return F_(this,null,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(t){return F_(this,null,function*(){return yield this.mtoonMaterialPlugin.loadMesh(t)})}getMaterialType(t){const e=this.mtoonMaterialPlugin.getMaterialType(t);return e??null}extendMaterialParams(t,e){return F_(this,null,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(t,e),yield this.mtoonMaterialPlugin.extendMaterialParams(t,e)})}afterRoot(t){return F_(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 nwe({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 fSe(t){const e=new Set;return t.traverse(n=>{if(!n.isMesh)return;const r=n;e.add(r)}),e}function zU(t,e,n){if(e.size===1){const a=e.values().next().value;if(a.weight===1)return t[a.index]}const r=new Float32Array(t[0].count*3);let i=0;if(n)i=1;else for(const a of e)i+=a.weight;for(const a of e){const o=t[a.index],l=a.weight/i;for(let c=0;c<o.count;c++)r[c*3+0]+=o.getX(c)*l,r[c*3+1]+=o.getY(c)*l,r[c*3+2]+=o.getZ(c)*l}return new Qt(r,3)}function hSe(t){var e;const n=fSe(t.scene),r=new Map,i=(e=t.expressionManager)==null?void 0:e.expressionMap;if(i!=null)for(const[s,a]of Object.entries(i)){const o=new Set;for(const l of a.binds)if(l instanceof qw){if(l.weight!==0)for(const c of l.primitives){let d=r.get(c);d==null&&(d=new Map,r.set(c,d));let f=d.get(s);f==null&&(f=new Set,d.set(s,f)),f.add(l)}o.add(l)}for(const l of o)a.deleteBind(l)}for(const s of n){const a=r.get(s);if(a==null)continue;const o=s.geometry.morphAttributes;s.geometry.morphAttributes={};const l=s.geometry.clone();s.geometry=l;const c=l.morphTargetsRelative,d=o.position!=null,f=o.normal!=null,p={},y={},x=[];if(d||f){d&&(p.position=[]),f&&(p.normal=[]);let S=0;for(const[w,b]of a)d&&(p.position[S]=zU(o.position,b,c)),f&&(p.normal[S]=zU(o.normal,b,c)),i==null||i[w].addBind(new qw({index:S,weight:1,primitives:[s]})),y[w]=S,x.push(0),S++}l.morphAttributes=p,s.morphTargetDictionary=y,s.morphTargetInfluences=x}}function Yw(t,e,n){if(t.getComponent)return t.getComponent(e,n);{let r=t.array[e*t.itemSize+n];return t.normalized&&(r=vr.denormalize(r,t.array)),r}}function g8(t,e,n,r){t.setComponent?t.setComponent(e,n,r):(t.normalized&&(r=vr.normalize(r,t.array)),t.array[e*t.itemSize+n]=r)}function pSe(t){var e;const n=mSe(t),r=new Set;for(const f of n)r.has(f.geometry)&&(f.geometry=_Se(f.geometry)),r.add(f.geometry);const i=new Map;for(const f of r){const p=f.getAttribute("skinIndex"),y=(e=i.get(p))!=null?e:new Map;i.set(p,y);const x=f.getAttribute("skinWeight"),S=gSe(p,x);y.set(x,S)}const s=new Map;for(const f of n){const p=vSe(f,i);s.set(f,p)}const a=[];for(const[f,p]of s){let y=!1;for(const x of a)if(ySe(p,x.boneInverseMap)){y=!0,x.meshes.add(f);for(const[w,b]of p)x.boneInverseMap.set(w,b);break}y||a.push({boneInverseMap:p,meshes:new Set([f])})}const o=new Map,l=new bT,c=new bT,d=new bT;for(const f of a){const{boneInverseMap:p,meshes:y}=f,x=Array.from(p.keys()),S=Array.from(p.values()),w=new Fd(x,S),b=c.getOrCreate(w);for(const M of y){const T=M.geometry.getAttribute("skinIndex"),C=l.getOrCreate(T),L=M.skeleton.bones,N=L.map(V=>d.getOrCreate(V)).join(","),D=`${C};${b};${N}`;let F=o.get(D);F==null&&(F=T.clone(),xSe(F,L,x),o.set(D,F)),M.geometry.setAttribute("skinIndex",F)}for(const M of y)M.bind(w,new Rt)}}function mSe(t){const e=new Set;return t.traverse(n=>{if(!n.isSkinnedMesh)return;const r=n;e.add(r)}),e}function gSe(t,e){const n=new Set;for(let r=0;r<t.count;r++)for(let i=0;i<t.itemSize;i++){const s=Yw(t,r,i);Yw(e,r,i)!==0&&n.add(s)}return n}function vSe(t,e){const n=new Map,r=t.skeleton,i=t.geometry,s=i.getAttribute("skinIndex"),a=i.getAttribute("skinWeight"),o=e.get(s),l=o==null?void 0:o.get(a);if(!l)throw new Error("Unreachable. attributeUsedIndexSetMap does not know the skin index attribute or the skin weight attribute.");for(const c of l)n.set(r.bones[c],r.boneInverses[c]);return n}function ySe(t,e){for(const[n,r]of t.entries()){const i=e.get(n);if(i!=null&&!bSe(r,i))return!1}return!0}function xSe(t,e,n){const r=new Map;for(const s of e)r.set(s,r.size);const i=new Map;for(const[s,a]of n.entries()){const o=r.get(a);i.set(o,s)}for(let s=0;s<t.count;s++)for(let a=0;a<t.itemSize;a++){const o=Yw(t,s,a),l=i.get(o);g8(t,s,a,l)}t.needsUpdate=!0}function bSe(t,e,n){if(n=n||1e-4,t.elements.length!=e.elements.length)return!1;for(let r=0,i=t.elements.length;r<i;r++)if(Math.abs(t.elements[r]-e.elements[r])>n)return!1;return!0}var bT=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 _Se(t){var e,n,r,i;const s=new Yt;s.name=t.name,s.setIndex(t.index);for(const[a,o]of Object.entries(t.attributes))s.setAttribute(a,o);for(const[a,o]of Object.entries(t.morphAttributes)){const l=a;s.morphAttributes[l]=o.concat()}s.morphTargetsRelative=t.morphTargetsRelative,s.groups=[];for(const a of t.groups)s.addGroup(a.start,a.count,a.materialIndex);return s.boundingSphere=(n=(e=t.boundingSphere)==null?void 0:e.clone())!=null?n:null,s.boundingBox=(i=(r=t.boundingBox)==null?void 0:r.clone())!=null?i:null,s.drawRange.start=t.drawRange.start,s.drawRange.count=t.drawRange.count,s.userData=t.userData,s}function BU(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 wSe(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=>BU(i)):r&&BU(r))}function SSe(t){t.traverse(wSe)}function MSe(t,e){var n,r;console.warn("VRMUtils.removeUnnecessaryJoints: removeUnnecessaryJoints is deprecated. Use combineSkeletons instead. combineSkeletons contributes more to the performance improvement. This function will be removed in the next major version.");const i=(n=e==null?void 0:e.experimentalSameBoneCounts)!=null?n:!1,s=[];t.traverse(l=>{l.type==="SkinnedMesh"&&s.push(l)});const a=new Map;let o=0;for(const l of s){const d=l.geometry.getAttribute("skinIndex");if(a.has(d))continue;const f=new Map,p=new Map;for(let y=0;y<d.count;y++)for(let x=0;x<d.itemSize;x++){const S=Yw(d,y,x);let w=f.get(S);w==null&&(w=f.size,f.set(S,w),p.set(w,S)),g8(d,y,x,w)}d.needsUpdate=!0,a.set(d,p),o=Math.max(o,f.size)}for(const l of s){const d=l.geometry.getAttribute("skinIndex"),f=a.get(d),p=[],y=[],x=i?o:f.size;for(let w=0;w<x;w++){const b=(r=f.get(w))!=null?r:0;p.push(l.skeleton.bones[b]),y.push(l.skeleton.boneInverses[b])}const S=new Fd(p,y);l.bind(S,new Rt)}}function ESe(t,e){const n=t.position.count,r=new Array(n);let i=0;const s=e.array;for(let a=0;a<s.length;a++){const o=s[a];r[o]||(r[o]=!0,i++)}return{isVertexUsed:r,vertexCount:n,verticesUsed:i}}function ASe(t){const e=[],n=[];let r=0;for(let i=0;i<t.length;i++)if(t[i]){const s=r++;e[i]=s,n[s]=i}return{originalIndexNewIndexMap:e,newIndexOriginalIndexMap:n}}function TSe(t,e){var n,r,i,s;e.name=t.name,e.morphTargetsRelative=t.morphTargetsRelative,t.groups.forEach(a=>{e.addGroup(a.start,a.count,a.materialIndex)}),e.boundingBox=(r=(n=t.boundingBox)==null?void 0:n.clone())!=null?r:null,e.boundingSphere=(s=(i=t.boundingSphere)==null?void 0:i.clone())!=null?s:null,e.setDrawRange(t.drawRange.start,t.drawRange.count),e.userData=t.userData}function CSe(t,e,n){const r=e.array,i=new r.constructor(r.length);for(let s=0;s<r.length;s++){const a=r[s];i[s]=n[a]}t.setIndex(new Qt(i,e.itemSize,e.normalized))}function Zw(t,e,n){const r=t.constructor,i=new r(e.length*n);let s=!0;for(let a=0;a<e.length;a++){const l=e[a]*n,c=a*n;for(let d=0;d<n;d++){const f=t[l+d];i[c+d]=f,s=s&&f===0}}return[i,s]}function PSe(t){var e;const n=new Map,r=[];for(const[i,s]of Object.entries(t))if(s.isInterleavedBufferAttribute){const a=s,o=a.data,l=(e=n.get(o))!=null?e:[];n.set(o,l),l.push([i,a])}else{const a=s;r.push([i,a])}return[n,r]}function RSe(t,e,n){const[r,i]=PSe(e);for(const[s,a]of r){const o=s.array,{stride:l}=s,[c]=Zw(o,n,l),d=new up(c,l);d.setUsage(s.usage);for(const[f,p]of a){const{itemSize:y,offset:x,normalized:S}=p,w=new Fl(d,y,x,S);t.setAttribute(f,w)}}for(const[s,a]of i){const o=a.array,{itemSize:l,normalized:c}=a,[d]=Zw(o,n,l);t.setAttribute(s,new Qt(d,l,c))}}function NSe(t){var e;const n=new Map,r=[];for(const[i,s]of Object.entries(t)){const a=i;for(let o=0;o<s.length;o++){const l=s[o];if(l.isInterleavedBufferAttribute){const c=l,d=c.data,f=(e=n.get(d))!=null?e:[];n.set(d,f),f.push([a,o,c])}else{const c=l;r.push([a,o,c])}}}return[n,r]}function kSe(t,e,n){var r,i;let s=!0;const[a,o]=NSe(e),l={};for(const[c,d]of a){const f=c.array,{stride:p}=c,[y,x]=Zw(f,n,p);s=s&&x;const S=new up(y,p);S.setUsage(c.usage);for(const[w,b,M]of d){const{itemSize:T,offset:C,normalized:L}=M,N=new Fl(S,T,C,L);(r=l[w])!=null||(l[w]=[]),l[w][b]=N}}for(const[c,d,f]of o){const p=f,y=p.array,{itemSize:x,normalized:S}=p,[w,b]=Zw(y,n,x);s=s&&b,(i=l[c])!=null||(l[c]=[]),l[c][d]=new Qt(w,x,S)}t.morphAttributes=s?{}:l}function ISe(t){const e=new Map;t.traverse(n=>{if(!n.isMesh)return;const r=n,i=r.geometry,s=i.index;if(s==null)return;const a=e.get(i);if(a!=null){r.geometry=a;return}const{isVertexUsed:o,vertexCount:l,verticesUsed:c}=ESe(i.attributes,s);if(c===l)return;const{originalIndexNewIndexMap:d,newIndexOriginalIndexMap:f}=ASe(o),p=new Yt;TSe(i,p),e.set(i,p),CSe(p,s,d),RSe(p,i.attributes,f),kSe(p,i.morphAttributes,f),r.geometry=p}),Array.from(e.keys()).forEach(n=>{n.dispose()})}function LSe(t){var e;((e=t.meta)==null?void 0:e.metaVersion)==="0"&&(t.scene.rotation.y=Math.PI)}var Kc=class{constructor(){}};Kc.combineMorphs=hSe;Kc.combineSkeletons=pSe;Kc.deepDispose=SSe;Kc.removeUnnecessaryJoints=MSe;Kc.removeUnnecessaryVertices=ISe;Kc.rotateVRM0=LSe;/*!
|
||
* @pixiv/three-vrm-core v3.5.4
|
||
* The implementation of core features of VRM, for @pixiv/three-vrm
|
||
*
|
||
* Copyright (c) 2019-2026 pixiv Inc.
|
||
* @pixiv/three-vrm-core is distributed under MIT License
|
||
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
||
*//*!
|
||
* @pixiv/three-vrm-materials-mtoon v3.5.4
|
||
* MToon (toon material) module for @pixiv/three-vrm
|
||
*
|
||
* Copyright (c) 2019-2026 pixiv Inc.
|
||
* @pixiv/three-vrm-materials-mtoon is distributed under MIT License
|
||
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
||
*//*!
|
||
* @pixiv/three-vrm-materials-hdr-emissive-multiplier v3.5.4
|
||
* Support VRMC_hdr_emissiveMultiplier for @pixiv/three-vrm
|
||
*
|
||
* Copyright (c) 2019-2026 pixiv Inc.
|
||
* @pixiv/three-vrm-materials-hdr-emissive-multiplier is distributed under MIT License
|
||
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
||
*//*!
|
||
* @pixiv/three-vrm-materials-v0compat v3.5.4
|
||
* VRM0.0 materials compatibility layer plugin for @pixiv/three-vrm
|
||
*
|
||
* Copyright (c) 2019-2026 pixiv Inc.
|
||
* @pixiv/three-vrm-materials-v0compat is distributed under MIT License
|
||
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
||
*//*!
|
||
* @pixiv/three-vrm-node-constraint v3.5.4
|
||
* Node constraint module for @pixiv/three-vrm
|
||
*
|
||
* Copyright (c) 2019-2026 pixiv Inc.
|
||
* @pixiv/three-vrm-node-constraint is distributed under MIT License
|
||
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
||
*//*!
|
||
* @pixiv/three-vrm-springbone v3.5.4
|
||
* Spring bone module for @pixiv/three-vrm
|
||
*
|
||
* 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 OSe={leftUpperArm:[0,0,1.2],rightUpperArm:[0,0,-1.2],leftLowerArm:[0,-.2,0],rightLowerArm:[0,.2,0]};function Io(t,e,n,r,i){var a;const s=(a=t.humanoid)==null?void 0:a.getNormalizedBoneNode(e);s&&s.rotation.set(n,r,i)}function DSe(t){var e;for(const[n,r]of Object.entries(OSe))Io(t,n,r[0],r[1],r[2]);(e=t.humanoid)==null||e.update()}function jSe(t,e,n,r,i,s){const a=Math.sin(e*1.7),o=Math.sin(e*.45),l=Math.sin(e*.32),c=Math.min(1,n*1.4),d=Math.sin(e*1.3)*c*.06;Io(t,"hips",0,l*.045,l*.03),Io(t,"spine",a*.025+s*.07,o*.022,-l*.03),Io(t,"chest",a*.02+s*.02,o*.018,0),Io(t,"upperChest",a*.015,0,0),Io(t,"neck",i*.4+d*.5,r*.4,0),Io(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;Io(t,"leftUpperArm",0,0,1.18+f+l*.04),Io(t,"rightUpperArm",0,0,-1.18-f+l*.04),Io(t,"leftLowerArm",0,-.18-Math.sin(e*.8)*.03,0),Io(t,"rightLowerArm",0,.18+Math.sin(e*.8)*.03,0)}const USe=["happy","angry","sad","surprised","relaxed"],FSe={neutral:null,happy:"happy",angry:"angry",sad:"sad",surprised:"surprised",relaxed:"relaxed"};function zSe({url:t,audioLevel:e,emotion:n,onError:r}){const[i,s]=P.useState(null),a=P.useRef({}),o=P.useRef({t:0,next:3,active:0}),l=P.useRef({yaw:0,pitch:0,tYaw:0,tPitch:0,t:0,next:2.5,lean:0});return P.useEffect(()=>{let c=!1,d=null;const f=new V_e;return f.register(p=>new dSe(p)),f.load(t,p=>{var x;if(c)return;const y=p.userData.vrm;if(!y){r("Datei enthält kein gültiges VRM-Modell.");return}Kc.removeUnnecessaryVertices(p.scene),((x=y.meta)==null?void 0:x.metaVersion)==="0"&&Kc.rotateVRM0(y),y.scene.rotation.y=Math.PI,DSe(y),d=y,s(y)},void 0,p=>{console.error("VRM-Load-Fehler:",p),r("Avatar konnte nicht geladen werden (CORS/URL?).")}),()=>{c=!0,d&&Kc.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 p=l.current;p.t+=d,p.t>p.next&&(p.tYaw=(Math.random()-.5)*.5,p.tPitch=(Math.random()-.5)*.24,p.t=0,p.next=2.5+Math.random()*3.5),p.yaw+=(p.tYaw-p.yaw)*Math.min(1,d*1.5),p.pitch+=(p.tPitch-p.pitch)*Math.min(1,d*1.5),p.lean+=(Math.min(1,f*1.6)-p.lean)*Math.min(1,d*3),jSe(i,c.clock.elapsedTime,f,p.yaw,p.pitch,p.lean);const y=i.expressionManager;if(y){const S=(a.current.aa??0)*.4+f*.6;a.current.aa=S,y.setValue("aa",S);const w=FSe[n.current];for(const T of USe){const C=w===T?.75:0,L=a.current[T]??0,N=L+(C-L)*Math.min(1,d*4);a.current[T]=N,y.setValue(T,N)}const b=o.current;b.t+=d,b.active<=0&&b.t>b.next&&(b.active=.16,b.t=0,b.next=3+Math.random()*4);let M=0;if(b.active>0){b.active-=d;const T=1-b.active/.16;M=1-Math.abs(T-.5)*2}y.setValue("blink",Math.max(0,M))}i.update(d)}),i?g.jsx("primitive",{object:i.scene}):null}function BSe({url:t,audioLevel:e,emotion:n}){const[r,i]=P.useState(null);return g.jsxs("div",{className:"relative h-full w-full",children:[g.jsxs(I_e,{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(zSe,{url:t,audioLevel:e,emotion:n,onError:i},t),g.jsx(H_e,{target:[0,1.3,0],enablePan:!1,minDistance:.7,maxDistance:3,minPolarAngle:Math.PI/3,maxPolarAngle:Math.PI/1.8})]}),r&&g.jsx("div",{className:"absolute inset-x-0 bottom-3 mx-auto w-fit rounded-md bg-red-500/15 border border-red-500/30 px-3 py-1.5 text-xs text-red-300",children:r})]})}const HSe=["elevenlabs","edge"],VSe={elevenlabs:"ElevenLabs (premium)",edge:"Edge (natürlich · gratis)"};function GSe(){const[t,e]=P.useState([]),[n,r]=P.useState(localStorage.getItem("mc_voice_engine")||"elevenlabs"),[i,s]=P.useState(localStorage.getItem("mc_voice_voice")||""),[a,o]=P.useState(!1),[l,c]=P.useState(()=>{const b=localStorage.getItem("mc_voice_volume");if(b===null||b==="")return .6;const M=Number(b);return Number.isNaN(M)?.6:M}),d=P.useRef(null),f=b=>{c(b),localStorage.setItem("mc_voice_volume",String(b)),window.dispatchEvent(new CustomEvent("mc-voice-volume",{detail:b}))},p=(b,M)=>{r(b),s(M),localStorage.setItem("mc_voice_engine",b),localStorage.setItem("mc_voice_voice",M)};P.useEffect(()=>{fetch("/api/voice/voices").then(b=>b.ok?b.json():Promise.reject()).then(b=>{const M=b.voices||[];if(e(M),!i){const T=M.find(C=>C.engine===n);T&&p(n,T.id)}}).catch(()=>e([]))},[]);const y=async()=>{var b;if(!a){o(!0);try{const M=await fetch("/api/voice/tts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:"Hallo! So klingt diese Stimme auf Deutsch.",engine:n,voice:i})});if(!M.ok)throw new Error(`TTS ${M.status}`);const T=URL.createObjectURL(await M.blob());(b=d.current)==null||b.pause();const C=new Audio(T);C.volume=Math.min(1,l),d.current=C,C.onended=()=>URL.revokeObjectURL(T),await C.play()}catch(M){console.error("Probe fehlgeschlagen:",M)}finally{o(!1)}}},x=b=>{const M=t.find(T=>T.engine===b);p(b,(M==null?void 0:M.id)||"")},S=t.filter(b=>b.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(oh,{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:HSe.map(b=>g.jsx("button",{onClick:()=>x(b),className:`rounded-md border px-2.5 py-1.5 text-xs transition-colors ${n===b?"border-primary/50 bg-primary/10 text-primary":"border-border/40 hover:bg-accent"}`,children:VSe[b]},b))}),g.jsx("select",{value:i,onChange:b=>p(n,b.target.value),className:"w-full rounded-md border border-border/40 bg-background/40 px-2.5 py-2 text-xs outline-none focus:border-primary/50",children:S.map(b=>g.jsx("option",{value:b.id,children:b.label},b.id))}),g.jsxs("button",{onClick:y,disabled:a||w,className:"flex w-full items-center justify-center gap-2 rounded-md border border-primary/40 bg-primary/10 px-2.5 py-2 text-xs text-primary hover:bg-primary/20 transition-colors disabled:opacity-60",children:[a?g.jsx(Xg,{className:"h-3.5 w-3.5 animate-spin"}):g.jsx(zT,{className:"h-3.5 w-3.5"}),a?"Spielt …":"Probe hören"]}),g.jsxs("div",{className:"flex items-center gap-2 pt-0.5",children:[g.jsx(zT,{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:b=>f(Number(b.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 WSe(t){const[e,n]=P.useState(!1),r=P.useRef(null),i=P.useRef([]),s=P.useRef(null),a=P.useCallback(async()=>{if(r.current)return;let l;try{l=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(f){console.error("Mikrofon-Zugriff verweigert:",f);return}s.current=l;const c=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":"audio/webm",d=new MediaRecorder(l,{mimeType:c});i.current=[],d.ondataavailable=f=>{f.data.size&&i.current.push(f.data)},d.onstop=()=>{var p;const f=new Blob(i.current,{type:c});(p=s.current)==null||p.getTracks().forEach(y=>y.stop()),s.current=null,r.current=null,n(!1),f.size>1200&&t(f)},d.start(),r.current=d,n(!0)},[t]),o=P.useCallback(()=>{var l;(l=r.current)==null||l.stop()},[]);return P.useEffect(()=>()=>{var l,c;(l=r.current)==null||l.stop(),(c=s.current)==null||c.getTracks().forEach(d=>d.stop())},[]),{recording:e,start:a,stop:o}}class hN{constructor(){$s(this,"ctx");$s(this,"analyser");$s(this,"gain");$s(this,"queue",[]);$s(this,"playing",!1);$s(this,"raf",0);$s(this,"freq");$s(this,"level",{current:0});$s(this,"onSpeaking");const e=window.AudioContext||window.webkitAudioContext;this.ctx=new e,this.analyser=this.ctx.createAnalyser(),this.analyser.fftSize=256,this.analyser.smoothingTimeConstant=.6,this.gain=this.ctx.createGain(),this.gain.gain.value=hN.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<n;s++)r+=this.freq[s];const i=r/(n-2)/255;this.level.current=Math.min(1,i*1.9),this.raf=requestAnimationFrame(e)};e()}stopMeter(){cancelAnimationFrame(this.raf),this.level.current=0}}const $Se=[["happy",/(super|toll|klasse|freu|cool|prima|perfekt|danke|großartig|wunderbar|gerne|haha|:\)|😊|😄|🎉)/i],["surprised",/(wow|wirklich\?|krass|unglaublich|echt\?|tatsächlich|\?!|!\?|oha)/i],["angry",/(fehler|kaputt|mist|verdammt|nervt|schlecht|problem|ärgerlich|leider nicht|geht nicht)/i],["sad",/(leider|schade|traurig|tut mir leid|entschuldigung|sorry|bedauere)/i]];function XSe(t){for(const[e,n]of $Se)if(n.test(t))return e;return"neutral"}const qSe="Du sprichst per Sprache mit dem Nutzer. Antworte natürlich, freundlich und KNAPP in ganzen, gut vorlesbaren Sätzen. Kein Markdown, keine Codeblöcke, keine Aufzählungszeichen, keine Emojis — reiner Fließtext, den man laut vorlesen kann. Verwende IMMER echte deutsche Umlaute (ä, ö, ü, ß) und NIEMALS Umschreibungen wie ae, oe, ue oder ss. Nenne möglichst keine langen URLs oder Codebefehle.";function KSe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/`([^`]*)`/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/https?:\/\/\S+/gi," ").replace(/www\.\S+/gi," ").replace(/\b\S+@\S+\.\S+\b/g," ").replace(/[*_#>~|`]+/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 HU(){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 YSe(){return{engine:localStorage.getItem("mc_voice_engine")||"elevenlabs",voice:localStorage.getItem("mc_voice_voice")||""}}function ZSe(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 QSe(){const[t,e]=P.useState("idle"),[n,r]=P.useState([]),[i,s]=P.useState(null),a=P.useRef({current:0}),o=P.useRef("neutral"),l=P.useRef(null),c=P.useRef(HU()),d=P.useCallback(()=>{if(!l.current){const M=new hN;M.onSpeaking=T=>e(C=>T?"speaking":C==="speaking"?"idle":C),l.current=M,a.current=M.level}return l.current},[]),f=P.useCallback(async M=>{var te,re,pe,ee;s(null);const T=d();T.clear(),e("transcribing");let C="";try{const ce=new FormData;ce.append("audio",M,"rec.webm");const B=await fetch("/api/voice/stt",{method:"POST",body:ce});if(!B.ok)throw new Error(`STT ${B.status}`);C=((te=(await B.json()).text)==null?void 0:te.trim())||""}catch(ce){e("error"),s(`Spracherkennung fehlgeschlagen: ${ce.message}`);return}if(!C){e("idle");return}r(ce=>[...ce,{role:"user",text:C}]),e("thinking");const{engine:L,voice:N}=YSe();let D="",F="";r(ce=>[...ce,{role:"assistant",text:""}]);let V=Promise.resolve(),I=!1,U=!1;const X=ce=>{const B=KSe(ce);B&&(V=V.then(async()=>{try{const J=await fetch("/api/voice/tts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:B,engine:L,voice:N})});if(!J.ok)throw new Error(`TTS ${J.status}`);await T.enqueue(await J.arrayBuffer()),I=!0}catch(J){U=!0,console.error("TTS-Fehler:",J)}}))};try{const ce=await fetch("/api/voice/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:C,session_id:c.current,system:qSe})});if(!ce.ok||!ce.body)throw new Error(`Agent ${ce.status}`);const B=ce.body.getReader(),J=new TextDecoder;let Z="";for(;;){const{done:G,value:W}=await B.read();if(G)break;Z+=J.decode(W,{stream:!0});const oe=Z.split(`
|
||
|
||
`);Z=oe.pop()||"";for(const se of oe){const le=se.split(`
|
||
`).find(Xe=>Xe.startsWith("data:"));if(!le)continue;const Me=le.slice(5).trim();if(Me==="[DONE]")continue;let Se;try{Se=JSON.parse(Me)}catch{continue}if(Se.error)throw new Error(Se.error);const $e=((ee=(pe=(re=Se.choices)==null?void 0:re[0])==null?void 0:pe.delta)==null?void 0:ee.content)||"";if(!$e)continue;D+=$e,F+=$e,o.current=XSe(D),r(Xe=>{const fe=Xe.slice();return fe[fe.length-1]={role:"assistant",text:D},fe});const{sentences:Ee,rest:Ge}=ZSe(F);F=Ge,Ee.forEach(X)}}if(F.trim()&&X(F),await V,!D.trim()){e("idle");return}I||(e("error"),s(U?"Sprachausgabe fehlgeschlagen — Engine/Stimme prüfen.":"Keine Sprachausgabe erzeugt."))}catch(ce){e("error"),s(`Agent-Antwort fehlgeschlagen: ${ce.message}`)}},[d]),{recording:p,start:y,stop:x}=WSe(f),S=P.useCallback(()=>{d(),e("listening"),y()},[d,y]),w=P.useCallback(()=>{x()},[x]),b=P.useCallback(()=>{var M;(M=l.current)==null||M.clear(),r([]),s(null),e("idle"),localStorage.removeItem("mc_voice_session"),c.current=HU()},[]);return P.useEffect(()=>{!p&&t==="listening"&&e("transcribing")},[p,t]),{status:t,messages:n,error:i,recording:p,audioLevel:a,emotion:o,pressStart:S,pressEnd:w,reset:b}}const JSe="/avatar.vrm";function eMe(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 tMe(){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 nMe={idle:"Bereit — halte zum Sprechen",listening:"Höre zu …",transcribing:"Verstehe …",thinking:"Hermes denkt …",speaking:"Hermes spricht …",error:"Fehler"};function rMe(){const{status:t,messages:e,error:n,recording:r,audioLevel:i,emotion:s,pressStart:a,pressEnd:o,reset:l}=QSe(),c=P.useRef(!1),d=P.useRef(null);P.useEffect(()=>{var y;(y=d.current)==null||y.scrollIntoView({behavior:"smooth",block:"end"})},[e]),P.useEffect(()=>{const y=w=>w instanceof HTMLElement&&/^(INPUT|TEXTAREA|SELECT)$/.test(w.tagName),x=w=>{w.code!=="Space"||w.repeat||c.current||y(w.target)||(w.preventDefault(),c.current=!0,a())},S=w=>{w.code!=="Space"||!c.current||(w.preventDefault(),c.current=!1,o())};return window.addEventListener("keydown",x),window.addEventListener("keyup",S),()=>{window.removeEventListener("keydown",x),window.removeEventListener("keyup",S)}},[a,o]);const f=t==="speaking",p=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(BSe,{url:JSe,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:qe("flex items-center gap-2 text-sm",t==="error"?"text-red-400":f?"text-primary":"text-muted-foreground"),children:[p&&g.jsx(Xg,{className:"h-4 w-4 animate-spin"}),f&&g.jsx(zT,{className:"h-4 w-4 animate-pulse"}),g.jsx("span",{children:n||nMe[t]})]}),g.jsx("button",{onPointerDown:y=>{y.preventDefault(),c.current=!0,a()},onPointerUp:()=>{c.current&&(c.current=!1,o())},onPointerLeave:()=>{c.current&&(c.current=!1,o())},className:qe("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(TP,{className:qe("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(GSe,{})}),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(_5,{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:qe("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:qe("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?eMe(y.text):g.jsx(tMe,{})})]},x)),g.jsx("div",{ref:d})]})]})]})]})}const VU=[{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 iMe(t){var e;(e=document.getElementById(t))==null||e.scrollIntoView({behavior:"smooth",block:"start"})}function ga({id:t,icon:e,color:n,title:r,kicker:i,children:s,wide:a}){return g.jsxs("section",{id:t,className:qe("scroll-mt-20 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-3",a&&"md:col-span-2"),children:[g.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[g.jsx(e,{className:qe("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:qe("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 Yf({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(oh,{className:"h-3 w-3"})," Bei dir konkret"]}),g.jsx("div",{className:"text-muted-foreground space-y-1",children:t})]})}function hn({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(zW,{className:"h-3 w-3 opacity-60"})]}),g.jsxs("span",{className:"text-muted-foreground",children:[" — ",n]})]})}function sMe(){const[t,e]=P.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(DT,{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(jT,{className:"h-3.5 w-3.5 text-primary ml-1 mr-0.5 shrink-0"}),(t?VU:VU.slice(0,9)).map(n=>g.jsx("button",{onClick:()=>iMe(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(ga,{id:"grundlagen",icon:Pd,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(ga,{id:"moe",icon:AP,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(hn,{children:"Q8"})," nahezu verlustfrei, größter Footprint"]}),g.jsxs("li",{children:[g.jsx(hn,{children:"Q6_K"})," sehr gut, guter Mittelweg"]}),g.jsxs("li",{children:[g.jsx(hn,{children:"Q4_K_M"})," der Sweet-Spot für lokal — viel Modell pro GB"]})]}),g.jsxs(Yf,{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(hn,{children:"Q4_K_M"}),"/",g.jsx(hn,{children:"Q6_K"}),"."]})]}),g.jsxs(ga,{id:"lokal",icon:f1,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(hn,{children:"CUDA"})," NVIDIA · ",g.jsx(hn,{children:"ROCm"})," AMD · ",g.jsx(hn,{children:"Vulkan"})," herstellerübergreifend · ",g.jsx(hn,{children:"Metal"})," Apple"]})}),g.jsxs("p",{className:"pt-1",children:[g.jsx("strong",{children:"Begriffe, die immer wiederkommen:"})," Kontext (",g.jsx(hn,{children:"-c"}),"), Slots/Parallel, KV-Cache, Modell-TTL/Swap, ",g.jsx("strong",{children:"Speculative Decoding"})," (kleines Draft-Modell rät voraus → schneller)."]})]})]}),g.jsxs(Yf,{children:["Deine Box hat eine AMD-APU (gfx1151). ",g.jsx("strong",{children:"Einschränkung & Trick:"})," dort schlägt ",g.jsx(hn,{children:"Vulkan/RADV"})," das offizielle ",g.jsx(hn,{children:"ROCm"})," bei Token-Generierung um ~12–22 % — darum läuft die Engine auf Vulkan.",g.jsx(hn,{children:"llama-swap"})," hält die Alltags-Hirne dauerwarm; ",g.jsx(hn,{children:"coder"})," nutzt Spec-Decoding."]})]}),g.jsxs(ga,{id:"modelle",icon:o1,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(Yf,{children:["Dein Line-up via llama-swap: ",g.jsx(hn,{children:"fast"})," (Alltag/Vision/MoE) · ",g.jsx(hn,{children:"heavy"})," (schwere Logik) ·",g.jsx(hn,{children:"coder"})," · ",g.jsx(hn,{children:"scout"})," · ",g.jsx(hn,{children:"vision"})," · ",g.jsx(hn,{children:"embed"})," (fürs Gedächtnis) ·",g.jsx(hn,{children:"hermes"})," (Agent-Hirn). Verwalten/tauschen im ",g.jsx("strong",{children:"Modell-Manager"}),"-Tab."]})]}),g.jsxs(ga,{id:"gateway",icon:v9,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(hn,{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(hn,{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(Yf,{children:["Dein Gateway: ",g.jsx(hn,{children:"http://192.168.178.151:9001/v1"}),", Model ",g.jsx(hn,{children:"auto"}),", API-Key beliebig. Fertige Configs erzeugt dir der ",g.jsx("strong",{children:"Verbinden"}),"-Tab live — eine Wahrheit, kein Abtippen."]})]}),g.jsxs(ga,{id:"mcp",icon:u1,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(h9,{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(ga,{id:"skills",icon:_9,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(hn,{children:"SKILL.md"})," (YAML-Kopf + Anleitung, optional Skripte/Beispiele), den der Agent für eine bestimmte Aufgabe lädt — z.B. TDD, Code-Vereinfachung, API-Design."]}),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(hn,{children:"npx skills find"})," /",g.jsx(hn,{children:"npx skills add owner/repo"}),". Skills liegen projektweit (vom Agent beim Start gelesen) oder global."]})]}),g.jsxs(ga,{id:"memory",icon:JW,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(Yf,{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(hn,{children:"Identität"})," · ",g.jsx(hn,{children:"Wissen"})," · ",g.jsx(hn,{children:"Regeln"})," · ",g.jsx(hn,{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(ga,{id:"agents",icon:Nl,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(Yf,{children:[g.jsx("strong",{children:"Hermes"})," ist dein Box-Agent (Hirn = ",g.jsx(hn,{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(ga,{id:"ide",icon:l1,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(Yf,{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(hn,{children:"…:9001/v1"}),", Model ",g.jsx(hn,{children:"auto"}),", Key beliebig."]})]}),g.jsx(ga,{id:"tricks",icon:d9,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(Md,{className:"h-3 w-3 text-amber-400"})," ",n]}),g.jsx("p",{className:"text-[11px]",children:r})]},n))})}),g.jsx(ga,{id:"wartung",icon:rg,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(b5,{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(eS,{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(hn,{children:"restore.sh"})," (Doku in ",g.jsx(hn,{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(jT,{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(o1,{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(u1,{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(Nl,{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(DT,{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(ga,{id:"troubleshooting",icon:u9,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(hn,{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(hn,{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(hn,{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 aMe({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(QW,{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 GU=[{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 V0({icon:t,iconClass:e,name:n,status:r,available:i,busy:s,actionLabel:a,onAction:o}){return g.jsxs("div",{className:qe("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:qe("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:qe("text-[10px] truncate",i?"text-amber-400/90":"text-muted-foreground"),children:r})]}),g.jsx("button",{onClick:o,disabled:!i||s,className:qe("text-[11px] font-semibold rounded-lg px-2.5 py-1 transition-colors shrink-0",i?"bg-primary text-primary-foreground hover:opacity-90 cursor-pointer":"border border-border/50 text-muted-foreground/40 cursor-default"),children:s?"…":a})]})}function oMe({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:qe("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(ih,{className:qe("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(e9,{className:"h-3.5 w-3.5"})})]})}function _T(t){return t==null?"":t>1024**3?`${(t/1024**3).toFixed(2)} GB`:`${(t/1024**2).toFixed(1)} MB`}function lMe({open:t,onClose:e,defaultTab:n="maintenance"}){var Ye;const[r,i]=P.useState(null),[s,a]=P.useState([]),[o,l]=P.useState("llama-swap"),[c,d]=P.useState(""),[f,p]=P.useState(!1),[y,x]=P.useState(null),[S,w]=P.useState({}),[b,M]=P.useState("maintenance"),[T,C]=P.useState(!1),[L,N]=P.useState(""),[D,F]=P.useState(!1),[V,I]=P.useState(null),[U,X]=P.useState([]),[te,re]=P.useState(!1),[pe,ee]=P.useState(null),[ce,B]=P.useState(null);function J(ne,tt,Mt){B({type:"alert",title:ne,message:tt,onConfirm:()=>{B(null),Mt&&Mt()}})}function Z(ne,tt,Mt){B({type:"confirm",title:ne,message:tt,onConfirm:()=>{B(null),Mt()},onCancel:()=>B(null)})}function G(ne){return ne?new Date(ne*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}const[W,oe]=P.useState(""),[se,le]=P.useState(""),[Me,Se]=P.useState(!1),[$e,Ee]=P.useState(!1);P.useEffect(()=>{t&&(oe(localStorage.getItem("mc_sudo_password")||""),le(localStorage.getItem("mc_hf_token")||""))},[t]),P.useEffect(()=>{t&&n&&M(n)},[t,n]);const Ge=P.useRef(null);function Xe(){Pt("/api/maintenance/updates").then(i).catch(ne=>console.error("Error loading updates",ne))}function fe(){Pt("/api/jobs").then(ne=>a(ne.jobs||[])).catch(ne=>console.error("Error loading jobs",ne))}function Q(){Pt("/api/system/services").then(I).catch(()=>{})}function Ve(){Pt("/api/system/backups").then(ne=>X(ne.backups||[])).catch(()=>{})}function Le(ne){p(!0),x(null),Pt(`/api/maintenance/logs?service=${ne}&lines=150`).then(tt=>{tt.ok?d(tt.text):(d(`Fehler beim Laden der Logs: ${tt.err||"Unbekannter Fehler"}`),(tt.status==="incorrect_password"||tt.status==="password_required")&&x(tt.status))}).catch(tt=>d(`Fehler: ${tt.message}`)).finally(()=>{p(!1),setTimeout(()=>{Ge.current&&(Ge.current.scrollTop=Ge.current.scrollHeight)},50)})}P.useEffect(()=>{if(!t)return;Xe(),fe(),Q(),Ve();const ne=setInterval(()=>{fe(),Xe(),Q()},3e3);return()=>clearInterval(ne)},[t]),P.useEffect(()=>{!t||b!=="logs"||Le(o)},[t,b,o]);function We(ne){return(ne==null?void 0:ne.status)==="busy"?(J("Update läuft bereits",`Es läuft gerade „${ne.running}". Bitte warte, bis es fertig ist.`),fe(),!0):!1}async function Je(){try{const ne=await Pt("/api/maintenance/os-update",{method:"POST"});if(We(ne))return;fe(),M("maintenance")}catch(ne){J("Fehler",`Fehler beim Starten des OS-Updates: ${ne.message}`)}}async function de(){try{const ne=await Pt("/api/maintenance/engine-update",{method:"POST"});if(We(ne))return;fe(),M("maintenance")}catch(ne){J("Fehler",`Fehler beim Engine-Update: ${ne.message}`)}}async function De(){try{const ne=await Pt("/api/maintenance/swap-update",{method:"POST"});if(We(ne))return;fe(),M("maintenance")}catch(ne){J("Fehler",`Fehler beim Router-Update: ${ne.message}`)}}async function K(){re(!0);try{const ne=await Pt("/api/maintenance/hermes-update",{method:"POST"});if(We(ne))return;fe()}catch(ne){J("Fehler",`Hermes-Update fehlgeschlagen: ${ne.message}`)}finally{re(!1)}}async function H(ne){ee({kind:ne,loading:!0,data:null});try{const tt=await Pt(`/api/maintenance/update-details?kind=${ne}`);ee({kind:ne,loading:!1,data:tt})}catch(tt){ee({kind:ne,loading:!1,data:{kind:ne,error:tt.message}})}}function xe(){const ne=pe==null?void 0:pe.kind;ee(null),ne==="os"?Je():ne==="engine"?de():ne==="swap"?De():ne==="hermes"&&K()}async function je(){C(!0);try{await Pt("/api/maintenance/check-updates",{method:"POST"}),fe(),M("maintenance")}catch(ne){J("Fehler",`Fehler bei der Update-Suche: ${ne.message}`)}finally{C(!1)}}async function Oe(ne,tt){try{await Pt("/api/models/install",{method:"POST",body:JSON.stringify({repo:ne,role:tt})}),J("Gestartet",`Modell-Upgrade für '${tt}' (${ne}) gestartet.`),fe(),M("maintenance")}catch(Mt){J("Fehler",`Fehler beim Starten des Modell-Upgrades: ${Mt.message}`)}}async function Fe(){Z("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await Pt("/api/maintenance/reboot",{method:"POST"}),J("Reboot","Reboot ausgelöst. System startet neu...",()=>{e()})}catch(ne){J("Fehler",`Fehler beim Reboot: ${ne.message}`)}})}async function xt(){F(!0),N("Snapshot wird erzeugt...");try{const ne=await Pt("/api/system/backup",{method:"POST"});N(ne.ok?`Snapshot erzeugt: ${ne.snapshot} (${ne.files.length} Komponenten)`:"Backup fehlgeschlagen."),Ve()}catch(ne){N(`Fehler: ${ne.message}`)}finally{F(!1)}}async function rt(ne){w(tt=>({...tt,[ne]:!0}));try{const tt=await Pt("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:ne})});tt.ok?J("Dienst neu gestartet",`Dienst ${ne} wurde erfolgreich neu gestartet.`,()=>{b==="logs"&&o===ne&&Le(ne)}):J("Fehler",`Fehler beim Neustart: ${tt.err||"Unbekannter Fehler"}`)}catch(tt){J("Fehler",`Fehler beim Neustart: ${tt.message}`)}finally{w(tt=>({...tt,[ne]:!1}))}}async function ft(ne){try{await Pt(`/api/jobs/${ne}/cancel`,{method:"POST"}),fe()}catch(tt){J("Fehler",`Fehler beim Abbrechen: ${tt.message}`)}}const zt=s.find(ne=>(ne.state==="running"||ne.state==="queued")&&ne.group==="maintenance");return g.jsxs(g.Fragment,{children:[g.jsx("div",{className:qe("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:qe("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(Pd,{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(kl,{className:"h-4 w-4"})})]}),g.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[g.jsx("button",{onClick:()=>M("maintenance"),className:qe("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",b==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),g.jsx("button",{onClick:()=>M("logs"),className:qe("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",b==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),g.jsx("button",{onClick:()=>M("settings"),className:qe("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",b==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),g.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[b==="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:je,disabled:T||!!zt,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[g.jsx(ih,{className:qe("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: ",G(r.last_check)]}),zt&&g.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-300",children:[g.jsx(ih,{className:"h-3.5 w-3.5 shrink-0 animate-spin"}),g.jsxs("span",{children:["Update läuft: ",g.jsx("span",{className:"font-semibold",children:zt.label})," — bitte warten. Weitere Updates sind solange gesperrt."]})]}),g.jsxs("div",{className:"space-y-1.5",children:[g.jsx(V0,{icon:rg,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:()=>H("os")}),g.jsx(V0,{icon:f1,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:()=>H("engine")}),g.jsx(V0,{icon:pk,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:()=>H("swap")}),(()=>{var tt;const ne=(tt=r==null?void 0:r.components)==null?void 0:tt.find(Mt=>Mt.key==="hermes_agent");return g.jsx(V0,{icon:Nl,iconClass:"text-amber-400",name:"Hermes-Agent",available:(ne==null?void 0:ne.update)===!0,busy:te,status:(ne==null?void 0:ne.update)===!0?`Update: ${ne.latest}`:(ne==null?void 0:ne.reachable)===!1?"offline":"aktuell",actionLabel:"Anzeigen",onAction:()=>H("hermes")})})(),(Ye=r==null?void 0:r.model_list)==null?void 0:Ye.map(ne=>g.jsx(V0,{icon:BW,iconClass:"text-emerald-400",name:`Modell · ${ne.role}`,available:!0,status:ne.title,actionLabel:"Upgrade",onAction:()=>Oe(ne.repo,ne.role)},ne.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:GU.map(ne=>{var tt;return g.jsx(oMe,{label:ne.label,system:ne.type==="system",ok:(tt=V==null?void 0:V.services.find(Mt=>Mt.name.toLowerCase().includes(ne.reach)))==null?void 0:tt.ok,busy:S[ne.id],onRestart:()=>rt(ne.id),onLogs:()=>{l(ne.id),M("logs")}},ne.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:xt,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(GW,{className:qe("h-3.5 w-3.5",D&&"animate-pulse")})," Snapshot"]})]}),L&&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:L})]}),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:Fe,className:"flex w-full items-center gap-3 p-3 rounded-lg border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 text-red-400 transition-all text-left text-xs font-semibold",children:[g.jsx(b9,{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(ne=>ne.state==="running"||ne.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(ne=>{const tt=ne.state==="running"||ne.state==="queued";return g.jsxs("div",{className:qe("p-3 rounded-xl border transition-all duration-300",tt?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[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:[tt&&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"})]}),ne.label]}),g.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[g.jsxs("span",{children:["ID: ",ne.id]}),g.jsx("span",{children:"•"}),g.jsx("span",{className:qe(ne.state==="done"&&"text-emerald-400",ne.state==="failed"&&"text-red-400",ne.state==="running"&&"text-primary",ne.state==="queued"&&"text-amber-400",ne.state==="canceled"&&"text-muted-foreground"),children:ne.state})]})]}),tt&&g.jsx("button",{onClick:()=>ft(ne.id),className:"text-[10px] font-semibold text-red-400 hover:text-red-300 border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 px-2 py-0.5 rounded transition-colors",children:"Abbrechen"})]}),ne.state==="running"&&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:`${ne.progress??0}%`}})}),g.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[g.jsxs("span",{children:[ne.progress??0,"%"]}),ne.done_bytes!=null&&ne.total_bytes!=null&&g.jsxs("span",{children:[_T(ne.done_bytes)," / ",_T(ne.total_bytes),ne.rate_bps!=null&&` (${_T(ne.rate_bps)}/s)`]}),ne.eta_s!=null&&g.jsxs("span",{children:["ETA: ",ne.eta_s,"s"]})]})]})]},ne.id)})})]})]}),b==="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:o,onChange:ne=>l(ne.target.value),className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none text-foreground font-semibold",children:GU.map(ne=>g.jsxs("option",{value:ne.id,children:[ne.label," (",ne.type==="system"?"systemd-root":"user",")"]},ne.id))}),g.jsxs("button",{onClick:()=>rt(o),disabled:S[o],className:"flex h-9 px-3 items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-background/20 hover:border-primary/50 transition-colors disabled:opacity-50",title:"Dienst neu starten",children:[g.jsx(ih,{className:qe("h-3.5 w-3.5",S[o]&&"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(M5,{className:"h-3 w-3 text-primary"}),g.jsxs("span",{children:["stdout/stderr - ",o]})]}),g.jsx("button",{onClick:()=>Le(o),disabled:f,className:"text-muted-foreground hover:text-foreground transition-colors",children:g.jsx(ih,{className:qe("h-3 w-3",f&&"animate-spin")})})]}),g.jsx("pre",{ref:Ge,className:"flex-1 p-4 overflow-y-auto text-[10px] font-mono text-cyan-300/90 whitespace-pre-wrap select-text leading-relaxed scrollbar-thin",children:y==="password_required"||y==="incorrect_password"?g.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[g.jsx(Yc,{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 ",o," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),g.jsx("button",{onClick:()=>M("settings"),className:"px-3 py-1.5 text-[10px] font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-md transition-colors mt-2",children:"Sudo-Passwort eintragen"})]}):f&&!c?g.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):c||g.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),b==="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(rg,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),g.jsxs("div",{className:"relative",children:[g.jsx("input",{type:Me?"text":"password",value:W,onChange:ne=>oe(ne.target.value),"aria-label":"Host Sudo-Passwort",name:"sudo-password",autoComplete:"off",spellCheck:!1,placeholder:"Sudo-Passwort für System-Operationen",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),g.jsx("button",{type:"button",onClick:()=>Se(!Me),"aria-label":Me?"Passwort verbergen":"Passwort anzeigen",className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Me?g.jsx(dk,{className:"h-4 w-4","aria-hidden":"true"}):g.jsx(c1,{className:"h-4 w-4","aria-hidden":"true"})})]}),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(o9,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),g.jsxs("div",{className:"relative",children:[g.jsx("input",{type:$e?"text":"password",value:se,onChange:ne=>le(ne.target.value),"aria-label":"HuggingFace API Token",name:"hf-token",autoComplete:"off",spellCheck:!1,placeholder:"hf_…",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),g.jsx("button",{type:"button",onClick:()=>Ee(!$e),"aria-label":$e?"Token verbergen":"Token anzeigen",className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:$e?g.jsx(dk,{className:"h-4 w-4","aria-hidden":"true"}):g.jsx(c1,{className:"h-4 w-4","aria-hidden":"true"})})]}),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",W),localStorage.setItem("mc_hf_token",se),J("Erfolgreich","Einstellungen erfolgreich lokal gespeichert.")},className:"flex-1 h-9 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/90 rounded-lg transition-colors shadow shadow-primary/10 cursor-pointer",children:"Speichern"}),g.jsx("button",{onClick:()=>{oe(""),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"})]})]})]})]}),pe&&(()=>{var Zt;const ne=pe.data,tt={os:{icon:rg,cls:"text-cyan-400",title:"OS-Pakete (apt)"},engine:{icon:f1,cls:"text-violet-400",title:"Inferenz-Engine (llama.cpp)"},swap:{icon:pk,cls:"text-fuchsia-400",title:"Router (llama-swap)"},hermes:{icon:Nl,cls:"text-amber-400",title:"Hermes-Agent"}}[pe.kind],Mt=tt.icon,vt=ne?pe.kind==="os"?(ne.count??0)===0:pe.kind==="hermes"?(ne.behind??0)===0:ne.installed_build!=null&&ne.latest_build!=null&&ne.latest_build<=ne.installed_build:!0;return 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:()=>ee(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(Mt,{className:qe("h-4.5 w-4.5",tt.cls)}),g.jsx("h3",{className:"text-sm font-semibold",children:tt.title})]}),g.jsx("button",{onClick:()=>ee(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(kl,{className:"h-4 w-4"})})]}),g.jsx("div",{className:"flex-1 overflow-y-auto p-5 text-xs space-y-3 scrollbar-thin",children:pe.loading?g.jsxs("div",{className:"flex h-24 items-center justify-center gap-2 text-muted-foreground",children:[g.jsx(ih,{className:"h-4 w-4 animate-spin"})," Details werden geladen…"]}):ne!=null&&ne.error?g.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/5 p-3 text-red-400",children:ne.error}):pe.kind==="os"?((ne==null?void 0:ne.count)??0)===0?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:[ne.count," Paket(e) werden aktualisiert:"]}),g.jsx("div",{className:"space-y-1",children:ne.packages.map(he=>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(y9,{className:"h-3 w-3 text-cyan-400 shrink-0"}),he.name]}),g.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] text-muted-foreground shrink-0",children:[g.jsx("span",{children:he.current}),g.jsx(a1,{className:"h-3 w-3"}),g.jsx("span",{className:"text-emerald-400",children:he.candidate})]})]},he.name))})]}):pe.kind==="engine"||pe.kind==="swap"?g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex items-center gap-2 font-mono text-[11px]",children:[g.jsxs("span",{className:"rounded-md border border-border/40 bg-background/30 px-2 py-1",children:["Build ",(ne==null?void 0:ne.installed_build)??"?"]}),g.jsx(a1,{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 ",(ne==null?void 0:ne.latest_build)??"?"]})]}),((ne==null?void 0:ne.name)||(ne==null?void 0:ne.latest_tag))&&g.jsxs("div",{className:"text-muted-foreground",children:["Release: ",g.jsx("span",{className:"text-foreground",children:ne==null?void 0:ne.name}),ne!=null&&ne.latest_tag?` (${ne.latest_tag})`:""]}),(ne==null?void 0:ne.url)&&g.jsxs("a",{href:ne.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-primary hover:underline",children:["Release-Notes auf GitHub ",g.jsx(Ag,{className:"h-3 w-3"})]}),(ne==null?void 0:ne.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:ne.body})]}):(((Zt=ne==null?void 0:ne.commits)==null?void 0:Zt.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:[ne.behind," neue Commit(s) auf ",g.jsxs("span",{className:"font-mono text-foreground",children:["origin/",ne.branch]}),":"]}),g.jsx("div",{className:"space-y-1",children:ne.commits.map(he=>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(r9,{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:he.subject}),g.jsxs("div",{className:"font-mono text-[9px] text-muted-foreground",children:[he.hash," · ",he.when]})]})]},he.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:()=>ee(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:xe,disabled:pe.loading||vt||!!zt,title:zt?`Update läuft bereits: ${zt.label}`:void 0,className:"h-9 flex-1 rounded-lg bg-primary text-xs font-semibold text-primary-foreground hover:opacity-90 transition-all cursor-pointer disabled:opacity-40 disabled:cursor-default",children:zt?"Update läuft…":"Jetzt aktualisieren"})]})]})]})})(),ce&&g.jsx(NV,{type:ce.type,title:ce.title,message:ce.message,onConfirm:ce.onConfirm,onCancel:ce.onCancel})]})}function cMe(){var p,y,x,S,w;LX();const[t,e]=P.useState(()=>{const b=window.location.hash.slice(1);return W0.some(M=>M.id===b)?b:"dashboard"}),n=P.useCallback(b=>{window.location.hash.slice(1)===b?e(b):window.location.hash=b},[]),[r,i]=P.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[s,a]=P.useState(!1),[o,l]=P.useState("maintenance"),{data:c}=pF(),{data:d}=rp(2e4);P.useEffect(()=>{document.documentElement.classList.add("dark")},[]),P.useEffect(()=>{const b=M=>{var C;l(((C=M.detail)==null?void 0:C.tab)||"maintenance"),a(!0)};return window.addEventListener("open-system-drawer",b),()=>window.removeEventListener("open-system-drawer",b)},[]),P.useEffect(()=>{const b=M=>{var C;const T=(C=M.detail)==null?void 0:C.view;T&&n(T)};return window.addEventListener("mc-navigate",b),()=>window.removeEventListener("mc-navigate",b)},[n]),P.useEffect(()=>{const b=()=>{const M=window.location.hash.slice(1);W0.some(T=>T.id===M)&&e(M)};return window.addEventListener("hashchange",b),()=>window.removeEventListener("hashchange",b)},[]);const f=W0.find(b=>b.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:n}),g.jsx(lMe,{open:s,onClose:()=>a(!1),defaultTab:o}),g.jsxs("aside",{className:qe("flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",r?"w-16":"w-60"),children:[g.jsxs("div",{className:qe("flex items-center py-4 border-b border-border/40 shrink-0",r?"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"}),!r&&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:()=>{i(b=>{const M=!b;return localStorage.setItem("mc_sidebar_collapsed",M.toString()),M})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer","aria-label":r?"Seitenleiste ausklappen":"Seitenleiste einklappen",title:r?"Maximieren":"Minimieren",children:r?g.jsx(y5,{className:"h-4 w-4","aria-hidden":"true"}):g.jsx(WW,{className:"h-4 w-4","aria-hidden":"true"})})]}),g.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:W0.map(b=>g.jsxs("a",{href:`#${b.id}`,"aria-current":t===b.id?"page":void 0,className:qe("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",r?"justify-center p-2.5":"gap-3 px-3 py-2",t===b.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:r?b.label:void 0,"aria-label":r?b.label:void 0,children:[g.jsx(b.icon,{className:"h-4.5 w-4.5 shrink-0","aria-hidden":"true"}),!r&&g.jsx("span",{className:"truncate",children:b.label})]},b.id))}),g.jsx("div",{className:qe("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",r?"px-2 text-center":"px-5"),children:r?g.jsx("div",{className:"flex justify-center",children:g.jsx("span",{className:qe("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",c?c.engine_reachable?c.brain&&!c.brain.ready?"bg-amber-500 animate-pulse":"bg-emerald-500 animate-pulse":"bg-amber-500":"bg-red-500"),title:c?c.engine_reachable?c.brain&&!c.brain.ready?`Hirn offline (${c.brain.model??"fast"})`:"Engine + Hirn online":"Engine offline":"Backend offline"})}):g.jsxs("div",{className:"space-y-2 text-left",children:[c?g.jsxs(g.Fragment,{children:[g.jsxs("span",{className:"flex items-center gap-2",children:[g.jsx("span",{className:qe("h-2 w-2 rounded-full animate-pulse",c.engine_reachable?"bg-emerald-500":"bg-amber-500")}),g.jsxs("span",{className:"truncate",children:["Engine ",c.engine_reachable?"online":"offline"]})]}),c.brain&&!c.brain.ready&&g.jsxs("span",{className:"flex items-center gap-2 text-amber-400",title:`Agent-Hirn '${c.brain.model??"fast"}' lädt nicht/abgestürzt`,children:[g.jsx("span",{className:"h-2 w-2 rounded-full bg-amber-500 animate-pulse"}),g.jsxs("span",{className:"truncate",children:["Hirn offline",c.brain.model?` (${c.brain.model})`:""]})]})]}):g.jsxs("span",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",g.jsx("span",{className:"truncate",children:"Backend offline"})]}),(d==null?void 0:d.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:d.versions.mc2?`${d.versions.mc2.branch}-${d.versions.mc2.hash}${d.versions.mc2.dirty?"*":""} (${d.versions.mc2.date})`:"nicht gefunden",children:[g.jsx("strong",{children:"MC2:"})," ",d.versions.mc2?`${d.versions.mc2.hash}${d.versions.mc2.dirty?"*":""}`:"—"]}),g.jsxs("div",{className:"truncate",title:((p=d.versions.engine)==null?void 0:p.type)==="git"?`${d.versions.engine.branch}-${d.versions.engine.hash}${d.versions.engine.dirty?"*":""} (${d.versions.engine.date})`:((y=d.versions.engine)==null?void 0:y.version_text)||"unbekannt",children:[g.jsx("strong",{children:"Engine:"})," ",((x=d.versions.engine)==null?void 0:x.type)==="git"?`${d.versions.engine.hash}${d.versions.engine.dirty?"*":""}`:((w=(S=d.versions.engine)==null?void 0:S.version_text)==null?void 0:w.split(" ").pop())||"—"]}),g.jsxs("div",{className:"truncate",title:d.versions.hermes_ui?`${d.versions.hermes_ui.branch}-${d.versions.hermes_ui.hash}${d.versions.hermes_ui.dirty?"*":""} (${d.versions.hermes_ui.date})`:"nicht gefunden",children:[g.jsx("strong",{children:"Hermes UI:"})," ",d.versions.hermes_ui?`${d.versions.hermes_ui.hash}${d.versions.hermes_ui.dirty?"*":""}`:"—"]}),g.jsxs("div",{className:"truncate",title:d.versions.hermes_agent?`${d.versions.hermes_agent.branch}-${d.versions.hermes_agent.hash}${d.versions.hermes_agent.dirty?"*":""} (${d.versions.hermes_agent.date})`:"nicht gefunden",children:[g.jsx("strong",{children:"Hermes Agent:"})," ",d.versions.hermes_agent?`${d.versions.hermes_agent.hash}${d.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:f.hint}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(bX,{}),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 b=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(b)},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(ZW,{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(fhe,{}),t==="models"&&g.jsx(Ahe,{}),t==="connect"&&g.jsx(Che,{}),t==="memory"&&g.jsx(Ohe,{}),t==="agent"&&g.jsx(jhe,{}),t==="terminal"&&g.jsx(Uhe,{}),t==="voice"&&g.jsx(rMe,{}),t==="guide"&&g.jsx(sMe,{}),!["dashboard","models","connect","memory","agent","terminal","voice","guide"].includes(t)&&g.jsx(aMe,{title:f.label,hint:f.hint})]})]})]})}const uMe=new MW({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});Q8.createRoot(document.getElementById("root")).render(g.jsx(t5.StrictMode,{children:g.jsx(EW,{client:uMe,children:g.jsx(cMe,{})})}));export{ih as R,oh as S,FT as T,M9 as a,Qw as g,g as j,P as r};
|