c1fac1e688
Beseitigt Redundanzen/Mismatches, die sich mit den Lanes angesammelt hatten: - Modell-Manager: großen animierten SVG-Gateway-Graph (~310 Z.) entfernt — Rolle→Modell deckt das Slot-Grid ab, Lanes der Lane-Editor, IDE-Config die "Verbinden"-Seite. Cockpit-Brain-Switch raus → Verweis auf Hermes-Tab. - Hermes: zweiten SVG-Graph + 4 Status-Kacheln durch einen ruhigen Box→Pfeil- Fluss ersetzt (Terminal → Gateway → Hirn/Verdrahtung/PC), Stil wie "Verbinden". - Hirn-Wechsel vereinheitlicht: nur noch im Hermes-Tab. Installiert = warm-bewusst (/api/agent/brain/set), Alias = /api/agent/brain; Lane-Aliase chat/coding/fast/heavy. - Terminologie auf Lane-Sprache: ConnectView "model auto" → chat/coding; connect.py-Snippets defaulten auf 'coding' (GATEWAY_MODELS mit Lanes vorn). - Zentrale: ActiveModelsCard + RolesCard zu einer ModelsCard verschmolzen (Rollen + warm + Inferenz + Größe); Layout entdoppelt. ~600 Zeilen SVG-Graph-Code raus, 2 tote Karten gelöscht. Verifiziert: npm run build (tsc strict) clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
5467 lines
1.8 MiB
Plaintext
5467 lines
1.8 MiB
Plaintext
var wW=Object.defineProperty;var BN=t=>{throw TypeError(t)};var SW=(t,e,n)=>e in t?wW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Gs=(t,e,n)=>SW(t,typeof e!="symbol"?e+"":e,n),YM=(t,e,n)=>e.has(t)||BN("Cannot "+n);var ge=(t,e,n)=>(YM(t,e,"read from private field"),n?n.call(t):e.get(t)),Gt=(t,e,n)=>e.has(t)?BN("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),wt=(t,e,n,r)=>(YM(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),_n=(t,e,n)=>(YM(t,e,"access private method"),n);var ub=(t,e,n,r)=>({set _(i){wt(t,e,i,n)},get _(){return ge(t,e,r)}});function MW(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 o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function B1(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ZM={exports:{}},n0={},QM={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 HN;function EW(){if(HN)return gn;HN=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),f=Symbol.iterator;function p(V){return V===null||typeof V!="object"?null:(V=f&&V[f]||V["@@iterator"],typeof V=="function"?V:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,S={};function w(V,q,pe){this.props=V,this.context=q,this.refs=S,this.updater=pe||y}w.prototype.isReactComponent={},w.prototype.setState=function(V,q){if(typeof V!="object"&&typeof V!="function"&&V!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,V,q,"setState")},w.prototype.forceUpdate=function(V){this.updater.enqueueForceUpdate(this,V,"forceUpdate")};function _(){}_.prototype=w.prototype;function E(V,q,pe){this.props=V,this.context=q,this.refs=S,this.updater=pe||y}var T=E.prototype=new _;T.constructor=E,x(T,w.prototype),T.isPureReactComponent=!0;var P=Array.isArray,O=Object.prototype.hasOwnProperty,N={current:null},D={key:!0,ref:!0,__self:!0,__source:!0};function z(V,q,pe){var ae,ce={},Se=null,Ee=null;if(q!=null)for(ae in q.ref!==void 0&&(Ee=q.ref),q.key!==void 0&&(Se=""+q.key),q)O.call(q,ae)&&!D.hasOwnProperty(ae)&&(ce[ae]=q[ae]);var $e=arguments.length-2;if($e===1)ce.children=pe;else if(1<$e){for(var Me=Array($e),Ge=0;Ge<$e;Ge++)Me[Ge]=arguments[Ge+2];ce.children=Me}if(V&&V.defaultProps)for(ae in $e=V.defaultProps,$e)ce[ae]===void 0&&(ce[ae]=$e[ae]);return{$$typeof:t,type:V,key:Se,ref:Ee,props:ce,_owner:N.current}}function G(V,q){return{$$typeof:t,type:V.type,key:q,ref:V.ref,props:V.props,_owner:V._owner}}function k(V){return typeof V=="object"&&V!==null&&V.$$typeof===t}function j(V){var q={"=":"=0",":":"=2"};return"$"+V.replace(/[=:]/g,function(pe){return q[pe]})}var H=/\/+/g;function ee(V,q){return typeof V=="object"&&V!==null&&V.key!=null?j(""+V.key):q.toString(36)}function te(V,q,pe,ae,ce){var Se=typeof V;(Se==="undefined"||Se==="boolean")&&(V=null);var Ee=!1;if(V===null)Ee=!0;else switch(Se){case"string":case"number":Ee=!0;break;case"object":switch(V.$$typeof){case t:case e:Ee=!0}}if(Ee)return Ee=V,ce=ce(Ee),V=ae===""?"."+ee(Ee,0):ae,P(ce)?(pe="",V!=null&&(pe=V.replace(H,"$&/")+"/"),te(ce,q,pe,"",function(Ge){return Ge})):ce!=null&&(k(ce)&&(ce=G(ce,pe+(!ce.key||Ee&&Ee.key===ce.key?"":(""+ce.key).replace(H,"$&/")+"/")+V)),q.push(ce)),1;if(Ee=0,ae=ae===""?".":ae+":",P(V))for(var $e=0;$e<V.length;$e++){Se=V[$e];var Me=ae+ee(Se,$e);Ee+=te(Se,q,pe,Me,ce)}else if(Me=p(V),typeof Me=="function")for(V=Me.call(V),$e=0;!(Se=V.next()).done;)Se=Se.value,Me=ae+ee(Se,$e++),Ee+=te(Se,q,pe,Me,ce);else if(Se==="object")throw q=String(V),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(V).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.");return Ee}function he(V,q,pe){if(V==null)return V;var ae=[],ce=0;return te(V,ae,"","",function(Se){return q.call(pe,Se,ce++)}),ae}function se(V){if(V._status===-1){var q=V._result;q=q(),q.then(function(pe){(V._status===0||V._status===-1)&&(V._status=1,V._result=pe)},function(pe){(V._status===0||V._status===-1)&&(V._status=2,V._result=pe)}),V._status===-1&&(V._status=0,V._result=q)}if(V._status===1)return V._result.default;throw V._result}var fe={current:null},B={transition:null},J={ReactCurrentDispatcher:fe,ReactCurrentBatchConfig:B,ReactCurrentOwner:N};function Y(){throw Error("act(...) is not supported in production builds of React.")}return gn.Children={map:he,forEach:function(V,q,pe){he(V,function(){q.apply(this,arguments)},pe)},count:function(V){var q=0;return he(V,function(){q++}),q},toArray:function(V){return he(V,function(q){return q})||[]},only:function(V){if(!k(V))throw Error("React.Children.only expected to receive a single React element child.");return V}},gn.Component=w,gn.Fragment=n,gn.Profiler=i,gn.PureComponent=E,gn.StrictMode=r,gn.Suspense=l,gn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=J,gn.act=Y,gn.cloneElement=function(V,q,pe){if(V==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+V+".");var ae=x({},V.props),ce=V.key,Se=V.ref,Ee=V._owner;if(q!=null){if(q.ref!==void 0&&(Se=q.ref,Ee=N.current),q.key!==void 0&&(ce=""+q.key),V.type&&V.type.defaultProps)var $e=V.type.defaultProps;for(Me in q)O.call(q,Me)&&!D.hasOwnProperty(Me)&&(ae[Me]=q[Me]===void 0&&$e!==void 0?$e[Me]:q[Me])}var Me=arguments.length-2;if(Me===1)ae.children=pe;else if(1<Me){$e=Array(Me);for(var Ge=0;Ge<Me;Ge++)$e[Ge]=arguments[Ge+2];ae.children=$e}return{$$typeof:t,type:V.type,key:ce,ref:Se,props:ae,_owner:Ee}},gn.createContext=function(V){return V={$$typeof:o,_currentValue:V,_currentValue2:V,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},V.Provider={$$typeof:s,_context:V},V.Consumer=V},gn.createElement=z,gn.createFactory=function(V){var q=z.bind(null,V);return q.type=V,q},gn.createRef=function(){return{current:null}},gn.forwardRef=function(V){return{$$typeof:a,render:V}},gn.isValidElement=k,gn.lazy=function(V){return{$$typeof:d,_payload:{_status:-1,_result:V},_init:se}},gn.memo=function(V,q){return{$$typeof:c,type:V,compare:q===void 0?null:q}},gn.startTransition=function(V){var q=B.transition;B.transition={};try{V()}finally{B.transition=q}},gn.unstable_act=Y,gn.useCallback=function(V,q){return fe.current.useCallback(V,q)},gn.useContext=function(V){return fe.current.useContext(V)},gn.useDebugValue=function(){},gn.useDeferredValue=function(V){return fe.current.useDeferredValue(V)},gn.useEffect=function(V,q){return fe.current.useEffect(V,q)},gn.useId=function(){return fe.current.useId()},gn.useImperativeHandle=function(V,q,pe){return fe.current.useImperativeHandle(V,q,pe)},gn.useInsertionEffect=function(V,q){return fe.current.useInsertionEffect(V,q)},gn.useLayoutEffect=function(V,q){return fe.current.useLayoutEffect(V,q)},gn.useMemo=function(V,q){return fe.current.useMemo(V,q)},gn.useReducer=function(V,q,pe){return fe.current.useReducer(V,q,pe)},gn.useRef=function(V){return fe.current.useRef(V)},gn.useState=function(V){return fe.current.useState(V)},gn.useSyncExternalStore=function(V,q,pe){return fe.current.useSyncExternalStore(V,q,pe)},gn.useTransition=function(){return fe.current.useTransition()},gn.version="18.3.1",gn}var VN;function Xh(){return VN||(VN=1,QM.exports=EW()),QM.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 GN;function AW(){if(GN)return n0;GN=1;var t=Xh(),e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,l,c){var d,f={},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(a&&a.defaultProps)for(d in l=a.defaultProps,l)f[d]===void 0&&(f[d]=l[d]);return{$$typeof:e,type:a,key:p,ref:y,props:f,_owner:i.current}}return n0.Fragment=n,n0.jsx=o,n0.jsxs=o,n0}var WN;function TW(){return WN||(WN=1,ZM.exports=AW()),ZM.exports}var v=TW(),R=Xh();const $j=B1(R),H1=MW({__proto__:null,default:$j},[R]);var db={},JM={exports:{}},Ws={},eE={exports:{}},tE={};/**
|
||
* @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 $N;function PW(){return $N||($N=1,(function(t){function e(B,J){var Y=B.length;B.push(J);e:for(;0<Y;){var V=Y-1>>>1,q=B[V];if(0<i(q,J))B[V]=J,B[Y]=q,Y=V;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],Y=B.pop();if(Y!==J){B[0]=Y;e:for(var V=0,q=B.length,pe=q>>>1;V<pe;){var ae=2*(V+1)-1,ce=B[ae],Se=ae+1,Ee=B[Se];if(0>i(ce,Y))Se<q&&0>i(Ee,ce)?(B[V]=Ee,B[Se]=Y,V=Se):(B[V]=ce,B[ae]=Y,V=ae);else if(Se<q&&0>i(Ee,Y))B[V]=Ee,B[Se]=Y,V=Se;else break e}}return J}function i(B,J){var Y=B.sortIndex-J.sortIndex;return Y!==0?Y:B.id-J.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,f=null,p=3,y=!1,x=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(B){for(var J=n(c);J!==null;){if(J.callback===null)r(c);else if(J.startTime<=B)r(c),J.sortIndex=J.expirationTime,e(l,J);else break;J=n(c)}}function P(B){if(S=!1,T(B),!x)if(n(l)!==null)x=!0,se(O);else{var J=n(c);J!==null&&fe(P,J.startTime-B)}}function O(B,J){x=!1,S&&(S=!1,_(z),z=-1),y=!0;var Y=p;try{for(T(J),f=n(l);f!==null&&(!(f.expirationTime>J)||B&&!j());){var V=f.callback;if(typeof V=="function"){f.callback=null,p=f.priorityLevel;var q=V(f.expirationTime<=J);J=t.unstable_now(),typeof q=="function"?f.callback=q:f===n(l)&&r(l),T(J)}else r(l);f=n(l)}if(f!==null)var pe=!0;else{var ae=n(c);ae!==null&&fe(P,ae.startTime-J),pe=!1}return pe}finally{f=null,p=Y,y=!1}}var N=!1,D=null,z=-1,G=5,k=-1;function j(){return!(t.unstable_now()-k<G)}function H(){if(D!==null){var B=t.unstable_now();k=B;var J=!0;try{J=D(!0,B)}finally{J?ee():(N=!1,D=null)}}else N=!1}var ee;if(typeof E=="function")ee=function(){E(H)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,he=te.port2;te.port1.onmessage=H,ee=function(){he.postMessage(null)}}else ee=function(){w(H,0)};function se(B){D=B,N||(N=!0,ee())}function fe(B,J){z=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,se(O))},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"):G=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 Y=p;p=J;try{return B()}finally{p=Y}},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 Y=p;p=B;try{return J()}finally{p=Y}},t.unstable_scheduleCallback=function(B,J,Y){var V=t.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?V+Y:V):Y=V,B){case 1:var q=-1;break;case 2:q=250;break;case 5:q=1073741823;break;case 4:q=1e4;break;default:q=5e3}return q=Y+q,B={id:d++,callback:J,priorityLevel:B,startTime:Y,expirationTime:q,sortIndex:-1},Y>V?(B.sortIndex=Y,e(c,B),n(l)===null&&B===n(c)&&(S?(_(z),z=-1):S=!0,fe(P,Y-V))):(B.sortIndex=q,e(l,B),x||y||(x=!0,se(O))),B},t.unstable_shouldYield=j,t.unstable_wrapCallback=function(B){var J=p;return function(){var Y=p;p=J;try{return B.apply(this,arguments)}finally{p=Y}}}})(tE)),tE}var XN;function CW(){return XN||(XN=1,eE.exports=PW()),eE.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 RW(){if(qN)return Ws;qN=1;var t=Xh(),e=CW();function n(u){for(var h="https://reactjs.org/docs/error-decoder.html?invariant="+u,b=1;b<arguments.length;b++)h+="&args[]="+encodeURIComponent(arguments[b]);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){o(u,h),o(u+"Capture",h)}function o(u,h){for(i[u]=h,u=0;u<h.length;u++)r.add(h[u])}var a=!(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,b,A){if(b!==null&&b.type===0)return!1;switch(typeof h){case"function":case"symbol":return!0;case"boolean":return A?!1:b!==null?!b.acceptsBooleans:(u=u.toLowerCase().slice(0,5),u!=="data-"&&u!=="aria-");default:return!1}}function x(u,h,b,A){if(h===null||typeof h>"u"||y(u,h,b,A))return!0;if(A)return!1;if(b!==null)switch(b.type){case 3:return!h;case 4:return h===!1;case 5:return isNaN(h);case 6:return isNaN(h)||1>h}return!1}function S(u,h,b,A,I,U,$){this.acceptsBooleans=h===2||h===3||h===4,this.attributeName=A,this.attributeNamespace=I,this.mustUseProperty=b,this.propertyName=u,this.type=h,this.sanitizeURL=U,this.removeEmptyString=$}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(u){w[u]=new S(u,0,!1,u,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(u){var h=u[0];w[h]=new S(h,1,!1,u[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(u){w[u]=new S(u,2,!1,u.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(u){w[u]=new S(u,2,!1,u,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(u){w[u]=new S(u,3,!1,u.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(u){w[u]=new S(u,3,!0,u,null,!1,!1)}),["capture","download"].forEach(function(u){w[u]=new S(u,4,!1,u,null,!1,!1)}),["cols","rows","size","span"].forEach(function(u){w[u]=new S(u,6,!1,u,null,!1,!1)}),["rowSpan","start"].forEach(function(u){w[u]=new S(u,5,!1,u.toLowerCase(),null,!1,!1)});var _=/[\-:]([a-z])/g;function E(u){return u[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(u){var h=u.replace(_,E);w[h]=new S(h,1,!1,u,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(u){var h=u.replace(_,E);w[h]=new S(h,1,!1,u,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(u){var h=u.replace(_,E);w[h]=new S(h,1,!1,u,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(u){w[u]=new S(u,1,!1,u.toLowerCase(),null,!1,!1)}),w.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(u){w[u]=new S(u,1,!1,u.toLowerCase(),null,!0,!0)});function T(u,h,b,A){var I=w.hasOwnProperty(h)?w[h]:null;(I!==null?I.type!==0:A||!(2<h.length)||h[0]!=="o"&&h[0]!=="O"||h[1]!=="n"&&h[1]!=="N")&&(x(h,b,I,A)&&(b=null),A||I===null?p(h)&&(b===null?u.removeAttribute(h):u.setAttribute(h,""+b)):I.mustUseProperty?u[I.propertyName]=b===null?I.type===3?!1:"":b:(h=I.attributeName,A=I.attributeNamespace,b===null?u.removeAttribute(h):(I=I.type,b=I===3||I===4&&b===!0?"":""+b,A?u.setAttributeNS(A,h,b):u.setAttribute(h,b))))}var P=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,O=Symbol.for("react.element"),N=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),G=Symbol.for("react.profiler"),k=Symbol.for("react.provider"),j=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),te=Symbol.for("react.suspense_list"),he=Symbol.for("react.memo"),se=Symbol.for("react.lazy"),fe=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 Y=Object.assign,V;function q(u){if(V===void 0)try{throw Error()}catch(b){var h=b.stack.trim().match(/\n( *(at )?)/);V=h&&h[1]||""}return`
|
||
`+V+u}var pe=!1;function ae(u,h){if(!u||pe)return"";pe=!0;var b=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(Oe){var A=Oe}Reflect.construct(u,[],h)}else{try{h.call()}catch(Oe){A=Oe}u.call(h.prototype)}else{try{throw Error()}catch(Oe){A=Oe}u()}}catch(Oe){if(Oe&&A&&typeof Oe.stack=="string"){for(var I=Oe.stack.split(`
|
||
`),U=A.stack.split(`
|
||
`),$=I.length-1,oe=U.length-1;1<=$&&0<=oe&&I[$]!==U[oe];)oe--;for(;1<=$&&0<=oe;$--,oe--)if(I[$]!==U[oe]){if($!==1||oe!==1)do if($--,oe--,0>oe||I[$]!==U[oe]){var me=`
|
||
`+I[$].replace(" at new "," at ");return u.displayName&&me.includes("<anonymous>")&&(me=me.replace("<anonymous>",u.displayName)),me}while(1<=$&&0<=oe);break}}}finally{pe=!1,Error.prepareStackTrace=b}return(u=u?u.displayName||u.name:"")?q(u):""}function ce(u){switch(u.tag){case 5:return q(u.type);case 16:return q("Lazy");case 13:return q("Suspense");case 19:return q("SuspenseList");case 0:case 2:case 15:return u=ae(u.type,!1),u;case 11:return u=ae(u.type.render,!1),u;case 1:return u=ae(u.type,!0),u;default:return""}}function Se(u){if(u==null)return null;if(typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case D:return"Fragment";case N:return"Portal";case G:return"Profiler";case z:return"StrictMode";case ee:return"Suspense";case te:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case j:return(u.displayName||"Context")+".Consumer";case k:return(u._context.displayName||"Context")+".Provider";case H:var h=u.render;return u=u.displayName,u||(u=h.displayName||h.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case he:return h=u.displayName||null,h!==null?h:Se(u.type)||"Memo";case se:h=u._payload,u=u._init;try{return Se(u(h))}catch{}}return null}function Ee(u){var h=u.type;switch(u.tag){case 24:return"Cache";case 9:return(h.displayName||"Context")+".Consumer";case 10:return(h._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return u=h.render,u=u.displayName||u.name||"",h.displayName||(u!==""?"ForwardRef("+u+")":"ForwardRef");case 7:return"Fragment";case 5:return h;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Se(h);case 8:return h===z?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof h=="function")return h.displayName||h.name||null;if(typeof h=="string")return h}return null}function $e(u){switch(typeof u){case"boolean":case"number":case"string":case"undefined":return u;case"object":return u;default:return""}}function Me(u){var h=u.type;return(u=u.nodeName)&&u.toLowerCase()==="input"&&(h==="checkbox"||h==="radio")}function Ge(u){var h=Me(u)?"checked":"value",b=Object.getOwnPropertyDescriptor(u.constructor.prototype,h),A=""+u[h];if(!u.hasOwnProperty(h)&&typeof b<"u"&&typeof b.get=="function"&&typeof b.set=="function"){var I=b.get,U=b.set;return Object.defineProperty(u,h,{configurable:!0,get:function(){return I.call(this)},set:function($){A=""+$,U.call(this,$)}}),Object.defineProperty(u,h,{enumerable:b.enumerable}),{getValue:function(){return A},setValue:function($){A=""+$},stopTracking:function(){u._valueTracker=null,delete u[h]}}}}function We(u){u._valueTracker||(u._valueTracker=Ge(u))}function ue(u){if(!u)return!1;var h=u._valueTracker;if(!h)return!0;var b=h.getValue(),A="";return u&&(A=Me(u)?u.checked?"true":"false":u.value),u=A,u!==b?(h.setValue(u),!0):!1}function Z(u){if(u=u||(typeof document<"u"?document:void 0),typeof u>"u")return null;try{return u.activeElement||u.body}catch{return u.body}}function Ve(u,h){var b=h.checked;return Y({},h,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:b??u._wrapperState.initialChecked})}function Le(u,h){var b=h.defaultValue==null?"":h.defaultValue,A=h.checked!=null?h.checked:h.defaultChecked;b=$e(h.value!=null?h.value:b),u._wrapperState={initialChecked:A,initialValue:b,controlled:h.type==="checkbox"||h.type==="radio"?h.checked!=null:h.value!=null}}function re(u,h){h=h.checked,h!=null&&T(u,"checked",h,!1)}function Ce(u,h){re(u,h);var b=$e(h.value),A=h.type;if(b!=null)A==="number"?(b===0&&u.value===""||u.value!=b)&&(u.value=""+b):u.value!==""+b&&(u.value=""+b);else if(A==="submit"||A==="reset"){u.removeAttribute("value");return}h.hasOwnProperty("value")?Ze(u,h.type,b):h.hasOwnProperty("defaultValue")&&Ze(u,h.type,$e(h.defaultValue)),h.checked==null&&h.defaultChecked!=null&&(u.defaultChecked=!!h.defaultChecked)}function qe(u,h,b){if(h.hasOwnProperty("value")||h.hasOwnProperty("defaultValue")){var A=h.type;if(!(A!=="submit"&&A!=="reset"||h.value!==void 0&&h.value!==null))return;h=""+u._wrapperState.initialValue,b||h===u.value||(u.value=h),u.defaultValue=h}b=u.name,b!==""&&(u.name=""),u.defaultChecked=!!u._wrapperState.initialChecked,b!==""&&(u.name=b)}function Ze(u,h,b){(h!=="number"||Z(u.ownerDocument)!==u)&&(b==null?u.defaultValue=""+u._wrapperState.initialValue:u.defaultValue!==""+b&&(u.defaultValue=""+b))}var Q=Array.isArray;function W(u,h,b,A){if(u=u.options,h){h={};for(var I=0;I<b.length;I++)h["$"+b[I]]=!0;for(b=0;b<u.length;b++)I=h.hasOwnProperty("$"+u[b].value),u[b].selected!==I&&(u[b].selected=I),I&&A&&(u[b].defaultSelected=!0)}else{for(b=""+$e(b),h=null,I=0;I<u.length;I++){if(u[I].value===b){u[I].selected=!0,A&&(u[I].defaultSelected=!0);return}h!==null||u[I].disabled||(h=u[I])}h!==null&&(h.selected=!0)}}function be(u,h){if(h.dangerouslySetInnerHTML!=null)throw Error(n(91));return Y({},h,{value:void 0,defaultValue:void 0,children:""+u._wrapperState.initialValue})}function Ue(u,h){var b=h.value;if(b==null){if(b=h.children,h=h.defaultValue,b!=null){if(h!=null)throw Error(n(92));if(Q(b)){if(1<b.length)throw Error(n(93));b=b[0]}h=b}h==null&&(h=""),b=h}u._wrapperState={initialValue:$e(b)}}function ze(u,h){var b=$e(h.value),A=$e(h.defaultValue);b!=null&&(b=""+b,b!==u.value&&(u.value=b),h.defaultValue==null&&u.defaultValue!==b&&(u.defaultValue=b)),A!=null&&(u.defaultValue=""+A)}function Fe(u){var h=u.textContent;h===u._wrapperState.initialValue&&h!==""&&h!==null&&(u.value=h)}function bt(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"?bt(h):u==="http://www.w3.org/2000/svg"&&h==="foreignObject"?"http://www.w3.org/1999/xhtml":u}var ft,Xt=(function(u){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(h,b,A,I){MSApp.execUnsafeLocalFunction(function(){return u(h,b,A,I)})}: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 Ke(u,h){if(h){var b=u.firstChild;if(b&&b===u.lastChild&&b.nodeType===3){b.nodeValue=h;return}}u.textContent=h}var 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},et=["Webkit","ms","Moz","O"];Object.keys(ne).forEach(function(u){et.forEach(function(h){h=h+u.charAt(0).toUpperCase()+u.substring(1),ne[h]=ne[u]})});function Mt(u,h,b){return h==null||typeof h=="boolean"||h===""?"":b||typeof h!="number"||h===0||ne.hasOwnProperty(u)&&ne[u]?(""+h).trim():h+"px"}function vt(u,h){u=u.style;for(var b in h)if(h.hasOwnProperty(b)){var A=b.indexOf("--")===0,I=Mt(b,h[b],A);b==="float"&&(b="cssFloat"),A?u.setProperty(b,I):u[b]=I}}var Zt=Y({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function de(u,h){if(h){if(Zt[u]&&(h.children!=null||h.dangerouslySetInnerHTML!=null))throw Error(n(137,u));if(h.dangerouslySetInnerHTML!=null){if(h.children!=null)throw Error(n(60));if(typeof h.dangerouslySetInnerHTML!="object"||!("__html"in h.dangerouslySetInnerHTML))throw Error(n(61))}if(h.style!=null&&typeof h.style!="object")throw Error(n(62))}}function Xe(u,h){if(u.indexOf("-")===-1)return typeof h.is=="string";switch(u){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var le=null;function Ye(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var Re=null,Be=null,ot=null;function pt(u){if(u=ha(u)){if(typeof Re!="function")throw Error(n(280));var h=u.stateNode;h&&(h=Dp(h),Re(u.stateNode,u.type,h))}}function Jt(u){Be?ot?ot.push(u):ot=[u]:Be=u}function pn(){if(Be){var u=Be,h=ot;if(ot=Be=null,pt(u),h)for(u=0;u<h.length;u++)pt(h[u])}}function jn(u,h){return u(h)}function en(){}var Hn=!1;function pr(u,h,b){if(Hn)return u(h,b);Hn=!0;try{return jn(u,h,b)}finally{Hn=!1,(Be!==null||ot!==null)&&(en(),pn())}}function Mi(u,h){var b=u.stateNode;if(b===null)return null;var A=Dp(b);if(A===null)return null;b=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(b&&typeof b!="function")throw Error(n(231,h,typeof b));return b}var na=!1;if(a)try{var Ei={};Object.defineProperty(Ei,"passive",{get:function(){na=!0}}),window.addEventListener("test",Ei,Ei),window.removeEventListener("test",Ei,Ei)}catch{na=!1}function Ka(u,h,b,A,I,U,$,oe,me){var Oe=Array.prototype.slice.call(arguments,3);try{h.apply(b,Oe)}catch(Je){this.onError(Je)}}var Ns=!1,ra=null,Ai=!1,Ao=null,ia={onError:function(u){Ns=!0,ra=u}};function au(u,h,b,A,I,U,$,oe,me){Ns=!1,ra=null,Ka.apply(ia,arguments)}function lu(u,h,b,A,I,U,$,oe,me){if(au.apply(this,arguments),Ns){if(Ns){var Oe=ra;Ns=!1,ra=null}else throw Error(n(198));Ai||(Ai=!0,Ao=Oe)}}function To(u){var h=u,b=u;if(u.alternate)for(;h.return;)h=h.return;else{u=h;do h=u,(h.flags&4098)!==0&&(b=h.return),u=h.return;while(u)}return h.tag===3?b:null}function cu(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 Bl(u){if(To(u)!==u)throw Error(n(188))}function K(u){var h=u.alternate;if(!h){if(h=To(u),h===null)throw Error(n(188));return h!==u?null:u}for(var b=u,A=h;;){var I=b.return;if(I===null)break;var U=I.alternate;if(U===null){if(A=I.return,A!==null){b=A;continue}break}if(I.child===U.child){for(U=I.child;U;){if(U===b)return Bl(I),u;if(U===A)return Bl(I),h;U=U.sibling}throw Error(n(188))}if(b.return!==A.return)b=I,A=U;else{for(var $=!1,oe=I.child;oe;){if(oe===b){$=!0,b=I,A=U;break}if(oe===A){$=!0,A=I,b=U;break}oe=oe.sibling}if(!$){for(oe=U.child;oe;){if(oe===b){$=!0,b=U,A=I;break}if(oe===A){$=!0,A=U,b=I;break}oe=oe.sibling}if(!$)throw Error(n(189))}}if(b.alternate!==A)throw Error(n(190))}if(b.tag!==3)throw Error(n(188));return b.stateNode.current===b?u:h}function xe(u){return u=K(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 Ie=e.unstable_scheduleCallback,we=e.unstable_cancelCallback,it=e.unstable_shouldYield,yt=e.unstable_requestPaint,lt=e.unstable_now,Et=e.unstable_getCurrentPriorityLevel,jt=e.unstable_ImmediatePriority,Bt=e.unstable_UserBlockingPriority,Rt=e.unstable_NormalPriority,Sn=e.unstable_LowPriority,Mn=e.unstable_IdlePriority,yn=null,Kt=null;function Ut(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 Is(u){switch(u&-u){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return u&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return u&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return u}}function Vn(u,h){var b=u.pendingLanes;if(b===0)return 0;var A=0,I=u.suspendedLanes,U=u.pingedLanes,$=b&268435455;if($!==0){var oe=$&~I;oe!==0?A=Is(oe):(U&=$,U!==0&&(A=Is(U)))}else $=b&~I,$!==0?A=Is($):U!==0&&(A=Is(U));if(A===0)return 0;if(h!==0&&h!==A&&(h&I)===0&&(I=A&-A,U=h&-h,I>=U||I===16&&(U&4194240)!==0))return h;if((A&4)!==0&&(A|=b&16),h=u.entangledLanes,h!==0)for(u=u.entanglements,h&=A;0<h;)b=31-mt(h),I=1<<b,A|=u[b],h&=~I;return A}function to(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 Ya(u,h){for(var b=u.suspendedLanes,A=u.pingedLanes,I=u.expirationTimes,U=u.pendingLanes;0<U;){var $=31-mt(U),oe=1<<$,me=I[$];me===-1?((oe&b)===0||(oe&A)!==0)&&(I[$]=to(oe,h)):me<=h&&(u.expiredLanes|=oe),U&=~oe}}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 Dd(u){for(var h=[],b=0;31>b;b++)h.push(u);return h}function Za(u,h,b){u.pendingLanes|=h,h!==536870912&&(u.suspendedLanes=0,u.pingedLanes=0),u=u.eventTimes,h=31-mt(h),u[h]=b}function bM(u,h){var b=u.pendingLanes&~h;u.pendingLanes=h,u.suspendedLanes=0,u.pingedLanes=0,u.expiredLanes&=h,u.mutableReadLanes&=h,u.entangledLanes&=h,h=u.entanglements;var A=u.eventTimes;for(u=u.expirationTimes;0<b;){var I=31-mt(b),U=1<<I;h[I]=0,A[I]=-1,u[I]=-1,b&=~U}}function uu(u,h){var b=u.entangledLanes|=h;for(u=u.entanglements;b;){var A=31-mt(b),I=1<<A;I&h|u[A]&h&&(u[A]|=h),b&=~I}}var Pn=0;function du(u){return u&=-u,1<u?4<u?(u&268435455)!==0?16:536870912:4:1}var Ud,lv,yx,ip,sp,Hl=!1,op=[],Po=null,un=null,sa=null,Vl=new Map,fu=new Map,Qa=[],_M="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":Po=null;break;case"dragenter":case"dragleave":un=null;break;case"mouseover":case"mouseout":sa=null;break;case"pointerover":case"pointerout":Vl.delete(h.pointerId);break;case"gotpointercapture":case"lostpointercapture":fu.delete(h.pointerId)}}function Gl(u,h,b,A,I,U){return u===null||u.nativeEvent!==U?(u={blockedOn:h,domEventName:b,eventSystemFlags:A,nativeEvent:U,targetContainers:[I]},h!==null&&(h=ha(h),h!==null&&lv(h)),u):(u.eventSystemFlags|=A,h=u.targetContainers,I!==null&&h.indexOf(I)===-1&&h.push(I),u)}function wM(u,h,b,A,I){switch(h){case"focusin":return Po=Gl(Po,u,h,b,A,I),!0;case"dragenter":return un=Gl(un,u,h,b,A,I),!0;case"mouseover":return sa=Gl(sa,u,h,b,A,I),!0;case"pointerover":var U=I.pointerId;return Vl.set(U,Gl(Vl.get(U)||null,u,h,b,A,I)),!0;case"gotpointercapture":return U=I.pointerId,fu.set(U,Gl(fu.get(U)||null,u,h,b,A,I)),!0}return!1}function ap(u){var h=sl(u.target);if(h!==null){var b=To(h);if(b!==null){if(h=b.tag,h===13){if(h=cu(b),h!==null){u.blockedOn=h,sp(u.priority,function(){yx(b)});return}}else if(h===3&&b.stateNode.current.memoizedState.isDehydrated){u.blockedOn=b.tag===3?b.stateNode.containerInfo:null;return}}}u.blockedOn=null}function lp(u){if(u.blockedOn!==null)return!1;for(var h=u.targetContainers;0<h.length;){var b=Os(u.domEventName,u.eventSystemFlags,h[0],u.nativeEvent);if(b===null){b=u.nativeEvent;var A=new b.constructor(b.type,b);le=A,b.target.dispatchEvent(A),le=null}else return h=ha(b),h!==null&&lv(h),u.blockedOn=b,!1;h.shift()}return!0}function jd(u,h,b){lp(u)&&b.delete(h)}function Co(){Hl=!1,Po!==null&&lp(Po)&&(Po=null),un!==null&&lp(un)&&(un=null),sa!==null&&lp(sa)&&(sa=null),Vl.forEach(jd),fu.forEach(jd)}function Fd(u,h){u.blockedOn===h&&(u.blockedOn=null,Hl||(Hl=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Co)))}function zd(u){function h(I){return Fd(I,u)}if(0<op.length){Fd(op[0],u);for(var b=1;b<op.length;b++){var A=op[b];A.blockedOn===u&&(A.blockedOn=null)}}for(Po!==null&&Fd(Po,u),un!==null&&Fd(un,u),sa!==null&&Fd(sa,u),Vl.forEach(h),fu.forEach(h),b=0;b<Qa.length;b++)A=Qa[b],A.blockedOn===u&&(A.blockedOn=null);for(;0<Qa.length&&(b=Qa[0],b.blockedOn===null);)ap(b),b.blockedOn===null&&Qa.shift()}var Ti=P.ReactCurrentBatchConfig,ks=!0;function cp(u,h,b,A){var I=Pn,U=Ti.transition;Ti.transition=null;try{Pn=1,up(u,h,b,A)}finally{Pn=I,Ti.transition=U}}function cv(u,h,b,A){var I=Pn,U=Ti.transition;Ti.transition=null;try{Pn=4,up(u,h,b,A)}finally{Pn=I,Ti.transition=U}}function up(u,h,b,A){if(ks){var I=Os(u,h,b,A);if(I===null)Rp(u,h,A,dp,b),Nr(u,A);else if(wM(I,u,h,b,A))A.stopPropagation();else if(Nr(u,A),h&4&&-1<_M.indexOf(u)){for(;I!==null;){var U=ha(I);if(U!==null&&Ud(U),U=Os(u,h,b,A),U===null&&Rp(u,h,A,dp,b),U===I)break;I=U}I!==null&&A.stopPropagation()}else Rp(u,h,A,null,b)}}var dp=null;function Os(u,h,b,A){if(dp=null,u=Ye(A),u=sl(u),u!==null)if(h=To(u),h===null)u=null;else if(b=h.tag,b===13){if(u=cu(h),u!==null)return u;u=null}else if(b===3){if(h.stateNode.current.memoizedState.isDehydrated)return h.tag===3?h.stateNode.containerInfo:null;u=null}else h!==u&&(u=null);return dp=u,null}function xx(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 jt:return 1;case Bt:return 4;case Rt:case Sn:return 16;case Mn:return 536870912;default:return 16}default:return 16}}var no=null,uv=null,$i=null;function Bd(){if($i)return $i;var u,h=uv,b=h.length,A,I="value"in no?no.value:no.textContent,U=I.length;for(u=0;u<b&&h[u]===I[u];u++);var $=b-u;for(A=1;A<=$&&h[b-A]===I[U-A];A++);return $i=I.slice(u,1<A?1-A:void 0)}function Wl(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 oa(){return!0}function fp(){return!1}function Pi(u){function h(b,A,I,U,$){this._reactName=b,this._targetInst=I,this.type=A,this.nativeEvent=U,this.target=$,this.currentTarget=null;for(var oe in u)u.hasOwnProperty(oe)&&(b=u[oe],this[oe]=b?b(U):U[oe]);return this.isDefaultPrevented=(U.defaultPrevented!=null?U.defaultPrevented:U.returnValue===!1)?oa:fp,this.isPropagationStopped=fp,this}return Y(h.prototype,{preventDefault:function(){this.defaultPrevented=!0;var b=this.nativeEvent;b&&(b.preventDefault?b.preventDefault():typeof b.returnValue!="unknown"&&(b.returnValue=!1),this.isDefaultPrevented=oa)},stopPropagation:function(){var b=this.nativeEvent;b&&(b.stopPropagation?b.stopPropagation():typeof b.cancelBubble!="unknown"&&(b.cancelBubble=!0),this.isPropagationStopped=oa)},persist:function(){},isPersistent:oa}),h}var $l={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(u){return u.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Hd=Pi($l),Xl=Y({},$l,{view:0,detail:0}),hu=Pi(Xl),Xi,Ls,Ds,pu=Y({},Xl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:el,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!==Ds&&(Ds&&u.type==="mousemove"?(Xi=u.screenX-Ds.screenX,Ls=u.screenY-Ds.screenY):Ls=Xi=0,Ds=u),Xi)},movementY:function(u){return"movementY"in u?u.movementY:Ls}}),dv=Pi(pu),aa=Y({},pu,{dataTransfer:0}),Ja=Pi(aa),hp=Y({},Xl,{relatedTarget:0}),pp=Pi(hp),mp=Y({},$l,{animationName:0,elapsedTime:0,pseudoElement:0}),bx=Pi(mp),_x=Y({},$l,{clipboardData:function(u){return"clipboardData"in u?u.clipboardData:window.clipboardData}}),fv=Pi(_x),gp=Y({},$l,{data:0}),hv=Pi(gp),wx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Sx={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"},pv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function mu(u){var h=this.nativeEvent;return h.getModifierState?h.getModifierState(u):(u=pv[u])?!!h[u]:!1}function el(){return mu}var vp=Y({},Xl,{key:function(u){if(u.key){var h=wx[u.key]||u.key;if(h!=="Unidentified")return h}return u.type==="keypress"?(u=Wl(u),u===13?"Enter":String.fromCharCode(u)):u.type==="keydown"||u.type==="keyup"?Sx[u.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:el,charCode:function(u){return u.type==="keypress"?Wl(u):0},keyCode:function(u){return u.type==="keydown"||u.type==="keyup"?u.keyCode:0},which:function(u){return u.type==="keypress"?Wl(u):u.type==="keydown"||u.type==="keyup"?u.keyCode:0}}),yp=Pi(vp),Us=Y({},pu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),us=Pi(Us),ql=Y({},Xl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:el}),la=Pi(ql),ca=Y({},$l,{propertyName:0,elapsedTime:0,pseudoElement:0}),Kl=Pi(ca),Mx=Y({},pu,{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}),mv=Pi(Mx),gv=[9,13,27,32],Ci=a&&"CompositionEvent"in window,qr=null;a&&"documentMode"in document&&(qr=document.documentMode);var Qn=a&&"TextEvent"in window&&!qr,gu=a&&(!Ci||qr&&8<qr&&11>=qr),js=" ",vv=!1;function yv(u,h){switch(u){case"keyup":return gv.indexOf(h.keyCode)!==-1;case"keydown":return h.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xp(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var tl=!1;function Ex(u,h){switch(u){case"compositionend":return xp(h);case"keypress":return h.which!==32?null:(vv=!0,js);case"textInput":return u=h.data,u===js&&vv?null:u;default:return null}}function Vd(u,h){if(tl)return u==="compositionend"||!Ci&&yv(u,h)?(u=Bd(),$i=uv=no=null,tl=!1,u):null;switch(u){case"paste":return null;case"keypress":if(!(h.ctrlKey||h.altKey||h.metaKey)||h.ctrlKey&&h.altKey){if(h.char&&1<h.char.length)return h.char;if(h.which)return String.fromCharCode(h.which)}return null;case"compositionend":return gu&&h.locale!=="ko"?null:h.data;default:return null}}var vu={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 bp(u){var h=u&&u.nodeName&&u.nodeName.toLowerCase();return h==="input"?!!vu[u.type]:h==="textarea"}function yu(u,h,b,A){Jt(A),h=Np(h,"onChange"),0<h.length&&(b=new Hd("onChange","change",null,b,A),u.push({event:b,listeners:h}))}var nl=null,xu=null;function Ax(u){Su(u,0)}function ua(u){var h=mr(u);if(ue(h))return u}function Tx(u,h){if(u==="change")return h}var bu=!1;if(a){var qi;if(a){var Yl="oninput"in document;if(!Yl){var Zl=document.createElement("div");Zl.setAttribute("oninput","return;"),Yl=typeof Zl.oninput=="function"}qi=Yl}else qi=!1;bu=qi&&(!document.documentMode||9<document.documentMode)}function ro(){nl&&(nl.detachEvent("onpropertychange",_p),xu=nl=null)}function _p(u){if(u.propertyName==="value"&&ua(xu)){var h=[];yu(h,xu,u,Ye(u)),pr(Ax,h)}}function _u(u,h,b){u==="focusin"?(ro(),nl=h,xu=b,nl.attachEvent("onpropertychange",_p)):u==="focusout"&&ro()}function Px(u){if(u==="selectionchange"||u==="keyup"||u==="keydown")return ua(xu)}function xv(u,h){if(u==="click")return ua(h)}function nr(u,h){if(u==="input"||u==="change")return ua(h)}function wp(u,h){return u===h&&(u!==0||1/u===1/h)||u!==u&&h!==h}var ds=typeof Object.is=="function"?Object.is:wp;function Ql(u,h){if(ds(u,h))return!0;if(typeof u!="object"||u===null||typeof h!="object"||h===null)return!1;var b=Object.keys(u),A=Object.keys(h);if(b.length!==A.length)return!1;for(A=0;A<b.length;A++){var I=b[A];if(!l.call(h,I)||!ds(u[I],h[I]))return!1}return!0}function Gd(u){for(;u&&u.firstChild;)u=u.firstChild;return u}function fs(u,h){var b=Gd(u);u=0;for(var A;b;){if(b.nodeType===3){if(A=u+b.textContent.length,u<=h&&A>=h)return{node:b,offset:h-u};u=A}e:{for(;b;){if(b.nextSibling){b=b.nextSibling;break e}b=b.parentNode}b=void 0}b=Gd(b)}}function Jl(u,h){return u&&h?u===h?!0:u&&u.nodeType===3?!1:h&&h.nodeType===3?Jl(u,h.parentNode):"contains"in u?u.contains(h):u.compareDocumentPosition?!!(u.compareDocumentPosition(h)&16):!1:!1}function rr(){for(var u=window,h=Z();h instanceof u.HTMLIFrameElement;){try{var b=typeof h.contentWindow.location.href=="string"}catch{b=!1}if(b)u=h.contentWindow;else break;h=Z(u.document)}return h}function Dr(u){var h=u&&u.nodeName&&u.nodeName.toLowerCase();return h&&(h==="input"&&(u.type==="text"||u.type==="search"||u.type==="tel"||u.type==="url"||u.type==="password")||h==="textarea"||u.contentEditable==="true")}function Ur(u){var h=rr(),b=u.focusedElem,A=u.selectionRange;if(h!==b&&b&&b.ownerDocument&&Jl(b.ownerDocument.documentElement,b)){if(A!==null&&Dr(b)){if(h=A.start,u=A.end,u===void 0&&(u=h),"selectionStart"in b)b.selectionStart=h,b.selectionEnd=Math.min(u,b.value.length);else if(u=(h=b.ownerDocument||document)&&h.defaultView||window,u.getSelection){u=u.getSelection();var I=b.textContent.length,U=Math.min(A.start,I);A=A.end===void 0?U:Math.min(A.end,I),!u.extend&&U>A&&(I=A,A=U,U=I),I=fs(b,U);var $=fs(b,A);I&&$&&(u.rangeCount!==1||u.anchorNode!==I.node||u.anchorOffset!==I.offset||u.focusNode!==$.node||u.focusOffset!==$.offset)&&(h=h.createRange(),h.setStart(I.node,I.offset),u.removeAllRanges(),U>A?(u.addRange(h),u.extend($.node,$.offset)):(h.setEnd($.node,$.offset),u.addRange(h)))}}for(h=[],u=b;u=u.parentNode;)u.nodeType===1&&h.push({element:u,left:u.scrollLeft,top:u.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<h.length;b++)u=h[b],u.element.scrollLeft=u.left,u.element.scrollTop=u.top}}var Sp=a&&"documentMode"in document&&11>=document.documentMode,Ro=null,ec=null,Wd=null,jr=!1;function Mp(u,h,b){var A=b.window===b?b.document:b.nodeType===9?b:b.ownerDocument;jr||Ro==null||Ro!==Z(A)||(A=Ro,"selectionStart"in A&&Dr(A)?A={start:A.selectionStart,end:A.selectionEnd}:(A=(A.ownerDocument&&A.ownerDocument.defaultView||window).getSelection(),A={anchorNode:A.anchorNode,anchorOffset:A.anchorOffset,focusNode:A.focusNode,focusOffset:A.focusOffset}),Wd&&Ql(Wd,A)||(Wd=A,A=Np(ec,"onSelect"),0<A.length&&(h=new Hd("onSelect","select",null,h,b),u.push({event:h,listeners:A}),h.target=Ro)))}function wu(u,h){var b={};return b[u.toLowerCase()]=h.toLowerCase(),b["Webkit"+u]="webkit"+h,b["Moz"+u]="moz"+h,b}var rl={animationend:wu("Animation","AnimationEnd"),animationiteration:wu("Animation","AnimationIteration"),animationstart:wu("Animation","AnimationStart"),transitionend:wu("Transition","TransitionEnd")},io={},so={};a&&(so=document.createElement("div").style,"AnimationEvent"in window||(delete rl.animationend.animation,delete rl.animationiteration.animation,delete rl.animationstart.animation),"TransitionEvent"in window||delete rl.transitionend.transition);function No(u){if(io[u])return io[u];if(!rl[u])return u;var h=rl[u],b;for(b in h)if(h.hasOwnProperty(b)&&b in so)return io[u]=h[b];return u}var $d=No("animationend"),Xd=No("animationiteration"),bv=No("animationstart"),_v=No("transitionend"),wv=new Map,Sv="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 da(u,h){wv.set(u,h),s(h,[u])}for(var Ep=0;Ep<Sv.length;Ep++){var qd=Sv[Ep],Kd=qd.toLowerCase(),Cx=qd[0].toUpperCase()+qd.slice(1);da(Kd,"on"+Cx)}da($d,"onAnimationEnd"),da(Xd,"onAnimationIteration"),da(bv,"onAnimationStart"),da("dblclick","onDoubleClick"),da("focusin","onFocus"),da("focusout","onBlur"),da(_v,"onTransitionEnd"),o("onMouseEnter",["mouseout","mouseover"]),o("onMouseLeave",["mouseout","mouseover"]),o("onPointerEnter",["pointerout","pointerover"]),o("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 il="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(" "),Ap=new Set("cancel close invalid load scroll toggle".split(" ").concat(il));function Tp(u,h,b){var A=u.type||"unknown-event";u.currentTarget=b,lu(A,h,void 0,u),u.currentTarget=null}function Su(u,h){h=(h&4)!==0;for(var b=0;b<u.length;b++){var A=u[b],I=A.event;A=A.listeners;e:{var U=void 0;if(h)for(var $=A.length-1;0<=$;$--){var oe=A[$],me=oe.instance,Oe=oe.currentTarget;if(oe=oe.listener,me!==U&&I.isPropagationStopped())break e;Tp(I,oe,Oe),U=me}else for($=0;$<A.length;$++){if(oe=A[$],me=oe.instance,Oe=oe.currentTarget,oe=oe.listener,me!==U&&I.isPropagationStopped())break e;Tp(I,oe,Oe),U=me}}}if(Ai)throw u=Ao,Ai=!1,Ao=null,u}function Wn(u,h){var b=h[rc];b===void 0&&(b=h[rc]=new Set);var A=u+"__bubble";b.has(A)||(Cp(h,u,2,!1),b.add(A))}function Pp(u,h,b){var A=0;h&&(A|=4),Cp(b,u,A,h)}var Yd="_reactListening"+Math.random().toString(36).slice(2);function Mu(u){if(!u[Yd]){u[Yd]=!0,r.forEach(function(b){b!=="selectionchange"&&(Ap.has(b)||Pp(b,!1,u),Pp(b,!0,u))});var h=u.nodeType===9?u:u.ownerDocument;h===null||h[Yd]||(h[Yd]=!0,Pp("selectionchange",!1,h))}}function Cp(u,h,b,A){switch(xx(h)){case 1:var I=cp;break;case 4:I=cv;break;default:I=up}b=I.bind(null,h,b,u),I=void 0,!na||h!=="touchstart"&&h!=="touchmove"&&h!=="wheel"||(I=!0),A?I!==void 0?u.addEventListener(h,b,{capture:!0,passive:I}):u.addEventListener(h,b,!0):I!==void 0?u.addEventListener(h,b,{passive:I}):u.addEventListener(h,b,!1)}function Rp(u,h,b,A,I){var U=A;if((h&1)===0&&(h&2)===0&&A!==null)e:for(;;){if(A===null)return;var $=A.tag;if($===3||$===4){var oe=A.stateNode.containerInfo;if(oe===I||oe.nodeType===8&&oe.parentNode===I)break;if($===4)for($=A.return;$!==null;){var me=$.tag;if((me===3||me===4)&&(me=$.stateNode.containerInfo,me===I||me.nodeType===8&&me.parentNode===I))return;$=$.return}for(;oe!==null;){if($=sl(oe),$===null)return;if(me=$.tag,me===5||me===6){A=U=$;continue e}oe=oe.parentNode}}A=A.return}pr(function(){var Oe=U,Je=Ye(b),tt=[];e:{var Qe=wv.get(u);if(Qe!==void 0){var _t=Hd,Pt=u;switch(u){case"keypress":if(Wl(b)===0)break e;case"keydown":case"keyup":_t=yp;break;case"focusin":Pt="focus",_t=pp;break;case"focusout":Pt="blur",_t=pp;break;case"beforeblur":case"afterblur":_t=pp;break;case"click":if(b.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":_t=dv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":_t=Ja;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":_t=la;break;case $d:case Xd:case bv:_t=bx;break;case _v:_t=Kl;break;case"scroll":_t=hu;break;case"wheel":_t=mv;break;case"copy":case"cut":case"paste":_t=fv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":_t=us}var Nt=(h&4)!==0,kr=!Nt&&u==="scroll",Ae=Nt?Qe!==null?Qe+"Capture":null:Qe;Nt=[];for(var ve=Oe,Pe;ve!==null;){Pe=ve;var at=Pe.stateNode;if(Pe.tag===5&&at!==null&&(Pe=at,Ae!==null&&(at=Mi(ve,Ae),at!=null&&Nt.push(Eu(ve,at,Pe)))),kr)break;ve=ve.return}0<Nt.length&&(Qe=new _t(Qe,Pt,null,b,Je),tt.push({event:Qe,listeners:Nt}))}}if((h&7)===0){e:{if(Qe=u==="mouseover"||u==="pointerover",_t=u==="mouseout"||u==="pointerout",Qe&&b!==le&&(Pt=b.relatedTarget||b.fromElement)&&(sl(Pt)||Pt[hs]))break e;if((_t||Qe)&&(Qe=Je.window===Je?Je:(Qe=Je.ownerDocument)?Qe.defaultView||Qe.parentWindow:window,_t?(Pt=b.relatedTarget||b.toElement,_t=Oe,Pt=Pt?sl(Pt):null,Pt!==null&&(kr=To(Pt),Pt!==kr||Pt.tag!==5&&Pt.tag!==6)&&(Pt=null)):(_t=null,Pt=Oe),_t!==Pt)){if(Nt=dv,at="onMouseLeave",Ae="onMouseEnter",ve="mouse",(u==="pointerout"||u==="pointerover")&&(Nt=us,at="onPointerLeave",Ae="onPointerEnter",ve="pointer"),kr=_t==null?Qe:mr(_t),Pe=Pt==null?Qe:mr(Pt),Qe=new Nt(at,ve+"leave",_t,b,Je),Qe.target=kr,Qe.relatedTarget=Pe,at=null,sl(Je)===Oe&&(Nt=new Nt(Ae,ve+"enter",Pt,b,Je),Nt.target=Pe,Nt.relatedTarget=kr,at=Nt),kr=at,_t&&Pt)t:{for(Nt=_t,Ae=Pt,ve=0,Pe=Nt;Pe;Pe=tc(Pe))ve++;for(Pe=0,at=Ae;at;at=tc(at))Pe++;for(;0<ve-Pe;)Nt=tc(Nt),ve--;for(;0<Pe-ve;)Ae=tc(Ae),Pe--;for(;ve--;){if(Nt===Ae||Ae!==null&&Nt===Ae.alternate)break t;Nt=tc(Nt),Ae=tc(Ae)}Nt=null}else Nt=null;_t!==null&&Rx(tt,Qe,_t,Nt,!1),Pt!==null&&kr!==null&&Rx(tt,kr,Pt,Nt,!0)}}e:{if(Qe=Oe?mr(Oe):window,_t=Qe.nodeName&&Qe.nodeName.toLowerCase(),_t==="select"||_t==="input"&&Qe.type==="file")var Dt=Tx;else if(bp(Qe))if(bu)Dt=nr;else{Dt=Px;var Ht=_u}else(_t=Qe.nodeName)&&_t.toLowerCase()==="input"&&(Qe.type==="checkbox"||Qe.type==="radio")&&(Dt=xv);if(Dt&&(Dt=Dt(u,Oe))){yu(tt,Dt,b,Je);break e}Ht&&Ht(u,Qe,Oe),u==="focusout"&&(Ht=Qe._wrapperState)&&Ht.controlled&&Qe.type==="number"&&Ze(Qe,"number",Qe.value)}switch(Ht=Oe?mr(Oe):window,u){case"focusin":(bp(Ht)||Ht.contentEditable==="true")&&(Ro=Ht,ec=Oe,Wd=null);break;case"focusout":Wd=ec=Ro=null;break;case"mousedown":jr=!0;break;case"contextmenu":case"mouseup":case"dragend":jr=!1,Mp(tt,b,Je);break;case"selectionchange":if(Sp)break;case"keydown":case"keyup":Mp(tt,b,Je)}var Vt;if(Ci)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 tl?yv(u,b)&&(nn="onCompositionEnd"):u==="keydown"&&b.keyCode===229&&(nn="onCompositionStart");nn&&(gu&&b.locale!=="ko"&&(tl||nn!=="onCompositionStart"?nn==="onCompositionEnd"&&tl&&(Vt=Bd()):(no=Je,uv="value"in no?no.value:no.textContent,tl=!0)),Ht=Np(Oe,nn),0<Ht.length&&(nn=new hv(nn,u,null,b,Je),tt.push({event:nn,listeners:Ht}),Vt?nn.data=Vt:(Vt=xp(b),Vt!==null&&(nn.data=Vt)))),(Vt=Qn?Ex(u,b):Vd(u,b))&&(Oe=Np(Oe,"onBeforeInput"),0<Oe.length&&(Je=new hv("onBeforeInput","beforeinput",null,b,Je),tt.push({event:Je,listeners:Oe}),Je.data=Vt))}Su(tt,h)})}function Eu(u,h,b){return{instance:u,listener:h,currentTarget:b}}function Np(u,h){for(var b=h+"Capture",A=[];u!==null;){var I=u,U=I.stateNode;I.tag===5&&U!==null&&(I=U,U=Mi(u,b),U!=null&&A.unshift(Eu(u,U,I)),U=Mi(u,h),U!=null&&A.push(Eu(u,U,I))),u=u.return}return A}function tc(u){if(u===null)return null;do u=u.return;while(u&&u.tag!==5);return u||null}function Rx(u,h,b,A,I){for(var U=h._reactName,$=[];b!==null&&b!==A;){var oe=b,me=oe.alternate,Oe=oe.stateNode;if(me!==null&&me===A)break;oe.tag===5&&Oe!==null&&(oe=Oe,I?(me=Mi(b,U),me!=null&&$.unshift(Eu(b,me,oe))):I||(me=Mi(b,U),me!=null&&$.push(Eu(b,me,oe)))),b=b.return}$.length!==0&&u.push({event:h,listeners:$})}var SM=/\r\n?/g,Nx=/\u0000|\uFFFD/g;function Mv(u){return(typeof u=="string"?u:""+u).replace(SM,`
|
||
`).replace(Nx,"")}function Zd(u,h,b){if(h=Mv(h),Mv(u)!==h&&b)throw Error(n(425))}function Qd(){}var Au=null,Ev=null;function Av(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 Tv=typeof setTimeout=="function"?setTimeout:void 0,Pv=typeof clearTimeout=="function"?clearTimeout:void 0,Ip=typeof Promise=="function"?Promise:void 0,MM=typeof queueMicrotask=="function"?queueMicrotask:typeof Ip<"u"?function(u){return Ip.resolve(null).then(u).catch(Ix)}:Tv;function Ix(u){setTimeout(function(){throw u})}function kp(u,h){var b=h,A=0;do{var I=b.nextSibling;if(u.removeChild(b),I&&I.nodeType===8)if(b=I.data,b==="/$"){if(A===0){u.removeChild(I),zd(h);return}A--}else b!=="$"&&b!=="$?"&&b!=="$!"||A++;b=I}while(b);zd(h)}function fa(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 Cv(u){u=u.previousSibling;for(var h=0;u;){if(u.nodeType===8){var b=u.data;if(b==="$"||b==="$!"||b==="$?"){if(h===0)return u;h--}else b==="/$"&&h++}u=u.previousSibling}return null}var nc=Math.random().toString(36).slice(2),Ir="__reactFiber$"+nc,Tu="__reactProps$"+nc,hs="__reactContainer$"+nc,rc="__reactEvents$"+nc,Op="__reactListeners$"+nc,Lp="__reactHandles$"+nc;function sl(u){var h=u[Ir];if(h)return h;for(var b=u.parentNode;b;){if(h=b[hs]||b[Ir]){if(b=h.alternate,h.child!==null||b!==null&&b.child!==null)for(u=Cv(u);u!==null;){if(b=u[Ir])return b;u=Cv(u)}return h}u=b,b=u.parentNode}return null}function ha(u){return u=u[Ir]||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 Dp(u){return u[Tu]||null}var Rv=[],Fr=-1;function lr(u){return{current:u}}function $n(u){0>Fr||(u.current=Rv[Fr],Rv[Fr]=null,Fr--)}function Gn(u,h){Fr++,Rv[Fr]=u.current,u.current=h}var pa={},Kr=lr(pa),Ri=lr(!1),ma=pa;function ic(u,h){var b=u.type.contextTypes;if(!b)return pa;var A=u.stateNode;if(A&&A.__reactInternalMemoizedUnmaskedChildContext===h)return A.__reactInternalMemoizedMaskedChildContext;var I={},U;for(U in b)I[U]=h[U];return A&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=h,u.__reactInternalMemoizedMaskedChildContext=I),I}function ui(u){return u=u.childContextTypes,u!=null}function Jd(){$n(Ri),$n(Kr)}function Nv(u,h,b){if(Kr.current!==pa)throw Error(n(168));Gn(Kr,h),Gn(Ri,b)}function ef(u,h,b){var A=u.stateNode;if(h=h.childContextTypes,typeof A.getChildContext!="function")return b;A=A.getChildContext();for(var I in A)if(!(I in h))throw Error(n(108,Ee(u)||"Unknown",I));return Y({},b,A)}function sc(u){return u=(u=u.stateNode)&&u.__reactInternalMemoizedMergedChildContext||pa,ma=Kr.current,Gn(Kr,u),Gn(Ri,Ri.current),!0}function Iv(u,h,b){var A=u.stateNode;if(!A)throw Error(n(169));b?(u=ef(u,h,ma),A.__reactInternalMemoizedMergedChildContext=u,$n(Ri),$n(Kr),Gn(Kr,u)):$n(Ri),Gn(Ri,b)}var oo=null,tf=!1,Up=!1;function nf(u){oo===null?oo=[u]:oo.push(u)}function kx(u){tf=!0,nf(u)}function Io(){if(!Up&&oo!==null){Up=!0;var u=0,h=Pn;try{var b=oo;for(Pn=1;u<b.length;u++){var A=b[u];do A=A(!0);while(A!==null)}oo=null,tf=!1}catch(I){throw oo!==null&&(oo=oo.slice(u+1)),Ie(jt,Io),I}finally{Pn=h,Up=!1}}return null}var oc=[],Ki=0,jp=null,Fp=0,Ni=[],zr=0,ac=null,ut=1,Fs="";function ga(u,h){oc[Ki++]=Fp,oc[Ki++]=jp,jp=u,Fp=h}function kv(u,h,b){Ni[zr++]=ut,Ni[zr++]=Fs,Ni[zr++]=ac,ac=u;var A=ut;u=Fs;var I=32-mt(A)-1;A&=~(1<<I),b+=1;var U=32-mt(h)+I;if(30<U){var $=I-I%5;U=(A&(1<<$)-1).toString(32),A>>=$,I-=$,ut=1<<32-mt(h)+I|b<<I|A,Fs=U+u}else ut=1<<U|b<<I|A,Fs=u}function Ov(u){u.return!==null&&(ga(u,1),kv(u,1,0))}function va(u){for(;u===jp;)jp=oc[--Ki],oc[Ki]=null,Fp=oc[--Ki],oc[Ki]=null;for(;u===ac;)ac=Ni[--zr],Ni[zr]=null,Fs=Ni[--zr],Ni[zr]=null,ut=Ni[--zr],Ni[zr]=null}var Yr=null,Ii=null,Kn=!1,zs=null;function Lv(u,h){var b=Uo(5,null,null,0);b.elementType="DELETED",b.stateNode=h,b.return=u,h=u.deletions,h===null?(u.deletions=[b],u.flags|=16):h.push(b)}function Dv(u,h){switch(u.tag){case 5:var b=u.type;return h=h.nodeType!==1||b.toLowerCase()!==h.nodeName.toLowerCase()?null:h,h!==null?(u.stateNode=h,Yr=u,Ii=fa(h.firstChild),!0):!1;case 6:return h=u.pendingProps===""||h.nodeType!==3?null:h,h!==null?(u.stateNode=h,Yr=u,Ii=null,!0):!1;case 13:return h=h.nodeType!==8?null:h,h!==null?(b=ac!==null?{id:ut,overflow:Fs}:null,u.memoizedState={dehydrated:h,treeContext:b,retryLane:1073741824},b=Uo(18,null,null,0),b.stateNode=h,b.return=u,u.child=b,Yr=u,Ii=null,!0):!1;default:return!1}}function zp(u){return(u.mode&1)!==0&&(u.flags&128)===0}function Bp(u){if(Kn){var h=Ii;if(h){var b=h;if(!Dv(u,h)){if(zp(u))throw Error(n(418));h=fa(b.nextSibling);var A=Yr;h&&Dv(u,h)?Lv(A,b):(u.flags=u.flags&-4097|2,Kn=!1,Yr=u)}}else{if(zp(u))throw Error(n(418));u.flags=u.flags&-4097|2,Kn=!1,Yr=u}}}function Hp(u){for(u=u.return;u!==null&&u.tag!==5&&u.tag!==3&&u.tag!==13;)u=u.return;Yr=u}function Pu(u){if(u!==Yr)return!1;if(!Kn)return Hp(u),Kn=!0,!1;var h;if((h=u.tag!==3)&&!(h=u.tag!==5)&&(h=u.type,h=h!=="head"&&h!=="body"&&!Av(u.type,u.memoizedProps)),h&&(h=Ii)){if(zp(u))throw Uv(),Error(n(418));for(;h;)Lv(u,h),h=fa(h.nextSibling)}if(Hp(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 b=u.data;if(b==="/$"){if(h===0){Ii=fa(u.nextSibling);break e}h--}else b!=="$"&&b!=="$!"&&b!=="$?"||h++}u=u.nextSibling}Ii=null}}else Ii=Yr?fa(u.stateNode.nextSibling):null;return!0}function Uv(){for(var u=Ii;u;)u=fa(u.nextSibling)}function ol(){Ii=Yr=null,Kn=!1}function Cu(u){zs===null?zs=[u]:zs.push(u)}var EM=P.ReactCurrentBatchConfig;function rf(u,h,b){if(u=b.ref,u!==null&&typeof u!="function"&&typeof u!="object"){if(b._owner){if(b=b._owner,b){if(b.tag!==1)throw Error(n(309));var A=b.stateNode}if(!A)throw Error(n(147,u));var I=A,U=""+u;return h!==null&&h.ref!==null&&typeof h.ref=="function"&&h.ref._stringRef===U?h.ref:(h=function($){var oe=I.refs;$===null?delete oe[U]:oe[U]=$},h._stringRef=U,h)}if(typeof u!="string")throw Error(n(284));if(!b._owner)throw Error(n(290,u))}return u}function sf(u,h){throw u=Object.prototype.toString.call(h),Error(n(31,u==="[object Object]"?"object with keys {"+Object.keys(h).join(", ")+"}":u))}function jv(u){var h=u._init;return h(u._payload)}function Fv(u){function h(Ae,ve){if(u){var Pe=Ae.deletions;Pe===null?(Ae.deletions=[ve],Ae.flags|=16):Pe.push(ve)}}function b(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 I(Ae,ve){return Ae=zu(Ae,ve),Ae.index=0,Ae.sibling=null,Ae}function U(Ae,ve,Pe){return Ae.index=Pe,u?(Pe=Ae.alternate,Pe!==null?(Pe=Pe.index,Pe<ve?(Ae.flags|=2,ve):Pe):(Ae.flags|=2,ve)):(Ae.flags|=1048576,ve)}function $(Ae){return u&&Ae.alternate===null&&(Ae.flags|=2),Ae}function oe(Ae,ve,Pe,at){return ve===null||ve.tag!==6?(ve=GM(Pe,Ae.mode,at),ve.return=Ae,ve):(ve=I(ve,Pe),ve.return=Ae,ve)}function me(Ae,ve,Pe,at){var Dt=Pe.type;return Dt===D?Je(Ae,ve,Pe.props.children,at,Pe.key):ve!==null&&(ve.elementType===Dt||typeof Dt=="object"&&Dt!==null&&Dt.$$typeof===se&&jv(Dt)===ve.type)?(at=I(ve,Pe.props),at.ref=rf(Ae,ve,Pe),at.return=Ae,at):(at=nb(Pe.type,Pe.key,Pe.props,null,Ae.mode,at),at.ref=rf(Ae,ve,Pe),at.return=Ae,at)}function Oe(Ae,ve,Pe,at){return ve===null||ve.tag!==4||ve.stateNode.containerInfo!==Pe.containerInfo||ve.stateNode.implementation!==Pe.implementation?(ve=WM(Pe,Ae.mode,at),ve.return=Ae,ve):(ve=I(ve,Pe.children||[]),ve.return=Ae,ve)}function Je(Ae,ve,Pe,at,Dt){return ve===null||ve.tag!==7?(ve=wf(Pe,Ae.mode,at,Dt),ve.return=Ae,ve):(ve=I(ve,Pe),ve.return=Ae,ve)}function tt(Ae,ve,Pe){if(typeof ve=="string"&&ve!==""||typeof ve=="number")return ve=GM(""+ve,Ae.mode,Pe),ve.return=Ae,ve;if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case O:return Pe=nb(ve.type,ve.key,ve.props,null,Ae.mode,Pe),Pe.ref=rf(Ae,null,ve),Pe.return=Ae,Pe;case N:return ve=WM(ve,Ae.mode,Pe),ve.return=Ae,ve;case se:var at=ve._init;return tt(Ae,at(ve._payload),Pe)}if(Q(ve)||J(ve))return ve=wf(ve,Ae.mode,Pe,null),ve.return=Ae,ve;sf(Ae,ve)}return null}function Qe(Ae,ve,Pe,at){var Dt=ve!==null?ve.key:null;if(typeof Pe=="string"&&Pe!==""||typeof Pe=="number")return Dt!==null?null:oe(Ae,ve,""+Pe,at);if(typeof Pe=="object"&&Pe!==null){switch(Pe.$$typeof){case O:return Pe.key===Dt?me(Ae,ve,Pe,at):null;case N:return Pe.key===Dt?Oe(Ae,ve,Pe,at):null;case se:return Dt=Pe._init,Qe(Ae,ve,Dt(Pe._payload),at)}if(Q(Pe)||J(Pe))return Dt!==null?null:Je(Ae,ve,Pe,at,null);sf(Ae,Pe)}return null}function _t(Ae,ve,Pe,at,Dt){if(typeof at=="string"&&at!==""||typeof at=="number")return Ae=Ae.get(Pe)||null,oe(ve,Ae,""+at,Dt);if(typeof at=="object"&&at!==null){switch(at.$$typeof){case O:return Ae=Ae.get(at.key===null?Pe:at.key)||null,me(ve,Ae,at,Dt);case N:return Ae=Ae.get(at.key===null?Pe:at.key)||null,Oe(ve,Ae,at,Dt);case se:var Ht=at._init;return _t(Ae,ve,Pe,Ht(at._payload),Dt)}if(Q(at)||J(at))return Ae=Ae.get(Pe)||null,Je(ve,Ae,at,Dt,null);sf(ve,at)}return null}function Pt(Ae,ve,Pe,at){for(var Dt=null,Ht=null,Vt=ve,nn=ve=0,pi=null;Vt!==null&&nn<Pe.length;nn++){Vt.index>nn?(pi=Vt,Vt=null):pi=Vt.sibling;var Ln=Qe(Ae,Vt,Pe[nn],at);if(Ln===null){Vt===null&&(Vt=pi);break}u&&Vt&&Ln.alternate===null&&h(Ae,Vt),ve=U(Ln,ve,nn),Ht===null?Dt=Ln:Ht.sibling=Ln,Ht=Ln,Vt=pi}if(nn===Pe.length)return b(Ae,Vt),Kn&&ga(Ae,nn),Dt;if(Vt===null){for(;nn<Pe.length;nn++)Vt=tt(Ae,Pe[nn],at),Vt!==null&&(ve=U(Vt,ve,nn),Ht===null?Dt=Vt:Ht.sibling=Vt,Ht=Vt);return Kn&&ga(Ae,nn),Dt}for(Vt=A(Ae,Vt);nn<Pe.length;nn++)pi=_t(Vt,Ae,nn,Pe[nn],at),pi!==null&&(u&&pi.alternate!==null&&Vt.delete(pi.key===null?nn:pi.key),ve=U(pi,ve,nn),Ht===null?Dt=pi:Ht.sibling=pi,Ht=pi);return u&&Vt.forEach(function(Bu){return h(Ae,Bu)}),Kn&&ga(Ae,nn),Dt}function Nt(Ae,ve,Pe,at){var Dt=J(Pe);if(typeof Dt!="function")throw Error(n(150));if(Pe=Dt.call(Pe),Pe==null)throw Error(n(151));for(var Ht=Dt=null,Vt=ve,nn=ve=0,pi=null,Ln=Pe.next();Vt!==null&&!Ln.done;nn++,Ln=Pe.next()){Vt.index>nn?(pi=Vt,Vt=null):pi=Vt.sibling;var Bu=Qe(Ae,Vt,Ln.value,at);if(Bu===null){Vt===null&&(Vt=pi);break}u&&Vt&&Bu.alternate===null&&h(Ae,Vt),ve=U(Bu,ve,nn),Ht===null?Dt=Bu:Ht.sibling=Bu,Ht=Bu,Vt=pi}if(Ln.done)return b(Ae,Vt),Kn&&ga(Ae,nn),Dt;if(Vt===null){for(;!Ln.done;nn++,Ln=Pe.next())Ln=tt(Ae,Ln.value,at),Ln!==null&&(ve=U(Ln,ve,nn),Ht===null?Dt=Ln:Ht.sibling=Ln,Ht=Ln);return Kn&&ga(Ae,nn),Dt}for(Vt=A(Ae,Vt);!Ln.done;nn++,Ln=Pe.next())Ln=_t(Vt,Ae,nn,Ln.value,at),Ln!==null&&(u&&Ln.alternate!==null&&Vt.delete(Ln.key===null?nn:Ln.key),ve=U(Ln,ve,nn),Ht===null?Dt=Ln:Ht.sibling=Ln,Ht=Ln);return u&&Vt.forEach(function(_W){return h(Ae,_W)}),Kn&&ga(Ae,nn),Dt}function kr(Ae,ve,Pe,at){if(typeof Pe=="object"&&Pe!==null&&Pe.type===D&&Pe.key===null&&(Pe=Pe.props.children),typeof Pe=="object"&&Pe!==null){switch(Pe.$$typeof){case O:e:{for(var Dt=Pe.key,Ht=ve;Ht!==null;){if(Ht.key===Dt){if(Dt=Pe.type,Dt===D){if(Ht.tag===7){b(Ae,Ht.sibling),ve=I(Ht,Pe.props.children),ve.return=Ae,Ae=ve;break e}}else if(Ht.elementType===Dt||typeof Dt=="object"&&Dt!==null&&Dt.$$typeof===se&&jv(Dt)===Ht.type){b(Ae,Ht.sibling),ve=I(Ht,Pe.props),ve.ref=rf(Ae,Ht,Pe),ve.return=Ae,Ae=ve;break e}b(Ae,Ht);break}else h(Ae,Ht);Ht=Ht.sibling}Pe.type===D?(ve=wf(Pe.props.children,Ae.mode,at,Pe.key),ve.return=Ae,Ae=ve):(at=nb(Pe.type,Pe.key,Pe.props,null,Ae.mode,at),at.ref=rf(Ae,ve,Pe),at.return=Ae,Ae=at)}return $(Ae);case N:e:{for(Ht=Pe.key;ve!==null;){if(ve.key===Ht)if(ve.tag===4&&ve.stateNode.containerInfo===Pe.containerInfo&&ve.stateNode.implementation===Pe.implementation){b(Ae,ve.sibling),ve=I(ve,Pe.children||[]),ve.return=Ae,Ae=ve;break e}else{b(Ae,ve);break}else h(Ae,ve);ve=ve.sibling}ve=WM(Pe,Ae.mode,at),ve.return=Ae,Ae=ve}return $(Ae);case se:return Ht=Pe._init,kr(Ae,ve,Ht(Pe._payload),at)}if(Q(Pe))return Pt(Ae,ve,Pe,at);if(J(Pe))return Nt(Ae,ve,Pe,at);sf(Ae,Pe)}return typeof Pe=="string"&&Pe!==""||typeof Pe=="number"?(Pe=""+Pe,ve!==null&&ve.tag===6?(b(Ae,ve.sibling),ve=I(ve,Pe),ve.return=Ae,Ae=ve):(b(Ae,ve),ve=GM(Pe,Ae.mode,at),ve.return=Ae,Ae=ve),$(Ae)):b(Ae,ve)}return kr}var lc=Fv(!0),of=Fv(!1),cc=lr(null),uc=null,ya=null,Ru=null;function dc(){Ru=ya=uc=null}function af(u){var h=cc.current;$n(cc),u._currentValue=h}function lf(u,h,b){for(;u!==null;){var A=u.alternate;if((u.childLanes&h)!==h?(u.childLanes|=h,A!==null&&(A.childLanes|=h)):A!==null&&(A.childLanes&h)!==h&&(A.childLanes|=h),u===b)break;u=u.return}}function al(u,h){uc=u,Ru=ya=null,u=u.dependencies,u!==null&&u.firstContext!==null&&((u.lanes&h)!==0&&(ln=!0),u.firstContext=null)}function ps(u){var h=u._currentValue;if(Ru!==u)if(u={context:u,memoizedValue:h,next:null},ya===null){if(uc===null)throw Error(n(308));ya=u,uc.dependencies={lanes:0,firstContext:u}}else ya=ya.next=u;return h}var xa=null;function zv(u){xa===null?xa=[u]:xa.push(u)}function cf(u,h,b,A){var I=h.interleaved;return I===null?(b.next=b,zv(h)):(b.next=I.next,I.next=b),h.interleaved=b,ao(u,A)}function ao(u,h){u.lanes|=h;var b=u.alternate;for(b!==null&&(b.lanes|=h),b=u,u=u.return;u!==null;)u.childLanes|=h,b=u.alternate,b!==null&&(b.childLanes|=h),b=u,u=u.return;return b.tag===3?b.stateNode:null}var Fn=!1;function an(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function gr(u,h){u=u.updateQueue,h.updateQueue===u&&(h.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,effects:u.effects})}function zn(u,h){return{eventTime:u,lane:h,tag:0,payload:null,callback:null,next:null}}function Jn(u,h,b){var A=u.updateQueue;if(A===null)return null;if(A=A.shared,(kn&2)!==0){var I=A.pending;return I===null?h.next=h:(h.next=I.next,I.next=h),A.pending=h,ao(u,b)}return I=A.interleaved,I===null?(h.next=h,zv(A)):(h.next=I.next,I.next=h),A.interleaved=h,ao(u,b)}function di(u,h,b){if(h=h.updateQueue,h!==null&&(h=h.shared,(b&4194240)!==0)){var A=h.lanes;A&=u.pendingLanes,b|=A,h.lanes=b,uu(u,b)}}function fc(u,h){var b=u.updateQueue,A=u.alternate;if(A!==null&&(A=A.updateQueue,b===A)){var I=null,U=null;if(b=b.firstBaseUpdate,b!==null){do{var $={eventTime:b.eventTime,lane:b.lane,tag:b.tag,payload:b.payload,callback:b.callback,next:null};U===null?I=U=$:U=U.next=$,b=b.next}while(b!==null);U===null?I=U=h:U=U.next=h}else I=U=h;b={baseState:A.baseState,firstBaseUpdate:I,lastBaseUpdate:U,shared:A.shared,effects:A.effects},u.updateQueue=b;return}u=b.lastBaseUpdate,u===null?b.firstBaseUpdate=h:u.next=h,b.lastBaseUpdate=h}function cr(u,h,b,A){var I=u.updateQueue;Fn=!1;var U=I.firstBaseUpdate,$=I.lastBaseUpdate,oe=I.shared.pending;if(oe!==null){I.shared.pending=null;var me=oe,Oe=me.next;me.next=null,$===null?U=Oe:$.next=Oe,$=me;var Je=u.alternate;Je!==null&&(Je=Je.updateQueue,oe=Je.lastBaseUpdate,oe!==$&&(oe===null?Je.firstBaseUpdate=Oe:oe.next=Oe,Je.lastBaseUpdate=me))}if(U!==null){var tt=I.baseState;$=0,Je=Oe=me=null,oe=U;do{var Qe=oe.lane,_t=oe.eventTime;if((A&Qe)===Qe){Je!==null&&(Je=Je.next={eventTime:_t,lane:0,tag:oe.tag,payload:oe.payload,callback:oe.callback,next:null});e:{var Pt=u,Nt=oe;switch(Qe=h,_t=b,Nt.tag){case 1:if(Pt=Nt.payload,typeof Pt=="function"){tt=Pt.call(_t,tt,Qe);break e}tt=Pt;break e;case 3:Pt.flags=Pt.flags&-65537|128;case 0:if(Pt=Nt.payload,Qe=typeof Pt=="function"?Pt.call(_t,tt,Qe):Pt,Qe==null)break e;tt=Y({},tt,Qe);break e;case 2:Fn=!0}}oe.callback!==null&&oe.lane!==0&&(u.flags|=64,Qe=I.effects,Qe===null?I.effects=[oe]:Qe.push(oe))}else _t={eventTime:_t,lane:Qe,tag:oe.tag,payload:oe.payload,callback:oe.callback,next:null},Je===null?(Oe=Je=_t,me=tt):Je=Je.next=_t,$|=Qe;if(oe=oe.next,oe===null){if(oe=I.shared.pending,oe===null)break;Qe=oe,oe=Qe.next,Qe.next=null,I.lastBaseUpdate=Qe,I.shared.pending=null}}while(!0);if(Je===null&&(me=tt),I.baseState=me,I.firstBaseUpdate=Oe,I.lastBaseUpdate=Je,h=I.shared.interleaved,h!==null){I=h;do $|=I.lane,I=I.next;while(I!==h)}else U===null&&(I.shared.lanes=0);yf|=$,u.lanes=$,u.memoizedState=tt}}function Nu(u,h,b){if(u=h.effects,h.effects=null,u!==null)for(h=0;h<u.length;h++){var A=u[h],I=A.callback;if(I!==null){if(A.callback=null,A=b,typeof I!="function")throw Error(n(191,I));I.call(A)}}}var ko={},ms=lr(ko),hc=lr(ko),ba=lr(ko);function br(u){if(u===ko)throw Error(n(174));return u}function uf(u,h){switch(Gn(ba,h),Gn(hc,u),Gn(ms,ko),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)}$n(ms),Gn(ms,h)}function ll(){$n(ms),$n(hc),$n(ba)}function pc(u){br(ba.current);var h=br(ms.current),b=rt(h,u.type);h!==b&&(Gn(hc,u),Gn(ms,b))}function Iu(u){hc.current===u&&($n(ms),$n(hc))}var Yn=lr(0);function lo(u){for(var h=u;h!==null;){if(h.tag===13){var b=h.memoizedState;if(b!==null&&(b=b.dehydrated,b===null||b.data==="$?"||b.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 ku=[];function Oo(){for(var u=0;u<ku.length;u++)ku[u]._workInProgressVersionPrimary=null;ku.length=0}var mc=P.ReactCurrentDispatcher,gc=P.ReactCurrentBatchConfig,_a=0,Xn=null,ur=null,Cn=null,co=!1,fi=!1,cl=0,Yi=0;function Zr(){throw Error(n(321))}function df(u,h){if(h===null)return!1;for(var b=0;b<h.length&&b<u.length;b++)if(!ds(u[b],h[b]))return!1;return!0}function ff(u,h,b,A,I,U){if(_a=U,Xn=h,h.memoizedState=null,h.updateQueue=null,h.lanes=0,mc.current=u===null||u.memoizedState===null?zx:Bx,u=b(A,I),fi){U=0;do{if(fi=!1,cl=0,25<=U)throw Error(n(301));U+=1,Cn=ur=null,h.updateQueue=null,mc.current=Hx,u=b(A,I)}while(fi)}if(mc.current=Kp,h=ur!==null&&ur.next!==null,_a=0,Cn=ur=Xn=null,co=!1,h)throw Error(n(300));return u}function Bv(){var u=cl!==0;return cl=0,u}function Qr(){var u={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Cn===null?Xn.memoizedState=Cn=u:Cn=Cn.next=u,Cn}function gs(){if(ur===null){var u=Xn.alternate;u=u!==null?u.memoizedState:null}else u=ur.next;var h=Cn===null?Xn.memoizedState:Cn.next;if(h!==null)Cn=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},Cn===null?Xn.memoizedState=Cn=u:Cn=Cn.next=u}return Cn}function Ou(u,h){return typeof h=="function"?h(u):h}function hf(u){var h=gs(),b=h.queue;if(b===null)throw Error(n(311));b.lastRenderedReducer=u;var A=ur,I=A.baseQueue,U=b.pending;if(U!==null){if(I!==null){var $=I.next;I.next=U.next,U.next=$}A.baseQueue=I=U,b.pending=null}if(I!==null){U=I.next,A=A.baseState;var oe=$=null,me=null,Oe=U;do{var Je=Oe.lane;if((_a&Je)===Je)me!==null&&(me=me.next={lane:0,action:Oe.action,hasEagerState:Oe.hasEagerState,eagerState:Oe.eagerState,next:null}),A=Oe.hasEagerState?Oe.eagerState:u(A,Oe.action);else{var tt={lane:Je,action:Oe.action,hasEagerState:Oe.hasEagerState,eagerState:Oe.eagerState,next:null};me===null?(oe=me=tt,$=A):me=me.next=tt,Xn.lanes|=Je,yf|=Je}Oe=Oe.next}while(Oe!==null&&Oe!==U);me===null?$=A:me.next=oe,ds(A,h.memoizedState)||(ln=!0),h.memoizedState=A,h.baseState=$,h.baseQueue=me,b.lastRenderedState=A}if(u=b.interleaved,u!==null){I=u;do U=I.lane,Xn.lanes|=U,yf|=U,I=I.next;while(I!==u)}else I===null&&(b.lanes=0);return[h.memoizedState,b.dispatch]}function wa(u){var h=gs(),b=h.queue;if(b===null)throw Error(n(311));b.lastRenderedReducer=u;var A=b.dispatch,I=b.pending,U=h.memoizedState;if(I!==null){b.pending=null;var $=I=I.next;do U=u(U,$.action),$=$.next;while($!==I);ds(U,h.memoizedState)||(ln=!0),h.memoizedState=U,h.baseQueue===null&&(h.baseState=U),b.lastRenderedState=U}return[U,A]}function Hv(){}function Vv(u,h){var b=Xn,A=gs(),I=h(),U=!ds(A.memoizedState,I);if(U&&(A.memoizedState=I,ln=!0),A=A.queue,$v(Ox.bind(null,b,A,u),[u]),A.getSnapshot!==h||U||Cn!==null&&Cn.memoizedState.tag&1){if(b.flags|=2048,uo(9,pf.bind(null,b,A,I,h),void 0,null),hi===null)throw Error(n(349));(_a&30)!==0||Vp(b,h,I)}return I}function Vp(u,h,b){u.flags|=16384,u={getSnapshot:h,value:b},h=Xn.updateQueue,h===null?(h={lastEffect:null,stores:null},Xn.updateQueue=h,h.stores=[u]):(b=h.stores,b===null?h.stores=[u]:b.push(u))}function pf(u,h,b,A){h.value=b,h.getSnapshot=A,Lx(h)&&Gv(u)}function Ox(u,h,b){return b(function(){Lx(h)&&Gv(u)})}function Lx(u){var h=u.getSnapshot;u=u.value;try{var b=h();return!ds(u,b)}catch{return!0}}function Gv(u){var h=ao(u,1);h!==null&&Ta(h,u,1,-1)}function Wv(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:Ou,lastRenderedState:u},h.queue=u,u=u.dispatch=vc.bind(null,Xn,u),[h.memoizedState,u]}function uo(u,h,b,A){return u={tag:u,create:h,destroy:b,deps:A,next:null},h=Xn.updateQueue,h===null?(h={lastEffect:null,stores:null},Xn.updateQueue=h,h.lastEffect=u.next=u):(b=h.lastEffect,b===null?h.lastEffect=u.next=u:(A=b.next,b.next=u,u.next=A,h.lastEffect=u)),u}function Dx(){return gs().memoizedState}function Lo(u,h,b,A){var I=Qr();Xn.flags|=u,I.memoizedState=uo(1|h,b,void 0,A===void 0?null:A)}function mf(u,h,b,A){var I=gs();A=A===void 0?null:A;var U=void 0;if(ur!==null){var $=ur.memoizedState;if(U=$.destroy,A!==null&&df(A,$.deps)){I.memoizedState=uo(h,b,U,A);return}}Xn.flags|=u,I.memoizedState=uo(1|h,b,U,A)}function ki(u,h){return Lo(8390656,8,u,h)}function $v(u,h){return mf(2048,8,u,h)}function Xv(u,h){return mf(4,2,u,h)}function Ux(u,h){return mf(4,4,u,h)}function jx(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 qv(u,h,b){return b=b!=null?b.concat([u]):null,mf(4,4,jx.bind(null,h,u),b)}function Gp(){}function Fx(u,h){var b=gs();h=h===void 0?null:h;var A=b.memoizedState;return A!==null&&h!==null&&df(h,A[1])?A[0]:(b.memoizedState=[u,h],u)}function vs(u,h){var b=gs();h=h===void 0?null:h;var A=b.memoizedState;return A!==null&&h!==null&&df(h,A[1])?A[0]:(u=u(),b.memoizedState=[u,h],u)}function Wp(u,h,b){return(_a&21)===0?(u.baseState&&(u.baseState=!1,ln=!0),u.memoizedState=b):(ds(b,h)||(b=ci(),Xn.lanes|=b,yf|=b,u.baseState=!0),h)}function AM(u,h){var b=Pn;Pn=b!==0&&4>b?b:4,u(!0);var A=gc.transition;gc.transition={};try{u(!1),h()}finally{Pn=b,gc.transition=A}}function Sa(){return gs().memoizedState}function $p(u,h,b){var A=ju(u);if(b={lane:A,action:b,hasEagerState:!1,eagerState:null,next:null},gf(u))Xp(h,b);else if(b=cf(u,h,b,A),b!==null){var I=xs();Ta(b,u,A,I),qp(b,h,A)}}function vc(u,h,b){var A=ju(u),I={lane:A,action:b,hasEagerState:!1,eagerState:null,next:null};if(gf(u))Xp(h,I);else{var U=u.alternate;if(u.lanes===0&&(U===null||U.lanes===0)&&(U=h.lastRenderedReducer,U!==null))try{var $=h.lastRenderedState,oe=U($,b);if(I.hasEagerState=!0,I.eagerState=oe,ds(oe,$)){var me=h.interleaved;me===null?(I.next=I,zv(h)):(I.next=me.next,me.next=I),h.interleaved=I;return}}catch{}finally{}b=cf(u,h,I,A),b!==null&&(I=xs(),Ta(b,u,A,I),qp(b,h,A))}}function gf(u){var h=u.alternate;return u===Xn||h!==null&&h===Xn}function Xp(u,h){fi=co=!0;var b=u.pending;b===null?h.next=h:(h.next=b.next,b.next=h),u.pending=h}function qp(u,h,b){if((b&4194240)!==0){var A=h.lanes;A&=u.pendingLanes,b|=A,h.lanes=b,uu(u,b)}}var Kp={readContext:ps,useCallback:Zr,useContext:Zr,useEffect:Zr,useImperativeHandle:Zr,useInsertionEffect:Zr,useLayoutEffect:Zr,useMemo:Zr,useReducer:Zr,useRef:Zr,useState:Zr,useDebugValue:Zr,useDeferredValue:Zr,useTransition:Zr,useMutableSource:Zr,useSyncExternalStore:Zr,useId:Zr,unstable_isNewReconciler:!1},zx={readContext:ps,useCallback:function(u,h){return Qr().memoizedState=[u,h===void 0?null:h],u},useContext:ps,useEffect:ki,useImperativeHandle:function(u,h,b){return b=b!=null?b.concat([u]):null,Lo(4194308,4,jx.bind(null,h,u),b)},useLayoutEffect:function(u,h){return Lo(4194308,4,u,h)},useInsertionEffect:function(u,h){return Lo(4,2,u,h)},useMemo:function(u,h){var b=Qr();return h=h===void 0?null:h,u=u(),b.memoizedState=[u,h],u},useReducer:function(u,h,b){var A=Qr();return h=b!==void 0?b(h):h,A.memoizedState=A.baseState=h,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:h},A.queue=u,u=u.dispatch=$p.bind(null,Xn,u),[A.memoizedState,u]},useRef:function(u){var h=Qr();return u={current:u},h.memoizedState=u},useState:Wv,useDebugValue:Gp,useDeferredValue:function(u){return Qr().memoizedState=u},useTransition:function(){var u=Wv(!1),h=u[0];return u=AM.bind(null,u[1]),Qr().memoizedState=u,[h,u]},useMutableSource:function(){},useSyncExternalStore:function(u,h,b){var A=Xn,I=Qr();if(Kn){if(b===void 0)throw Error(n(407));b=b()}else{if(b=h(),hi===null)throw Error(n(349));(_a&30)!==0||Vp(A,h,b)}I.memoizedState=b;var U={value:b,getSnapshot:h};return I.queue=U,ki(Ox.bind(null,A,U,u),[u]),A.flags|=2048,uo(9,pf.bind(null,A,U,b,h),void 0,null),b},useId:function(){var u=Qr(),h=hi.identifierPrefix;if(Kn){var b=Fs,A=ut;b=(A&~(1<<32-mt(A)-1)).toString(32)+b,h=":"+h+"R"+b,b=cl++,0<b&&(h+="H"+b.toString(32)),h+=":"}else b=Yi++,h=":"+h+"r"+b.toString(32)+":";return u.memoizedState=h},unstable_isNewReconciler:!1},Bx={readContext:ps,useCallback:Fx,useContext:ps,useEffect:$v,useImperativeHandle:qv,useInsertionEffect:Xv,useLayoutEffect:Ux,useMemo:vs,useReducer:hf,useRef:Dx,useState:function(){return hf(Ou)},useDebugValue:Gp,useDeferredValue:function(u){var h=gs();return Wp(h,ur.memoizedState,u)},useTransition:function(){var u=hf(Ou)[0],h=gs().memoizedState;return[u,h]},useMutableSource:Hv,useSyncExternalStore:Vv,useId:Sa,unstable_isNewReconciler:!1},Hx={readContext:ps,useCallback:Fx,useContext:ps,useEffect:$v,useImperativeHandle:qv,useInsertionEffect:Xv,useLayoutEffect:Ux,useMemo:vs,useReducer:wa,useRef:Dx,useState:function(){return wa(Ou)},useDebugValue:Gp,useDeferredValue:function(u){var h=gs();return ur===null?h.memoizedState=u:Wp(h,ur.memoizedState,u)},useTransition:function(){var u=wa(Ou)[0],h=gs().memoizedState;return[u,h]},useMutableSource:Hv,useSyncExternalStore:Vv,useId:Sa,unstable_isNewReconciler:!1};function Bs(u,h){if(u&&u.defaultProps){h=Y({},h),u=u.defaultProps;for(var b in u)h[b]===void 0&&(h[b]=u[b]);return h}return h}function vf(u,h,b,A){h=u.memoizedState,b=b(A,h),b=b==null?h:Y({},h,b),u.memoizedState=b,u.lanes===0&&(u.updateQueue.baseState=b)}var Yp={isMounted:function(u){return(u=u._reactInternals)?To(u)===u:!1},enqueueSetState:function(u,h,b){u=u._reactInternals;var A=xs(),I=ju(u),U=zn(A,I);U.payload=h,b!=null&&(U.callback=b),h=Jn(u,U,I),h!==null&&(Ta(h,u,I,A),di(h,u,I))},enqueueReplaceState:function(u,h,b){u=u._reactInternals;var A=xs(),I=ju(u),U=zn(A,I);U.tag=1,U.payload=h,b!=null&&(U.callback=b),h=Jn(u,U,I),h!==null&&(Ta(h,u,I,A),di(h,u,I))},enqueueForceUpdate:function(u,h){u=u._reactInternals;var b=xs(),A=ju(u),I=zn(b,A);I.tag=2,h!=null&&(I.callback=h),h=Jn(u,I,A),h!==null&&(Ta(h,u,A,b),di(h,u,A))}};function Vx(u,h,b,A,I,U,$){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(A,U,$):h.prototype&&h.prototype.isPureReactComponent?!Ql(b,A)||!Ql(I,U):!0}function m(u,h,b){var A=!1,I=pa,U=h.contextType;return typeof U=="object"&&U!==null?U=ps(U):(I=ui(h)?ma:Kr.current,A=h.contextTypes,U=(A=A!=null)?ic(u,I):pa),h=new h(b,U),u.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Yp,u.stateNode=h,h._reactInternals=u,A&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=I,u.__reactInternalMemoizedMaskedChildContext=U),h}function g(u,h,b,A){u=h.state,typeof h.componentWillReceiveProps=="function"&&h.componentWillReceiveProps(b,A),typeof h.UNSAFE_componentWillReceiveProps=="function"&&h.UNSAFE_componentWillReceiveProps(b,A),h.state!==u&&Yp.enqueueReplaceState(h,h.state,null)}function M(u,h,b,A){var I=u.stateNode;I.props=b,I.state=u.memoizedState,I.refs={},an(u);var U=h.contextType;typeof U=="object"&&U!==null?I.context=ps(U):(U=ui(h)?ma:Kr.current,I.context=ic(u,U)),I.state=u.memoizedState,U=h.getDerivedStateFromProps,typeof U=="function"&&(vf(u,h,U,b),I.state=u.memoizedState),typeof h.getDerivedStateFromProps=="function"||typeof I.getSnapshotBeforeUpdate=="function"||typeof I.UNSAFE_componentWillMount!="function"&&typeof I.componentWillMount!="function"||(h=I.state,typeof I.componentWillMount=="function"&&I.componentWillMount(),typeof I.UNSAFE_componentWillMount=="function"&&I.UNSAFE_componentWillMount(),h!==I.state&&Yp.enqueueReplaceState(I,I.state,null),cr(u,b,I,A),I.state=u.memoizedState),typeof I.componentDidMount=="function"&&(u.flags|=4194308)}function C(u,h){try{var b="",A=h;do b+=ce(A),A=A.return;while(A);var I=b}catch(U){I=`
|
||
Error generating stack: `+U.message+`
|
||
`+U.stack}return{value:u,source:h,stack:I,digest:null}}function L(u,h,b){return{value:u,source:null,stack:b??null,digest:h??null}}function F(u,h){try{console.error(h.value)}catch(b){setTimeout(function(){throw b})}}var ie=typeof WeakMap=="function"?WeakMap:Map;function ye(u,h,b){b=zn(-1,b),b.tag=3,b.payload={element:null};var A=h.value;return b.callback=function(){Yx||(Yx=!0,DM=A),F(u,h)},b}function je(u,h,b){b=zn(-1,b),b.tag=3;var A=u.type.getDerivedStateFromError;if(typeof A=="function"){var I=h.value;b.payload=function(){return A(I)},b.callback=function(){F(u,h)}}var U=u.stateNode;return U!==null&&typeof U.componentDidCatch=="function"&&(b.callback=function(){F(u,h),typeof A!="function"&&(Du===null?Du=new Set([this]):Du.add(this));var $=h.stack;this.componentDidCatch(h.value,{componentStack:$!==null?$:""})}),b}function st(u,h,b){var A=u.pingCache;if(A===null){A=u.pingCache=new ie;var I=new Set;A.set(h,I)}else I=A.get(h),I===void 0&&(I=new Set,A.set(h,I));I.has(b)||(I.add(b),u=uW.bind(null,u,h,b),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,b,A,I){return(u.mode&1)===0?(u===h?u.flags|=65536:(u.flags|=128,b.flags|=131072,b.flags&=-52805,b.tag===1&&(b.alternate===null?b.tag=17:(h=zn(-1,1),h.tag=2,Jn(b,h,1))),b.lanes|=1),u):(u.flags|=65536,u.lanes=I,u)}var zt=P.ReactCurrentOwner,ln=!1;function xt(u,h,b,A){h.child=u===null?of(h,null,b,A):lc(h,u.child,b,A)}function Jr(u,h,b,A,I){b=b.render;var U=h.ref;return al(h,I),A=ff(u,h,b,A,U,I),b=Bv(),u!==null&&!ln?(h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~I,yc(u,h,I)):(Kn&&b&&Ov(h),h.flags|=1,xt(u,h,A,I),h.child)}function ys(u,h,b,A,I){if(u===null){var U=b.type;return typeof U=="function"&&!VM(U)&&U.defaultProps===void 0&&b.compare===null&&b.defaultProps===void 0?(h.tag=15,h.type=U,Ne(u,h,U,A,I)):(u=nb(b.type,null,A,h,h.mode,I),u.ref=h.ref,u.return=h,h.child=u)}if(U=u.child,(u.lanes&I)===0){var $=U.memoizedProps;if(b=b.compare,b=b!==null?b:Ql,b($,A)&&u.ref===h.ref)return yc(u,h,I)}return h.flags|=1,u=zu(U,A),u.ref=h.ref,u.return=h,h.child=u}function Ne(u,h,b,A,I){if(u!==null){var U=u.memoizedProps;if(Ql(U,A)&&u.ref===h.ref)if(ln=!1,h.pendingProps=A=U,(u.lanes&I)!==0)(u.flags&131072)!==0&&(ln=!0);else return h.lanes=u.lanes,yc(u,h,I)}return gt(u,h,b,A,I)}function _e(u,h,b){var A=h.pendingProps,I=A.children,U=u!==null?u.memoizedState:null;if(A.mode==="hidden")if((h.mode&1)===0)h.memoizedState={baseLanes:0,cachePool:null,transitions:null},Gn(Qp,fo),fo|=b;else{if((b&1073741824)===0)return u=U!==null?U.baseLanes|b:b,h.lanes=h.childLanes=1073741824,h.memoizedState={baseLanes:u,cachePool:null,transitions:null},h.updateQueue=null,Gn(Qp,fo),fo|=u,null;h.memoizedState={baseLanes:0,cachePool:null,transitions:null},A=U!==null?U.baseLanes:b,Gn(Qp,fo),fo|=A}else U!==null?(A=U.baseLanes|b,h.memoizedState=null):A=b,Gn(Qp,fo),fo|=A;return xt(u,h,I,b),h.child}function De(u,h){var b=h.ref;(u===null&&b!==null||u!==null&&u.ref!==b)&&(h.flags|=512,h.flags|=2097152)}function gt(u,h,b,A,I){var U=ui(b)?ma:Kr.current;return U=ic(h,U),al(h,I),b=ff(u,h,b,A,U,I),A=Bv(),u!==null&&!ln?(h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~I,yc(u,h,I)):(Kn&&A&&Ov(h),h.flags|=1,xt(u,h,b,I),h.child)}function Ot(u,h,b,A,I){if(ui(b)){var U=!0;sc(h)}else U=!1;if(al(h,I),h.stateNode===null)Wx(u,h),m(h,b,A),M(h,b,A,I),A=!0;else if(u===null){var $=h.stateNode,oe=h.memoizedProps;$.props=oe;var me=$.context,Oe=b.contextType;typeof Oe=="object"&&Oe!==null?Oe=ps(Oe):(Oe=ui(b)?ma:Kr.current,Oe=ic(h,Oe));var Je=b.getDerivedStateFromProps,tt=typeof Je=="function"||typeof $.getSnapshotBeforeUpdate=="function";tt||typeof $.UNSAFE_componentWillReceiveProps!="function"&&typeof $.componentWillReceiveProps!="function"||(oe!==A||me!==Oe)&&g(h,$,A,Oe),Fn=!1;var Qe=h.memoizedState;$.state=Qe,cr(h,A,$,I),me=h.memoizedState,oe!==A||Qe!==me||Ri.current||Fn?(typeof Je=="function"&&(vf(h,b,Je,A),me=h.memoizedState),(oe=Fn||Vx(h,b,oe,A,Qe,me,Oe))?(tt||typeof $.UNSAFE_componentWillMount!="function"&&typeof $.componentWillMount!="function"||(typeof $.componentWillMount=="function"&&$.componentWillMount(),typeof $.UNSAFE_componentWillMount=="function"&&$.UNSAFE_componentWillMount()),typeof $.componentDidMount=="function"&&(h.flags|=4194308)):(typeof $.componentDidMount=="function"&&(h.flags|=4194308),h.memoizedProps=A,h.memoizedState=me),$.props=A,$.state=me,$.context=Oe,A=oe):(typeof $.componentDidMount=="function"&&(h.flags|=4194308),A=!1)}else{$=h.stateNode,gr(u,h),oe=h.memoizedProps,Oe=h.type===h.elementType?oe:Bs(h.type,oe),$.props=Oe,tt=h.pendingProps,Qe=$.context,me=b.contextType,typeof me=="object"&&me!==null?me=ps(me):(me=ui(b)?ma:Kr.current,me=ic(h,me));var _t=b.getDerivedStateFromProps;(Je=typeof _t=="function"||typeof $.getSnapshotBeforeUpdate=="function")||typeof $.UNSAFE_componentWillReceiveProps!="function"&&typeof $.componentWillReceiveProps!="function"||(oe!==tt||Qe!==me)&&g(h,$,A,me),Fn=!1,Qe=h.memoizedState,$.state=Qe,cr(h,A,$,I);var Pt=h.memoizedState;oe!==tt||Qe!==Pt||Ri.current||Fn?(typeof _t=="function"&&(vf(h,b,_t,A),Pt=h.memoizedState),(Oe=Fn||Vx(h,b,Oe,A,Qe,Pt,me)||!1)?(Je||typeof $.UNSAFE_componentWillUpdate!="function"&&typeof $.componentWillUpdate!="function"||(typeof $.componentWillUpdate=="function"&&$.componentWillUpdate(A,Pt,me),typeof $.UNSAFE_componentWillUpdate=="function"&&$.UNSAFE_componentWillUpdate(A,Pt,me)),typeof $.componentDidUpdate=="function"&&(h.flags|=4),typeof $.getSnapshotBeforeUpdate=="function"&&(h.flags|=1024)):(typeof $.componentDidUpdate!="function"||oe===u.memoizedProps&&Qe===u.memoizedState||(h.flags|=4),typeof $.getSnapshotBeforeUpdate!="function"||oe===u.memoizedProps&&Qe===u.memoizedState||(h.flags|=1024),h.memoizedProps=A,h.memoizedState=Pt),$.props=A,$.state=Pt,$.context=me,A=Oe):(typeof $.componentDidUpdate!="function"||oe===u.memoizedProps&&Qe===u.memoizedState||(h.flags|=4),typeof $.getSnapshotBeforeUpdate!="function"||oe===u.memoizedProps&&Qe===u.memoizedState||(h.flags|=1024),A=!1)}return on(u,h,b,A,U,I)}function on(u,h,b,A,I,U){De(u,h);var $=(h.flags&128)!==0;if(!A&&!$)return I&&Iv(h,b,!1),yc(u,h,U);A=h.stateNode,zt.current=h;var oe=$&&typeof b.getDerivedStateFromError!="function"?null:A.render();return h.flags|=1,u!==null&&$?(h.child=lc(h,u.child,null,U),h.child=lc(h,null,oe,U)):xt(u,h,oe,U),h.memoizedState=A.state,I&&Iv(h,b,!0),h.child}function sn(u){var h=u.stateNode;h.pendingContext?Nv(u,h.pendingContext,h.pendingContext!==h.context):h.context&&Nv(u,h.context,!1),uf(u,h.containerInfo)}function En(u,h,b,A,I){return ol(),Cu(I),h.flags|=256,xt(u,h,b,A),h.child}var _r={dehydrated:null,treeContext:null,retryLane:0};function bn(u){return{baseLanes:u,cachePool:null,transitions:null}}function Ma(u,h,b){var A=h.pendingProps,I=Yn.current,U=!1,$=(h.flags&128)!==0,oe;if((oe=$)||(oe=u!==null&&u.memoizedState===null?!1:(I&2)!==0),oe?(U=!0,h.flags&=-129):(u===null||u.memoizedState!==null)&&(I|=1),Gn(Yn,I&1),u===null)return Bp(h),u=h.memoizedState,u!==null&&(u=u.dehydrated,u!==null)?((h.mode&1)===0?h.lanes=1:u.data==="$!"?h.lanes=8:h.lanes=1073741824,null):($=A.children,u=A.fallback,U?(A=h.mode,U=h.child,$={mode:"hidden",children:$},(A&1)===0&&U!==null?(U.childLanes=0,U.pendingProps=$):U=rb($,A,0,null),u=wf(u,A,b,null),U.return=h,u.return=h,U.sibling=u,h.child=U,h.child.memoizedState=bn(b),h.memoizedState=_r,u):Kv(h,$));if(I=u.memoizedState,I!==null&&(oe=I.dehydrated,oe!==null))return QG(u,h,$,A,oe,I,b);if(U){U=A.fallback,$=h.mode,I=u.child,oe=I.sibling;var me={mode:"hidden",children:A.children};return($&1)===0&&h.child!==I?(A=h.child,A.childLanes=0,A.pendingProps=me,h.deletions=null):(A=zu(I,me),A.subtreeFlags=I.subtreeFlags&14680064),oe!==null?U=zu(oe,U):(U=wf(U,$,b,null),U.flags|=2),U.return=h,A.return=h,A.sibling=U,h.child=A,A=U,U=h.child,$=u.child.memoizedState,$=$===null?bn(b):{baseLanes:$.baseLanes|b,cachePool:null,transitions:$.transitions},U.memoizedState=$,U.childLanes=u.childLanes&~b,h.memoizedState=_r,A}return U=u.child,u=U.sibling,A=zu(U,{mode:"visible",children:A.children}),(h.mode&1)===0&&(A.lanes=b),A.return=h,A.sibling=null,u!==null&&(b=h.deletions,b===null?(h.deletions=[u],h.flags|=16):b.push(u)),h.child=A,h.memoizedState=null,A}function Kv(u,h){return h=rb({mode:"visible",children:h},u.mode,0,null),h.return=u,u.child=h}function Gx(u,h,b,A){return A!==null&&Cu(A),lc(h,u.child,null,b),u=Kv(h,h.pendingProps.children),u.flags|=2,h.memoizedState=null,u}function QG(u,h,b,A,I,U,$){if(b)return h.flags&256?(h.flags&=-257,A=L(Error(n(422))),Gx(u,h,$,A)):h.memoizedState!==null?(h.child=u.child,h.flags|=128,null):(U=A.fallback,I=h.mode,A=rb({mode:"visible",children:A.children},I,0,null),U=wf(U,I,$,null),U.flags|=2,A.return=h,U.return=h,A.sibling=U,h.child=A,(h.mode&1)!==0&&lc(h,u.child,null,$),h.child.memoizedState=bn($),h.memoizedState=_r,U);if((h.mode&1)===0)return Gx(u,h,$,null);if(I.data==="$!"){if(A=I.nextSibling&&I.nextSibling.dataset,A)var oe=A.dgst;return A=oe,U=Error(n(419)),A=L(U,A,void 0),Gx(u,h,$,A)}if(oe=($&u.childLanes)!==0,ln||oe){if(A=hi,A!==null){switch($&-$){case 4:I=2;break;case 16:I=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:I=32;break;case 536870912:I=268435456;break;default:I=0}I=(I&(A.suspendedLanes|$))!==0?0:I,I!==0&&I!==U.retryLane&&(U.retryLane=I,ao(u,I),Ta(A,u,I,-1))}return HM(),A=L(Error(n(421))),Gx(u,h,$,A)}return I.data==="$?"?(h.flags|=128,h.child=u.child,h=dW.bind(null,u),I._reactRetry=h,null):(u=U.treeContext,Ii=fa(I.nextSibling),Yr=h,Kn=!0,zs=null,u!==null&&(Ni[zr++]=ut,Ni[zr++]=Fs,Ni[zr++]=ac,ut=u.id,Fs=u.overflow,ac=h),h=Kv(h,A.children),h.flags|=4096,h)}function uN(u,h,b){u.lanes|=h;var A=u.alternate;A!==null&&(A.lanes|=h),lf(u.return,h,b)}function TM(u,h,b,A,I){var U=u.memoizedState;U===null?u.memoizedState={isBackwards:h,rendering:null,renderingStartTime:0,last:A,tail:b,tailMode:I}:(U.isBackwards=h,U.rendering=null,U.renderingStartTime=0,U.last=A,U.tail=b,U.tailMode=I)}function dN(u,h,b){var A=h.pendingProps,I=A.revealOrder,U=A.tail;if(xt(u,h,A.children,b),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&&uN(u,b,h);else if(u.tag===19)uN(u,b,h);else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===h)break e;for(;u.sibling===null;){if(u.return===null||u.return===h)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}A&=1}if(Gn(Yn,A),(h.mode&1)===0)h.memoizedState=null;else switch(I){case"forwards":for(b=h.child,I=null;b!==null;)u=b.alternate,u!==null&&lo(u)===null&&(I=b),b=b.sibling;b=I,b===null?(I=h.child,h.child=null):(I=b.sibling,b.sibling=null),TM(h,!1,I,b,U);break;case"backwards":for(b=null,I=h.child,h.child=null;I!==null;){if(u=I.alternate,u!==null&&lo(u)===null){h.child=I;break}u=I.sibling,I.sibling=b,b=I,I=u}TM(h,!0,b,null,U);break;case"together":TM(h,!1,null,null,void 0);break;default:h.memoizedState=null}return h.child}function Wx(u,h){(h.mode&1)===0&&u!==null&&(u.alternate=null,h.alternate=null,h.flags|=2)}function yc(u,h,b){if(u!==null&&(h.dependencies=u.dependencies),yf|=h.lanes,(b&h.childLanes)===0)return null;if(u!==null&&h.child!==u.child)throw Error(n(153));if(h.child!==null){for(u=h.child,b=zu(u,u.pendingProps),h.child=b,b.return=h;u.sibling!==null;)u=u.sibling,b=b.sibling=zu(u,u.pendingProps),b.return=h;b.sibling=null}return h.child}function JG(u,h,b){switch(h.tag){case 3:sn(h),ol();break;case 5:pc(h);break;case 1:ui(h.type)&&sc(h);break;case 4:uf(h,h.stateNode.containerInfo);break;case 10:var A=h.type._context,I=h.memoizedProps.value;Gn(cc,A._currentValue),A._currentValue=I;break;case 13:if(A=h.memoizedState,A!==null)return A.dehydrated!==null?(Gn(Yn,Yn.current&1),h.flags|=128,null):(b&h.child.childLanes)!==0?Ma(u,h,b):(Gn(Yn,Yn.current&1),u=yc(u,h,b),u!==null?u.sibling:null);Gn(Yn,Yn.current&1);break;case 19:if(A=(b&h.childLanes)!==0,(u.flags&128)!==0){if(A)return dN(u,h,b);h.flags|=128}if(I=h.memoizedState,I!==null&&(I.rendering=null,I.tail=null,I.lastEffect=null),Gn(Yn,Yn.current),A)break;return null;case 22:case 23:return h.lanes=0,_e(u,h,b)}return yc(u,h,b)}var fN,PM,hN,pN;fN=function(u,h){for(var b=h.child;b!==null;){if(b.tag===5||b.tag===6)u.appendChild(b.stateNode);else if(b.tag!==4&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===h)break;for(;b.sibling===null;){if(b.return===null||b.return===h)return;b=b.return}b.sibling.return=b.return,b=b.sibling}},PM=function(){},hN=function(u,h,b,A){var I=u.memoizedProps;if(I!==A){u=h.stateNode,br(ms.current);var U=null;switch(b){case"input":I=Ve(u,I),A=Ve(u,A),U=[];break;case"select":I=Y({},I,{value:void 0}),A=Y({},A,{value:void 0}),U=[];break;case"textarea":I=be(u,I),A=be(u,A),U=[];break;default:typeof I.onClick!="function"&&typeof A.onClick=="function"&&(u.onclick=Qd)}de(b,A);var $;b=null;for(Oe in I)if(!A.hasOwnProperty(Oe)&&I.hasOwnProperty(Oe)&&I[Oe]!=null)if(Oe==="style"){var oe=I[Oe];for($ in oe)oe.hasOwnProperty($)&&(b||(b={}),b[$]="")}else Oe!=="dangerouslySetInnerHTML"&&Oe!=="children"&&Oe!=="suppressContentEditableWarning"&&Oe!=="suppressHydrationWarning"&&Oe!=="autoFocus"&&(i.hasOwnProperty(Oe)?U||(U=[]):(U=U||[]).push(Oe,null));for(Oe in A){var me=A[Oe];if(oe=I!=null?I[Oe]:void 0,A.hasOwnProperty(Oe)&&me!==oe&&(me!=null||oe!=null))if(Oe==="style")if(oe){for($ in oe)!oe.hasOwnProperty($)||me&&me.hasOwnProperty($)||(b||(b={}),b[$]="");for($ in me)me.hasOwnProperty($)&&oe[$]!==me[$]&&(b||(b={}),b[$]=me[$])}else b||(U||(U=[]),U.push(Oe,b)),b=me;else Oe==="dangerouslySetInnerHTML"?(me=me?me.__html:void 0,oe=oe?oe.__html:void 0,me!=null&&oe!==me&&(U=U||[]).push(Oe,me)):Oe==="children"?typeof me!="string"&&typeof me!="number"||(U=U||[]).push(Oe,""+me):Oe!=="suppressContentEditableWarning"&&Oe!=="suppressHydrationWarning"&&(i.hasOwnProperty(Oe)?(me!=null&&Oe==="onScroll"&&Wn("scroll",u),U||oe===me||(U=[])):(U=U||[]).push(Oe,me))}b&&(U=U||[]).push("style",b);var Oe=U;(h.updateQueue=Oe)&&(h.flags|=4)}},pN=function(u,h,b,A){b!==A&&(h.flags|=4)};function Yv(u,h){if(!Kn)switch(u.tailMode){case"hidden":h=u.tail;for(var b=null;h!==null;)h.alternate!==null&&(b=h),h=h.sibling;b===null?u.tail=null:b.sibling=null;break;case"collapsed":b=u.tail;for(var A=null;b!==null;)b.alternate!==null&&(A=b),b=b.sibling;A===null?h||u.tail===null?u.tail=null:u.tail.sibling=null:A.sibling=null}}function Zi(u){var h=u.alternate!==null&&u.alternate.child===u.child,b=0,A=0;if(h)for(var I=u.child;I!==null;)b|=I.lanes|I.childLanes,A|=I.subtreeFlags&14680064,A|=I.flags&14680064,I.return=u,I=I.sibling;else for(I=u.child;I!==null;)b|=I.lanes|I.childLanes,A|=I.subtreeFlags,A|=I.flags,I.return=u,I=I.sibling;return u.subtreeFlags|=A,u.childLanes=b,h}function eW(u,h,b){var A=h.pendingProps;switch(va(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)&&Jd(),Zi(h),null;case 3:return A=h.stateNode,ll(),$n(Ri),$n(Kr),Oo(),A.pendingContext&&(A.context=A.pendingContext,A.pendingContext=null),(u===null||u.child===null)&&(Pu(h)?h.flags|=4:u===null||u.memoizedState.isDehydrated&&(h.flags&256)===0||(h.flags|=1024,zs!==null&&(FM(zs),zs=null))),PM(u,h),Zi(h),null;case 5:Iu(h);var I=br(ba.current);if(b=h.type,u!==null&&h.stateNode!=null)hN(u,h,b,A,I),u.ref!==h.ref&&(h.flags|=512,h.flags|=2097152);else{if(!A){if(h.stateNode===null)throw Error(n(166));return Zi(h),null}if(u=br(ms.current),Pu(h)){A=h.stateNode,b=h.type;var U=h.memoizedProps;switch(A[Ir]=h,A[Tu]=U,u=(h.mode&1)!==0,b){case"dialog":Wn("cancel",A),Wn("close",A);break;case"iframe":case"object":case"embed":Wn("load",A);break;case"video":case"audio":for(I=0;I<il.length;I++)Wn(il[I],A);break;case"source":Wn("error",A);break;case"img":case"image":case"link":Wn("error",A),Wn("load",A);break;case"details":Wn("toggle",A);break;case"input":Le(A,U),Wn("invalid",A);break;case"select":A._wrapperState={wasMultiple:!!U.multiple},Wn("invalid",A);break;case"textarea":Ue(A,U),Wn("invalid",A)}de(b,U),I=null;for(var $ in U)if(U.hasOwnProperty($)){var oe=U[$];$==="children"?typeof oe=="string"?A.textContent!==oe&&(U.suppressHydrationWarning!==!0&&Zd(A.textContent,oe,u),I=["children",oe]):typeof oe=="number"&&A.textContent!==""+oe&&(U.suppressHydrationWarning!==!0&&Zd(A.textContent,oe,u),I=["children",""+oe]):i.hasOwnProperty($)&&oe!=null&&$==="onScroll"&&Wn("scroll",A)}switch(b){case"input":We(A),qe(A,U,!0);break;case"textarea":We(A),Fe(A);break;case"select":case"option":break;default:typeof U.onClick=="function"&&(A.onclick=Qd)}A=I,h.updateQueue=A,A!==null&&(h.flags|=4)}else{$=I.nodeType===9?I:I.ownerDocument,u==="http://www.w3.org/1999/xhtml"&&(u=bt(b)),u==="http://www.w3.org/1999/xhtml"?b==="script"?(u=$.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild)):typeof A.is=="string"?u=$.createElement(b,{is:A.is}):(u=$.createElement(b),b==="select"&&($=u,A.multiple?$.multiple=!0:A.size&&($.size=A.size))):u=$.createElementNS(u,b),u[Ir]=h,u[Tu]=A,fN(u,h,!1,!1),h.stateNode=u;e:{switch($=Xe(b,A),b){case"dialog":Wn("cancel",u),Wn("close",u),I=A;break;case"iframe":case"object":case"embed":Wn("load",u),I=A;break;case"video":case"audio":for(I=0;I<il.length;I++)Wn(il[I],u);I=A;break;case"source":Wn("error",u),I=A;break;case"img":case"image":case"link":Wn("error",u),Wn("load",u),I=A;break;case"details":Wn("toggle",u),I=A;break;case"input":Le(u,A),I=Ve(u,A),Wn("invalid",u);break;case"option":I=A;break;case"select":u._wrapperState={wasMultiple:!!A.multiple},I=Y({},A,{value:void 0}),Wn("invalid",u);break;case"textarea":Ue(u,A),I=be(u,A),Wn("invalid",u);break;default:I=A}de(b,I),oe=I;for(U in oe)if(oe.hasOwnProperty(U)){var me=oe[U];U==="style"?vt(u,me):U==="dangerouslySetInnerHTML"?(me=me?me.__html:void 0,me!=null&&Xt(u,me)):U==="children"?typeof me=="string"?(b!=="textarea"||me!=="")&&Ke(u,me):typeof me=="number"&&Ke(u,""+me):U!=="suppressContentEditableWarning"&&U!=="suppressHydrationWarning"&&U!=="autoFocus"&&(i.hasOwnProperty(U)?me!=null&&U==="onScroll"&&Wn("scroll",u):me!=null&&T(u,U,me,$))}switch(b){case"input":We(u),qe(u,A,!1);break;case"textarea":We(u),Fe(u);break;case"option":A.value!=null&&u.setAttribute("value",""+$e(A.value));break;case"select":u.multiple=!!A.multiple,U=A.value,U!=null?W(u,!!A.multiple,U,!1):A.defaultValue!=null&&W(u,!!A.multiple,A.defaultValue,!0);break;default:typeof I.onClick=="function"&&(u.onclick=Qd)}switch(b){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)pN(u,h,u.memoizedProps,A);else{if(typeof A!="string"&&h.stateNode===null)throw Error(n(166));if(b=br(ba.current),br(ms.current),Pu(h)){if(A=h.stateNode,b=h.memoizedProps,A[Ir]=h,(U=A.nodeValue!==b)&&(u=Yr,u!==null))switch(u.tag){case 3:Zd(A.nodeValue,b,(u.mode&1)!==0);break;case 5:u.memoizedProps.suppressHydrationWarning!==!0&&Zd(A.nodeValue,b,(u.mode&1)!==0)}U&&(h.flags|=4)}else A=(b.nodeType===9?b:b.ownerDocument).createTextNode(A),A[Ir]=h,h.stateNode=A}return Zi(h),null;case 13:if($n(Yn),A=h.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(Kn&&Ii!==null&&(h.mode&1)!==0&&(h.flags&128)===0)Uv(),ol(),h.flags|=98560,U=!1;else if(U=Pu(h),A!==null&&A.dehydrated!==null){if(u===null){if(!U)throw Error(n(318));if(U=h.memoizedState,U=U!==null?U.dehydrated:null,!U)throw Error(n(317));U[Ir]=h}else ol(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;Zi(h),U=!1}else zs!==null&&(FM(zs),zs=null),U=!0;if(!U)return h.flags&65536?h:null}return(h.flags&128)!==0?(h.lanes=b,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):HM())),h.updateQueue!==null&&(h.flags|=4),Zi(h),null);case 4:return ll(),PM(u,h),u===null&&Mu(h.stateNode.containerInfo),Zi(h),null;case 10:return af(h.type._context),Zi(h),null;case 17:return ui(h.type)&&Jd(),Zi(h),null;case 19:if($n(Yn),U=h.memoizedState,U===null)return Zi(h),null;if(A=(h.flags&128)!==0,$=U.rendering,$===null)if(A)Yv(U,!1);else{if(ei!==0||u!==null&&(u.flags&128)!==0)for(u=h.child;u!==null;){if($=lo(u),$!==null){for(h.flags|=128,Yv(U,!1),A=$.updateQueue,A!==null&&(h.updateQueue=A,h.flags|=4),h.subtreeFlags=0,A=b,b=h.child;b!==null;)U=b,u=A,U.flags&=14680066,$=U.alternate,$===null?(U.childLanes=0,U.lanes=u,U.child=null,U.subtreeFlags=0,U.memoizedProps=null,U.memoizedState=null,U.updateQueue=null,U.dependencies=null,U.stateNode=null):(U.childLanes=$.childLanes,U.lanes=$.lanes,U.child=$.child,U.subtreeFlags=0,U.deletions=null,U.memoizedProps=$.memoizedProps,U.memoizedState=$.memoizedState,U.updateQueue=$.updateQueue,U.type=$.type,u=$.dependencies,U.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext}),b=b.sibling;return Gn(Yn,Yn.current&1|2),h.child}u=u.sibling}U.tail!==null&<()>Jp&&(h.flags|=128,A=!0,Yv(U,!1),h.lanes=4194304)}else{if(!A)if(u=lo($),u!==null){if(h.flags|=128,A=!0,b=u.updateQueue,b!==null&&(h.updateQueue=b,h.flags|=4),Yv(U,!0),U.tail===null&&U.tailMode==="hidden"&&!$.alternate&&!Kn)return Zi(h),null}else 2*lt()-U.renderingStartTime>Jp&&b!==1073741824&&(h.flags|=128,A=!0,Yv(U,!1),h.lanes=4194304);U.isBackwards?($.sibling=h.child,h.child=$):(b=U.last,b!==null?b.sibling=$:h.child=$,U.last=$)}return U.tail!==null?(h=U.tail,U.rendering=h,U.tail=h.sibling,U.renderingStartTime=lt(),h.sibling=null,b=Yn.current,Gn(Yn,A?b&1|2:b&1),h):(Zi(h),null);case 22:case 23:return BM(),A=h.memoizedState!==null,u!==null&&u.memoizedState!==null!==A&&(h.flags|=8192),A&&(h.mode&1)!==0?(fo&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 tW(u,h){switch(va(h),h.tag){case 1:return ui(h.type)&&Jd(),u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 3:return ll(),$n(Ri),$n(Kr),Oo(),u=h.flags,(u&65536)!==0&&(u&128)===0?(h.flags=u&-65537|128,h):null;case 5:return Iu(h),null;case 13:if($n(Yn),u=h.memoizedState,u!==null&&u.dehydrated!==null){if(h.alternate===null)throw Error(n(340));ol()}return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 19:return $n(Yn),null;case 4:return ll(),null;case 10:return af(h.type._context),null;case 22:case 23:return BM(),null;case 24:return null;default:return null}}var $x=!1,Qi=!1,nW=typeof WeakSet=="function"?WeakSet:Set,At=null;function Zp(u,h){var b=u.ref;if(b!==null)if(typeof b=="function")try{b(null)}catch(A){wr(u,h,A)}else b.current=null}function CM(u,h,b){try{b()}catch(A){wr(u,h,A)}}var mN=!1;function rW(u,h){if(Au=ks,u=rr(),Dr(u)){if("selectionStart"in u)var b={start:u.selectionStart,end:u.selectionEnd};else e:{b=(b=u.ownerDocument)&&b.defaultView||window;var A=b.getSelection&&b.getSelection();if(A&&A.rangeCount!==0){b=A.anchorNode;var I=A.anchorOffset,U=A.focusNode;A=A.focusOffset;try{b.nodeType,U.nodeType}catch{b=null;break e}var $=0,oe=-1,me=-1,Oe=0,Je=0,tt=u,Qe=null;t:for(;;){for(var _t;tt!==b||I!==0&&tt.nodeType!==3||(oe=$+I),tt!==U||A!==0&&tt.nodeType!==3||(me=$+A),tt.nodeType===3&&($+=tt.nodeValue.length),(_t=tt.firstChild)!==null;)Qe=tt,tt=_t;for(;;){if(tt===u)break t;if(Qe===b&&++Oe===I&&(oe=$),Qe===U&&++Je===A&&(me=$),(_t=tt.nextSibling)!==null)break;tt=Qe,Qe=tt.parentNode}tt=_t}b=oe===-1||me===-1?null:{start:oe,end:me}}else b=null}b=b||{start:0,end:0}}else b=null;for(Ev={focusedElem:u,selectionRange:b},ks=!1,At=h;At!==null;)if(h=At,u=h.child,(h.subtreeFlags&1028)!==0&&u!==null)u.return=h,At=u;else for(;At!==null;){h=At;try{var Pt=h.alternate;if((h.flags&1024)!==0)switch(h.tag){case 0:case 11:case 15:break;case 1:if(Pt!==null){var Nt=Pt.memoizedProps,kr=Pt.memoizedState,Ae=h.stateNode,ve=Ae.getSnapshotBeforeUpdate(h.elementType===h.type?Nt:Bs(h.type,Nt),kr);Ae.__reactInternalSnapshotBeforeUpdate=ve}break;case 3:var Pe=h.stateNode.containerInfo;Pe.nodeType===1?Pe.textContent="":Pe.nodeType===9&&Pe.documentElement&&Pe.removeChild(Pe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(at){wr(h,h.return,at)}if(u=h.sibling,u!==null){u.return=h.return,At=u;break}At=h.return}return Pt=mN,mN=!1,Pt}function Zv(u,h,b){var A=h.updateQueue;if(A=A!==null?A.lastEffect:null,A!==null){var I=A=A.next;do{if((I.tag&u)===u){var U=I.destroy;I.destroy=void 0,U!==void 0&&CM(h,b,U)}I=I.next}while(I!==A)}}function Xx(u,h){if(h=h.updateQueue,h=h!==null?h.lastEffect:null,h!==null){var b=h=h.next;do{if((b.tag&u)===u){var A=b.create;b.destroy=A()}b=b.next}while(b!==h)}}function RM(u){var h=u.ref;if(h!==null){var b=u.stateNode;switch(u.tag){case 5:u=b;break;default:u=b}typeof h=="function"?h(u):h.current=u}}function gN(u){var h=u.alternate;h!==null&&(u.alternate=null,gN(h)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(h=u.stateNode,h!==null&&(delete h[Ir],delete h[Tu],delete h[rc],delete h[Op],delete h[Lp])),u.stateNode=null,u.return=null,u.dependencies=null,u.memoizedProps=null,u.memoizedState=null,u.pendingProps=null,u.stateNode=null,u.updateQueue=null}function vN(u){return u.tag===5||u.tag===3||u.tag===4}function yN(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||vN(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function NM(u,h,b){var A=u.tag;if(A===5||A===6)u=u.stateNode,h?b.nodeType===8?b.parentNode.insertBefore(u,h):b.insertBefore(u,h):(b.nodeType===8?(h=b.parentNode,h.insertBefore(u,b)):(h=b,h.appendChild(u)),b=b._reactRootContainer,b!=null||h.onclick!==null||(h.onclick=Qd));else if(A!==4&&(u=u.child,u!==null))for(NM(u,h,b),u=u.sibling;u!==null;)NM(u,h,b),u=u.sibling}function IM(u,h,b){var A=u.tag;if(A===5||A===6)u=u.stateNode,h?b.insertBefore(u,h):b.appendChild(u);else if(A!==4&&(u=u.child,u!==null))for(IM(u,h,b),u=u.sibling;u!==null;)IM(u,h,b),u=u.sibling}var Oi=null,Ea=!1;function Lu(u,h,b){for(b=b.child;b!==null;)xN(u,h,b),b=b.sibling}function xN(u,h,b){if(Kt&&typeof Kt.onCommitFiberUnmount=="function")try{Kt.onCommitFiberUnmount(yn,b)}catch{}switch(b.tag){case 5:Qi||Zp(b,h);case 6:var A=Oi,I=Ea;Oi=null,Lu(u,h,b),Oi=A,Ea=I,Oi!==null&&(Ea?(u=Oi,b=b.stateNode,u.nodeType===8?u.parentNode.removeChild(b):u.removeChild(b)):Oi.removeChild(b.stateNode));break;case 18:Oi!==null&&(Ea?(u=Oi,b=b.stateNode,u.nodeType===8?kp(u.parentNode,b):u.nodeType===1&&kp(u,b),zd(u)):kp(Oi,b.stateNode));break;case 4:A=Oi,I=Ea,Oi=b.stateNode.containerInfo,Ea=!0,Lu(u,h,b),Oi=A,Ea=I;break;case 0:case 11:case 14:case 15:if(!Qi&&(A=b.updateQueue,A!==null&&(A=A.lastEffect,A!==null))){I=A=A.next;do{var U=I,$=U.destroy;U=U.tag,$!==void 0&&((U&2)!==0||(U&4)!==0)&&CM(b,h,$),I=I.next}while(I!==A)}Lu(u,h,b);break;case 1:if(!Qi&&(Zp(b,h),A=b.stateNode,typeof A.componentWillUnmount=="function"))try{A.props=b.memoizedProps,A.state=b.memoizedState,A.componentWillUnmount()}catch(oe){wr(b,h,oe)}Lu(u,h,b);break;case 21:Lu(u,h,b);break;case 22:b.mode&1?(Qi=(A=Qi)||b.memoizedState!==null,Lu(u,h,b),Qi=A):Lu(u,h,b);break;default:Lu(u,h,b)}}function bN(u){var h=u.updateQueue;if(h!==null){u.updateQueue=null;var b=u.stateNode;b===null&&(b=u.stateNode=new nW),h.forEach(function(A){var I=fW.bind(null,u,A);b.has(A)||(b.add(A),A.then(I,I))})}}function Aa(u,h){var b=h.deletions;if(b!==null)for(var A=0;A<b.length;A++){var I=b[A];try{var U=u,$=h,oe=$;e:for(;oe!==null;){switch(oe.tag){case 5:Oi=oe.stateNode,Ea=!1;break e;case 3:Oi=oe.stateNode.containerInfo,Ea=!0;break e;case 4:Oi=oe.stateNode.containerInfo,Ea=!0;break e}oe=oe.return}if(Oi===null)throw Error(n(160));xN(U,$,I),Oi=null,Ea=!1;var me=I.alternate;me!==null&&(me.return=null),I.return=null}catch(Oe){wr(I,h,Oe)}}if(h.subtreeFlags&12854)for(h=h.child;h!==null;)_N(h,u),h=h.sibling}function _N(u,h){var b=u.alternate,A=u.flags;switch(u.tag){case 0:case 11:case 14:case 15:if(Aa(h,u),ul(u),A&4){try{Zv(3,u,u.return),Xx(3,u)}catch(Nt){wr(u,u.return,Nt)}try{Zv(5,u,u.return)}catch(Nt){wr(u,u.return,Nt)}}break;case 1:Aa(h,u),ul(u),A&512&&b!==null&&Zp(b,b.return);break;case 5:if(Aa(h,u),ul(u),A&512&&b!==null&&Zp(b,b.return),u.flags&32){var I=u.stateNode;try{Ke(I,"")}catch(Nt){wr(u,u.return,Nt)}}if(A&4&&(I=u.stateNode,I!=null)){var U=u.memoizedProps,$=b!==null?b.memoizedProps:U,oe=u.type,me=u.updateQueue;if(u.updateQueue=null,me!==null)try{oe==="input"&&U.type==="radio"&&U.name!=null&&re(I,U),Xe(oe,$);var Oe=Xe(oe,U);for($=0;$<me.length;$+=2){var Je=me[$],tt=me[$+1];Je==="style"?vt(I,tt):Je==="dangerouslySetInnerHTML"?Xt(I,tt):Je==="children"?Ke(I,tt):T(I,Je,tt,Oe)}switch(oe){case"input":Ce(I,U);break;case"textarea":ze(I,U);break;case"select":var Qe=I._wrapperState.wasMultiple;I._wrapperState.wasMultiple=!!U.multiple;var _t=U.value;_t!=null?W(I,!!U.multiple,_t,!1):Qe!==!!U.multiple&&(U.defaultValue!=null?W(I,!!U.multiple,U.defaultValue,!0):W(I,!!U.multiple,U.multiple?[]:"",!1))}I[Tu]=U}catch(Nt){wr(u,u.return,Nt)}}break;case 6:if(Aa(h,u),ul(u),A&4){if(u.stateNode===null)throw Error(n(162));I=u.stateNode,U=u.memoizedProps;try{I.nodeValue=U}catch(Nt){wr(u,u.return,Nt)}}break;case 3:if(Aa(h,u),ul(u),A&4&&b!==null&&b.memoizedState.isDehydrated)try{zd(h.containerInfo)}catch(Nt){wr(u,u.return,Nt)}break;case 4:Aa(h,u),ul(u);break;case 13:Aa(h,u),ul(u),I=u.child,I.flags&8192&&(U=I.memoizedState!==null,I.stateNode.isHidden=U,!U||I.alternate!==null&&I.alternate.memoizedState!==null||(LM=lt())),A&4&&bN(u);break;case 22:if(Je=b!==null&&b.memoizedState!==null,u.mode&1?(Qi=(Oe=Qi)||Je,Aa(h,u),Qi=Oe):Aa(h,u),ul(u),A&8192){if(Oe=u.memoizedState!==null,(u.stateNode.isHidden=Oe)&&!Je&&(u.mode&1)!==0)for(At=u,Je=u.child;Je!==null;){for(tt=At=Je;At!==null;){switch(Qe=At,_t=Qe.child,Qe.tag){case 0:case 11:case 14:case 15:Zv(4,Qe,Qe.return);break;case 1:Zp(Qe,Qe.return);var Pt=Qe.stateNode;if(typeof Pt.componentWillUnmount=="function"){A=Qe,b=Qe.return;try{h=A,Pt.props=h.memoizedProps,Pt.state=h.memoizedState,Pt.componentWillUnmount()}catch(Nt){wr(A,b,Nt)}}break;case 5:Zp(Qe,Qe.return);break;case 22:if(Qe.memoizedState!==null){MN(tt);continue}}_t!==null?(_t.return=Qe,At=_t):MN(tt)}Je=Je.sibling}e:for(Je=null,tt=u;;){if(tt.tag===5){if(Je===null){Je=tt;try{I=tt.stateNode,Oe?(U=I.style,typeof U.setProperty=="function"?U.setProperty("display","none","important"):U.display="none"):(oe=tt.stateNode,me=tt.memoizedProps.style,$=me!=null&&me.hasOwnProperty("display")?me.display:null,oe.style.display=Mt("display",$))}catch(Nt){wr(u,u.return,Nt)}}}else if(tt.tag===6){if(Je===null)try{tt.stateNode.nodeValue=Oe?"":tt.memoizedProps}catch(Nt){wr(u,u.return,Nt)}}else if((tt.tag!==22&&tt.tag!==23||tt.memoizedState===null||tt===u)&&tt.child!==null){tt.child.return=tt,tt=tt.child;continue}if(tt===u)break e;for(;tt.sibling===null;){if(tt.return===null||tt.return===u)break e;Je===tt&&(Je=null),tt=tt.return}Je===tt&&(Je=null),tt.sibling.return=tt.return,tt=tt.sibling}}break;case 19:Aa(h,u),ul(u),A&4&&bN(u);break;case 21:break;default:Aa(h,u),ul(u)}}function ul(u){var h=u.flags;if(h&2){try{e:{for(var b=u.return;b!==null;){if(vN(b)){var A=b;break e}b=b.return}throw Error(n(160))}switch(A.tag){case 5:var I=A.stateNode;A.flags&32&&(Ke(I,""),A.flags&=-33);var U=yN(u);IM(u,U,I);break;case 3:case 4:var $=A.stateNode.containerInfo,oe=yN(u);NM(u,oe,$);break;default:throw Error(n(161))}}catch(me){wr(u,u.return,me)}u.flags&=-3}h&4096&&(u.flags&=-4097)}function iW(u,h,b){At=u,wN(u)}function wN(u,h,b){for(var A=(u.mode&1)!==0;At!==null;){var I=At,U=I.child;if(I.tag===22&&A){var $=I.memoizedState!==null||$x;if(!$){var oe=I.alternate,me=oe!==null&&oe.memoizedState!==null||Qi;oe=$x;var Oe=Qi;if($x=$,(Qi=me)&&!Oe)for(At=I;At!==null;)$=At,me=$.child,$.tag===22&&$.memoizedState!==null?EN(I):me!==null?(me.return=$,At=me):EN(I);for(;U!==null;)At=U,wN(U),U=U.sibling;At=I,$x=oe,Qi=Oe}SN(u)}else(I.subtreeFlags&8772)!==0&&U!==null?(U.return=I,At=U):SN(u)}}function SN(u){for(;At!==null;){var h=At;if((h.flags&8772)!==0){var b=h.alternate;try{if((h.flags&8772)!==0)switch(h.tag){case 0:case 11:case 15:Qi||Xx(5,h);break;case 1:var A=h.stateNode;if(h.flags&4&&!Qi)if(b===null)A.componentDidMount();else{var I=h.elementType===h.type?b.memoizedProps:Bs(h.type,b.memoizedProps);A.componentDidUpdate(I,b.memoizedState,A.__reactInternalSnapshotBeforeUpdate)}var U=h.updateQueue;U!==null&&Nu(h,U,A);break;case 3:var $=h.updateQueue;if($!==null){if(b=null,h.child!==null)switch(h.child.tag){case 5:b=h.child.stateNode;break;case 1:b=h.child.stateNode}Nu(h,$,b)}break;case 5:var oe=h.stateNode;if(b===null&&h.flags&4){b=oe;var me=h.memoizedProps;switch(h.type){case"button":case"input":case"select":case"textarea":me.autoFocus&&b.focus();break;case"img":me.src&&(b.src=me.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(h.memoizedState===null){var Oe=h.alternate;if(Oe!==null){var Je=Oe.memoizedState;if(Je!==null){var tt=Je.dehydrated;tt!==null&&zd(tt)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Qi||h.flags&512&&RM(h)}catch(Qe){wr(h,h.return,Qe)}}if(h===u){At=null;break}if(b=h.sibling,b!==null){b.return=h.return,At=b;break}At=h.return}}function MN(u){for(;At!==null;){var h=At;if(h===u){At=null;break}var b=h.sibling;if(b!==null){b.return=h.return,At=b;break}At=h.return}}function EN(u){for(;At!==null;){var h=At;try{switch(h.tag){case 0:case 11:case 15:var b=h.return;try{Xx(4,h)}catch(me){wr(h,b,me)}break;case 1:var A=h.stateNode;if(typeof A.componentDidMount=="function"){var I=h.return;try{A.componentDidMount()}catch(me){wr(h,I,me)}}var U=h.return;try{RM(h)}catch(me){wr(h,U,me)}break;case 5:var $=h.return;try{RM(h)}catch(me){wr(h,$,me)}}}catch(me){wr(h,h.return,me)}if(h===u){At=null;break}var oe=h.sibling;if(oe!==null){oe.return=h.return,At=oe;break}At=h.return}}var sW=Math.ceil,qx=P.ReactCurrentDispatcher,kM=P.ReactCurrentOwner,Do=P.ReactCurrentBatchConfig,kn=0,hi=null,Br=null,Li=0,fo=0,Qp=lr(0),ei=0,Qv=null,yf=0,Kx=0,OM=0,Jv=null,Hs=null,LM=0,Jp=1/0,xc=null,Yx=!1,DM=null,Du=null,Zx=!1,Uu=null,Qx=0,e0=0,UM=null,Jx=-1,eb=0;function xs(){return(kn&6)!==0?lt():Jx!==-1?Jx:Jx=lt()}function ju(u){return(u.mode&1)===0?1:(kn&2)!==0&&Li!==0?Li&-Li:EM.transition!==null?(eb===0&&(eb=ci()),eb):(u=Pn,u!==0||(u=window.event,u=u===void 0?16:xx(u.type)),u)}function Ta(u,h,b,A){if(50<e0)throw e0=0,UM=null,Error(n(185));Za(u,b,A),((kn&2)===0||u!==hi)&&(u===hi&&((kn&2)===0&&(Kx|=b),ei===4&&Fu(u,Li)),Vs(u,A),b===1&&kn===0&&(h.mode&1)===0&&(Jp=lt()+500,tf&&Io()))}function Vs(u,h){var b=u.callbackNode;Ya(u,h);var A=Vn(u,u===hi?Li:0);if(A===0)b!==null&&we(b),u.callbackNode=null,u.callbackPriority=0;else if(h=A&-A,u.callbackPriority!==h){if(b!=null&&we(b),h===1)u.tag===0?kx(TN.bind(null,u)):nf(TN.bind(null,u)),MM(function(){(kn&6)===0&&Io()}),b=null;else{switch(du(A)){case 1:b=jt;break;case 4:b=Bt;break;case 16:b=Rt;break;case 536870912:b=Mn;break;default:b=Rt}b=LN(b,AN.bind(null,u))}u.callbackPriority=h,u.callbackNode=b}}function AN(u,h){if(Jx=-1,eb=0,(kn&6)!==0)throw Error(n(327));var b=u.callbackNode;if(em()&&u.callbackNode!==b)return null;var A=Vn(u,u===hi?Li:0);if(A===0)return null;if((A&30)!==0||(A&u.expiredLanes)!==0||h)h=tb(u,A);else{h=A;var I=kn;kn|=2;var U=CN();(hi!==u||Li!==h)&&(xc=null,Jp=lt()+500,bf(u,h));do try{lW();break}catch(oe){PN(u,oe)}while(!0);dc(),qx.current=U,kn=I,Br!==null?h=0:(hi=null,Li=0,h=ei)}if(h!==0){if(h===2&&(I=Xr(u),I!==0&&(A=I,h=jM(u,I))),h===1)throw b=Qv,bf(u,0),Fu(u,A),Vs(u,lt()),b;if(h===6)Fu(u,A);else{if(I=u.current.alternate,(A&30)===0&&!oW(I)&&(h=tb(u,A),h===2&&(U=Xr(u),U!==0&&(A=U,h=jM(u,U))),h===1))throw b=Qv,bf(u,0),Fu(u,A),Vs(u,lt()),b;switch(u.finishedWork=I,u.finishedLanes=A,h){case 0:case 1:throw Error(n(345));case 2:_f(u,Hs,xc);break;case 3:if(Fu(u,A),(A&130023424)===A&&(h=LM+500-lt(),10<h)){if(Vn(u,0)!==0)break;if(I=u.suspendedLanes,(I&A)!==A){xs(),u.pingedLanes|=u.suspendedLanes&I;break}u.timeoutHandle=Tv(_f.bind(null,u,Hs,xc),h);break}_f(u,Hs,xc);break;case 4:if(Fu(u,A),(A&4194240)===A)break;for(h=u.eventTimes,I=-1;0<A;){var $=31-mt(A);U=1<<$,$=h[$],$>I&&(I=$),A&=~U}if(A=I,A=lt()-A,A=(120>A?120:480>A?480:1080>A?1080:1920>A?1920:3e3>A?3e3:4320>A?4320:1960*sW(A/1960))-A,10<A){u.timeoutHandle=Tv(_f.bind(null,u,Hs,xc),A);break}_f(u,Hs,xc);break;case 5:_f(u,Hs,xc);break;default:throw Error(n(329))}}}return Vs(u,lt()),u.callbackNode===b?AN.bind(null,u):null}function jM(u,h){var b=Jv;return u.current.memoizedState.isDehydrated&&(bf(u,h).flags|=256),u=tb(u,h),u!==2&&(h=Hs,Hs=b,h!==null&&FM(h)),u}function FM(u){Hs===null?Hs=u:Hs.push.apply(Hs,u)}function oW(u){for(var h=u;;){if(h.flags&16384){var b=h.updateQueue;if(b!==null&&(b=b.stores,b!==null))for(var A=0;A<b.length;A++){var I=b[A],U=I.getSnapshot;I=I.value;try{if(!ds(U(),I))return!1}catch{return!1}}}if(b=h.child,h.subtreeFlags&16384&&b!==null)b.return=h,h=b;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 Fu(u,h){for(h&=~OM,h&=~Kx,u.suspendedLanes|=h,u.pingedLanes&=~h,u=u.expirationTimes;0<h;){var b=31-mt(h),A=1<<b;u[b]=-1,h&=~A}}function TN(u){if((kn&6)!==0)throw Error(n(327));em();var h=Vn(u,0);if((h&1)===0)return Vs(u,lt()),null;var b=tb(u,h);if(u.tag!==0&&b===2){var A=Xr(u);A!==0&&(h=A,b=jM(u,A))}if(b===1)throw b=Qv,bf(u,0),Fu(u,h),Vs(u,lt()),b;if(b===6)throw Error(n(345));return u.finishedWork=u.current.alternate,u.finishedLanes=h,_f(u,Hs,xc),Vs(u,lt()),null}function zM(u,h){var b=kn;kn|=1;try{return u(h)}finally{kn=b,kn===0&&(Jp=lt()+500,tf&&Io())}}function xf(u){Uu!==null&&Uu.tag===0&&(kn&6)===0&&em();var h=kn;kn|=1;var b=Do.transition,A=Pn;try{if(Do.transition=null,Pn=1,u)return u()}finally{Pn=A,Do.transition=b,kn=h,(kn&6)===0&&Io()}}function BM(){fo=Qp.current,$n(Qp)}function bf(u,h){u.finishedWork=null,u.finishedLanes=0;var b=u.timeoutHandle;if(b!==-1&&(u.timeoutHandle=-1,Pv(b)),Br!==null)for(b=Br.return;b!==null;){var A=b;switch(va(A),A.tag){case 1:A=A.type.childContextTypes,A!=null&&Jd();break;case 3:ll(),$n(Ri),$n(Kr),Oo();break;case 5:Iu(A);break;case 4:ll();break;case 13:$n(Yn);break;case 19:$n(Yn);break;case 10:af(A.type._context);break;case 22:case 23:BM()}b=b.return}if(hi=u,Br=u=zu(u.current,null),Li=fo=h,ei=0,Qv=null,OM=Kx=yf=0,Hs=Jv=null,xa!==null){for(h=0;h<xa.length;h++)if(b=xa[h],A=b.interleaved,A!==null){b.interleaved=null;var I=A.next,U=b.pending;if(U!==null){var $=U.next;U.next=I,A.next=$}b.pending=A}xa=null}return u}function PN(u,h){do{var b=Br;try{if(dc(),mc.current=Kp,co){for(var A=Xn.memoizedState;A!==null;){var I=A.queue;I!==null&&(I.pending=null),A=A.next}co=!1}if(_a=0,Cn=ur=Xn=null,fi=!1,cl=0,kM.current=null,b===null||b.return===null){ei=1,Qv=h,Br=null;break}e:{var U=u,$=b.return,oe=b,me=h;if(h=Li,oe.flags|=32768,me!==null&&typeof me=="object"&&typeof me.then=="function"){var Oe=me,Je=oe,tt=Je.tag;if((Je.mode&1)===0&&(tt===0||tt===11||tt===15)){var Qe=Je.alternate;Qe?(Je.updateQueue=Qe.updateQueue,Je.memoizedState=Qe.memoizedState,Je.lanes=Qe.lanes):(Je.updateQueue=null,Je.memoizedState=null)}var _t=St($);if(_t!==null){_t.flags&=-257,rn(_t,$,oe,U,h),_t.mode&1&&st(U,Oe,h),h=_t,me=Oe;var Pt=h.updateQueue;if(Pt===null){var Nt=new Set;Nt.add(me),h.updateQueue=Nt}else Pt.add(me);break e}else{if((h&1)===0){st(U,Oe,h),HM();break e}me=Error(n(426))}}else if(Kn&&oe.mode&1){var kr=St($);if(kr!==null){(kr.flags&65536)===0&&(kr.flags|=256),rn(kr,$,oe,U,h),Cu(C(me,oe));break e}}U=me=C(me,oe),ei!==4&&(ei=2),Jv===null?Jv=[U]:Jv.push(U),U=$;do{switch(U.tag){case 3:U.flags|=65536,h&=-h,U.lanes|=h;var Ae=ye(U,me,h);fc(U,Ae);break e;case 1:oe=me;var ve=U.type,Pe=U.stateNode;if((U.flags&128)===0&&(typeof ve.getDerivedStateFromError=="function"||Pe!==null&&typeof Pe.componentDidCatch=="function"&&(Du===null||!Du.has(Pe)))){U.flags|=65536,h&=-h,U.lanes|=h;var at=je(U,oe,h);fc(U,at);break e}}U=U.return}while(U!==null)}NN(b)}catch(Dt){h=Dt,Br===b&&b!==null&&(Br=b=b.return);continue}break}while(!0)}function CN(){var u=qx.current;return qx.current=Kp,u===null?Kp:u}function HM(){(ei===0||ei===3||ei===2)&&(ei=4),hi===null||(yf&268435455)===0&&(Kx&268435455)===0||Fu(hi,Li)}function tb(u,h){var b=kn;kn|=2;var A=CN();(hi!==u||Li!==h)&&(xc=null,bf(u,h));do try{aW();break}catch(I){PN(u,I)}while(!0);if(dc(),kn=b,qx.current=A,Br!==null)throw Error(n(261));return hi=null,Li=0,ei}function aW(){for(;Br!==null;)RN(Br)}function lW(){for(;Br!==null&&!it();)RN(Br)}function RN(u){var h=ON(u.alternate,u,fo);u.memoizedProps=u.pendingProps,h===null?NN(u):Br=h,kM.current=null}function NN(u){var h=u;do{var b=h.alternate;if(u=h.return,(h.flags&32768)===0){if(b=eW(b,h,fo),b!==null){Br=b;return}}else{if(b=tW(b,h),b!==null){b.flags&=32767,Br=b;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 _f(u,h,b){var A=Pn,I=Do.transition;try{Do.transition=null,Pn=1,cW(u,h,b,A)}finally{Do.transition=I,Pn=A}return null}function cW(u,h,b,A){do em();while(Uu!==null);if((kn&6)!==0)throw Error(n(327));b=u.finishedWork;var I=u.finishedLanes;if(b===null)return null;if(u.finishedWork=null,u.finishedLanes=0,b===u.current)throw Error(n(177));u.callbackNode=null,u.callbackPriority=0;var U=b.lanes|b.childLanes;if(bM(u,U),u===hi&&(Br=hi=null,Li=0),(b.subtreeFlags&2064)===0&&(b.flags&2064)===0||Zx||(Zx=!0,LN(Rt,function(){return em(),null})),U=(b.flags&15990)!==0,(b.subtreeFlags&15990)!==0||U){U=Do.transition,Do.transition=null;var $=Pn;Pn=1;var oe=kn;kn|=4,kM.current=null,rW(u,b),_N(b,u),Ur(Ev),ks=!!Au,Ev=Au=null,u.current=b,iW(b),yt(),kn=oe,Pn=$,Do.transition=U}else u.current=b;if(Zx&&(Zx=!1,Uu=u,Qx=I),U=u.pendingLanes,U===0&&(Du=null),Ut(b.stateNode),Vs(u,lt()),h!==null)for(A=u.onRecoverableError,b=0;b<h.length;b++)I=h[b],A(I.value,{componentStack:I.stack,digest:I.digest});if(Yx)throw Yx=!1,u=DM,DM=null,u;return(Qx&1)!==0&&u.tag!==0&&em(),U=u.pendingLanes,(U&1)!==0?u===UM?e0++:(e0=0,UM=u):e0=0,Io(),null}function em(){if(Uu!==null){var u=du(Qx),h=Do.transition,b=Pn;try{if(Do.transition=null,Pn=16>u?16:u,Uu===null)var A=!1;else{if(u=Uu,Uu=null,Qx=0,(kn&6)!==0)throw Error(n(331));var I=kn;for(kn|=4,At=u.current;At!==null;){var U=At,$=U.child;if((At.flags&16)!==0){var oe=U.deletions;if(oe!==null){for(var me=0;me<oe.length;me++){var Oe=oe[me];for(At=Oe;At!==null;){var Je=At;switch(Je.tag){case 0:case 11:case 15:Zv(8,Je,U)}var tt=Je.child;if(tt!==null)tt.return=Je,At=tt;else for(;At!==null;){Je=At;var Qe=Je.sibling,_t=Je.return;if(gN(Je),Je===Oe){At=null;break}if(Qe!==null){Qe.return=_t,At=Qe;break}At=_t}}}var Pt=U.alternate;if(Pt!==null){var Nt=Pt.child;if(Nt!==null){Pt.child=null;do{var kr=Nt.sibling;Nt.sibling=null,Nt=kr}while(Nt!==null)}}At=U}}if((U.subtreeFlags&2064)!==0&&$!==null)$.return=U,At=$;else e:for(;At!==null;){if(U=At,(U.flags&2048)!==0)switch(U.tag){case 0:case 11:case 15:Zv(9,U,U.return)}var Ae=U.sibling;if(Ae!==null){Ae.return=U.return,At=Ae;break e}At=U.return}}var ve=u.current;for(At=ve;At!==null;){$=At;var Pe=$.child;if(($.subtreeFlags&2064)!==0&&Pe!==null)Pe.return=$,At=Pe;else e:for($=ve;At!==null;){if(oe=At,(oe.flags&2048)!==0)try{switch(oe.tag){case 0:case 11:case 15:Xx(9,oe)}}catch(Dt){wr(oe,oe.return,Dt)}if(oe===$){At=null;break e}var at=oe.sibling;if(at!==null){at.return=oe.return,At=at;break e}At=oe.return}}if(kn=I,Io(),Kt&&typeof Kt.onPostCommitFiberRoot=="function")try{Kt.onPostCommitFiberRoot(yn,u)}catch{}A=!0}return A}finally{Pn=b,Do.transition=h}}return!1}function IN(u,h,b){h=C(b,h),h=ye(u,h,1),u=Jn(u,h,1),h=xs(),u!==null&&(Za(u,1,h),Vs(u,h))}function wr(u,h,b){if(u.tag===3)IN(u,u,b);else for(;h!==null;){if(h.tag===3){IN(h,u,b);break}else if(h.tag===1){var A=h.stateNode;if(typeof h.type.getDerivedStateFromError=="function"||typeof A.componentDidCatch=="function"&&(Du===null||!Du.has(A))){u=C(b,u),u=je(h,u,1),h=Jn(h,u,1),u=xs(),h!==null&&(Za(h,1,u),Vs(h,u));break}}h=h.return}}function uW(u,h,b){var A=u.pingCache;A!==null&&A.delete(h),h=xs(),u.pingedLanes|=u.suspendedLanes&b,hi===u&&(Li&b)===b&&(ei===4||ei===3&&(Li&130023424)===Li&&500>lt()-LM?bf(u,0):OM|=b),Vs(u,h)}function kN(u,h){h===0&&((u.mode&1)===0?h=1:(h=In,In<<=1,(In&130023424)===0&&(In=4194304)));var b=xs();u=ao(u,h),u!==null&&(Za(u,h,b),Vs(u,b))}function dW(u){var h=u.memoizedState,b=0;h!==null&&(b=h.retryLane),kN(u,b)}function fW(u,h){var b=0;switch(u.tag){case 13:var A=u.stateNode,I=u.memoizedState;I!==null&&(b=I.retryLane);break;case 19:A=u.stateNode;break;default:throw Error(n(314))}A!==null&&A.delete(h),kN(u,b)}var ON;ON=function(u,h,b){if(u!==null)if(u.memoizedProps!==h.pendingProps||Ri.current)ln=!0;else{if((u.lanes&b)===0&&(h.flags&128)===0)return ln=!1,JG(u,h,b);ln=(u.flags&131072)!==0}else ln=!1,Kn&&(h.flags&1048576)!==0&&kv(h,Fp,h.index);switch(h.lanes=0,h.tag){case 2:var A=h.type;Wx(u,h),u=h.pendingProps;var I=ic(h,Kr.current);al(h,b),I=ff(null,h,A,u,I,b);var U=Bv();return h.flags|=1,typeof I=="object"&&I!==null&&typeof I.render=="function"&&I.$$typeof===void 0?(h.tag=1,h.memoizedState=null,h.updateQueue=null,ui(A)?(U=!0,sc(h)):U=!1,h.memoizedState=I.state!==null&&I.state!==void 0?I.state:null,an(h),I.updater=Yp,h.stateNode=I,I._reactInternals=h,M(h,A,u,b),h=on(null,h,A,!0,U,b)):(h.tag=0,Kn&&U&&Ov(h),xt(null,h,I,b),h=h.child),h;case 16:A=h.elementType;e:{switch(Wx(u,h),u=h.pendingProps,I=A._init,A=I(A._payload),h.type=A,I=h.tag=pW(A),u=Bs(A,u),I){case 0:h=gt(null,h,A,u,b);break e;case 1:h=Ot(null,h,A,u,b);break e;case 11:h=Jr(null,h,A,u,b);break e;case 14:h=ys(null,h,A,Bs(A.type,u),b);break e}throw Error(n(306,A,""))}return h;case 0:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),gt(u,h,A,I,b);case 1:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),Ot(u,h,A,I,b);case 3:e:{if(sn(h),u===null)throw Error(n(387));A=h.pendingProps,U=h.memoizedState,I=U.element,gr(u,h),cr(h,A,null,b);var $=h.memoizedState;if(A=$.element,U.isDehydrated)if(U={element:A,isDehydrated:!1,cache:$.cache,pendingSuspenseBoundaries:$.pendingSuspenseBoundaries,transitions:$.transitions},h.updateQueue.baseState=U,h.memoizedState=U,h.flags&256){I=C(Error(n(423)),h),h=En(u,h,A,b,I);break e}else if(A!==I){I=C(Error(n(424)),h),h=En(u,h,A,b,I);break e}else for(Ii=fa(h.stateNode.containerInfo.firstChild),Yr=h,Kn=!0,zs=null,b=of(h,null,A,b),h.child=b;b;)b.flags=b.flags&-3|4096,b=b.sibling;else{if(ol(),A===I){h=yc(u,h,b);break e}xt(u,h,A,b)}h=h.child}return h;case 5:return pc(h),u===null&&Bp(h),A=h.type,I=h.pendingProps,U=u!==null?u.memoizedProps:null,$=I.children,Av(A,I)?$=null:U!==null&&Av(A,U)&&(h.flags|=32),De(u,h),xt(u,h,$,b),h.child;case 6:return u===null&&Bp(h),null;case 13:return Ma(u,h,b);case 4:return uf(h,h.stateNode.containerInfo),A=h.pendingProps,u===null?h.child=lc(h,null,A,b):xt(u,h,A,b),h.child;case 11:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),Jr(u,h,A,I,b);case 7:return xt(u,h,h.pendingProps,b),h.child;case 8:return xt(u,h,h.pendingProps.children,b),h.child;case 12:return xt(u,h,h.pendingProps.children,b),h.child;case 10:e:{if(A=h.type._context,I=h.pendingProps,U=h.memoizedProps,$=I.value,Gn(cc,A._currentValue),A._currentValue=$,U!==null)if(ds(U.value,$)){if(U.children===I.children&&!Ri.current){h=yc(u,h,b);break e}}else for(U=h.child,U!==null&&(U.return=h);U!==null;){var oe=U.dependencies;if(oe!==null){$=U.child;for(var me=oe.firstContext;me!==null;){if(me.context===A){if(U.tag===1){me=zn(-1,b&-b),me.tag=2;var Oe=U.updateQueue;if(Oe!==null){Oe=Oe.shared;var Je=Oe.pending;Je===null?me.next=me:(me.next=Je.next,Je.next=me),Oe.pending=me}}U.lanes|=b,me=U.alternate,me!==null&&(me.lanes|=b),lf(U.return,b,h),oe.lanes|=b;break}me=me.next}}else if(U.tag===10)$=U.type===h.type?null:U.child;else if(U.tag===18){if($=U.return,$===null)throw Error(n(341));$.lanes|=b,oe=$.alternate,oe!==null&&(oe.lanes|=b),lf($,b,h),$=U.sibling}else $=U.child;if($!==null)$.return=U;else for($=U;$!==null;){if($===h){$=null;break}if(U=$.sibling,U!==null){U.return=$.return,$=U;break}$=$.return}U=$}xt(u,h,I.children,b),h=h.child}return h;case 9:return I=h.type,A=h.pendingProps.children,al(h,b),I=ps(I),A=A(I),h.flags|=1,xt(u,h,A,b),h.child;case 14:return A=h.type,I=Bs(A,h.pendingProps),I=Bs(A.type,I),ys(u,h,A,I,b);case 15:return Ne(u,h,h.type,h.pendingProps,b);case 17:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),Wx(u,h),h.tag=1,ui(A)?(u=!0,sc(h)):u=!1,al(h,b),m(h,A,I),M(h,A,I,b),on(null,h,A,!0,u,b);case 19:return dN(u,h,b);case 22:return _e(u,h,b)}throw Error(n(156,h.tag))};function LN(u,h){return Ie(u,h)}function hW(u,h,b,A){this.tag=u,this.key=b,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=h,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=A,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Uo(u,h,b,A){return new hW(u,h,b,A)}function VM(u){return u=u.prototype,!(!u||!u.isReactComponent)}function pW(u){if(typeof u=="function")return VM(u)?1:0;if(u!=null){if(u=u.$$typeof,u===H)return 11;if(u===he)return 14}return 2}function zu(u,h){var b=u.alternate;return b===null?(b=Uo(u.tag,h,u.key,u.mode),b.elementType=u.elementType,b.type=u.type,b.stateNode=u.stateNode,b.alternate=u,u.alternate=b):(b.pendingProps=h,b.type=u.type,b.flags=0,b.subtreeFlags=0,b.deletions=null),b.flags=u.flags&14680064,b.childLanes=u.childLanes,b.lanes=u.lanes,b.child=u.child,b.memoizedProps=u.memoizedProps,b.memoizedState=u.memoizedState,b.updateQueue=u.updateQueue,h=u.dependencies,b.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext},b.sibling=u.sibling,b.index=u.index,b.ref=u.ref,b}function nb(u,h,b,A,I,U){var $=2;if(A=u,typeof u=="function")VM(u)&&($=1);else if(typeof u=="string")$=5;else e:switch(u){case D:return wf(b.children,I,U,h);case z:$=8,I|=8;break;case G:return u=Uo(12,b,h,I|2),u.elementType=G,u.lanes=U,u;case ee:return u=Uo(13,b,h,I),u.elementType=ee,u.lanes=U,u;case te:return u=Uo(19,b,h,I),u.elementType=te,u.lanes=U,u;case fe:return rb(b,I,U,h);default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case k:$=10;break e;case j:$=9;break e;case H:$=11;break e;case he:$=14;break e;case se:$=16,A=null;break e}throw Error(n(130,u==null?u:typeof u,""))}return h=Uo($,b,h,I),h.elementType=u,h.type=A,h.lanes=U,h}function wf(u,h,b,A){return u=Uo(7,u,A,h),u.lanes=b,u}function rb(u,h,b,A){return u=Uo(22,u,A,h),u.elementType=fe,u.lanes=b,u.stateNode={isHidden:!1},u}function GM(u,h,b){return u=Uo(6,u,null,h),u.lanes=b,u}function WM(u,h,b){return h=Uo(4,u.children!==null?u.children:[],u.key,h),h.lanes=b,h.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},h}function mW(u,h,b,A,I){this.tag=h,this.containerInfo=u,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Dd(0),this.expirationTimes=Dd(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Dd(0),this.identifierPrefix=A,this.onRecoverableError=I,this.mutableSourceEagerHydrationData=null}function $M(u,h,b,A,I,U,$,oe,me){return u=new mW(u,h,b,oe,me),h===1?(h=1,U===!0&&(h|=8)):h=0,U=Uo(3,null,null,h),u.current=U,U.stateNode=u,U.memoizedState={element:A,isDehydrated:b,cache:null,transitions:null,pendingSuspenseBoundaries:null},an(U),u}function gW(u,h,b){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:b}}function DN(u){if(!u)return pa;u=u._reactInternals;e:{if(To(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 b=u.type;if(ui(b))return ef(u,b,h)}return h}function UN(u,h,b,A,I,U,$,oe,me){return u=$M(b,A,!0,u,I,U,$,oe,me),u.context=DN(null),b=u.current,A=xs(),I=ju(b),U=zn(A,I),U.callback=h??null,Jn(b,U,I),u.current.lanes=I,Za(u,I,A),Vs(u,A),u}function ib(u,h,b,A){var I=h.current,U=xs(),$=ju(I);return b=DN(b),h.context===null?h.context=b:h.pendingContext=b,h=zn(U,$),h.payload={element:u},A=A===void 0?null:A,A!==null&&(h.callback=A),u=Jn(I,h,$),u!==null&&(Ta(u,I,$,U),di(u,I,$)),$}function sb(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 jN(u,h){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var b=u.retryLane;u.retryLane=b!==0&&b<h?b:h}}function XM(u,h){jN(u,h),(u=u.alternate)&&jN(u,h)}function vW(){return null}var FN=typeof reportError=="function"?reportError:function(u){console.error(u)};function qM(u){this._internalRoot=u}ob.prototype.render=qM.prototype.render=function(u){var h=this._internalRoot;if(h===null)throw Error(n(409));ib(u,h,null,null)},ob.prototype.unmount=qM.prototype.unmount=function(){var u=this._internalRoot;if(u!==null){this._internalRoot=null;var h=u.containerInfo;xf(function(){ib(null,u,null,null)}),h[hs]=null}};function ob(u){this._internalRoot=u}ob.prototype.unstable_scheduleHydration=function(u){if(u){var h=ip();u={blockedOn:null,target:u,priority:h};for(var b=0;b<Qa.length&&h!==0&&h<Qa[b].priority;b++);Qa.splice(b,0,u),b===0&&ap(u)}};function KM(u){return!(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)}function ab(u){return!(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11&&(u.nodeType!==8||u.nodeValue!==" react-mount-point-unstable "))}function zN(){}function yW(u,h,b,A,I){if(I){if(typeof A=="function"){var U=A;A=function(){var Oe=sb($);U.call(Oe)}}var $=UN(h,A,u,0,null,!1,!1,"",zN);return u._reactRootContainer=$,u[hs]=$.current,Mu(u.nodeType===8?u.parentNode:u),xf(),$}for(;I=u.lastChild;)u.removeChild(I);if(typeof A=="function"){var oe=A;A=function(){var Oe=sb(me);oe.call(Oe)}}var me=$M(u,0,!1,null,null,!1,!1,"",zN);return u._reactRootContainer=me,u[hs]=me.current,Mu(u.nodeType===8?u.parentNode:u),xf(function(){ib(h,me,b,A)}),me}function lb(u,h,b,A,I){var U=b._reactRootContainer;if(U){var $=U;if(typeof I=="function"){var oe=I;I=function(){var me=sb($);oe.call(me)}}ib(h,$,u,I)}else $=yW(b,h,u,I,A);return sb($)}Ud=function(u){switch(u.tag){case 3:var h=u.stateNode;if(h.current.memoizedState.isDehydrated){var b=Is(h.pendingLanes);b!==0&&(uu(h,b|1),Vs(h,lt()),(kn&6)===0&&(Jp=lt()+500,Io()))}break;case 13:xf(function(){var A=ao(u,1);if(A!==null){var I=xs();Ta(A,u,1,I)}}),XM(u,1)}},lv=function(u){if(u.tag===13){var h=ao(u,134217728);if(h!==null){var b=xs();Ta(h,u,134217728,b)}XM(u,134217728)}},yx=function(u){if(u.tag===13){var h=ju(u),b=ao(u,h);if(b!==null){var A=xs();Ta(b,u,h,A)}XM(u,h)}},ip=function(){return Pn},sp=function(u,h){var b=Pn;try{return Pn=u,h()}finally{Pn=b}},Re=function(u,h,b){switch(h){case"input":if(Ce(u,b),h=b.name,b.type==="radio"&&h!=null){for(b=u;b.parentNode;)b=b.parentNode;for(b=b.querySelectorAll("input[name="+JSON.stringify(""+h)+'][type="radio"]'),h=0;h<b.length;h++){var A=b[h];if(A!==u&&A.form===u.form){var I=Dp(A);if(!I)throw Error(n(90));ue(A),Ce(A,I)}}}break;case"textarea":ze(u,b);break;case"select":h=b.value,h!=null&&W(u,!!b.multiple,h,!1)}},jn=zM,en=xf;var xW={usingClientEntryPoint:!1,Events:[ha,mr,Dp,Jt,pn,zM]},t0={findFiberByHostInstance:sl,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},bW={bundleType:t0.bundleType,version:t0.version,rendererPackageName:t0.rendererPackageName,rendererConfig:t0.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:P.ReactCurrentDispatcher,findHostInstanceByFiber:function(u){return u=xe(u),u===null?null:u.stateNode},findFiberByHostInstance:t0.findFiberByHostInstance||vW,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 cb=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!cb.isDisabled&&cb.supportsFiber)try{yn=cb.inject(bW),Kt=cb}catch{}}return Ws.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=xW,Ws.createPortal=function(u,h){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!KM(h))throw Error(n(200));return gW(u,h,null,b)},Ws.createRoot=function(u,h){if(!KM(u))throw Error(n(299));var b=!1,A="",I=FN;return h!=null&&(h.unstable_strictMode===!0&&(b=!0),h.identifierPrefix!==void 0&&(A=h.identifierPrefix),h.onRecoverableError!==void 0&&(I=h.onRecoverableError)),h=$M(u,1,!1,null,null,b,!1,A,I),u[hs]=h.current,Mu(u.nodeType===8?u.parentNode:u),new qM(h)},Ws.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=xe(h),u=u===null?null:u.stateNode,u},Ws.flushSync=function(u){return xf(u)},Ws.hydrate=function(u,h,b){if(!ab(h))throw Error(n(200));return lb(null,u,h,!0,b)},Ws.hydrateRoot=function(u,h,b){if(!KM(u))throw Error(n(405));var A=b!=null&&b.hydratedSources||null,I=!1,U="",$=FN;if(b!=null&&(b.unstable_strictMode===!0&&(I=!0),b.identifierPrefix!==void 0&&(U=b.identifierPrefix),b.onRecoverableError!==void 0&&($=b.onRecoverableError)),h=UN(h,null,u,1,b??null,I,!1,U,$),u[hs]=h.current,Mu(u),A)for(u=0;u<A.length;u++)b=A[u],I=b._getVersion,I=I(b._source),h.mutableSourceEagerHydrationData==null?h.mutableSourceEagerHydrationData=[b,I]:h.mutableSourceEagerHydrationData.push(b,I);return new ob(h)},Ws.render=function(u,h,b){if(!ab(h))throw Error(n(200));return lb(null,u,h,!1,b)},Ws.unmountComponentAtNode=function(u){if(!ab(u))throw Error(n(40));return u._reactRootContainer?(xf(function(){lb(null,null,u,!1,function(){u._reactRootContainer=null,u[hs]=null})}),!0):!1},Ws.unstable_batchedUpdates=zM,Ws.unstable_renderSubtreeIntoContainer=function(u,h,b,A){if(!ab(b))throw Error(n(200));if(u==null||u._reactInternals===void 0)throw Error(n(38));return lb(u,h,b,!1,A)},Ws.version="18.3.1-next-f1338f8080-20240426",Ws}var KN;function Xj(){if(KN)return JM.exports;KN=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(),JM.exports=RW(),JM.exports}var YN;function NW(){if(YN)return db;YN=1;var t=Xj();return db.createRoot=t.createRoot,db.hydrateRoot=t.hydrateRoot,db}var IW=NW();const kW=B1(IW);var Vy=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},fh,cd,sg,Dj,OW=(Dj=class extends Vy{constructor(){super();Gt(this,fh);Gt(this,cd);Gt(this,sg);wt(this,sg,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){ge(this,cd)||this.setEventListener(ge(this,sg))}onUnsubscribe(){var e;this.hasListeners()||((e=ge(this,cd))==null||e.call(this),wt(this,cd,void 0))}setEventListener(e){var n;wt(this,sg,e),(n=ge(this,cd))==null||n.call(this),wt(this,cd,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){ge(this,fh)!==e&&(wt(this,fh,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof ge(this,fh)=="boolean"?ge(this,fh):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},fh=new WeakMap,cd=new WeakMap,sg=new WeakMap,Dj),gC=new OW,LW={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},ud,mC,Uj,DW=(Uj=class{constructor(){Gt(this,ud,LW);Gt(this,mC,!1)}setTimeoutProvider(t){wt(this,ud,t)}setTimeout(t,e){return ge(this,ud).setTimeout(t,e)}clearTimeout(t){ge(this,ud).clearTimeout(t)}setInterval(t,e){return ge(this,ud).setInterval(t,e)}clearInterval(t){ge(this,ud).clearInterval(t)}},ud=new WeakMap,mC=new WeakMap,Uj),eh=new DW;function UW(t){setTimeout(t,0)}var jW=typeof window>"u"||"Deno"in globalThis;function qs(){}function FW(t,e){return typeof t=="function"?t(e):t}function pT(t){return typeof t=="number"&&t>=0&&t!==1/0}function qj(t,e){return Math.max(t+(e||0)-Date.now(),0)}function yd(t,e){return typeof t=="function"?t(e):t}function vo(t,e){return typeof t=="function"?t(e):t}function ZN(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=t;if(o){if(r){if(e.queryHash!==vC(o,e.options))return!1}else if(!sy(e.queryKey,o))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||i&&i!==e.state.fetchStatus||s&&!s(e))}function QN(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(iy(e.options.mutationKey)!==iy(s))return!1}else if(!sy(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function vC(t,e){return((e==null?void 0:e.queryKeyHashFn)||iy)(t)}function iy(t){return JSON.stringify(t,(e,n)=>gT(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function sy(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>sy(t[n],e[n])):!1}var zW=Object.prototype.hasOwnProperty;function Kj(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=JN(t)&&JN(e);if(!r&&!(gT(t)&&gT(e)))return e;const s=(r?t:Object.keys(t)).length,o=r?e:Object.keys(e),a=o.length,l=r?new Array(a):{};let c=0;for(let d=0;d<a;d++){const f=r?d:o[d],p=t[f],y=e[f];if(p===y){l[f]=p,(r?d<s:zW.call(t,f))&&c++;continue}if(p===null||y===null||typeof p!="object"||typeof y!="object"){l[f]=y;continue}const x=Kj(p,y,n+1);l[f]=x,x===p&&c++}return s===a&&c===s?t:l}function mT(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 JN(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function gT(t){if(!eI(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!eI(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function eI(t){return Object.prototype.toString.call(t)==="[object Object]"}function BW(t){return new Promise(e=>{eh.setTimeout(e,t)})}function vT(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?Kj(t,e):e}function HW(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function VW(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var yC=Symbol();function Yj(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===yC?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Zj(t,e){return typeof t=="function"?t(...e):!!t}function GW(t,e,n){let r=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(i??(i=e()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),t}var oy=(()=>{let t=()=>jW;return{isServer(){return t()},setIsServer(e){t=e}}})();function yT(){let t,e;const n=new Promise((i,s)=>{t=i,e=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}var WW=UW;function $W(){let t=[],e=0,n=a=>{a()},r=a=>{a()},i=WW;const s=a=>{e?t.push(a):i(()=>{n(a)})},o=()=>{const a=t;t=[],a.length&&i(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||o()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var zi=$W(),og,dd,ag,jj,XW=(jj=class extends Vy{constructor(){super();Gt(this,og,!0);Gt(this,dd);Gt(this,ag);wt(this,ag,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,dd)||this.setEventListener(ge(this,ag))}onUnsubscribe(){var e;this.hasListeners()||((e=ge(this,dd))==null||e.call(this),wt(this,dd,void 0))}setEventListener(e){var n;wt(this,ag,e),(n=ge(this,dd))==null||n.call(this),wt(this,dd,e(this.setOnline.bind(this)))}setOnline(e){ge(this,og)!==e&&(wt(this,og,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return ge(this,og)}},og=new WeakMap,dd=new WeakMap,ag=new WeakMap,jj),Q_=new XW;function qW(t){return Math.min(1e3*2**t,3e4)}function Qj(t){return(t??"online")==="online"?Q_.isOnline():!0}var xT=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function Jj(t){let e=!1,n=0,r;const i=yT(),s=()=>i.status!=="pending",o=S=>{var w;if(!s()){const _=new xT(S);p(_),(w=t.onCancel)==null||w.call(t,_)}},a=()=>{e=!0},l=()=>{e=!1},c=()=>gC.isFocused()&&(t.networkMode==="always"||Q_.isOnline())&&t.canRun(),d=()=>Qj(t.networkMode)&&t.canRun(),f=S=>{s()||(r==null||r(),i.resolve(S))},p=S=>{s()||(r==null||r(),i.reject(S))},y=()=>new Promise(S=>{var w;r=_=>{(s()||c())&&S(_)},(w=t.onPause)==null||w.call(t)}).then(()=>{var S;r=void 0,s()||(S=t.onContinue)==null||S.call(t)}),x=()=>{if(s())return;let S;const w=n===0?t.initialPromise:void 0;try{S=w??t.fn()}catch(_){S=Promise.reject(_)}Promise.resolve(S).then(f).catch(_=>{var N;if(s())return;const E=t.retry??(oy.isServer()?0:3),T=t.retryDelay??qW,P=typeof T=="function"?T(n,_):T,O=E===!0||typeof E=="number"&&n<E||typeof E=="function"&&E(n,_);if(e||!O){p(_);return}n++,(N=t.onFail)==null||N.call(t,n,_),BW(P).then(()=>c()?void 0:y()).then(()=>{e?p(_):x()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r==null||r(),i),cancelRetry:a,continueRetry:l,canStart:d,start:()=>(d()?x():y().then(x),i)}}var hh,Fj,eF=(Fj=class{constructor(){Gt(this,hh)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),pT(this.gcTime)&&wt(this,hh,eh.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(oy.isServer()?1/0:300*1e3))}clearGcTimeout(){ge(this,hh)!==void 0&&(eh.clearTimeout(ge(this,hh)),wt(this,hh,void 0))}},hh=new WeakMap,Fj);function KW(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)||[],o=((x=e.state.data)==null?void 0:x.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let S=!1;const w=T=>{GW(T,()=>e.signal,()=>S=!0)},_=Yj(e.options,e.fetchOptions),E=async(T,P,O)=>{if(S)return Promise.reject(e.signal.reason);if(P==null&&T.pages.length)return Promise.resolve(T);const D=(()=>{const j={client:e.client,queryKey:e.queryKey,pageParam:P,direction:O?"backward":"forward",meta:e.options.meta};return w(j),j})(),z=await _(D),{maxPages:G}=e.options,k=O?VW:HW;return{pages:k(T.pages,z,G),pageParams:k(T.pageParams,P,G)}};if(i&&s.length){const T=i==="backward",P=T?YW:tI,O={pages:s,pageParams:o},N=P(r,O);a=await E(O,N,T)}else{const T=t??s.length;do{const P=l===0?o[0]??r.initialPageParam:tI(r,a);if(l>0&&P==null)break;a=await E(a,P),l++}while(l<T)}return a};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 tI(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function YW(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var lg,ph,cg,Ho,mh,gi,jy,gh,go,tF,Tc,zj,ZW=(zj=class extends eF{constructor(e){super();Gt(this,go);Gt(this,lg);Gt(this,ph);Gt(this,cg);Gt(this,Ho);Gt(this,mh);Gt(this,gi);Gt(this,jy);Gt(this,gh);wt(this,gh,!1),wt(this,jy,e.defaultOptions),this.setOptions(e.options),this.observers=[],wt(this,mh,e.client),wt(this,Ho,ge(this,mh).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,wt(this,ph,rI(this.options)),this.state=e.state??ge(this,ph),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return ge(this,lg)}get promise(){var e;return(e=ge(this,gi))==null?void 0:e.promise}setOptions(e){if(this.options={...ge(this,jy),...e},e!=null&&e._type&&wt(this,lg,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=rI(this.options);n.data!==void 0&&(this.setState(nI(n.data,n.dataUpdatedAt)),wt(this,ph,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ge(this,Ho).remove(this)}setData(e,n){const r=vT(this.state.data,e,this.options);return _n(this,go,Tc).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e){_n(this,go,Tc).call(this,{type:"setState",state:e})}cancel(e){var r,i;const n=(r=ge(this,gi))==null?void 0:r.promise;return(i=ge(this,gi))==null||i.cancel(e),n?n.then(qs).catch(qs):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return ge(this,ph)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>vo(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===yC||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>yd(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!qj(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=ge(this,gi))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=ge(this,gi))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),ge(this,Ho).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,gh)||_n(this,go,tF).call(this)?ge(this,gi).cancel({revert:!0}):ge(this,gi).cancelRetry()),this.scheduleGc()),ge(this,Ho).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||_n(this,go,Tc).call(this,{type:"invalidate"})}async fetch(e,n){var c,d,f,p,y,x,S,w,_,E,T;if(this.state.fetchStatus!=="idle"&&((c=ge(this,gi))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(ge(this,gi))return ge(this,gi).continueRetry(),ge(this,gi).promise}if(e&&this.setOptions(e),!this.options.queryFn){const P=this.observers.find(O=>O.options.queryFn);P&&this.setOptions(P.options)}const r=new AbortController,i=P=>{Object.defineProperty(P,"signal",{enumerable:!0,get:()=>(wt(this,gh,!0),r.signal)})},s=()=>{const P=Yj(this.options,n),N=(()=>{const D={client:ge(this,mh),queryKey:this.queryKey,meta:this.meta};return i(D),D})();return wt(this,gh,!1),this.options.persister?this.options.persister(P,N,this):P(N)},a=(()=>{const P={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:ge(this,mh),state:this.state,fetchFn:s};return i(P),P})(),l=ge(this,lg)==="infinite"?KW(this.options.pages):this.options.behavior;l==null||l.onFetch(a,this),wt(this,cg,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&_n(this,go,Tc).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),wt(this,gi,Jj({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:P=>{P instanceof xT&&P.revert&&this.setState({...ge(this,cg),fetchStatus:"idle"}),r.abort()},onFail:(P,O)=>{_n(this,go,Tc).call(this,{type:"failed",failureCount:P,error:O})},onPause:()=>{_n(this,go,Tc).call(this,{type:"pause"})},onContinue:()=>{_n(this,go,Tc).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const P=await ge(this,gi).start();if(P===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(P),(y=(p=ge(this,Ho).config).onSuccess)==null||y.call(p,P,this),(S=(x=ge(this,Ho).config).onSettled)==null||S.call(x,P,this.state.error,this),P}catch(P){if(P instanceof xT){if(P.silent)return ge(this,gi).promise;if(P.revert){if(this.state.data===void 0)throw P;return this.state.data}}throw _n(this,go,Tc).call(this,{type:"error",error:P}),(_=(w=ge(this,Ho).config).onError)==null||_.call(w,P,this),(T=(E=ge(this,Ho).config).onSettled)==null||T.call(E,this.state.data,P,this),P}finally{this.scheduleGc()}}},lg=new WeakMap,ph=new WeakMap,cg=new WeakMap,Ho=new WeakMap,mh=new WeakMap,gi=new WeakMap,jy=new WeakMap,gh=new WeakMap,go=new WeakSet,tF=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Tc=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...nF(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...nI(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return wt(this,cg,e.manual?i:void 0),i;case"error":const s=e.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),zi.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),ge(this,Ho).notify({query:this,type:"updated",action:e})})},zj);function nF(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Qj(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function nI(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function rI(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Xs,An,Fy,ws,vh,ug,Nc,fd,zy,dg,fg,yh,xh,hd,hg,Bn,F0,bT,_T,wT,ST,MT,ET,AT,rF,Bj,QW=(Bj=class extends Vy{constructor(e,n){super();Gt(this,Bn);Gt(this,Xs);Gt(this,An);Gt(this,Fy);Gt(this,ws);Gt(this,vh);Gt(this,ug);Gt(this,Nc);Gt(this,fd);Gt(this,zy);Gt(this,dg);Gt(this,fg);Gt(this,yh);Gt(this,xh);Gt(this,hd);Gt(this,hg,new Set);this.options=n,wt(this,Xs,e),wt(this,fd,null),wt(this,Nc,yT()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(ge(this,An).addObserver(this),iI(ge(this,An),this.options)?_n(this,Bn,F0).call(this):this.updateResult(),_n(this,Bn,ST).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return TT(ge(this,An),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return TT(ge(this,An),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,_n(this,Bn,MT).call(this),_n(this,Bn,ET).call(this),ge(this,An).removeObserver(this)}setOptions(e){const n=this.options,r=ge(this,An);if(this.options=ge(this,Xs).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof vo(this.options.enabled,ge(this,An))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");_n(this,Bn,AT).call(this),ge(this,An).setOptions(this.options),n._defaulted&&!mT(this.options,n)&&ge(this,Xs).getQueryCache().notify({type:"observerOptionsUpdated",query:ge(this,An),observer:this});const i=this.hasListeners();i&&sI(ge(this,An),r,this.options,n)&&_n(this,Bn,F0).call(this),this.updateResult(),i&&(ge(this,An)!==r||vo(this.options.enabled,ge(this,An))!==vo(n.enabled,ge(this,An))||yd(this.options.staleTime,ge(this,An))!==yd(n.staleTime,ge(this,An)))&&_n(this,Bn,bT).call(this);const s=_n(this,Bn,_T).call(this);i&&(ge(this,An)!==r||vo(this.options.enabled,ge(this,An))!==vo(n.enabled,ge(this,An))||s!==ge(this,hd))&&_n(this,Bn,wT).call(this,s)}getOptimisticResult(e){const n=ge(this,Xs).getQueryCache().build(ge(this,Xs),e),r=this.createResult(n,e);return e8(this,r)&&(wt(this,ws,r),wt(this,ug,this.options),wt(this,vh,ge(this,An).state)),r}getCurrentResult(){return ge(this,ws)}trackResult(e,n){return new Proxy(e,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&ge(this,Nc).status==="pending"&&ge(this,Nc).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){ge(this,hg).add(e)}getCurrentQuery(){return ge(this,An)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=ge(this,Xs).defaultQueryOptions(e),r=ge(this,Xs).getQueryCache().build(ge(this,Xs),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return _n(this,Bn,F0).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),ge(this,ws)))}createResult(e,n){var G;const r=ge(this,An),i=this.options,s=ge(this,ws),o=ge(this,vh),a=ge(this,ug),c=e!==r?e.state:ge(this,Fy),{state:d}=e;let f={...d},p=!1,y;if(n._optimisticResults){const k=this.hasListeners(),j=!k&&iI(e,n),H=k&&sI(e,r,n,i);(j||H)&&(f={...f,...nF(d.data,e.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:x,errorUpdatedAt:S,status:w}=f;y=f.data;let _=!1;if(n.placeholderData!==void 0&&y===void 0&&w==="pending"){let k;s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(k=s.data,_=!0):k=typeof n.placeholderData=="function"?n.placeholderData((G=ge(this,fg))==null?void 0:G.state.data,ge(this,fg)):n.placeholderData,k!==void 0&&(w="success",y=vT(s==null?void 0:s.data,k,n),p=!0)}if(n.select&&y!==void 0&&!_)if(s&&y===(o==null?void 0:o.data)&&n.select===ge(this,zy))y=ge(this,dg);else try{wt(this,zy,n.select),y=n.select(y),y=vT(s==null?void 0:s.data,y,n),wt(this,dg,y),wt(this,fd,null)}catch(k){wt(this,fd,k)}ge(this,fd)&&(x=ge(this,fd),y=ge(this,dg),S=Date.now(),w="error");const E=f.fetchStatus==="fetching",T=w==="pending",P=w==="error",O=T&&E,N=y!==void 0,z={status:w,fetchStatus:f.fetchStatus,isPending:T,isSuccess:w==="success",isError:P,isInitialLoading:O,isLoading:O,data:y,dataUpdatedAt:f.dataUpdatedAt,error:x,errorUpdatedAt:S,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:f.dataUpdateCount>c.dataUpdateCount||f.errorUpdateCount>c.errorUpdateCount,isFetching:E,isRefetching:E&&!T,isLoadingError:P&&!N,isPaused:f.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:P&&N,isStale:xC(e,n),refetch:this.refetch,promise:ge(this,Nc),isEnabled:vo(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const k=z.data!==void 0,j=z.status==="error"&&!k,H=he=>{j?he.reject(z.error):k&&he.resolve(z.data)},ee=()=>{const he=wt(this,Nc,z.promise=yT());H(he)},te=ge(this,Nc);switch(te.status){case"pending":e.queryHash===r.queryHash&&H(te);break;case"fulfilled":(j||z.data!==te.value)&&ee();break;case"rejected":(!j||z.error!==te.reason)&&ee();break}}return z}updateResult(){const e=ge(this,ws),n=this.createResult(ge(this,An),this.options);if(wt(this,vh,ge(this,An).state),wt(this,ug,this.options),ge(this,vh).data!==void 0&&wt(this,fg,ge(this,An)),mT(n,e))return;wt(this,ws,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!ge(this,hg).size)return!0;const o=new Set(s??ge(this,hg));return this.options.throwOnError&&o.add("error"),Object.keys(ge(this,ws)).some(a=>{const l=a;return ge(this,ws)[l]!==e[l]&&o.has(l)})};_n(this,Bn,rF).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&_n(this,Bn,ST).call(this)}},Xs=new WeakMap,An=new WeakMap,Fy=new WeakMap,ws=new WeakMap,vh=new WeakMap,ug=new WeakMap,Nc=new WeakMap,fd=new WeakMap,zy=new WeakMap,dg=new WeakMap,fg=new WeakMap,yh=new WeakMap,xh=new WeakMap,hd=new WeakMap,hg=new WeakMap,Bn=new WeakSet,F0=function(e){_n(this,Bn,AT).call(this);let n=ge(this,An).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(qs)),n},bT=function(){_n(this,Bn,MT).call(this);const e=yd(this.options.staleTime,ge(this,An));if(oy.isServer()||ge(this,ws).isStale||!pT(e))return;const r=qj(ge(this,ws).dataUpdatedAt,e)+1;wt(this,yh,eh.setTimeout(()=>{ge(this,ws).isStale||this.updateResult()},r))},_T=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(ge(this,An)):this.options.refetchInterval)??!1},wT=function(e){_n(this,Bn,ET).call(this),wt(this,hd,e),!(oy.isServer()||vo(this.options.enabled,ge(this,An))===!1||!pT(ge(this,hd))||ge(this,hd)===0)&&wt(this,xh,eh.setInterval(()=>{(this.options.refetchIntervalInBackground||gC.isFocused())&&_n(this,Bn,F0).call(this)},ge(this,hd)))},ST=function(){_n(this,Bn,bT).call(this),_n(this,Bn,wT).call(this,_n(this,Bn,_T).call(this))},MT=function(){ge(this,yh)!==void 0&&(eh.clearTimeout(ge(this,yh)),wt(this,yh,void 0))},ET=function(){ge(this,xh)!==void 0&&(eh.clearInterval(ge(this,xh)),wt(this,xh,void 0))},AT=function(){const e=ge(this,Xs).getQueryCache().build(ge(this,Xs),this.options);if(e===ge(this,An))return;const n=ge(this,An);wt(this,An,e),wt(this,Fy,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},rF=function(e){zi.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(ge(this,ws))}),ge(this,Xs).getQueryCache().notify({query:ge(this,An),type:"observerResultsUpdated"})})},Bj);function JW(t,e){return vo(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&vo(e.retryOnMount,t)===!1)}function iI(t,e){return JW(t,e)||t.state.data!==void 0&&TT(t,e,e.refetchOnMount)}function TT(t,e,n){if(vo(e.enabled,t)!==!1&&yd(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&xC(t,e)}return!1}function sI(t,e,n,r){return(t!==e||vo(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&xC(t,n)}function xC(t,e){return vo(e.enabled,t)!==!1&&t.isStaleByTime(yd(e.staleTime,t))}function e8(t,e){return!mT(t.getCurrentResult(),e)}var By,yl,ns,bh,xl,rd,Hj,t8=(Hj=class extends eF{constructor(e){super();Gt(this,xl);Gt(this,By);Gt(this,yl);Gt(this,ns);Gt(this,bh);wt(this,By,e.client),this.mutationId=e.mutationId,wt(this,ns,e.mutationCache),wt(this,yl,[]),this.state=e.state||n8(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){ge(this,yl).includes(e)||(ge(this,yl).push(e),this.clearGcTimeout(),ge(this,ns).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){wt(this,yl,ge(this,yl).filter(n=>n!==e)),this.scheduleGc(),ge(this,ns).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){ge(this,yl).length||(this.state.status==="pending"?this.scheduleGc():ge(this,ns).remove(this))}continue(){var e;return((e=ge(this,bh))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,a,l,c,d,f,p,y,x,S,w,_,E,T,P,O,N,D;const n=()=>{_n(this,xl,rd).call(this,{type:"continue"})},r={client:ge(this,By),meta:this.options.meta,mutationKey:this.options.mutationKey};wt(this,bh,Jj({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(z,G)=>{_n(this,xl,rd).call(this,{type:"failed",failureCount:z,error:G})},onPause:()=>{_n(this,xl,rd).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ge(this,ns).canRun(this)}));const i=this.state.status==="pending",s=!ge(this,bh).canStart();try{if(i)n();else{_n(this,xl,rd).call(this,{type:"pending",variables:e,isPaused:s}),ge(this,ns).config.onMutate&&await ge(this,ns).config.onMutate(e,this,r);const G=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,e,r));G!==this.state.context&&_n(this,xl,rd).call(this,{type:"pending",context:G,variables:e,isPaused:s})}const z=await ge(this,bh).start();return await((c=(l=ge(this,ns).config).onSuccess)==null?void 0:c.call(l,z,e,this.state.context,this,r)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,z,e,this.state.context,r)),await((y=(p=ge(this,ns).config).onSettled)==null?void 0:y.call(p,z,null,this.state.variables,this.state.context,this,r)),await((S=(x=this.options).onSettled)==null?void 0:S.call(x,z,null,e,this.state.context,r)),_n(this,xl,rd).call(this,{type:"success",data:z}),z}catch(z){try{await((_=(w=ge(this,ns).config).onError)==null?void 0:_.call(w,z,e,this.state.context,this,r))}catch(G){Promise.reject(G)}try{await((T=(E=this.options).onError)==null?void 0:T.call(E,z,e,this.state.context,r))}catch(G){Promise.reject(G)}try{await((O=(P=ge(this,ns).config).onSettled)==null?void 0:O.call(P,void 0,z,this.state.variables,this.state.context,this,r))}catch(G){Promise.reject(G)}try{await((D=(N=this.options).onSettled)==null?void 0:D.call(N,void 0,z,e,this.state.context,r))}catch(G){Promise.reject(G)}throw _n(this,xl,rd).call(this,{type:"error",error:z}),z}finally{ge(this,ns).runNext(this)}}},By=new WeakMap,yl=new WeakMap,ns=new WeakMap,bh=new WeakMap,xl=new WeakSet,rd=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),zi.batch(()=>{ge(this,yl).forEach(r=>{r.onMutationUpdate(e)}),ge(this,ns).notify({mutation:this,type:"updated",action:e})})},Hj);function n8(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ic,La,Hy,Vj,r8=(Vj=class extends Vy{constructor(e={}){super();Gt(this,Ic);Gt(this,La);Gt(this,Hy);this.config=e,wt(this,Ic,new Set),wt(this,La,new Map),wt(this,Hy,0)}build(e,n,r){const i=new t8({client:e,mutationCache:this,mutationId:++ub(this,Hy)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){ge(this,Ic).add(e);const n=fb(e);if(typeof n=="string"){const r=ge(this,La).get(n);r?r.push(e):ge(this,La).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(ge(this,Ic).delete(e)){const n=fb(e);if(typeof n=="string"){const r=ge(this,La).get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&ge(this,La).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=fb(e);if(typeof n=="string"){const r=ge(this,La).get(n),i=r==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){var r;const n=fb(e);if(typeof n=="string"){const i=(r=ge(this,La).get(n))==null?void 0:r.find(s=>s!==e&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){zi.batch(()=>{ge(this,Ic).forEach(e=>{this.notify({type:"removed",mutation:e})}),ge(this,Ic).clear(),ge(this,La).clear()})}getAll(){return Array.from(ge(this,Ic))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>QN(n,r))}findAll(e={}){return this.getAll().filter(n=>QN(e,n))}notify(e){zi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return zi.batch(()=>Promise.all(e.map(n=>n.continue().catch(qs))))}},Ic=new WeakMap,La=new WeakMap,Hy=new WeakMap,Vj);function fb(t){var e;return(e=t.options.scope)==null?void 0:e.id}var bl,Gj,i8=(Gj=class extends Vy{constructor(e={}){super();Gt(this,bl);this.config=e,wt(this,bl,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??vC(i,n);let o=this.get(s);return o||(o=new ZW({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){ge(this,bl).has(e.queryHash)||(ge(this,bl).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=ge(this,bl).get(e.queryHash);n&&(e.destroy(),n===e&&ge(this,bl).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){zi.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return ge(this,bl).get(e)}getAll(){return[...ge(this,bl).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>ZN(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>ZN(e,r)):n}notify(e){zi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){zi.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){zi.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},bl=new WeakMap,Gj),Mr,pd,md,pg,mg,gd,gg,vg,Wj,s8=(Wj=class{constructor(t={}){Gt(this,Mr);Gt(this,pd);Gt(this,md);Gt(this,pg);Gt(this,mg);Gt(this,gd);Gt(this,gg);Gt(this,vg);wt(this,Mr,t.queryCache||new i8),wt(this,pd,t.mutationCache||new r8),wt(this,md,t.defaultOptions||{}),wt(this,pg,new Map),wt(this,mg,new Map),wt(this,gd,0)}mount(){ub(this,gd)._++,ge(this,gd)===1&&(wt(this,gg,gC.subscribe(async t=>{t&&(await this.resumePausedMutations(),ge(this,Mr).onFocus())})),wt(this,vg,Q_.subscribe(async t=>{t&&(await this.resumePausedMutations(),ge(this,Mr).onOnline())})))}unmount(){var t,e;ub(this,gd)._--,ge(this,gd)===0&&((t=ge(this,gg))==null||t.call(this),wt(this,gg,void 0),(e=ge(this,vg))==null||e.call(this),wt(this,vg,void 0))}isFetching(t){return ge(this,Mr).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return ge(this,pd).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(yd(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,o=FW(e,s);if(o!==void 0)return ge(this,Mr).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return zi.batch(()=>ge(this,Mr).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ge(this,Mr).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=ge(this,Mr);zi.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=ge(this,Mr);return zi.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=zi.batch(()=>ge(this,Mr).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(qs).catch(qs)}invalidateQueries(t,e={}){return zi.batch(()=>(ge(this,Mr).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=zi.batch(()=>ge(this,Mr).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(qs)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(qs)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=ge(this,Mr).build(this,e);return n.isStaleByTime(yd(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(qs).catch(qs)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(qs).catch(qs)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return Q_.isOnline()?ge(this,pd).resumePausedMutations():Promise.resolve()}getQueryCache(){return ge(this,Mr)}getMutationCache(){return ge(this,pd)}getDefaultOptions(){return ge(this,md)}setDefaultOptions(t){wt(this,md,t)}setQueryDefaults(t,e){ge(this,pg).set(iy(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...ge(this,pg).values()],n={};return e.forEach(r=>{sy(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){ge(this,mg).set(iy(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...ge(this,mg).values()],n={};return e.forEach(r=>{sy(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...ge(this,md).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=vC(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===yC&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...ge(this,md).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){ge(this,Mr).clear(),ge(this,pd).clear()}},Mr=new WeakMap,pd=new WeakMap,md=new WeakMap,pg=new WeakMap,mg=new WeakMap,gd=new WeakMap,gg=new WeakMap,vg=new WeakMap,Wj),iF=R.createContext(void 0),Rd=t=>{const e=R.useContext(iF);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},o8=({client:t,children:e})=>(R.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),v.jsx(iF.Provider,{value:t,children:e})),sF=R.createContext(!1),a8=()=>R.useContext(sF);sF.Provider;function l8(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var c8=R.createContext(l8()),u8=()=>R.useContext(c8),d8=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?Zj(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},f8=t=>{R.useEffect(()=>{t.clearReset()},[t])},h8=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||Zj(n,[t.error,r])),p8=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))}},m8=(t,e)=>t.isLoading&&t.isFetching&&!e,g8=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,oI=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function v8(t,e,n){var y,x,S,w;const r=a8(),i=u8(),s=Rd(),o=s.defaultQueryOptions(t);(x=(y=s.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||x.call(y,o);const a=s.getQueryCache().get(o.queryHash),l=t.subscribed!==!1;o._optimisticResults=r?"isRestoring":l?"optimistic":void 0,p8(o),d8(o,i,a),f8(i);const c=!s.getQueryCache().get(o.queryHash),[d]=R.useState(()=>new e(s,o)),f=d.getOptimisticResult(o),p=!r&&l;if(R.useSyncExternalStore(R.useCallback(_=>{const E=p?d.subscribe(zi.batchCalls(_)):qs;return d.updateResult(),E},[d,p]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),R.useEffect(()=>{d.setOptions(o)},[o,d]),g8(o,f))throw oI(o,d,i);if(h8({result:f,errorResetBoundary:i,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((w=(S=s.getDefaultOptions().queries)==null?void 0:S._experimental_afterQuery)==null||w.call(S,o,f),o.experimental_prefetchInRender&&!oy.isServer()&&m8(f,r)){const _=c?oI(o,d,i):a==null?void 0:a.promise;_==null||_.catch(qs).finally(()=>{d.updateResult()})}return o.notifyOnChangeProps?f:d.trackResult(f)}function bi(t,e){return v8(t,QW)}/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const y8=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),oF=(...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 x8={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 b8=R.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...a},l)=>R.createElement("svg",{ref:l,...x8,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:oF("lucide",i),...a},[...o.map(([c,d])=>R.createElement(c,d)),...Array.isArray(s)?s:[s]]));/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const ht=(t,e)=>{const n=R.forwardRef(({className:r,...i},s)=>R.createElement(b8,{ref:s,iconNode:e,className:oF(`lucide-${y8(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 bC=ht("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const J_=ht("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 _8=ht("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const PT=ht("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 $c=ht("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 w8=ht("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 ew=ht("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 V1=ht("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 S8=ht("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 Xo=ht("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 M8=ht("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 E8=ht("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 aF=ht("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 A8=ht("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 T8=ht("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 P8=ht("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 C8=ht("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 R8=ht("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 N8=ht("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 lF=ht("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 I8=ht("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 CT=ht("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 k8=ht("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 RT=ht("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 Sd=ht("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 O8=ht("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 yg=ht("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 xg=ht("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 aI=ht("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const NT=ht("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 L8=ht("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 D8=ht("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 cF=ht("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 U8=ht("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 j8=ht("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 nE=ht("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 lI=ht("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 F8=ht("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 z8=ht("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 _C=ht("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 B8=ht("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 H8=ht("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 V8=ht("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 G8=ht("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 G1=ht("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 W8=ht("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 $8=ht("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 X8=ht("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 uF=ht("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 cI=ht("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const q8=ht("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const K8=ht("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 Y8=ht("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 Z8=ht("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const IT=ht("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const kT=ht("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 Q8=ht("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 J8=ht("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 Qf=ht("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 dF=ht("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const e9=ht("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 wC=ht("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const t9=ht("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const tw=ht("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 n9=ht("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 r9=ht("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 Ym=ht("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 uI=ht("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 i9=ht("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 Vm=ht("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 fF=ht("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 s9=ht("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 hF=ht("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 OT=ht("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 bg=ht("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 o9=ht("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 LT=ht("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 SC=ht("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 Md=ht("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const _h=ht("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),DT=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:B8},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:ew},{id:"memory",label:"Gedächtnis",hint:"Geteiltes Memory verwalten",icon:V1},{id:"connect",label:"Verbinden",hint:"IDE-/Agent-Configs erzeugen",icon:IT},{id:"agent",label:"Hermes",hint:"Agent-Status & Verdrahtung",icon:$c},{id:"terminal",label:"Terminal",hint:"Interaktives Hermes-Agent-Terminal",icon:fF},{id:"voice",label:"Sprechen",hint:"Mit Hermes per Sprache reden (3D-Avatar)",icon:uF},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:P8}];var dI=1,a9=.9,l9=.8,c9=.17,rE=.1,iE=.999,u9=.9999,d9=.99,f9=/[\\\/_+.#"@\[\(\{&]/,h9=/[\\\/_+.#"@\[\(\{&]/g,p9=/[\s-]/,pF=/[\s-]/g;function UT(t,e,n,r,i,s,o){if(s===e.length)return i===t.length?dI:d9;var a=`${i},${s}`;if(o[a]!==void 0)return o[a];for(var l=r.charAt(s),c=n.indexOf(l,i),d=0,f,p,y,x;c>=0;)f=UT(t,e,n,r,c+1,s+1,o),f>d&&(c===i?f*=dI:f9.test(t.charAt(c-1))?(f*=l9,y=t.slice(i,c-1).match(h9),y&&i>0&&(f*=Math.pow(iE,y.length))):p9.test(t.charAt(c-1))?(f*=a9,x=t.slice(i,c-1).match(pF),x&&i>0&&(f*=Math.pow(iE,x.length))):(f*=c9,i>0&&(f*=Math.pow(iE,c-i))),t.charAt(c)!==e.charAt(s)&&(f*=u9)),(f<rE&&n.charAt(c-1)===r.charAt(s+1)||r.charAt(s+1)===r.charAt(s)&&n.charAt(c-1)!==r.charAt(s))&&(p=UT(t,e,n,r,c+1,s+2,o),p*rE>f&&(f=p*rE)),f>d&&(d=f),c=n.indexOf(l,c+1);return o[a]=d,d}function fI(t){return t.toLowerCase().replace(pF," ")}function m9(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,UT(t,e,fI(t),fI(e),0,0,{})}function xd(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 hI(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function _g(...t){return e=>{let n=!1;const r=t.map(i=>{const s=hI(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():hI(t[i],null)}}}}function qh(...t){return R.useCallback(_g(...t),t)}function g9(t,e=[]){let n=[];function r(s,o){const a=R.createContext(o);a.displayName=s+"Context";const l=n.length;n=[...n,o];const c=f=>{var _;const{scope:p,children:y,...x}=f,S=((_=p==null?void 0:p[t])==null?void 0:_[l])||a,w=R.useMemo(()=>x,Object.values(x));return v.jsx(S.Provider,{value:w,children:y})};c.displayName=s+"Provider";function d(f,p){var S;const y=((S=p==null?void 0:p[t])==null?void 0:S[l])||a,x=R.useContext(y);if(x)return x;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[c,d]}const i=()=>{const s=n.map(o=>R.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return R.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[r,v9(i,...e)]}function v9(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(s)[`__scope${c}`];return{...a,...f}},{});return R.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var ay=globalThis!=null&&globalThis.document?R.useLayoutEffect:()=>{},y9=H1[" useId ".trim().toString()]||(()=>{}),x9=0;function zc(t){const[e,n]=R.useState(y9());return ay(()=>{n(r=>r??String(x9++))},[t]),e?`radix-${e}`:""}var b9=H1[" useInsertionEffect ".trim().toString()]||ay;function _9({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,o]=w9({defaultProp:e,onChange:n}),a=t!==void 0,l=a?t:i;{const d=R.useRef(t!==void 0);R.useEffect(()=>{const f=d.current;f!==a&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=a},[a,r])}const c=R.useCallback(d=>{var f;if(a){const p=S9(d)?d(t):d;p!==t&&((f=o.current)==null||f.call(o,p))}else s(d)},[a,t,s,o]);return[l,c]}function w9({defaultProp:t,onChange:e}){const[n,r]=R.useState(t),i=R.useRef(n),s=R.useRef(e);return b9(()=>{s.current=e},[e]),R.useEffect(()=>{var o;i.current!==n&&((o=s.current)==null||o.call(s,n),i.current=n)},[n,i]),[n,r,s]}function S9(t){return typeof t=="function"}var W1=Xj();function mF(t){const e=R.forwardRef((n,r)=>{let{children:i,...s}=n,o=null,a=!1;const l=[];pI(i)&&typeof hb=="function"&&(i=hb(i._payload)),R.Children.forEach(i,p=>{var y;if(P9(p)){a=!0;const x=p;let S="child"in x.props?x.props.child:x.props.children;pI(S)&&typeof hb=="function"&&(S=hb(S._payload)),o=E9(x,S),l.push((y=o==null?void 0:o.props)==null?void 0:y.children)}else l.push(p)}),o?o=R.cloneElement(o,void 0,l):!a&&R.Children.count(i)===1&&R.isValidElement(i)&&(o=i);const c=o?T9(o):void 0,d=qh(r,c);if(!o){if(i||i===0)throw new Error(a?I9(t):N9(t));return i}const f=A9(s,o.props??{});return o.type!==R.Fragment&&(f.ref=r?d:c),R.cloneElement(o,f)});return e.displayName=`${t}.Slot`,e}var M9=Symbol.for("radix.slottable"),E9=(t,e)=>{if("child"in t.props){const n=t.props.child;return R.isValidElement(n)?R.cloneElement(n,void 0,t.props.children(n.props.children)):null}return R.isValidElement(e)?e:null};function A9(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function T9(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 P9(t){return R.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===M9}var C9=Symbol.for("react.lazy");function pI(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===C9&&"_payload"in t&&R9(t._payload)}function R9(t){return typeof t=="object"&&t!==null&&"then"in t}var N9=t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,I9=t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,hb=H1[" use ".trim().toString()],k9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Gi=k9.reduce((t,e)=>{const n=mF(`Primitive.${e}`),r=R.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function O9(t,e){t&&W1.flushSync(()=>t.dispatchEvent(e))}function ly(t){const e=R.useRef(t);return R.useEffect(()=>{e.current=t}),R.useMemo(()=>((...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)}),[])}function L9(t,e=globalThis==null?void 0:globalThis.document){const n=ly(t);R.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var D9="DismissableLayer",jT="dismissableLayer.update",U9="dismissableLayer.pointerDownOutside",j9="dismissableLayer.focusOutside",mI,MC=R.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),gF=R.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...c}=t,d=R.useContext(MC),[f,p]=R.useState(null),y=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=R.useState({}),S=qh(e,G=>p(G)),w=Array.from(d.layers),[_]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),E=w.indexOf(_),T=f?w.indexOf(f):-1,P=d.layersWithOutsidePointerEventsDisabled.size>0,O=T>=E,N=R.useRef(!1),D=H9(G=>{const k=G.target;if(!(k instanceof Node))return;const j=[...d.branches].some(H=>H.contains(k));!O||j||(s==null||s(G),a==null||a(G),G.defaultPrevented||l==null||l())},{ownerDocument:y,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:N,dismissableSurfaces:d.dismissableSurfaces}),z=V9(G=>{if(r&&N.current)return;const k=G.target;[...d.branches].some(H=>H.contains(k))||(o==null||o(G),a==null||a(G),G.defaultPrevented||l==null||l())},y);return L9(G=>{T===d.layers.size-1&&(i==null||i(G),!G.defaultPrevented&&l&&(G.preventDefault(),l()))},y),R.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(mI=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),gI(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(f),d.layersWithOutsidePointerEventsDisabled.size===0&&(y.body.style.pointerEvents=mI))}},[f,y,n,d]),R.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),gI())},[f,d]),R.useEffect(()=>{const G=()=>x({});return document.addEventListener(jT,G),()=>document.removeEventListener(jT,G)},[]),v.jsx(Gi.div,{...c,ref:S,style:{pointerEvents:P?O?"auto":"none":void 0,...t.style},onFocusCapture:xd(t.onFocusCapture,z.onFocusCapture),onBlurCapture:xd(t.onBlurCapture,z.onBlurCapture),onPointerDownCapture:xd(t.onPointerDownCapture,D.onPointerDownCapture)})});gF.displayName=D9;var F9="DismissableLayerBranch",z9=R.forwardRef((t,e)=>{const n=R.useContext(MC),r=R.useRef(null),i=qh(e,r);return R.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),v.jsx(Gi.div,{...t,ref:i})});z9.displayName=F9;function B9(){const t=R.useContext(MC),[e,n]=R.useState(null);return R.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}function H9(t,e){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s}=e,o=ly(t),a=R.useRef(!1),l=R.useRef(!1),c=R.useRef(new Map),d=R.useRef(()=>{});return R.useEffect(()=>{function f(){l.current=!1,i.current=!1,c.current.clear()}function p(){return Array.from(c.current.values()).some(Boolean)}function y(E){if(!l.current)return;const T=E.target;T instanceof Node&&[...s].some(O=>O.contains(T))||c.current.set(E.type,!0),E.type==="click"&&window.setTimeout(()=>{l.current&&d.current()},0)}function x(E){l.current&&c.current.set(E.type,!1)}const S=E=>{if(E.target&&!a.current){let T=function(){n.removeEventListener("click",d.current);const O=p();f(),O||vF(U9,o,P,{discrete:!0})};const P={originalEvent:E};l.current=!0,i.current=r&&E.button===0,c.current.clear(),!r||E.button!==0?T():(n.removeEventListener("click",d.current),d.current=T,n.addEventListener("click",d.current,{once:!0}))}else n.removeEventListener("click",d.current),f();a.current=!1},w=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const E of w)n.addEventListener(E,y,!0),n.addEventListener(E,x);const _=window.setTimeout(()=>{n.addEventListener("pointerdown",S)},0);return()=>{window.clearTimeout(_),n.removeEventListener("pointerdown",S),n.removeEventListener("click",d.current);for(const E of w)n.removeEventListener(E,y,!0),n.removeEventListener(E,x)}},[n,o,r,i,s]),{onPointerDownCapture:()=>a.current=!0}}function V9(t,e=globalThis==null?void 0:globalThis.document){const n=ly(t),r=R.useRef(!1);return R.useEffect(()=>{const i=s=>{s.target&&!r.current&&vF(j9,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 gI(){const t=new CustomEvent(jT);document.dispatchEvent(t)}function vF(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?O9(i,s):i.dispatchEvent(s)}var sE="focusScope.autoFocusOnMount",oE="focusScope.autoFocusOnUnmount",vI={bubbles:!1,cancelable:!0},G9="FocusScope",yF=R.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=R.useState(null),c=ly(i),d=ly(s),f=R.useRef(null),p=qh(e,S=>l(S)),y=R.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;R.useEffect(()=>{if(r){let S=function(T){if(y.paused||!a)return;const P=T.target;a.contains(P)?f.current=P:id(f.current,{select:!0})},w=function(T){if(y.paused||!a)return;const P=T.relatedTarget;P!==null&&(a.contains(P)||id(f.current,{select:!0}))},_=function(T){if(document.activeElement===document.body)for(const O of T)O.removedNodes.length>0&&id(a)};document.addEventListener("focusin",S),document.addEventListener("focusout",w);const E=new MutationObserver(_);return a&&E.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",w),E.disconnect()}}},[r,a,y.paused]),R.useEffect(()=>{if(a){xI.add(y);const S=document.activeElement;if(!a.contains(S)){const _=new CustomEvent(sE,vI);a.addEventListener(sE,c),a.dispatchEvent(_),_.defaultPrevented||(W9(Y9(xF(a)),{select:!0}),document.activeElement===S&&id(a))}return()=>{a.removeEventListener(sE,c),setTimeout(()=>{const _=new CustomEvent(oE,vI);a.addEventListener(oE,d),a.dispatchEvent(_),_.defaultPrevented||id(S??document.body,{select:!0}),a.removeEventListener(oE,d),xI.remove(y)},0)}}},[a,c,d,y]);const x=R.useCallback(S=>{if(!n&&!r||y.paused)return;const w=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,_=document.activeElement;if(w&&_){const E=S.currentTarget,[T,P]=$9(E);T&&P?!S.shiftKey&&_===P?(S.preventDefault(),n&&id(T,{select:!0})):S.shiftKey&&_===T&&(S.preventDefault(),n&&id(P,{select:!0})):_===E&&S.preventDefault()}},[n,r,y.paused]);return v.jsx(Gi.div,{tabIndex:-1,...o,ref:p,onKeyDown:x})});yF.displayName=G9;function W9(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(id(r,{select:e}),document.activeElement!==n)return}function $9(t){const e=xF(t),n=yI(e,t),r=yI(e.reverse(),t);return[n,r]}function xF(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 yI(t,e){for(const n of t)if(!X9(n,{upTo:e}))return n}function X9(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 q9(t){return t instanceof HTMLInputElement&&"select"in t}function id(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&q9(t)&&e&&t.select()}}var xI=K9();function K9(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=bI(t,e),t.unshift(e)},remove(e){var n;t=bI(t,e),(n=t[0])==null||n.resume()}}}function bI(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function Y9(t){return t.filter(e=>e.tagName!=="A")}var Z9="Portal",bF=R.forwardRef((t,e)=>{var a;const{container:n,...r}=t,[i,s]=R.useState(!1);ay(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?W1.createPortal(v.jsx(Gi.div,{...r,ref:e}),o):null});bF.displayName=Z9;function Q9(t,e){return R.useReducer((n,r)=>e[n][r]??n,t)}var $1=t=>{const{present:e,children:n}=t,r=J9(e),i=typeof n=="function"?n({present:r.isPresent}):R.Children.only(n),s=e$(r.ref,t$(i));return typeof n=="function"||r.isPresent?R.cloneElement(i,{ref:s}):null};$1.displayName="Presence";function J9(t){const[e,n]=R.useState(),r=R.useRef(null),i=R.useRef(t),s=R.useRef("none"),o=t?"mounted":"unmounted",[a,l]=Q9(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return R.useEffect(()=>{const c=pb(r.current);s.current=a==="mounted"?c:"none"},[a]),ay(()=>{const c=r.current,d=i.current;if(d!==t){const p=s.current,y=pb(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]),ay(()=>{if(e){let c;const d=e.ownerDocument.defaultView??window,f=y=>{const S=pb(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=pb(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(a),ref:R.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function _I(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function e$(...t){const e=R.useRef(t);return e.current=t,R.useCallback(n=>{const r=e.current;let i=!1;const s=r.map(o=>{const a=_I(o,n);return!i&&typeof a=="function"&&(i=!0),a});if(i)return()=>{for(let o=0;o<s.length;o++){const a=s[o];typeof a=="function"?a():_I(r[o],null)}}},[])}function pb(t){return(t==null?void 0:t.animationName)||"none"}function t$(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 mb=0,dl=null;function n$(){R.useEffect(()=>{dl||(dl={start:wI(),end:wI()});const{start:t,end:e}=dl;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),mb++,()=>{mb===1&&(dl==null||dl.start.remove(),dl==null||dl.end.remove(),dl=null),mb=Math.max(0,mb-1)}},[])}function wI(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var _l=function(){return _l=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},_l.apply(this,arguments)};function _F(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 r$(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 D_="right-scroll-bar-position",U_="width-before-scroll-bar",i$="with-scroll-bars-hidden",s$="--removed-body-scroll-bar-size";function aE(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function o$(t,e){var n=R.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 a$=typeof window<"u"?R.useLayoutEffect:R.useEffect,SI=new WeakMap;function l$(t,e){var n=o$(null,function(r){return t.forEach(function(i){return aE(i,r)})});return a$(function(){var r=SI.get(n);if(r){var i=new Set(r),s=new Set(t),o=n.current;i.forEach(function(a){s.has(a)||aE(a,null)}),s.forEach(function(a){i.has(a)||aE(a,o)})}SI.set(n,t)},[t]),n}function c$(t){return t}function u$(t,e){e===void 0&&(e=c$);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 o=e(s,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(r=!0;n.length;){var o=n;n=[],o.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(s),o=n}var l=function(){var d=o;o=[],d.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(d){o.push(d),c()},filter:function(d){return o=o.filter(d),n}}}};return i}function d$(t){t===void 0&&(t={});var e=u$(null);return e.options=_l({async:!0,ssr:!1},t),e}var wF=function(t){var e=t.sideCar,n=_F(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 R.createElement(r,_l({},n))};wF.isSideCarExport=!0;function f$(t,e){return t.useMedium(e),wF}var SF=d$(),lE=function(){},X1=R.forwardRef(function(t,e){var n=R.useRef(null),r=R.useState({onScrollCapture:lE,onWheelCapture:lE,onTouchMoveCapture:lE}),i=r[0],s=r[1],o=t.forwardProps,a=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,_=t.as,E=_===void 0?"div":_,T=t.gapMode,P=_F(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=p,N=l$([n,e]),D=_l(_l({},P),i);return R.createElement(R.Fragment,null,d&&R.createElement(O,{sideCar:SF,removeScrollBar:c,shards:f,noRelative:y,noIsolation:x,inert:S,setCallbacks:s,allowPinchZoom:!!w,lockRef:n,gapMode:T}),o?R.cloneElement(R.Children.only(a),_l(_l({},D),{ref:N})):R.createElement(E,_l({},D,{className:l,ref:N}),a))});X1.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};X1.classNames={fullWidth:U_,zeroRight:D_};var h$=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function p$(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=h$();return e&&t.setAttribute("nonce",e),t}function m$(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function g$(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var v$=function(){var t=0,e=null;return{add:function(n){t==0&&(e=p$())&&(m$(e,n),g$(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},y$=function(){var t=v$();return function(e,n){R.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},MF=function(){var t=y$(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},x$={left:0,top:0,right:0,gap:0},cE=function(t){return parseInt(t||"",10)||0},b$=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[cE(n),cE(r),cE(i)]},_$=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return x$;var e=b$(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])}},w$=MF(),Zm="data-scroll-locked",S$=function(t,e,n,r){var i=t.left,s=t.top,o=t.right,a=t.gap;return n===void 0&&(n="margin"),`
|
||
.`.concat(i$,` {
|
||
overflow: hidden `).concat(r,`;
|
||
padding-right: `).concat(a,"px ").concat(r,`;
|
||
}
|
||
body[`).concat(Zm,`] {
|
||
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(o,`px;
|
||
margin-left:0;
|
||
margin-top:0;
|
||
margin-right: `).concat(a,"px ").concat(r,`;
|
||
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
|
||
}
|
||
|
||
.`).concat(D_,` {
|
||
right: `).concat(a,"px ").concat(r,`;
|
||
}
|
||
|
||
.`).concat(U_,` {
|
||
margin-right: `).concat(a,"px ").concat(r,`;
|
||
}
|
||
|
||
.`).concat(D_," .").concat(D_,` {
|
||
right: 0 `).concat(r,`;
|
||
}
|
||
|
||
.`).concat(U_," .").concat(U_,` {
|
||
margin-right: 0 `).concat(r,`;
|
||
}
|
||
|
||
body[`).concat(Zm,`] {
|
||
`).concat(s$,": ").concat(a,`px;
|
||
}
|
||
`)},MI=function(){var t=parseInt(document.body.getAttribute(Zm)||"0",10);return isFinite(t)?t:0},M$=function(){R.useEffect(function(){return document.body.setAttribute(Zm,(MI()+1).toString()),function(){var t=MI()-1;t<=0?document.body.removeAttribute(Zm):document.body.setAttribute(Zm,t.toString())}},[])},E$=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;M$();var s=R.useMemo(function(){return _$(i)},[i]);return R.createElement(w$,{styles:S$(s,!e,i,n?"":"!important")})},FT=!1;if(typeof window<"u")try{var gb=Object.defineProperty({},"passive",{get:function(){return FT=!0,!0}});window.addEventListener("test",gb,gb),window.removeEventListener("test",gb,gb)}catch{FT=!1}var tm=FT?{passive:!1}:!1,A$=function(t){return t.tagName==="TEXTAREA"},EF=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!A$(t)&&n[e]==="visible")},T$=function(t){return EF(t,"overflowY")},P$=function(t){return EF(t,"overflowX")},EI=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=AF(t,r);if(i){var s=TF(t,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},C$=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},R$=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},AF=function(t,e){return t==="v"?T$(e):P$(e)},TF=function(t,e){return t==="v"?C$(e):R$(e)},N$=function(t,e){return t==="h"&&e==="rtl"?-1:1},I$=function(t,e,n,r,i){var s=N$(t,window.getComputedStyle(e).direction),o=s*r,a=n.target,l=e.contains(a),c=!1,d=o>0,f=0,p=0;do{if(!a)break;var y=TF(t,a),x=y[0],S=y[1],w=y[2],_=S-w-s*x;(x||_)&&AF(t,a)&&(f+=_,p+=x);var E=a.parentNode;a=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(d&&Math.abs(f)<1||!d&&Math.abs(p)<1)&&(c=!0),c},vb=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},AI=function(t){return[t.deltaX,t.deltaY]},TI=function(t){return t&&"current"in t?t.current:t},k$=function(t,e){return t[0]===e[0]&&t[1]===e[1]},O$=function(t){return`
|
||
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
||
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
||
`)},L$=0,nm=[];function D$(t){var e=R.useRef([]),n=R.useRef([0,0]),r=R.useRef(),i=R.useState(L$++)[0],s=R.useState(MF)[0],o=R.useRef(t);R.useEffect(function(){o.current=t},[t]),R.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var S=r$([t.lockRef.current],(t.shards||[]).map(TI),!0).filter(Boolean);return S.forEach(function(w){return w.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),S.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=R.useCallback(function(S,w){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!o.current.allowPinchZoom;var _=vb(S),E=n.current,T="deltaX"in S?S.deltaX:E[0]-_[0],P="deltaY"in S?S.deltaY:E[1]-_[1],O,N=S.target,D=Math.abs(T)>Math.abs(P)?"h":"v";if("touches"in S&&D==="h"&&N.type==="range")return!1;var z=window.getSelection(),G=z&&z.anchorNode,k=G?G===N||G.contains(N):!1;if(k)return!1;var j=EI(D,N);if(!j)return!0;if(j?O=D:(O=D==="v"?"h":"v",j=EI(D,N)),!j)return!1;if(!r.current&&"changedTouches"in S&&(T||P)&&(r.current=O),!O)return!0;var H=r.current||O;return I$(H,w,S,H==="h"?T:P)},[]),l=R.useCallback(function(S){var w=S;if(!(!nm.length||nm[nm.length-1]!==s)){var _="deltaY"in w?AI(w):vb(w),E=e.current.filter(function(O){return O.name===w.type&&(O.target===w.target||w.target===O.shadowParent)&&k$(O.delta,_)})[0];if(E&&E.should){w.cancelable&&w.preventDefault();return}if(!E){var T=(o.current.shards||[]).map(TI).filter(Boolean).filter(function(O){return O.contains(w.target)}),P=T.length>0?a(w,T[0]):!o.current.noIsolation;P&&w.cancelable&&w.preventDefault()}}},[]),c=R.useCallback(function(S,w,_,E){var T={name:S,delta:w,target:_,should:E,shadowParent:U$(_)};e.current.push(T),setTimeout(function(){e.current=e.current.filter(function(P){return P!==T})},1)},[]),d=R.useCallback(function(S){n.current=vb(S),r.current=void 0},[]),f=R.useCallback(function(S){c(S.type,AI(S),S.target,a(S,t.lockRef.current))},[]),p=R.useCallback(function(S){c(S.type,vb(S),S.target,a(S,t.lockRef.current))},[]);R.useEffect(function(){return nm.push(s),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",l,tm),document.addEventListener("touchmove",l,tm),document.addEventListener("touchstart",d,tm),function(){nm=nm.filter(function(S){return S!==s}),document.removeEventListener("wheel",l,tm),document.removeEventListener("touchmove",l,tm),document.removeEventListener("touchstart",d,tm)}},[]);var y=t.removeScrollBar,x=t.inert;return R.createElement(R.Fragment,null,x?R.createElement(s,{styles:O$(i)}):null,y?R.createElement(E$,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function U$(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const j$=f$(SF,D$);var PF=R.forwardRef(function(t,e){return R.createElement(X1,_l({},t,{ref:e,sideCar:j$}))});PF.classNames=X1.classNames;var F$=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},rm=new WeakMap,yb=new WeakMap,xb={},uE=0,CF=function(t){return t&&(t.host||CF(t.parentNode))},z$=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=CF(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})},B$=function(t,e,n,r){var i=z$(e,Array.isArray(t)?t:[t]);xb[n]||(xb[n]=new WeakMap);var s=xb[n],o=[],a=new Set,l=new Set(i),c=function(f){!f||a.has(f)||(a.add(f),c(f.parentNode))};i.forEach(c);var d=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(p){if(a.has(p))d(p);else try{var y=p.getAttribute(r),x=y!==null&&y!=="false",S=(rm.get(p)||0)+1,w=(s.get(p)||0)+1;rm.set(p,S),s.set(p,w),o.push(p),S===1&&x&&yb.set(p,!0),w===1&&p.setAttribute(n,"true"),x||p.setAttribute(r,"true")}catch(_){console.error("aria-hidden: cannot operate on ",p,_)}})};return d(e),a.clear(),uE++,function(){o.forEach(function(f){var p=rm.get(f)-1,y=s.get(f)-1;rm.set(f,p),s.set(f,y),p||(yb.has(f)||f.removeAttribute(r),yb.delete(f)),y||f.removeAttribute(n)}),uE--,uE||(rm=new WeakMap,rm=new WeakMap,yb=new WeakMap,xb={})}},H$=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=F$(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),B$(r,i,n,"aria-hidden")):function(){return null}},q1="Dialog",[RF]=g9(q1),[V$,Wa]=RF(q1),NF=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!0}=t,a=R.useRef(null),l=R.useRef(null),[c,d]=_9({prop:r,defaultProp:i??!1,onChange:s,caller:q1});return v.jsx(V$,{scope:e,triggerRef:a,contentRef:l,contentId:zc(),titleId:zc(),descriptionId:zc(),open:c,onOpenChange:d,onOpenToggle:R.useCallback(()=>d(f=>!f),[d]),modal:o,children:n})};NF.displayName=q1;var IF="DialogTrigger",G$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(IF,n),s=qh(e,i.triggerRef);return v.jsx(Gi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":AC(i.open),...r,ref:s,onClick:xd(t.onClick,i.onOpenToggle)})});G$.displayName=IF;var EC="DialogPortal",[W$,kF]=RF(EC,{forceMount:void 0}),OF=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,s=Wa(EC,e);return v.jsx(W$,{scope:e,forceMount:n,children:R.Children.map(r,o=>v.jsx($1,{present:n||s.open,children:v.jsx(bF,{asChild:!0,container:i,children:o})}))})};OF.displayName=EC;var nw="DialogOverlay",LF=R.forwardRef((t,e)=>{const n=kF(nw,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Wa(nw,t.__scopeDialog);return s.modal?v.jsx($1,{present:r||s.open,children:v.jsx(X$,{...i,ref:e})}):null});LF.displayName=nw;var $$=mF("DialogOverlay.RemoveScroll"),X$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(nw,n),s=B9(),o=qh(e,s);return v.jsx(PF,{as:$$,allowPinchZoom:!0,shards:[i.contentRef],children:v.jsx(Gi.div,{"data-state":AC(i.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),wg="DialogContent",DF=R.forwardRef((t,e)=>{const n=kF(wg,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Wa(wg,t.__scopeDialog);return v.jsx($1,{present:r||s.open,children:s.modal?v.jsx(q$,{...i,ref:e}):v.jsx(K$,{...i,ref:e})})});DF.displayName=wg;var q$=R.forwardRef((t,e)=>{const n=Wa(wg,t.__scopeDialog),r=R.useRef(null),i=qh(e,n.contentRef,r);return R.useEffect(()=>{const s=r.current;if(s)return H$(s)},[]),v.jsx(UF,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:xd(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:xd(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:xd(t.onFocusOutside,s=>s.preventDefault())})}),K$=R.forwardRef((t,e)=>{const n=Wa(wg,t.__scopeDialog),r=R.useRef(!1),i=R.useRef(!1);return v.jsx(UF,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=t.onInteractOutside)==null||l.call(t,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),UF=R.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,a=Wa(wg,n);return n$(),v.jsx(v.Fragment,{children:v.jsx(yF,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:v.jsx(gF,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":AC(a.open),...o,ref:e,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),jF="DialogTitle",Y$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(jF,n);return v.jsx(Gi.h2,{id:i.titleId,...r,ref:e})});Y$.displayName=jF;var FF="DialogDescription",Z$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(FF,n);return v.jsx(Gi.p,{id:i.descriptionId,...r,ref:e})});Z$.displayName=FF;var zF="DialogClose",Q$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(zF,n);return v.jsx(Gi.button,{type:"button",...r,ref:e,onClick:xd(t.onClick,()=>i.onOpenChange(!1))})});Q$.displayName=zF;function AC(t){return t?"open":"closed"}var r0='[cmdk-group=""]',dE='[cmdk-group-items=""]',J$='[cmdk-group-heading=""]',BF='[cmdk-item=""]',PI=`${BF}:not([aria-disabled="true"])`,zT="cmdk-item-select",Dm="data-value",e7=(t,e,n)=>m9(t,e,n),HF=R.createContext(void 0),Gy=()=>R.useContext(HF),VF=R.createContext(void 0),TC=()=>R.useContext(VF),GF=R.createContext(void 0),WF=R.forwardRef((t,e)=>{let n=Um(()=>{var q,pe;return{search:"",value:(pe=(q=t.value)!=null?q:t.defaultValue)!=null?pe:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Um(()=>new Set),i=Um(()=>new Map),s=Um(()=>new Map),o=Um(()=>new Set),a=$F(t),{label:l,children:c,value:d,onValueChange:f,filter:p,shouldFilter:y,loop:x,disablePointerSelection:S=!1,vimBindings:w=!0,..._}=t,E=zc(),T=zc(),P=zc(),O=R.useRef(null),N=d7();Rh(()=>{if(d!==void 0){let q=d.trim();n.current.value=q,D.emit()}},[d]),Rh(()=>{N(6,ee)},[]);let D=R.useMemo(()=>({subscribe:q=>(o.current.add(q),()=>o.current.delete(q)),snapshot:()=>n.current,setState:(q,pe,ae)=>{var ce,Se,Ee,$e;if(!Object.is(n.current[q],pe)){if(n.current[q]=pe,q==="search")H(),k(),N(1,j);else if(q==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Me=document.getElementById(P);Me?Me.focus():(ce=document.getElementById(E))==null||ce.focus()}if(N(7,()=>{var Me;n.current.selectedItemId=(Me=te())==null?void 0:Me.id,D.emit()}),ae||N(5,ee),((Se=a.current)==null?void 0:Se.value)!==void 0){let Me=pe??"";($e=(Ee=a.current).onValueChange)==null||$e.call(Ee,Me);return}}D.emit()}},emit:()=>{o.current.forEach(q=>q())}}),[]),z=R.useMemo(()=>({value:(q,pe,ae)=>{var ce;pe!==((ce=s.current.get(q))==null?void 0:ce.value)&&(s.current.set(q,{value:pe,keywords:ae}),n.current.filtered.items.set(q,G(pe,ae)),N(2,()=>{k(),D.emit()}))},item:(q,pe)=>(r.current.add(q),pe&&(i.current.has(pe)?i.current.get(pe).add(q):i.current.set(pe,new Set([q]))),N(3,()=>{H(),k(),n.current.value||j(),D.emit()}),()=>{s.current.delete(q),r.current.delete(q),n.current.filtered.items.delete(q);let ae=te();N(4,()=>{H(),(ae==null?void 0:ae.getAttribute("id"))===q&&j(),D.emit()})}),group:q=>(i.current.has(q)||i.current.set(q,new Set),()=>{s.current.delete(q),i.current.delete(q)}),filter:()=>a.current.shouldFilter,label:l||t["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:E,inputId:P,labelId:T,listInnerRef:O}),[]);function G(q,pe){var ae,ce;let Se=(ce=(ae=a.current)==null?void 0:ae.filter)!=null?ce:e7;return q?Se(q,n.current.search,pe):0}function k(){if(!n.current.search||a.current.shouldFilter===!1)return;let q=n.current.filtered.items,pe=[];n.current.filtered.groups.forEach(ce=>{let Se=i.current.get(ce),Ee=0;Se.forEach($e=>{let Me=q.get($e);Ee=Math.max(Me,Ee)}),pe.push([ce,Ee])});let ae=O.current;he().sort((ce,Se)=>{var Ee,$e;let Me=ce.getAttribute("id"),Ge=Se.getAttribute("id");return((Ee=q.get(Ge))!=null?Ee:0)-(($e=q.get(Me))!=null?$e:0)}).forEach(ce=>{let Se=ce.closest(dE);Se?Se.appendChild(ce.parentElement===Se?ce:ce.closest(`${dE} > *`)):ae.appendChild(ce.parentElement===ae?ce:ce.closest(`${dE} > *`))}),pe.sort((ce,Se)=>Se[1]-ce[1]).forEach(ce=>{var Se;let Ee=(Se=O.current)==null?void 0:Se.querySelector(`${r0}[${Dm}="${encodeURIComponent(ce[0])}"]`);Ee==null||Ee.parentElement.appendChild(Ee)})}function j(){let q=he().find(ae=>ae.getAttribute("aria-disabled")!=="true"),pe=q==null?void 0:q.getAttribute(Dm);D.setState("value",pe||void 0)}function H(){var q,pe,ae,ce;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let Se=0;for(let Ee of r.current){let $e=(pe=(q=s.current.get(Ee))==null?void 0:q.value)!=null?pe:"",Me=(ce=(ae=s.current.get(Ee))==null?void 0:ae.keywords)!=null?ce:[],Ge=G($e,Me);n.current.filtered.items.set(Ee,Ge),Ge>0&&Se++}for(let[Ee,$e]of i.current)for(let Me of $e)if(n.current.filtered.items.get(Me)>0){n.current.filtered.groups.add(Ee);break}n.current.filtered.count=Se}function ee(){var q,pe,ae;let ce=te();ce&&(((q=ce.parentElement)==null?void 0:q.firstChild)===ce&&((ae=(pe=ce.closest(r0))==null?void 0:pe.querySelector(J$))==null||ae.scrollIntoView({block:"nearest"})),ce.scrollIntoView({block:"nearest"}))}function te(){var q;return(q=O.current)==null?void 0:q.querySelector(`${BF}[aria-selected="true"]`)}function he(){var q;return Array.from(((q=O.current)==null?void 0:q.querySelectorAll(PI))||[])}function se(q){let pe=he()[q];pe&&D.setState("value",pe.getAttribute(Dm))}function fe(q){var pe;let ae=te(),ce=he(),Se=ce.findIndex($e=>$e===ae),Ee=ce[Se+q];(pe=a.current)!=null&&pe.loop&&(Ee=Se+q<0?ce[ce.length-1]:Se+q===ce.length?ce[0]:ce[Se+q]),Ee&&D.setState("value",Ee.getAttribute(Dm))}function B(q){let pe=te(),ae=pe==null?void 0:pe.closest(r0),ce;for(;ae&&!ce;)ae=q>0?c7(ae,r0):u7(ae,r0),ce=ae==null?void 0:ae.querySelector(PI);ce?D.setState("value",ce.getAttribute(Dm)):fe(q)}let J=()=>se(he().length-1),Y=q=>{q.preventDefault(),q.metaKey?J():q.altKey?B(1):fe(1)},V=q=>{q.preventDefault(),q.metaKey?se(0):q.altKey?B(-1):fe(-1)};return R.createElement(Gi.div,{ref:e,tabIndex:-1,..._,"cmdk-root":"",onKeyDown:q=>{var pe;(pe=_.onKeyDown)==null||pe.call(_,q);let ae=q.nativeEvent.isComposing||q.keyCode===229;if(!(q.defaultPrevented||ae))switch(q.key){case"n":case"j":{w&&q.ctrlKey&&Y(q);break}case"ArrowDown":{Y(q);break}case"p":case"k":{w&&q.ctrlKey&&V(q);break}case"ArrowUp":{V(q);break}case"Home":{q.preventDefault(),se(0);break}case"End":{q.preventDefault(),J();break}case"Enter":{q.preventDefault();let ce=te();if(ce){let Se=new Event(zT);ce.dispatchEvent(Se)}}}}},R.createElement("label",{"cmdk-label":"",htmlFor:z.inputId,id:z.labelId,style:h7},l),K1(t,q=>R.createElement(VF.Provider,{value:D},R.createElement(HF.Provider,{value:z},q))))}),t7=R.forwardRef((t,e)=>{var n,r;let i=zc(),s=R.useRef(null),o=R.useContext(GF),a=Gy(),l=$F(t),c=(r=(n=l.current)==null?void 0:n.forceMount)!=null?r:o==null?void 0:o.forceMount;Rh(()=>{if(!c)return a.item(i,o==null?void 0:o.id)},[c]);let d=XF(i,s,[t.value,t.children,s],t.keywords),f=TC(),p=Ed(N=>N.value&&N.value===d.current),y=Ed(N=>c||a.filter()===!1?!0:N.search?N.filtered.items.get(i)>0:!0);R.useEffect(()=>{let N=s.current;if(!(!N||t.disabled))return N.addEventListener(zT,x),()=>N.removeEventListener(zT,x)},[y,t.onSelect,t.disabled]);function x(){var N,D;S(),(D=(N=l.current).onSelect)==null||D.call(N,d.current)}function S(){f.setState("value",d.current,!0)}if(!y)return null;let{disabled:w,value:_,onSelect:E,forceMount:T,keywords:P,...O}=t;return R.createElement(Gi.div,{ref:_g(s,e),...O,id:i,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!p,"data-disabled":!!w,"data-selected":!!p,onPointerMove:w||a.getDisablePointerSelection()?void 0:S,onClick:w?void 0:x},t.children)}),n7=R.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:i,...s}=t,o=zc(),a=R.useRef(null),l=R.useRef(null),c=zc(),d=Gy(),f=Ed(y=>i||d.filter()===!1?!0:y.search?y.filtered.groups.has(o):!0);Rh(()=>d.group(o),[]),XF(o,a,[t.value,t.heading,l]);let p=R.useMemo(()=>({id:o,forceMount:i}),[i]);return R.createElement(Gi.div,{ref:_g(a,e),...s,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&R.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),K1(t,y=>R.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},R.createElement(GF.Provider,{value:p},y))))}),r7=R.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,i=R.useRef(null),s=Ed(o=>!o.search);return!n&&!s?null:R.createElement(Gi.div,{ref:_g(i,e),...r,"cmdk-separator":"",role:"separator"})}),i7=R.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,i=t.value!=null,s=TC(),o=Ed(c=>c.search),a=Ed(c=>c.selectedItemId),l=Gy();return R.useEffect(()=>{t.value!=null&&s.setState("search",t.value)},[t.value]),R.createElement(Gi.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:i?t.value:o,onChange:c=>{i||s.setState("search",c.target.value),n==null||n(c.target.value)}})}),s7=R.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...i}=t,s=R.useRef(null),o=R.useRef(null),a=Ed(c=>c.selectedItemId),l=Gy();return R.useEffect(()=>{if(o.current&&s.current){let c=o.current,d=s.current,f,p=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let y=c.offsetHeight;d.style.setProperty("--cmdk-list-height",y.toFixed(1)+"px")})});return p.observe(c),()=>{cancelAnimationFrame(f),p.unobserve(c)}}},[]),R.createElement(Gi.div,{ref:_g(s,e),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},K1(t,c=>R.createElement("div",{ref:_g(o,l.listInnerRef),"cmdk-list-sizer":""},c)))}),o7=R.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:s,container:o,...a}=t;return R.createElement(NF,{open:n,onOpenChange:r},R.createElement(OF,{container:o},R.createElement(LF,{"cmdk-overlay":"",className:i}),R.createElement(DF,{"aria-label":t.label,"cmdk-dialog":"",className:s},R.createElement(WF,{ref:e,...a}))))}),a7=R.forwardRef((t,e)=>Ed(n=>n.filtered.count===0)?R.createElement(Gi.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),l7=R.forwardRef((t,e)=>{let{progress:n,children:r,label:i="Loading...",...s}=t;return R.createElement(Gi.div,{ref:e,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},K1(t,o=>R.createElement("div",{"aria-hidden":!0},o)))}),im=Object.assign(WF,{List:s7,Item:t7,Input:i7,Group:n7,Separator:r7,Dialog:o7,Empty:a7,Loading:l7});function c7(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function u7(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function $F(t){let e=R.useRef(t);return Rh(()=>{e.current=t}),e}var Rh=typeof window>"u"?R.useEffect:R.useLayoutEffect;function Um(t){let e=R.useRef();return e.current===void 0&&(e.current=t()),e}function Ed(t){let e=TC(),n=()=>t(e.snapshot());return R.useSyncExternalStore(e.subscribe,n,n)}function XF(t,e,n,r=[]){let i=R.useRef(),s=Gy();return Rh(()=>{var o;let a=(()=>{var c;for(let d of n){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?(c=d.current.textContent)==null?void 0:c.trim():i.current}})(),l=r.map(c=>c.trim());s.value(t,a,l),(o=e.current)==null||o.setAttribute(Dm,a),i.current=a}),i}var d7=()=>{let[t,e]=R.useState(),n=Um(()=>new Map);return Rh(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,i)=>{n.current.set(r,i),e({})}};function f7(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function K1({asChild:t,children:e},n){return t&&R.isValidElement(e)?R.cloneElement(f7(e),{ref:e.ref},n(e.props.children)):n(e)}var h7={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function p7({onNavigate:t}){const[e,n]=R.useState(!1);return R.useEffect(()=>{const r=i=>{(i.metaKey||i.ctrlKey)&&i.key.toLowerCase()==="k"&&(i.preventDefault(),n(s=>!s))};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[]),v.jsx(im.Dialog,{open:e,onOpenChange:n,label:"Befehlspalette",className:"fixed inset-0 z-50 flex items-start justify-center bg-black/50 p-4 pt-[12vh]",onClick:()=>n(!1),children:v.jsxs("div",{className:"w-full max-w-lg overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl",onClick:r=>r.stopPropagation(),children:[v.jsx(im.Input,{autoFocus:!0,placeholder:"Springe zu… (Modelle, Routing, System …)",className:"w-full border-b border-border bg-transparent px-4 py-3 text-sm outline-none placeholder:text-muted-foreground"}),v.jsxs(im.List,{className:"max-h-80 overflow-y-auto p-2",children:[v.jsx(im.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),v.jsx(im.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:DT.map(r=>v.jsxs(im.Item,{value:`${r.label} ${r.hint}`,onSelect:()=>{t(r.id),n(!1)},className:"flex cursor-pointer items-center gap-3 rounded-md px-3 py-2 text-sm text-foreground aria-selected:bg-accent aria-selected:text-accent-foreground",children:[v.jsx(r.icon,{className:"h-4 w-4 text-primary"}),v.jsx("span",{children:r.label}),v.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:r.hint})]},r.id))})]})]})})}async function It(t,e){var l;const n={"Content-Type":"application/json",...e==null?void 0:e.headers},r=localStorage.getItem("mc_sudo_password"),i=localStorage.getItem("mc_hf_token");r&&(n["X-Sudo-Password"]=r);let s=e==null?void 0:e.body;if((((l=e==null?void 0:e.method)==null?void 0:l.toUpperCase())||"GET")==="POST"){if(typeof s=="string")try{const c=JSON.parse(s);let d=!1;r&&!("sudo_password"in c)&&(c.sudo_password=r,d=!0),i&&!("hf_token"in c)&&(c.hf_token=i,d=!0),d&&(s=JSON.stringify(c))}catch{}else if(!s){const c={};r&&(c.sudo_password=r),i&&(c.hf_token=i),Object.keys(c).length>0&&(s=JSON.stringify(c))}}const a=await fetch(t,{...e,headers:n,body:s});if(!a.ok)throw new Error(`${a.status} ${a.statusText}`);return a.json()}const m7=(t,e,n=!1,r=!0)=>It("/api/groups",{method:"PUT",body:JSON.stringify({group:t,members:e,swap:n,persist:r})}),g7=t=>It("/api/routing/policy",{method:"PUT",body:JSON.stringify(t)}),qn={health:["health"],systemStatus:["system-status"],services:["services"],models:["models"],groups:["groups"],routing:["routing"],routingPolicy:["routing-policy"],voiceMetrics:["voice-metrics"],jobs:["jobs"],tokenStats:["token-stats"],agentStatus:["agent-status"],hermesBrain:["hermes-brain"],updates:["updates"],discover:["discover"],drafts:t=>["drafts",t??""],connect:t=>["connect",t??""],connectHealth:["connect-health"],memory:(t,e)=>["memory",t??"",e??""],memoryGraph:["memory-graph"]},v7=(t=!0)=>bi({queryKey:qn.memoryGraph,queryFn:()=>It("/api/memory/graph"),enabled:t}),y7=()=>bi({queryKey:qn.health,queryFn:()=>It("/api/health"),refetchInterval:1e4}),Y1=(t=5e3)=>bi({queryKey:qn.systemStatus,queryFn:()=>It("/api/system/status"),refetchInterval:t}),x7=(t=3e3)=>bi({queryKey:qn.services,queryFn:()=>It("/api/system/services"),refetchInterval:t}),Bg=(t=4e3)=>bi({queryKey:qn.models,queryFn:()=>It("/api/models"),refetchInterval:t}),b7=(t=8e3)=>bi({queryKey:qn.groups,queryFn:()=>It("/api/groups"),refetchInterval:t}),_7=(t=5e3)=>bi({queryKey:qn.voiceMetrics,queryFn:()=>It("/api/voice/metrics"),refetchInterval:t}),w7=()=>bi({queryKey:qn.routingPolicy,queryFn:()=>It("/api/routing/policy")}),S7=(t=2e3)=>bi({queryKey:qn.jobs,queryFn:()=>It("/api/jobs"),refetchInterval:t,select:e=>e.jobs??[]}),PC=(t=3e3)=>bi({queryKey:qn.tokenStats,queryFn:()=>It("/api/system/token-stats"),refetchInterval:t}),CC=(t=5e3)=>bi({queryKey:qn.agentStatus,queryFn:()=>It("/api/agent/status"),refetchInterval:t}),M7=(t=6e4)=>bi({queryKey:qn.hermesBrain,queryFn:()=>It("/api/agent/brain"),refetchInterval:t}),RC=t=>bi({queryKey:qn.updates,queryFn:()=>It("/api/maintenance/updates"),refetchInterval:t}),E7=()=>bi({queryKey:qn.discover,queryFn:()=>It("/api/discover")}),A7=t=>bi({queryKey:qn.drafts(t),queryFn:()=>It(`/api/models/drafts?target=${encodeURIComponent(t??"")}`),enabled:!!t}),T7=t=>bi({queryKey:qn.connect(t),queryFn:()=>It(t?`/api/connect?${t}`:"/api/connect")}),P7=()=>bi({queryKey:qn.connectHealth,queryFn:()=>It("/api/connect/health"),refetchInterval:15e3}),BT=t=>bi({queryKey:qn.memory(t==null?void 0:t.q,t==null?void 0:t.category),queryFn:()=>{const e=new URLSearchParams;return t!=null&&t.q&&e.set("q",t.q),t!=null&&t.category&&e.set("category",t.category),It(`/api/memory?${e}`)},select:e=>t!=null&&t.limit?e.slice(0,t.limit):e});let HT=[],VT=[];const GT=new Set,qF=()=>GT.forEach(t=>t());function KF(t){return GT.add(t),()=>{GT.delete(t)}}function C7(t){HT=[...HT,t].slice(-40),qF()}function R7(t){VT=[...VT,t].slice(-40),qF()}const N7=()=>R.useSyncExternalStore(KF,()=>HT),I7=()=>R.useSyncExternalStore(KF,()=>VT);function k7(){const{data:t,dataUpdatedAt:e}=Y1(3e3),{data:n,dataUpdatedAt:r}=PC(3e3),i=R.useRef(null);R.useEffect(()=>{var s,o,a,l;t&&C7({t:Date.now(),cpu:((s=t.cpu)==null?void 0:s.percent)??0,ram:((o=t.ram)==null?void 0:o.percent)??0,gpu:((a=t.gpu)==null?void 0:a.busy_percent)??null,disk:((l=t.disk)==null?void 0:l.percent)??null})},[e]),R.useEffect(()=>{if(!n)return;const s=Date.now(),o=n.prompt_tokens,a=n.completion_tokens;if(i.current){const l=Math.max((s-i.current.t)/1e3,.001);R7({t:s,prompt:Math.max(0,(o-i.current.p)/l),completion:Math.max(0,(a-i.current.c)/l)})}i.current={p:o,c:a,t:s}},[r])}function O7(){const{data:t,error:e}=Y1(3e3),n=N7();return{sys:t,hist:n,error:e}}function sm(t){return(t/1024**3).toFixed(1)}function WT(t){return t?t>1024**3?`${(t/1024**3).toFixed(1)} GB`:`${(t/1024**2).toFixed(0)} MB`:""}function Ia(t){if(!t)return"—";const e=t/1024**3;return e>=1?`${e.toFixed(1)} GB`:`${(t/1024**2).toFixed(0)} MB`}function L7(t){if(!t)return"";const e=Math.floor(t/60);return e>0?`${e} min`:`${t} s`}function CI(t){return t?`${Math.round(t/1024)}k`:"—"}function YF(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=YF(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=YF(t))&&(r&&(r+=" "),r+=e);return r}var D7=["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 NC(t){if(typeof t!="string")return!1;var e=D7;return e.includes(t)}var U7=["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"],j7=new Set(U7);function ZF(t){return typeof t!="string"?!1:j7.has(t)}function QF(t){return typeof t=="string"&&t.startsWith("data-")}function za(t){if(typeof t!="object"||t===null)return{};var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(ZF(n)||QF(n))&&(e[n]=t[n]);return e}function Z1(t){if(t==null)return null;if(R.isValidElement(t)&&typeof t.props=="object"&&t.props!==null){var e=t.props;return za(e)}return typeof t=="object"&&!Array.isArray(t)?za(t):null}function qo(t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(ZF(n)||QF(n)||NC(n))&&(e[n]=t[n]);return e}function F7(t){return t==null?null:R.isValidElement(t)?qo(t.props):typeof t=="object"&&!Array.isArray(t)?qo(t):null}var z7=["children","width","height","viewBox","className","style","title","desc"];function $T(){return $T=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},$T.apply(null,arguments)}function B7(t,e){if(t==null)return{};var n,r,i=H7(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 H7(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 JF=R.forwardRef((t,e)=>{var n=t.children,r=t.width,i=t.height,s=t.viewBox,o=t.className,a=t.style,l=t.title,c=t.desc,d=B7(t,z7),f=s||{width:r,height:i,x:0,y:0},p=tr("recharts-surface",o);return R.createElement("svg",$T({},qo(d),{className:p,width:r,height:i,style:a,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:e}),R.createElement("title",null,l),R.createElement("desc",null,c),n)}),V7=["children","className"];function XT(){return XT=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},XT.apply(null,arguments)}function G7(t,e){if(t==null)return{};var n,r,i=W7(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 W7(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 Ko=R.forwardRef((t,e)=>{var n=t.children,r=t.className,i=G7(t,V7),s=tr("recharts-layer",r);return R.createElement("g",XT({className:s},qo(i),{ref:e}),n)}),$7=R.createContext(null);function Er(t){return function(){return t}}const qT=Math.PI,KT=2*qT,Wf=1e-6,X7=KT-Wf;function e5(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function q7(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return e5;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 K7=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?e5:q7(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,o){this._append`C${+e},${+n},${+r},${+i},${this._x1=+s},${this._y1=+o}`}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 o=this._x1,a=this._y1,l=r-e,c=i-n,d=o-e,f=a-n,p=d*d+f*f;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(p>Wf)if(!(Math.abs(f*l-c*d)>Wf)||!s)this._append`L${this._x1=e},${this._y1=n}`;else{let y=r-o,x=i-a,S=l*l+c*c,w=y*y+x*x,_=Math.sqrt(S),E=Math.sqrt(p),T=s*Math.tan((qT-Math.acos((S+p-w)/(2*_*E)))/2),P=T/E,O=T/_;Math.abs(P-1)>Wf&&this._append`L${e+P*d},${n+P*f}`,this._append`A${s},${s},0,0,${+(f*y>d*x)},${this._x1=e+O*l},${this._y1=n+O*c}`}}arc(e,n,r,i,s,o){if(e=+e,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(i),l=r*Math.sin(i),c=e+a,d=n+l,f=1^o,p=o?i-s:s-i;this._x1===null?this._append`M${c},${d}`:(Math.abs(this._x1-c)>Wf||Math.abs(this._y1-d)>Wf)&&this._append`L${c},${d}`,r&&(p<0&&(p=p%KT+KT),p>X7?this._append`A${r},${r},0,1,${f},${e-a},${n-l}A${r},${r},0,1,${f},${this._x1=c},${this._y1=d}`:p>Wf&&this._append`A${r},${r},0,${+(p>=qT)},${f},${this._x1=e+r*Math.cos(s)},${this._y1=n+r*Math.sin(s)}`)}rect(e,n,r,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}};function t5(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 K7(e)}function IC(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function n5(t){this._context=t}n5.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 Q1(t){return new n5(t)}function r5(t){return t[0]}function i5(t){return t[1]}function s5(t,e){var n=Er(!0),r=null,i=Q1,s=null,o=t5(a);t=typeof t=="function"?t:t===void 0?r5:Er(t),e=typeof e=="function"?e:e===void 0?i5:Er(e);function a(l){var c,d=(l=IC(l)).length,f,p=!1,y;for(r==null&&(s=i(y=o())),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 a.x=function(l){return arguments.length?(t=typeof l=="function"?l:Er(+l),a):t},a.y=function(l){return arguments.length?(e=typeof l=="function"?l:Er(+l),a):e},a.defined=function(l){return arguments.length?(n=typeof l=="function"?l:Er(!!l),a):n},a.curve=function(l){return arguments.length?(i=l,r!=null&&(s=i(r)),a):i},a.context=function(l){return arguments.length?(l==null?r=s=null:s=i(r=l),a):r},a}function bb(t,e,n){var r=null,i=Er(!0),s=null,o=Q1,a=null,l=t5(c);t=typeof t=="function"?t:t===void 0?r5:Er(+t),e=typeof e=="function"?e:Er(e===void 0?0:+e),n=typeof n=="function"?n:n===void 0?i5:Er(+n);function c(f){var p,y,x,S=(f=IC(f)).length,w,_=!1,E,T=new Array(S),P=new Array(S);for(s==null&&(a=o(E=l())),p=0;p<=S;++p){if(!(p<S&&i(w=f[p],p,f))===_)if(_=!_)y=p,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),x=p-1;x>=y;--x)a.point(T[x],P[x]);a.lineEnd(),a.areaEnd()}_&&(T[p]=+t(w,p,f),P[p]=+e(w,p,f),a.point(r?+r(w,p,f):T[p],n?+n(w,p,f):P[p]))}if(E)return a=null,E+""||null}function d(){return s5().defined(i).curve(o).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?(o=f,s!=null&&(a=o(s)),c):o},c.context=function(f){return arguments.length?(f==null?s=a=null:a=o(s=f),c):s},c}class o5{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 Y7(t){return new o5(t,!0)}function Z7(t){return new o5(t,!1)}function rw(){}function iw(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 a5(t){this._context=t}a5.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:iw(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:iw(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Q7(t){return new a5(t)}function l5(t){this._context=t}l5.prototype={areaStart:rw,areaEnd:rw,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:iw(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function J7(t){return new l5(t)}function c5(t){this._context=t}c5.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:iw(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function eX(t){return new c5(t)}function u5(t){this._context=t}u5.prototype={areaStart:rw,areaEnd:rw,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 tX(t){return new u5(t)}function RI(t){return t<0?-1:1}function NI(t,e,n){var r=t._x1-t._x0,i=e-t._x1,s=(t._y1-t._y0)/(r||i<0&&-0),o=(n-t._y1)/(i||r<0&&-0),a=(s*i+o*r)/(r+i);return(RI(s)+RI(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function II(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function fE(t,e,n){var r=t._x0,i=t._y0,s=t._x1,o=t._y1,a=(s-r)/3;t._context.bezierCurveTo(r+a,i+a*e,s-a,o-a*n,s,o)}function sw(t){this._context=t}sw.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:fE(this,this._t0,II(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,fE(this,II(this,n=NI(this,t,e)),n);break;default:fE(this,this._t0,n=NI(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function d5(t){this._context=new f5(t)}(d5.prototype=Object.create(sw.prototype)).point=function(t,e){sw.prototype.point.call(this,e,t)};function f5(t){this._context=t}f5.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 nX(t){return new sw(t)}function rX(t){return new d5(t)}function h5(t){this._context=t}h5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var r=kI(t),i=kI(e),s=0,o=1;o<n;++s,++o)this._context.bezierCurveTo(r[0][s],i[0][s],r[1][s],i[1][s],t[o],e[o]);(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 kI(t){var e,n=t.length-1,r,i=new Array(n),s=new Array(n),o=new Array(n);for(i[0]=0,s[0]=2,o[0]=t[0]+2*t[1],e=1;e<n-1;++e)i[e]=1,s[e]=4,o[e]=4*t[e]+2*t[e+1];for(i[n-1]=2,s[n-1]=7,o[n-1]=8*t[n-1]+t[n],e=1;e<n;++e)r=i[e]/s[e-1],s[e]-=r,o[e]-=r*o[e-1];for(i[n-1]=o[n-1]/s[n-1],e=n-2;e>=0;--e)i[e]=(o[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 iX(t){return new h5(t)}function J1(t,e){this._context=t,this._t=e}J1.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 sX(t){return new J1(t,.5)}function oX(t){return new J1(t,0)}function aX(t){return new J1(t,1)}function Nh(t,e){if((o=t.length)>1)for(var n=1,r,i,s=t[e[0]],o,a=s.length;n<o;++n)for(i=s,s=t[e[n]],r=0;r<a;++r)s[r][1]+=s[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function YT(t){for(var e=t.length,n=new Array(e);--e>=0;)n[e]=e;return n}function lX(t,e){return t[e]}function cX(t){const e=[];return e.key=t,e}function uX(){var t=Er([]),e=YT,n=Nh,r=lX;function i(s){var o=Array.from(t.apply(this,arguments),cX),a,l=o.length,c=-1,d;for(const f of s)for(a=0,++c;a<l;++a)(o[a][c]=[0,+r(f,o[a].key,c,s)]).data=f;for(a=0,d=IC(e(o));a<l;++a)o[d[a]].index=a;return n(o,d),o}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?YT:typeof s=="function"?s:Er(Array.from(s)),i):e},i.offset=function(s){return arguments.length?(n=s??Nh,i):n},i}function dX(t,e){if((r=t.length)>0){for(var n,r,i=0,s=t[0].length,o;i<s;++i){for(o=n=0;n<r;++n)o+=t[n][i][1]||0;if(o)for(n=0;n<r;++n)t[n][i][1]/=o}Nh(t,e)}}function fX(t,e){if((i=t.length)>0){for(var n=0,r=t[e[0]],i,s=r.length;n<s;++n){for(var o=0,a=0;o<i;++o)a+=t[o][n][1]||0;r[n][1]+=r[n][0]=-a/2}Nh(t,e)}}function hX(t,e){if(!(!((o=t.length)>0)||!((s=(i=t[e[0]]).length)>0))){for(var n=0,r=1,i,s,o;r<s;++r){for(var a=0,l=0,c=0;a<o;++a){for(var d=t[e[a]],f=d[r][1]||0,p=d[r-1][1]||0,y=(f-p)/2,x=0;x<a;++x){var S=t[e[x]],w=S[r][1]||0,_=S[r-1][1]||0;y+=w-_}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,Nh(t,e)}}function ZT(t){return t==="__proto__"}function p5(t){switch(typeof t){case"number":case"symbol":return!1;case"string":return t.includes(".")||t.includes("[")||t.includes("]")}}function kC(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 m5(t){if(t==null)return"";if(typeof t=="string")return t;if(Array.isArray(t))return t.map(m5).join(",");const e=String(t);return e==="0"&&Object.is(Number(t),-0)?"-0":e}function OC(t){if(Array.isArray(t))return t.map(kC);if(typeof t=="symbol")return[t];t=m5(t);const e=[],n=t.length;if(n===0)return e;let r=0,i="",s="",o=!1;for(t.charCodeAt(0)===46&&e.push("");r<n;){const a=t[r];if(s)a==="\\"&&r+1<n?(r++,i+=t[r]):a===s?s="":i+=a;else if(o)a==='"'||a==="'"?s=a:a==="]"?(o=!1,e.push(i),i=""):i+=a;else if(a==="[")o=!0,i&&(e.push(i),i="");else if(a==="."){i&&(e.push(i),i="");const l=t[r+1];(l===void 0||l===".")&&e.push("")}else i+=a;r++}return i&&e.push(i),e}function Kh(t,e,n){if(t==null)return n;switch(typeof e){case"string":{if(ZT(e))return n;const r=t[e];return r===void 0?p5(e)&&!Object.hasOwn(t,e)?Kh(t,OC(e),n):n:r}case"number":case"symbol":{typeof e=="number"&&(e=kC(e));const r=t[e];return r===void 0?n:r}default:{if(Array.isArray(e))return pX(t,e,n);if(Object.is(e==null?void 0:e.valueOf(),-0)?e="-0":e=String(e),ZT(e))return n;const r=t[e];return r===void 0?n:r}}}function pX(t,e,n){if(e.length===0)return n;let r=t;for(let i=0;i<e.length;i++){if(r==null||ZT(e[i]))return n;r=r[e[i]]}return r===void 0?n:r}var mX=4;function vd(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:mX,n=10**e,r=Math.round(t*n)/n;return Object.is(r,-0)?0:r}function Ui(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return t.reduce((i,s,o)=>{var a=n[o-1];return typeof a=="string"?i+a+s:a!==void 0?i+vd(a)+s:i+s},"")}var Vo=t=>t===0?0:t>0?1:-1,Rl=t=>typeof t=="number"&&t!=+t,Ih=t=>typeof t=="string"&&t.length>1&&t.indexOf("%")===t.length-1,kt=t=>(typeof t=="number"||t instanceof Number)&&!Rl(t),Nl=t=>kt(t)||typeof t=="string",gX=0,cy=t=>{var e=++gX;return"".concat(t||"").concat(e)},Ad=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!kt(e)&&typeof e!="string")return r;var s;if(Ih(e)){if(n==null)return r;var o=e.indexOf("%");s=n*parseFloat(e.slice(0,o))/100}else s=+e;return Rl(s)&&(s=r),i&&n!=null&&s>n&&(s=n),s},g5=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 Dc(t,e,n){return kt(t)&&kt(e)?vd(t+n*(e-t)):e}function v5(t,e,n){if(!(!t||!t.length))return t.find(r=>r&&(typeof e=="function"?e(r):Kh(r,e))===n)}var Vi=t=>t===null||typeof t>"u",LC=t=>Vi(t)?t:"".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));function Ys(t){return t!=null}function Hg(){}var y5=t=>"radius"in t&&"startAngle"in t&&"endAngle"in t,DC=(t,e)=>{if(!t||typeof t=="function"||typeof t=="boolean")return null;var n=t;if(R.isValidElement(t)&&(n=t.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(i=>{NC(i)&&typeof n[i]=="function"&&(r[i]=(s=>n[i](n,s)))}),r},vX=(t,e,n)=>r=>(t(e,n,r),null),yX=(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];NC(i)&&typeof s=="function"&&(r||(r={}),r[i]=vX(s,e,n))}),r};function OI(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function xX(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?OI(Object(n),!0).forEach(function(r){bX(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):OI(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function bX(t,e,n){return(e=_X(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _X(t){var e=wX(t,"string");return typeof e=="symbol"?e:e+""}function wX(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 Qo(t,e){var n=xX({},t),r=e,i=Object.keys(e),s=i.reduce((o,a)=>(o[a]===void 0&&r[a]!==void 0&&(o[a]=r[a]),o),n);return s}function SX(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 MX(t,e){return function(...n){return t.apply(this,n.slice(0,e))}}function x5(t){return t}function EX(t){return function(e){return Kh(e,t)}}function QT(t){return t==null||typeof t!="object"&&typeof t!="function"}function AX(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function TX(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function UC(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const PX="[object RegExp]",b5="[object String]",_5="[object Number]",w5="[object Boolean]",S5="[object Arguments]",CX="[object Symbol]",RX="[object Date]",NX="[object Map]",IX="[object Set]",kX="[object Array]",OX="[object ArrayBuffer]",LX="[object Object]",DX="[object DataView]",UX="[object Uint8Array]",jX="[object Uint8ClampedArray]",FX="[object Uint16Array]",zX="[object Uint32Array]",BX="[object Int8Array]",HX="[object Int16Array]",VX="[object Int32Array]",GX="[object Float32Array]",WX="[object Float64Array]",LI=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function $X(t){return typeof LI.Buffer<"u"&&LI.Buffer.isBuffer(t)}function XX(t,e){return th(t,void 0,t,new Map,e)}function th(t,e,n,r=new Map,i=void 0){const s=i==null?void 0:i(t,e,n,r);if(s!==void 0)return s;if(QT(t))return t;if(r.has(t))return r.get(t);if(Array.isArray(t)){const o=new Array(t.length);r.set(t,o);for(let a=0;a<t.length;a++)o[a]=th(t[a],a,n,r,i);return Object.hasOwn(t,"index")&&(o.index=t.index),Object.hasOwn(t,"input")&&(o.input=t.input),o}if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){const o=new RegExp(t.source,t.flags);return o.lastIndex=t.lastIndex,o}if(t instanceof Map){const o=new Map;r.set(t,o);for(const[a,l]of t)o.set(a,th(l,a,n,r,i));return o}if(t instanceof Set){const o=new Set;r.set(t,o);for(const a of t)o.add(th(a,void 0,n,r,i));return o}if($X(t))return t.subarray();if(AX(t)){const o=new(Object.getPrototypeOf(t)).constructor(t.length);r.set(t,o);for(let a=0;a<t.length;a++)o[a]=th(t[a],a,n,r,i);return o}if(t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);if(t instanceof DataView){const o=new DataView(t.buffer.slice(0),t.byteOffset,t.byteLength);return r.set(t,o),ka(o,t,n,r,i),o}if(typeof File<"u"&&t instanceof File){const o=new File([t],t.name,{type:t.type});return r.set(t,o),ka(o,t,n,r,i),o}if(typeof Blob<"u"&&t instanceof Blob){const o=new Blob([t],{type:t.type});return r.set(t,o),ka(o,t,n,r,i),o}if(t instanceof Error){const o=structuredClone(t);return r.set(t,o),o.message=t.message,o.name=t.name,o.stack=t.stack,o.cause=t.cause,o.constructor=t.constructor,ka(o,t,n,r,i),o}if(t instanceof Boolean){const o=new Boolean(t.valueOf());return r.set(t,o),ka(o,t,n,r,i),o}if(t instanceof Number){const o=new Number(t.valueOf());return r.set(t,o),ka(o,t,n,r,i),o}if(t instanceof String){const o=new String(t.valueOf());return r.set(t,o),ka(o,t,n,r,i),o}if(typeof t=="object"&&qX(t)){const o=Object.create(Object.getPrototypeOf(t));return r.set(t,o),ka(o,t,n,r,i),o}return t}function ka(t,e,n=t,r,i){const s=[...Object.keys(e),...TX(e)];for(let o=0;o<s.length;o++){const a=s[o],l=Object.getOwnPropertyDescriptor(t,a);(l==null||l.writable)&&(t[a]=th(e[a],a,n,r,i))}}function qX(t){switch(UC(t)){case S5:case kX:case OX:case DX:case w5:case RX:case GX:case WX:case BX:case HX:case VX:case NX:case _5:case LX:case PX:case IX:case b5:case CX:case UX:case jX:case FX:case zX:return!0;default:return!1}}function KX(t){return th(t,void 0,t,new Map,void 0)}function j_(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}function M5(t){return t!==null&&(typeof t=="object"||typeof t=="function")}function E5(t,e,n){return typeof n!="function"?E5(t,e,()=>{}):JT(t,e,function r(i,s,o,a,l,c){const d=n(i,s,o,a,l,c);return d!==void 0?!!d:JT(i,s,r,c,!1)},new Map,!0)}function JT(t,e,n,r,i=!1){if(e===t)return!0;switch(typeof e){case"object":return YX(t,e,n,r);case"function":return Object.keys(e).length>0?JT(t,{...e},n,r,i):j_(t,e);default:return M5(t)&&i?typeof e=="string"?e==="":!0:j_(t,e)}}function YX(t,e,n,r){if(e==null)return!0;if(Array.isArray(e))return A5(t,e,n,r);if(e instanceof Map)return ZX(t,e,n,r);if(e instanceof Set)return QX(t,e,n,r);const i=Object.keys(e);if(t==null||QT(t))return i.length===0;if(i.length===0)return!0;if(r!=null&&r.has(e))return r.get(e)===t;r==null||r.set(e,t);try{for(let s=0;s<i.length;s++){const o=i[s];if(!QT(t)&&!(o in t)||e[o]===void 0&&t[o]!==void 0||e[o]===null&&t[o]!==null||!n(t[o],e[o],o,t,e,r))return!1}return!0}finally{r==null||r.delete(e)}}function ZX(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 A5(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 o=e[s];let a=!1;for(let l=0;l<t.length;l++){if(i.has(l))continue;const c=t[l];let d=!1;if(n(c,o,s,t,e,r)&&(d=!0),d){i.add(l),a=!0;break}}if(!a)return!1}return!0}function QX(t,e,n,r){return e.size===0?!0:t instanceof Set?A5([...t],[...e],n,r):!1}function T5(t,e){return E5(t,e,()=>{})}function JX(t){return t=KX(t),e=>T5(e,t)}function eq(t,e){return XX(t,(n,r,i,s)=>{if(typeof t=="object"){if(UC(t)==="[object Object]"&&typeof t.constructor!="function"){const o={};return s.set(t,o),ka(o,t,i,s),o}switch(Object.prototype.toString.call(t)){case _5:case b5:case w5:{const o=new t.constructor(t==null?void 0:t.valueOf());return ka(o,t),o}case S5:{const o={};return ka(o,t),o.length=t.length,o[Symbol.iterator]=t[Symbol.iterator],o}default:return}}})}function tq(t){return eq(t)}const nq=/^(?:0|[1-9]\d*)$/;function P5(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 nq.test(t)}}function rq(t){return t!==null&&typeof t=="object"&&UC(t)==="[object Arguments]"}function iq(t,e){let n;if(Array.isArray(e)?n=e:typeof e=="string"&&p5(e)&&(t==null?void 0:t[e])==null?n=OC(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)||rq(r))&&P5(s)&&s<r.length))return!1;r=r[s]}return!0}function sq(t,e){switch(typeof t){case"object":Object.is(t==null?void 0:t.valueOf(),-0)&&(t="-0");break;case"number":t=kC(t);break}return e=tq(e),function(n){const r=Kh(n,t);return r===void 0?iq(n,t):e===void 0?r===void 0:T5(r,e)}}function oq(t){if(t==null)return x5;switch(typeof t){case"function":return t;case"object":return Array.isArray(t)&&t.length===2?sq(t[0],t[1]):JX(t);case"string":case"symbol":case"number":return EX(t)}}function aq(t){return Number.isSafeInteger(t)&&t>=0}function C5(t){return t!=null&&typeof t!="function"&&aq(t.length)}function lq(t){return typeof t=="object"&&t!==null}function cq(t){return lq(t)&&C5(t)}function DI(t,e=x5){return cq(t)?SX(Array.from(t),MX(oq(e),1)):[]}function uq(t,e,n){return e===!0?DI(t,n):typeof e=="function"?DI(t,e):t}var hE={exports:{}},pE={},mE={exports:{}},gE={};/**
|
||
* @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 UI;function dq(){if(UI)return gE;UI=1;var t=Xh();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,o=t.useDebugValue;function a(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]),o(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:a;return gE.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,gE}var jI;function fq(){return jI||(jI=1,mE.exports=dq()),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 FI;function hq(){if(FI)return pE;FI=1;var t=Xh(),e=fq();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;return pE.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=a(function(){function _(N){if(!E){if(E=!0,T=N,N=p(N),y!==void 0&&S.hasValue){var D=S.value;if(y(D,N))return P=D}return P=N}if(D=P,r(T,N))return D;var z=p(N);return y!==void 0&&y(D,z)?(T=N,D):(T=N,P=z)}var E=!1,T,P,O=f===void 0?null:f;return[function(){return _(d())},O===null?void 0:function(){return _(O())}]},[d,f,p,y]);var w=i(c,x[0],x[1]);return o(function(){S.hasValue=!0,S.value=w},[w]),l(w),w},pE}var zI;function pq(){return zI||(zI=1,hE.exports=hq()),hE.exports}var mq=pq(),jC=R.createContext(null),gq=t=>t,Wr=()=>{var t=R.useContext(jC);return t?t.store.dispatch:gq},F_=()=>{},vq=()=>F_,yq=(t,e)=>t===e;function Ft(t){var e=R.useContext(jC),n=R.useMemo(()=>e?r=>{if(r!=null)return t(r)}:F_,[e,t]);return mq.useSyncExternalStoreWithSelector(e?e.subscription.addNestedSub:vq,e?e.store.getState:F_,e?e.store.getState:F_,n,yq)}function xq(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function bq(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(n=>typeof n=="function")){const n=t.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${e}[${n}]`)}}var BI=t=>Array.isArray(t)?t:[t];function _q(t){const e=Array.isArray(t[0])?t[0]:t;return bq(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function wq(t,e){const n=[],{length:r}=t;for(let i=0;i<r;i++)n.push(t[i].apply(null,e));return n}var Sq=class{constructor(t){this.value=t}deref(){return this.value}},Mq=()=>typeof WeakRef>"u"?Sq:WeakRef,R5=Mq(),Eq=0,HI=1;function _b(){return{s:Eq,v:void 0,o:null,p:null}}function Aq(t){return t instanceof R5?t.deref():t}function N5(t,e={}){let n=_b();const{resultEqualityCheck:r}=e;let i,s=0;function o(){let a=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=a.o;x===null&&(a.o=x=new WeakMap);const S=x.get(y);S===void 0?(a=_b(),x.set(y,a)):a=S}else{let x=a.p;x===null&&(a.p=x=new Map);const S=x.get(y);S===void 0?(a=_b(),x.set(y,a)):a=S}}const c=a;let d;if(a.s===HI)d=a.v;else if(d=t.apply(null,arguments),s++,r){const f=Aq(i);f!=null&&r(f,d)&&(d=f,s!==0&&s--),i=typeof d=="object"&&d!==null||typeof d=="function"?new R5(d):d}return c.s=HI,c.v=d,d}return o.clearCache=()=>{n=_b(),o.resetResultsCount()},o.resultsCount=()=>s,o.resetResultsCount=()=>{s=0},o}function Tq(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...i)=>{let s=0,o=0,a,l={},c=i.pop();typeof c=="object"&&(l=c,c=i.pop()),xq(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const d={...n,...l},{memoize:f,memoizeOptions:p=[],argsMemoize:y=N5,argsMemoizeOptions:x=[]}=d,S=BI(p),w=BI(x),_=_q(i),E=f(function(){return s++,c.apply(null,arguments)},...S),T=y(function(){o++;const O=wq(_,arguments);return a=E.apply(null,O),a},...w);return Object.assign(T,{resultFunc:c,memoizedResultFunc:E,dependencies:_,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>a,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:y})};return Object.assign(r,{withTypes:()=>r}),r}var ke=Tq(N5);function Pq(t,e=1){const n=[],r=Math.floor(e),i=(s,o)=>{for(let a=0;a<s.length;a++){const l=s[a];Array.isArray(l)&&o<r?i(l,o+1):n.push(l)}};return i(t,0),n}function eP(t,e,n){return M5(n)&&(typeof e=="number"&&C5(n)&&P5(e)&&e<n.length||typeof e=="string"&&e in n)?j_(n[e],t):!1}function VI(t){return typeof t=="symbol"?1:t===null?2:t===void 0?3:t!==t?4:0}const Cq=(t,e,n)=>{if(t!==e){const r=VI(t),i=VI(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 I5(t){return typeof t=="symbol"||t instanceof Symbol}const Rq=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Nq=/^\w*$/;function Iq(t,e){return Array.isArray(t)?!1:typeof t=="number"||typeof t=="boolean"||t==null||I5(t)?!0:typeof t=="string"&&(Nq.test(t)||!Rq.test(t))||e!=null}function kq(t,e,n,r){if(t==null)return[];n=n,Array.isArray(t)||(t=Object.values(t)),Array.isArray(e)||(e=e==null?[null]:[e]),e.length===0&&(e=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(a=>String(a));const i=(a,l)=>{let c=a;for(let d=0;d<l.length&&c!=null;++d)c=c[l[d]];return c},s=(a,l)=>l==null||a==null?l:typeof a=="object"&&"key"in a?Object.hasOwn(l,a.key)?l[a.key]:i(l,a.path):typeof a=="function"?a(l):Array.isArray(a)?i(l,a):typeof l=="object"?l[a]:l,o=e.map(a=>(Array.isArray(a)&&a.length===1&&(a=a[0]),a==null||typeof a=="function"||Array.isArray(a)||Iq(a)?a:{key:a,path:OC(a)}));return t.map(a=>({original:a,criteria:o.map(l=>s(l,a))})).slice().sort((a,l)=>{for(let c=0;c<o.length;c++){const d=Cq(a.criteria[c],l.criteria[c],n[c]);if(d!==0)return d}return 0}).map(a=>a.original)}function eS(t,...e){const n=e.length;return n>1&&eP(t,e[0],e[1])?e=[]:n>2&&eP(e[0],e[1],e[2])&&(e=[e[0]]),kq(t,Pq(e),["asc"])}var k5=t=>t.legend.settings,Oq=t=>t.legend.size,Lq=t=>t.legend.payload;ke([Lq,k5],(t,e)=>{var n=e.itemSorter,r=t.flat(1);return n?eS(r,n):r});function Dq(t,e){return zq(t)||Fq(t,e)||jq(t,e)||Uq()}function Uq(){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 jq(t,e){if(t){if(typeof t=="string")return GI(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?GI(t,e):void 0}}function GI(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Fq(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function zq(t){if(Array.isArray(t))return t}var wb=1;function WI(t,e){return Math.abs(t.height-e.height)>wb||Math.abs(t.left-e.left)>wb||Math.abs(t.top-e.top)>wb||Math.abs(t.width-e.width)>wb}function $I(t){var e=t.getBoundingClientRect();return{height:e.height,left:e.left,top:e.top,width:e.width}}function Bq(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=R.useState({height:0,left:0,top:0,width:0}),n=Dq(e,2),r=n[0],i=n[1],s=R.useRef(null),o=R.useRef(r);o.current=r;var a=R.useCallback(l=>{if(s.current!=null&&(s.current.disconnect(),s.current=null),l!=null){var c=$I(l);if(WI(c,o.current)&&i(c),typeof ResizeObserver<"u"){var d=new ResizeObserver(()=>{var f=$I(l);WI(f,o.current)&&i(f)});d.observe(l),s.current=d}}},[...t]);return R.useEffect(()=>()=>{var l;(l=s.current)===null||l===void 0||l.disconnect()},[]),[r,a]}function 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 Hq=typeof Symbol=="function"&&Symbol.observable||"@@observable",XI=Hq,vE=()=>Math.random().toString(36).substring(7).split("").join("."),Vq={INIT:`@@redux/INIT${vE()}`,REPLACE:`@@redux/REPLACE${vE()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${vE()}`},ow=Vq;function FC(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 O5(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(O5)(t,e)}let r=t,i=e,s=new Map,o=s,a=0,l=!1;function c(){o===s&&(o=new Map,s.forEach((w,_)=>{o.set(_,w)}))}function d(){if(l)throw new Error(Di(3));return i}function f(w){if(typeof w!="function")throw new Error(Di(4));if(l)throw new Error(Di(5));let _=!0;c();const E=a++;return o.set(E,w),function(){if(_){if(l)throw new Error(Di(6));_=!1,c(),o.delete(E),s=null}}}function p(w){if(!FC(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=o).forEach(E=>{E()}),w}function y(w){if(typeof w!="function")throw new Error(Di(10));r=w,p({type:ow.REPLACE})}function x(){const w=f;return{subscribe(_){if(typeof _!="object"||_===null)throw new Error(Di(11));function E(){const P=_;P.next&&P.next(d())}return E(),{unsubscribe:w(E)}},[XI](){return this}}}return p({type:ow.INIT}),{dispatch:p,subscribe:f,getState:d,replaceReducer:y,[XI]:x}}function Gq(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:ow.INIT})>"u")throw new Error(Di(12));if(typeof n(void 0,{type:ow.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Di(13))})}function L5(t){const e=Object.keys(t),n={};for(let s=0;s<e.length;s++){const o=e[s];typeof t[o]=="function"&&(n[o]=t[o])}const r=Object.keys(n);let i;try{Gq(n)}catch(s){i=s}return function(o={},a){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=o[f],x=p(y,a);if(typeof x>"u")throw a&&a.type,new Error(Di(14));c[f]=x,l=l||x!==y}return l=l||r.length!==Object.keys(o).length,l?c:o}}function aw(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function Wq(...t){return e=>(n,r)=>{const i=e(n,r);let s=()=>{throw new Error(Di(15))};const o={getState:i.getState,dispatch:(l,...c)=>s(l,...c)},a=t.map(l=>l(o));return s=aw(...a)(i.dispatch),{...i,dispatch:s}}}function D5(t){return FC(t)&&"type"in t&&typeof t.type=="string"}var U5=Symbol.for("immer-nothing"),qI=Symbol.for("immer-draftable"),Ps=Symbol.for("immer-state");function Ua(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var bo=Object,Sg=bo.getPrototypeOf,lw="constructor",tS="prototype",tP="configurable",cw="enumerable",z_="writable",uy="value",Xc=t=>!!t&&!!t[Ps];function Ba(t){var e;return t?j5(t)||rS(t)||!!t[qI]||!!((e=t[lw])!=null&&e[qI])||iS(t)||sS(t):!1}var $q=bo[tS][lw].toString(),KI=new WeakMap;function j5(t){if(!t||!zC(t))return!1;const e=Sg(t);if(e===null||e===bo[tS])return!0;const n=bo.hasOwnProperty.call(e,lw)&&e[lw];if(n===Object)return!0;if(!jm(n))return!1;let r=KI.get(n);return r===void 0&&(r=Function.toString.call(n),KI.set(n,r)),r===$q}function nS(t,e,n=!0){Wy(t)===0?(n?Reflect.ownKeys(t):bo.keys(t)).forEach(i=>{e(i,t[i],t)}):t.forEach((r,i)=>e(i,r,t))}function Wy(t){const e=t[Ps];return e?e.type_:rS(t)?1:iS(t)?2:sS(t)?3:0}var YI=(t,e,n=Wy(t))=>n===2?t.has(e):bo[tS].hasOwnProperty.call(t,e),nP=(t,e,n=Wy(t))=>n===2?t.get(e):t[e],uw=(t,e,n,r=Wy(t))=>{r===2?t.set(e,n):r===3?t.add(n):t[e]=n};function Xq(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var rS=Array.isArray,iS=t=>t instanceof Map,sS=t=>t instanceof Set,zC=t=>typeof t=="object",jm=t=>typeof t=="function",yE=t=>typeof t=="boolean";function qq(t){const e=+t;return Number.isInteger(e)&&String(e)===t}var Cc=t=>t.copy_||t.base_,BC=t=>t.modified_?t.copy_:t.base_;function rP(t,e){if(iS(t))return new Map(t);if(sS(t))return new Set(t);if(rS(t))return Array[tS].slice.call(t);const n=j5(t);if(e===!0||e==="class_only"&&!n){const r=bo.getOwnPropertyDescriptors(t);delete r[Ps];let i=Reflect.ownKeys(r);for(let s=0;s<i.length;s++){const o=i[s],a=r[o];a[z_]===!1&&(a[z_]=!0,a[tP]=!0),(a.get||a.set)&&(r[o]={[tP]:!0,[z_]:!0,[cw]:a[cw],[uy]:t[o]})}return bo.create(Sg(t),r)}else{const r=Sg(t);if(r!==null&&n)return{...t};const i=bo.create(r);return bo.assign(i,t)}}function HC(t,e=!1){return oS(t)||Xc(t)||!Ba(t)||(Wy(t)>1&&bo.defineProperties(t,{set:Sb,add:Sb,clear:Sb,delete:Sb}),bo.freeze(t),e&&nS(t,(n,r)=>{HC(r,!0)},!1)),t}function Kq(){Ua(2)}var Sb={[uy]:Kq};function oS(t){return t===null||!zC(t)?!0:bo.isFrozen(t)}var dw="MapSet",iP="Patches",ZI="ArrayMethods",F5={};function kh(t){const e=F5[t];return e||Ua(0,t),e}var QI=t=>!!F5[t],dy,z5=()=>dy,Yq=(t,e)=>({drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:QI(dw)?kh(dw):void 0,arrayMethodsPlugin_:QI(ZI)?kh(ZI):void 0});function JI(t,e){e&&(t.patchPlugin_=kh(iP),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function sP(t){oP(t),t.drafts_.forEach(Zq),t.drafts_=null}function oP(t){t===dy&&(dy=t.parent_)}var ek=t=>dy=Yq(dy,t);function Zq(t){const e=t[Ps];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function tk(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(t!==void 0&&t!==n){n[Ps].modified_&&(sP(e),Ua(4)),Ba(t)&&(t=nk(e,t));const{patchPlugin_:i}=e;i&&i.generateReplacementPatches_(n[Ps].base_,t,e)}else t=nk(e,n);return Qq(e,t,!0),sP(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==U5?t:void 0}function nk(t,e){if(oS(e))return e;const n=e[Ps];if(!n)return fw(e,t.handledSet_,t);if(!aS(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);V5(n,t)}return n.copy_}function Qq(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&HC(e,n)}function B5(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var aS=(t,e)=>t.scope_===e,Jq=[];function H5(t,e,n,r){const i=Cc(t),s=t.type_;if(r!==void 0&&nP(i,r,s)===e){uw(i,r,n,s);return}if(!t.draftLocations_){const a=t.draftLocations_=new Map;nS(i,(l,c)=>{if(Xc(c)){const d=a.get(c)||[];d.push(l),a.set(c,d)}})}const o=t.draftLocations_.get(e)??Jq;for(const a of o)uw(i,a,n,s)}function eK(t,e,n){t.callbacks_.push(function(i){var a;const s=e;if(!s||!aS(s,i))return;(a=i.mapSetPlugin_)==null||a.fixSetContents(s);const o=BC(s);H5(t,s.draft_??s,o,n),V5(s,i)})}function V5(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)}B5(t)}}function tK(t,e,n){const{scope_:r}=t;if(Xc(n)){const i=n[Ps];aS(i,r)&&i.callbacks_.push(function(){B_(t);const o=BC(i);H5(t,n,o,e)})}else Ba(n)&&t.callbacks_.push(function(){const s=Cc(t);t.type_===3?s.has(n)&&fw(n,r.handledSet_,r):nP(s,e,t.type_)===n&&r.drafts_.length>1&&(t.assigned_.get(e)??!1)===!0&&t.copy_&&fw(nP(t.copy_,e,t.type_),r.handledSet_,r)})}function fw(t,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Xc(t)||e.has(t)||!Ba(t)||oS(t)||(e.add(t),nS(t,(r,i)=>{if(Xc(i)){const s=i[Ps];if(aS(s,n)){const o=BC(s);uw(t,r,o,t.type_),B5(s)}}else Ba(i)&&fw(i,e,n)})),t}function nK(t,e){const n=rS(t),r={type_:n?1:0,scope_:e?e.scope_:z5(),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=hw;n&&(i=[r],s=fy);const{revoke:o,proxy:a}=Proxy.revocable(i,s);return r.draft_=a,r.revoke_=o,[a,r]}var hw={get(t,e){if(e===Ps)return t;let n=t.scope_.arrayMethodsPlugin_;const r=t.type_===1&&typeof e=="string";if(r&&n!=null&&n.isArrayOperationMethod(e))return n.createMethodInterceptor(t,e);const i=Cc(t);if(!YI(i,e,t.type_))return rK(t,i,e);const s=i[e];if(t.finalized_||!Ba(s)||r&&t.operationMethod&&(n!=null&&n.isMutatingArrayMethod(t.operationMethod))&&qq(e))return s;if(s===xE(t.base_,e)){B_(t);const o=t.type_===1?+e:e,a=lP(t.scope_,s,t,o);return t.copy_[o]=a}return s},has(t,e){return e in Cc(t)},ownKeys(t){return Reflect.ownKeys(Cc(t))},set(t,e,n){const r=G5(Cc(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=xE(Cc(t),e),s=i==null?void 0:i[Ps];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_.set(e,!1),!0;if(Xq(n,i)&&(n!==void 0||YI(t.base_,e,t.type_)))return!0;B_(t),aP(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),tK(t,e,n)),!0},deleteProperty(t,e){return B_(t),xE(t.base_,e)!==void 0||e in t.base_?(t.assigned_.set(e,!1),aP(t)):t.assigned_.delete(e),t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Cc(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{[z_]:!0,[tP]:t.type_!==1||e!=="length",[cw]:r[cw],[uy]:n[e]}},defineProperty(){Ua(11)},getPrototypeOf(t){return Sg(t.base_)},setPrototypeOf(){Ua(12)}},fy={};for(let t in hw){let e=hw[t];fy[t]=function(){const n=arguments;return n[0]=n[0][0],e.apply(this,n)}}fy.deleteProperty=function(t,e){return fy.set.call(this,t,e,void 0)};fy.set=function(t,e,n){return hw.set.call(this,t[0],e,n,t[0])};function xE(t,e){const n=t[Ps];return(n?Cc(n):t)[e]}function rK(t,e,n){var i;const r=G5(e,n);return r?uy in r?r[uy]:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function G5(t,e){if(!(e in t))return;let n=Sg(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Sg(n)}}function aP(t){t.modified_||(t.modified_=!0,t.parent_&&aP(t.parent_))}function B_(t){t.copy_||(t.assigned_=new Map,t.copy_=rP(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var iK=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if(jm(n)&&!jm(r)){const o=r;r=n;const a=this;return function(c=o,...d){return a.produce(c,f=>r.call(this,f,...d))}}jm(r)||Ua(6),i!==void 0&&!jm(i)&&Ua(7);let s;if(Ba(n)){const o=ek(this),a=lP(o,n,void 0);let l=!0;try{s=r(a),l=!1}finally{l?sP(o):oP(o)}return JI(o,i),tk(s,o)}else if(!n||!zC(n)){if(s=r(n),s===void 0&&(s=n),s===U5&&(s=void 0),this.autoFreeze_&&HC(s,!0),i){const o=[],a=[];kh(iP).generateReplacementPatches_(n,s,{patches_:o,inversePatches_:a}),i(o,a)}return s}else Ua(1,n)},this.produceWithPatches=(n,r)=>{if(jm(n))return(a,...l)=>this.produceWithPatches(a,c=>n(c,...l));let i,s;return[this.produce(n,r,(a,l)=>{i=a,s=l}),i,s]},yE(e==null?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),yE(e==null?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),yE(e==null?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Ba(e)||Ua(8),Xc(e)&&(e=Go(e));const n=ek(this),r=lP(n,e,void 0);return r[Ps].isManual_=!0,oP(n),r}finishDraft(e,n){const r=e&&e[Ps];(!r||!r.isManual_)&&Ua(9);const{scope_:i}=r;return JI(i,n),tk(void 0,i)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,n){let r;for(r=n.length-1;r>=0;r--){const s=n[r];if(s.path.length===0&&s.op==="replace"){e=s.value;break}}r>-1&&(n=n.slice(r+1));const i=kh(iP).applyPatches_;return Xc(e)?i(e,n):this.produce(e,s=>i(s,n))}};function lP(t,e,n,r){const[i,s]=iS(e)?kh(dw).proxyMap_(e,n):sS(e)?kh(dw).proxySet_(e,n):nK(e,n);return((n==null?void 0:n.scope_)??z5()).drafts_.push(i),s.callbacks_=(n==null?void 0:n.callbacks_)??[],s.key_=r,n&&r!==void 0?eK(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 Go(t){return Xc(t)||Ua(10,t),W5(t)}function W5(t){if(!Ba(t)||oS(t))return t;const e=t[Ps];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=rP(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=rP(t,!0);return nS(n,(i,s)=>{uw(n,i,W5(s))},r),e&&(e.finalized_=!1),n}var sK=new iK,$5=sK.produce;function X5(t){return({dispatch:n,getState:r})=>i=>s=>typeof s=="function"?s(n,r,t):i(s)}var oK=X5(),aK=X5,lK=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?aw:aw.apply(null,arguments)};function Mo(t,e){function n(...r){if(e){let i=e(...r);if(!i)throw new Error(wo(0));return{type:t,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:t,payload:r[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=r=>D5(r)&&r.type===t,n}var q5=class z0 extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,z0.prototype)}static get[Symbol.species](){return z0}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new z0(...e[0].concat(this)):new z0(...e.concat(this))}};function rk(t){return Ba(t)?$5(t,()=>{}):t}function Mb(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}function cK(t){return typeof t=="boolean"}var uK=()=>function(e){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=e??{};let o=new q5;return n&&(cK(n)?o.push(oK):o.push(aK(n.extraArgument))),o},K5="RTK_autoBatch",or=()=>t=>({payload:t,meta:{[K5]:!0}}),ik=t=>e=>{setTimeout(e,t)},dK=(t,e)=>n=>{let r=!1;const i=()=>{r||(r=!0,cancelAnimationFrame(s),clearTimeout(o),n())},s=t(i),o=setTimeout(i,e)},Y5=(t={type:"raf"})=>e=>(...n)=>{const r=e(...n);let i=!0,s=!1,o=!1;const a=new Set,l=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?dK(window.requestAnimationFrame,100):ik(10):t.type==="callback"?t.queueNotification:ik(t.timeout),c=()=>{o=!1,s&&(s=!1,a.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const f=()=>i&&d(),p=r.subscribe(f);return a.add(d),()=>{p(),a.delete(d)}},dispatch(d){var f;try{return i=!((f=d==null?void 0:d.meta)!=null&&f[K5]),s=!i,s&&(o||(o=!0,l(c))),r.dispatch(d)}finally{i=!0}}})},fK=t=>function(n){const{autoBatch:r=!0}=n??{};let i=new q5(t);return r&&i.push(Y5(typeof r=="object"?r:void 0)),i};function hK(t){const e=uK(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:s=void 0,enhancers:o=void 0}=t||{};let a;if(typeof n=="function")a=n;else if(FC(n))a=L5(n);else throw new Error(wo(1));let l;typeof r=="function"?l=r(e):l=e();let c=aw;i&&(c=lK({trace:!1,...typeof i=="object"&&i}));const d=Wq(...l),f=fK(d);let p=typeof o=="function"?o(f):f();const y=c(...p);return O5(a,s,y)}function Z5(t){const e={},n=[];let r;const i={addCase(s,o){const a=typeof s=="string"?s:s.type;if(!a)throw new Error(wo(28));if(a in e)throw new Error(wo(29));return e[a]=o,i},addAsyncThunk(s,o){return o.pending&&(e[s.pending.type]=o.pending),o.rejected&&(e[s.rejected.type]=o.rejected),o.fulfilled&&(e[s.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:s.settled,reducer:o.settled}),i},addMatcher(s,o){return n.push({matcher:s,reducer:o}),i},addDefaultCase(s){return r=s,i}};return t(i),[e,n,r]}function pK(t){return typeof t=="function"}function mK(t,e){let[n,r,i]=Z5(e),s;if(pK(t))s=()=>rk(t());else{const a=rk(t);s=()=>a}function o(a=s(),l){let c=[n[l.type],...r.filter(({matcher:d})=>d(l)).map(({reducer:d})=>d)];return c.filter(d=>!!d).length===0&&(c=[i]),c.reduce((d,f)=>{if(f)if(Xc(d)){const y=f(d,l);return y===void 0?d:y}else{if(Ba(d))return $5(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},a)}return o.getInitialState=s,o}var gK="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",vK=(t=21)=>{let e="",n=t;for(;n--;)e+=gK[Math.random()*64|0];return e},yK=Symbol.for("rtk-slice-createasyncthunk");function xK(t,e){return`${t}/${e}`}function bK({creators:t}={}){var n;const e=(n=t==null?void 0:t.asyncThunk)==null?void 0:n[yK];return function(i){const{name:s,reducerPath:o=s}=i;if(!s)throw new Error(wo(11));const a=(typeof i.reducers=="function"?i.reducers(wK()):i.reducers)||{},l=Object.keys(a),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(P,O){const N=typeof P=="string"?P:P.type;if(!N)throw new Error(wo(12));if(N in c.sliceCaseReducersByType)throw new Error(wo(13));return c.sliceCaseReducersByType[N]=O,d},addMatcher(P,O){return c.sliceMatchers.push({matcher:P,reducer:O}),d},exposeAction(P,O){return c.actionCreators[P]=O,d},exposeCaseReducer(P,O){return c.sliceCaseReducersByName[P]=O,d}};l.forEach(P=>{const O=a[P],N={reducerName:P,type:xK(s,P),createNotation:typeof i.reducers=="function"};MK(O)?AK(N,O,d,e):SK(N,O,d)});function f(){const[P={},O=[],N=void 0]=typeof i.extraReducers=="function"?Z5(i.extraReducers):[i.extraReducers],D={...P,...c.sliceCaseReducersByType};return mK(i.initialState,z=>{for(let G in D)z.addCase(G,D[G]);for(let G of c.sliceMatchers)z.addMatcher(G.matcher,G.reducer);for(let G of O)z.addMatcher(G.matcher,G.reducer);N&&z.addDefaultCase(N)})}const p=P=>P,y=new Map,x=new WeakMap;let S;function w(P,O){return S||(S=f()),S(P,O)}function _(){return S||(S=f()),S.getInitialState()}function E(P,O=!1){function N(z){let G=z[P];return typeof G>"u"&&O&&(G=Mb(x,N,_)),G}function D(z=p){const G=Mb(y,O,()=>new WeakMap);return Mb(G,z,()=>{const k={};for(const[j,H]of Object.entries(i.selectors??{}))k[j]=_K(H,z,()=>Mb(x,z,_),O);return k})}return{reducerPath:P,getSelectors:D,get selectors(){return D(N)},selectSlice:N}}const T={name:s,reducer:w,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:_,...E(o),injectInto(P,{reducerPath:O,...N}={}){const D=O??o;return P.inject({reducerPath:D,reducer:w},N),{...T,...E(D,!0)}}};return T}}function _K(t,e,n,r){function i(s,...o){let a=e(s);return typeof a>"u"&&r&&(a=n()),t(a,...o)}return i.unwrapped=t,i}var cs=bK();function wK(){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 SK({type:t,reducerName:e,createNotation:n},r,i){let s,o;if("reducer"in r){if(n&&!EK(r))throw new Error(wo(17));s=r.reducer,o=r.prepare}else s=r;i.addCase(t,s).exposeCaseReducer(e,s).exposeAction(e,o?Mo(t,o):Mo(t))}function MK(t){return t._reducerDefinitionType==="asyncThunk"}function EK(t){return t._reducerDefinitionType==="reducerWithPrepare"}function AK({type:t,reducerName:e},n,r,i){if(!i)throw new Error(wo(18));const{payloadCreator:s,fulfilled:o,pending:a,rejected:l,settled:c,options:d}=n,f=i(t,s,d);r.exposeAction(e,f),o&&r.addCase(f.fulfilled,o),a&&r.addCase(f.pending,a),l&&r.addCase(f.rejected,l),c&&r.addMatcher(f.settled,c),r.exposeCaseReducer(e,{fulfilled:o||Eb,pending:a||Eb,rejected:l||Eb,settled:c||Eb})}function Eb(){}var TK="task",Q5="listener",J5="completed",VC="cancelled",PK=`task-${VC}`,CK=`task-${J5}`,cP=`${Q5}-${VC}`,RK=`${Q5}-${J5}`,lS=class{constructor(t){Gs(this,"code");Gs(this,"name","TaskAbortError");Gs(this,"message");this.code=t,this.message=`${TK} ${VC} (reason: ${t})`}},GC=(t,e)=>{if(typeof t!="function")throw new TypeError(wo(32))},pw=()=>{},e4=(t,e=pw)=>(t.catch(e),t),t4=(t,e)=>(t.addEventListener("abort",e,{once:!0}),()=>t.removeEventListener("abort",e)),wh=t=>{if(t.aborted)throw new lS(t.reason)};function n4(t,e){let n=pw;return new Promise((r,i)=>{const s=()=>i(new lS(t.reason));if(t.aborted){s();return}n=t4(t,s),e.finally(()=>n()).then(r,i)}).finally(()=>{n=pw})}var NK=async(t,e)=>{try{return await Promise.resolve(),{status:"ok",value:await t()}}catch(n){return{status:n instanceof lS?"cancelled":"rejected",error:n}}finally{e==null||e()}},mw=t=>e=>e4(n4(t,e).then(n=>(wh(t),n))),r4=t=>{const e=mw(t);return n=>e(new Promise(r=>setTimeout(r,n)))},{assign:Qm}=Object,sk={},cS="listenerMiddleware",IK=(t,e)=>{const n=r=>t4(t,()=>r.abort(t.reason));return(r,i)=>{GC(r);const s=new AbortController;n(s);const o=NK(async()=>{wh(t),wh(s.signal);const a=await r({pause:mw(s.signal),delay:r4(s.signal),signal:s.signal});return wh(s.signal),a},()=>s.abort(CK));return i!=null&&i.autoJoin&&e.push(o.catch(pw)),{result:mw(t)(o),cancel(){s.abort(PK)}}}},kK=(t,e)=>{const n=async(r,i)=>{wh(e);let s=()=>{};const a=[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&&a.push(new Promise(l=>setTimeout(l,i,null)));try{const l=await n4(e,Promise.race(a));return wh(e),l}finally{s()}};return((r,i)=>e4(n(r,i)))},i4=t=>{let{type:e,actionCreator:n,matcher:r,predicate:i,effect:s}=t;if(e)i=Mo(e).match;else if(n)e=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(wo(21));return GC(s),{predicate:i,type:e,effect:s}},s4=Qm(t=>{const{type:e,predicate:n,effect:r}=i4(t);return{id:vK(),effect:r,type:e,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(wo(22))}}},{withTypes:()=>s4}),ok=(t,e)=>{const{type:n,effect:r,predicate:i}=i4(e);return Array.from(t.values()).find(s=>(typeof n=="string"?s.type===n:s.predicate===i)&&s.effect===r)},uP=t=>{t.pending.forEach(e=>{e.abort(cP)})},OK=(t,e)=>()=>{for(const n of e.keys())uP(n);t.clear()},ak=(t,e,n)=>{try{t(e,n)}catch(r){setTimeout(()=>{throw r},0)}},o4=Qm(Mo(`${cS}/add`),{withTypes:()=>o4}),LK=Mo(`${cS}/removeAll`),a4=Qm(Mo(`${cS}/remove`),{withTypes:()=>a4}),DK=(...t)=>{console.error(`${cS}/error`,...t)},$y=(t={})=>{const e=new Map,n=new Map,r=y=>{const x=n.get(y)??0;n.set(y,x+1)},i=y=>{const x=n.get(y)??1;x===1?n.delete(y):n.set(y,x-1)},{extra:s,onError:o=DK}=t;GC(o);const a=y=>(y.unsubscribe=()=>e.delete(y.id),e.set(y.id,y),x=>{y.unsubscribe(),x!=null&&x.cancelActive&&uP(y)}),l=(y=>{const x=ok(e,y)??s4(y);return a(x)});Qm(l,{withTypes:()=>l});const c=y=>{const x=ok(e,y);return x&&(x.unsubscribe(),y.cancelActive&&uP(x)),!!x};Qm(c,{withTypes:()=>c});const d=async(y,x,S,w)=>{const _=new AbortController,E=kK(l,_.signal),T=[];try{y.pending.add(_),r(y),await Promise.resolve(y.effect(x,Qm({},S,{getOriginalState:w,condition:(P,O)=>E(P,O).then(Boolean),take:E,delay:r4(_.signal),pause:mw(_.signal),extra:s,signal:_.signal,fork:IK(_.signal,T),unsubscribe:y.unsubscribe,subscribe:()=>{e.set(y.id,y)},cancelActiveListeners:()=>{y.pending.forEach((P,O,N)=>{P!==_&&(P.abort(cP),N.delete(P))})},cancel:()=>{_.abort(cP),y.pending.delete(_)},throwIfCancelled:()=>{wh(_.signal)}})))}catch(P){P instanceof lS||ak(o,P,{raisedBy:"effect"})}finally{await Promise.all(T),_.abort(RK),i(y),y.pending.delete(_)}},f=OK(e,n);return{middleware:y=>x=>S=>{if(!D5(S))return x(S);if(o4.match(S))return l(S.payload);if(LK.match(S)){f();return}if(a4.match(S))return c(S.payload);let w=y.getState();const _=()=>{if(w===sk)throw new Error(wo(23));return w};let E;try{if(E=x(S),e.size>0){const T=y.getState(),P=Array.from(e.values());for(const O of P){let N=!1;try{N=O.predicate(S,T,w)}catch(D){N=!1,ak(o,D,{raisedBy:"predicate"})}N&&d(O,S,y,_)}}}finally{w=sk}return E},startListening:l,stopListening:c,clearListeners:f}};function wo(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var UK={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},l4=cs({name:"chartLayout",initialState:UK,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}}}),uS=l4.actions,jK=uS.setMargin,FK=uS.setLayout,zK=uS.setChartSize,BK=uS.setScale,HK=l4.reducer;function c4(t,e,n){return Array.isArray(t)&&t&&e+n!==0?t.slice(e,n+1):t}function wn(t){return Number.isFinite(t)}function Il(t){return typeof t=="number"&&t>0&&Number.isFinite(t)}function lk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Gm(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?lk(Object(n),!0).forEach(function(r){VK(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):lk(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function VK(t,e,n){return(e=GK(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function GK(t){var e=WK(t,"string");return typeof e=="symbol"?e:e+""}function WK(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:Nl(e)?Kh(t,e,n):typeof e=="function"?e(t):n}var $K=(t,e,n)=>{if(e&&n){var r=n.width,i=n.height,s=e.align,o=e.verticalAlign,a=e.layout;if((a==="vertical"||a==="horizontal"&&o==="middle")&&s!=="center"&&kt(t[s]))return Gm(Gm({},t),{},{[s]:t[s]+(r||0)});if((a==="horizontal"||a==="vertical"&&s==="center")&&o!=="middle"&&kt(t[o]))return Gm(Gm({},t),{},{[o]:t[o]+(i||0)})}return t},jl=(t,e)=>t==="horizontal"&&e==="xAxis"||t==="vertical"&&e==="yAxis"||t==="centric"&&e==="angleAxis"||t==="radial"&&e==="radiusAxis",u4=(t,e,n,r)=>{if(r)return t.map(a=>a.coordinate);var i,s,o=t.map(a=>(a.coordinate===e&&(i=!0),a.coordinate===n&&(s=!0),a.coordinate));return i||o.push(e),s||o.push(n),o},d4=(t,e,n)=>{if(!t)return null;var r=t.duplicateDomain,i=t.type,s=t.range,o=t.scale,a=t.realScaleType,l=t.isCategorical,c=t.categoricalDomain,d=t.tickCount,f=t.ticks,p=t.niceTicks,y=t.axisType;if(!o)return null;var x=a==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,S=i==="category"&&o.bandwidth?o.bandwidth()/x:0;if(S=y==="angleAxis"&&s&&s.length>=2?Vo(s[0]-s[1])*2*S:S,f||p){var w=(f||p||[]).map((_,E)=>{var T=r?r.indexOf(_):_,P=o.map(T);return wn(P)?{coordinate:P+S,value:_,offset:S,index:E}:null}).filter(Ys);return w}return l&&c?c.map((_,E)=>{var T=o.map(_);return wn(T)?{coordinate:T+S,value:_,index:E,offset:S}:null}).filter(Ys):o.ticks&&d!=null?o.ticks(d).map((_,E)=>{var T=o.map(_);return wn(T)?{coordinate:T+S,value:_,index:E,offset:S}:null}).filter(Ys):o.domain().map((_,E)=>{var T=o.map(_);return wn(T)?{coordinate:T+S,value:r?r[_]:_,index:E,offset:S}:null}).filter(Ys)},XK=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,o=0,a=0;a<n;++a){var l=t[a],c=l==null?void 0:l[i];if(c!=null){var d=c[1],f=c[0],p=Rl(d)?f:d;p>=0?(c[0]=s,s+=p,c[1]=s):(c[0]=o,o+=p,c[1]=o)}}}},qK=t=>{var e,n=t.length;if(!(n<=0)){var r=(e=t[0])===null||e===void 0?void 0:e.length;if(!(r==null||r<=0))for(var i=0;i<r;++i)for(var s=0,o=0;o<n;++o){var a=t[o],l=a==null?void 0:a[i];if(l!=null){var c=Rl(l[1])?l[0]:l[1];c>=0?(l[0]=s,s+=c,l[1]=s):(l[0]=0,l[1]=0)}}}},KK={sign:XK,expand:dX,none:Nh,silhouette:fX,wiggle:hX,positive:qK},YK=(t,e,n)=>{var r,i=(r=KK[n])!==null&&r!==void 0?r:Nh,s=uX().keys(e).value((a,l)=>Number(yi(a,l,0))).order(YT).offset(i),o=s(t);return o.forEach((a,l)=>{a.forEach((c,d)=>{var f=yi(t[d],e[l],0);Array.isArray(f)&&f.length===2&&kt(f[0])&&kt(f[1])&&(c[0]=f[0],c[1]=f[1])})}),o};function ZK(t){return t==null?void 0:String(t)}function ck(t){var e=t.axis,n=t.ticks,r=t.bandSize,i=t.entry,s=t.index,o=t.dataKey;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!Vi(i[e.dataKey])){var a=v5(n,"value",i[e.dataKey]);if(a)return a.coordinate+r/2}return n!=null&&n[s]?n[s].coordinate+r/2:null}var l=yi(i,Vi(o)?e.dataKey:o),c=e.scale.map(l);return kt(c)?c:null}var QK=t=>{var e=t.flat(2).filter(kt);return[Math.min(...e),Math.max(...e)]},JK=t=>[t[0]===1/0?0:t[0],t[1]===-1/0?0:t[1]],eY=(t,e,n)=>{if(!(t==null||Object.keys(t).length===0))return JK(Object.keys(t).reduce((r,i)=>{var s=t[i];if(!s)return r;var o=s.stackedData,a=o.reduce((l,c)=>{var d=c4(c,e,n),f=QK(d);return!wn(f[0])||!wn(f[1])?l:[Math.min(l[0],f[0]),Math.max(l[1],f[1])]},[1/0,-1/0]);return[Math.min(a[0],r[0]),Math.max(a[1],r[1])]},[1/0,-1/0]))},uk=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,dk=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,gw=(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=eS(e,d=>d.coordinate),s=1/0,o=1,a=i.length;o<a;o++){var l=i[o],c=i[o-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 fk(t){var e=t.tooltipEntrySettings,n=t.dataKey,r=t.payload,i=t.value,s=t.name;return Gm(Gm({},e),{},{dataKey:n,payload:r,value:i,name:s})}function f4(t,e){if(t!=null)return String(t);if(typeof e=="string")return e}var tY=(t,e)=>{if(e==="horizontal")return t.relativeX;if(e==="vertical")return t.relativeY},nY=(t,e)=>e==="centric"?t.angle:t.radius,Jc=t=>t.layout.width,eu=t=>t.layout.height,rY=t=>t.layout.scale,h4=t=>t.layout.margin,dS=ke(t=>t.cartesianAxis.xAxis,t=>Object.values(t)),fS=ke(t=>t.cartesianAxis.yAxis,t=>Object.values(t)),iY="data-recharts-item-index",sY="data-recharts-item-id",Xy=60;function hk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ab(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?hk(Object(n),!0).forEach(function(r){oY(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):hk(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function oY(t,e,n){return(e=aY(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function aY(t){var e=lY(t,"string");return typeof e=="symbol"?e:e+""}function lY(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 cY=t=>t.brush.height;function uY(t){var e=fS(t);return e.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:Xy;return n+i}return n},0)}function dY(t){var e=fS(t);return e.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:Xy;return n+i}return n},0)}function fY(t){var e=dS(t);return e.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function hY(t){var e=dS(t);return e.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var Wi=ke([Jc,eu,h4,cY,uY,dY,fY,hY,k5,Oq],(t,e,n,r,i,s,o,a,l,c)=>{var d={left:(n.left||0)+i,right:(n.right||0)+s},f={top:(n.top||0)+o,bottom:(n.bottom||0)+a},p=Ab(Ab({},f),d),y=p.bottom;p.bottom+=r,p=$K(p,l,c);var x=t-p.left-p.right,S=e-p.top-p.bottom;return Ab(Ab({brushBottom:y},p),{},{width:Math.max(x,0),height:Math.max(S,0)})}),pY=ke(Wi,t=>({x:t.left,y:t.top,width:t.width,height:t.height})),p4=ke(Jc,eu,(t,e)=>({x:0,y:0,width:t,height:e})),mY=R.createContext(null),Js=()=>R.useContext(mY)!=null,hS=t=>t.brush,pS=ke([hS,Wi,h4],(t,e,n)=>({height:t.height,x:kt(t.x)?t.x:e.left,y:kt(t.y)?t.y:e.top+e.height+e.brushBottom-((n==null?void 0:n.bottom)||0),width:kt(t.width)?t.width:e.width}));function gY(t,e,{signal:n,edges:r}={}){let i,s=null;const o=r!=null&&r.includes("leading"),a=r==null||r.includes("trailing"),l=()=>{s!==null&&(t.apply(i,s),i=void 0,s=null)},c=()=>{a&&l(),y()};let d=null;const f=()=>{d!=null&&clearTimeout(d),d=setTimeout(()=>{d=null,c()},e)},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 _=d==null;f(),o&&_&&l()};return S.schedule=f,S.cancel=y,S.flush=x,n==null||n.addEventListener("abort",y,{once:!0}),S}function vY(t,e=0,n={}){typeof n!="object"&&(n={});const{leading:r=!1,trailing:i=!0,maxWait:s}=n,o=Array(2);r&&(o[0]="leading"),i&&(o[1]="trailing");let a,l=null;const c=gY(function(...p){a=t.apply(this,p),l=null},e,{edges:o}),d=function(...p){return s!=null&&(l===null&&(l=Date.now()),Date.now()-l>=s)?(a=t.apply(this,p),l=Date.now(),c.cancel(),c.schedule(),a):(c.apply(this,p),a)},f=()=>(c.flush(),a);return d.cancel=c.cancel,d.flush=f,d}function yY(t,e=0,n={}){const{leading:r=!0,trailing:i=!0}=n;return vY(t,e,{leading:r,maxWait:e,trailing:i})}var vw=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 o=0;console.warn(n.replace(/%s/g,()=>i[o++]))}},wl={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},m4=(t,e,n)=>{var r=n.width,i=r===void 0?wl.width:r,s=n.height,o=s===void 0?wl.height:s,a=n.aspect,l=n.maxHeight,c=Ih(i)?t:Number(i),d=Ih(o)?e:Number(o);return a&&a>0&&(c?d=c/a:d&&(c=d*a),l&&d!=null&&d>l&&(d=l)),{calculatedWidth:c,calculatedHeight:d}},xY={width:0,height:0,overflow:"visible"},bY={width:0,overflowX:"visible"},_Y={height:0,overflowY:"visible"},wY={},SY=t=>{var e=t.width,n=t.height,r=Ih(e),i=Ih(n);return r&&i?xY:r?bY:i?_Y:wY};function MY(t){var e=t.width,n=t.height,r=t.aspect,i=e,s=n;return i===void 0&&s===void 0?(i=wl.width,s=wl.height):i===void 0?i=r&&r>0?void 0:wl.width:s===void 0&&(s=r&&r>0?void 0:wl.height),{width:i,height:s}}var EY=["aspect","initialDimension","width","height","minWidth","minHeight","maxHeight","children","debounce","id","className","onResize","style"];function yw(){return yw=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},yw.apply(null,arguments)}function pk(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 mk(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?pk(Object(n),!0).forEach(function(r){AY(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):pk(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function AY(t,e,n){return(e=TY(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function TY(t){var e=PY(t,"string");return typeof e=="symbol"?e:e+""}function PY(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 CY(t,e){return kY(t)||IY(t,e)||NY(t,e)||RY()}function RY(){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 NY(t,e){if(t){if(typeof t=="string")return gk(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gk(t,e):void 0}}function gk(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function IY(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function kY(t){if(Array.isArray(t))return t}function OY(t,e){if(t==null)return{};var n,r,i=LY(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 LY(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 g4=R.createContext(wl.initialDimension);function DY(t){return Il(t.width)&&Il(t.height)}function v4(t){var e=t.children,n=t.width,r=t.height,i=R.useMemo(()=>({width:n,height:r}),[n,r]);return DY(i)?R.createElement(g4.Provider,{value:i},e):null}var WC=()=>R.useContext(g4),UY=R.forwardRef((t,e)=>{var n=t.aspect,r=t.initialDimension,i=r===void 0?wl.initialDimension:r,s=t.width,o=t.height,a=t.minWidth,l=a===void 0?wl.minWidth:a,c=t.minHeight,d=t.maxHeight,f=t.children,p=t.debounce,y=p===void 0?wl.debounce:p,x=t.id,S=t.className,w=t.onResize,_=t.style,E=_===void 0?{}:_,T=OY(t,EY),P=R.useRef(null),O=R.useRef();O.current=w,R.useImperativeHandle(e,()=>P.current);var N=R.useState({containerWidth:i.width,containerHeight:i.height}),D=CY(N,2),z=D[0],G=D[1],k=R.useCallback((se,fe)=>{G(B=>{var J=Math.round(se),Y=Math.round(fe);return B.containerWidth===J&&B.containerHeight===Y?B:{containerWidth:J,containerHeight:Y}})},[]);R.useEffect(()=>{if(P.current==null||typeof ResizeObserver>"u")return Hg;var se=V=>{var q,pe=V[0];if(pe!=null){var ae=pe.contentRect,ce=ae.width,Se=ae.height;k(ce,Se),(q=O.current)===null||q===void 0||q.call(O,ce,Se)}};y>0&&(se=yY(se,y,{trailing:!0,leading:!1}));var fe=new ResizeObserver(se),B=P.current.getBoundingClientRect(),J=B.width,Y=B.height;return k(J,Y),fe.observe(P.current),()=>{fe.disconnect()}},[k,y]);var j=z.containerWidth,H=z.containerHeight;vw(!n||n>0,"The aspect(%s) must be greater than zero.",n);var ee=m4(j,H,{width:s,height:o,aspect:n,maxHeight:d}),te=ee.calculatedWidth,he=ee.calculatedHeight;return vw(j<0||H<0||te!=null&&te>0||he!=null&&he>0,`The width(%s) and height(%s) of chart should be greater than 0,
|
||
please check the style of container, or the props width(%s) and height(%s),
|
||
or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
|
||
height and width.`,te,he,s,o,l,c,n),R.createElement("div",yw({id:x?"".concat(x):void 0,className:tr("recharts-responsive-container",S),style:mk(mk({},E),{},{width:s,height:o,minWidth:l,minHeight:c,maxHeight:d}),ref:P},T),R.createElement("div",{style:SY({width:s,height:o})},R.createElement(v4,{width:te,height:he},f)))}),jY=R.forwardRef((t,e)=>{var n=WC();if(Il(n.width)&&Il(n.height))return t.children;var r=MY({width:t.width,height:t.height,aspect:t.aspect}),i=r.width,s=r.height,o=m4(void 0,void 0,{width:i,height:s,aspect:t.aspect,maxHeight:t.maxHeight}),a=o.calculatedWidth,l=o.calculatedHeight;return kt(a)&&kt(l)?R.createElement(v4,{width:a,height:l},t.children):R.createElement(UY,yw({},t,{width:i,height:s,ref:e}))});function $C(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=Js(),n=Ft(pY),r=Ft(pS),i=(t=Ft(hS))===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}},FY={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},y4=()=>{var t;return(t=Ft(Wi))!==null&&t!==void 0?t:FY},x4=()=>Ft(Jc),b4=()=>Ft(eu),hr=t=>t.layout.layoutType,Vg=()=>Ft(hr),XC=()=>{var t=Vg();if(t==="horizontal"||t==="vertical")return t},_4=t=>{var e=t.layout.layoutType;if(e==="centric"||e==="radial")return e},zY=()=>{var t=Vg();return t!==void 0},qy=t=>{var e=Wr(),n=Js(),r=t.width,i=t.height,s=WC(),o=r,a=i;return s&&(o=s.width>0?s.width:r,a=s.height>0?s.height:i),R.useEffect(()=>{!n&&Il(o)&&Il(a)&&e(zK({width:o,height:a}))},[e,n,o,a]),null},w4=Symbol.for("immer-nothing"),vk=Symbol.for("immer-draftable"),Eo=Symbol.for("immer-state");function ja(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var hy=Object.getPrototypeOf;function Mg(t){return!!t&&!!t[Eo]}function Oh(t){var e;return t?S4(t)||Array.isArray(t)||!!t[vk]||!!((e=t.constructor)!=null&&e[vk])||Ky(t)||vS(t):!1}var BY=Object.prototype.constructor.toString(),yk=new WeakMap;function S4(t){if(!t||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);if(e===null||e===Object.prototype)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=yk.get(n);return r===void 0&&(r=Function.toString.call(n),yk.set(n,r)),r===BY}function xw(t,e,n=!0){gS(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 gS(t){const e=t[Eo];return e?e.type_:Array.isArray(t)?1:Ky(t)?2:vS(t)?3:0}function dP(t,e){return gS(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function M4(t,e,n){const r=gS(t);r===2?t.set(e,n):r===3?t.add(n):t[e]=n}function HY(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function Ky(t){return t instanceof Map}function vS(t){return t instanceof Set}function $f(t){return t.copy_||t.base_}function fP(t,e){if(Ky(t))return new Map(t);if(vS(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=S4(t);if(e===!0||e==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(t);delete r[Eo];let i=Reflect.ownKeys(r);for(let s=0;s<i.length;s++){const o=i[s],a=r[o];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(r[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:t[o]})}return Object.create(hy(t),r)}else{const r=hy(t);if(r!==null&&n)return{...t};const i=Object.create(r);return Object.assign(i,t)}}function qC(t,e=!1){return yS(t)||Mg(t)||!Oh(t)||(gS(t)>1&&Object.defineProperties(t,{set:Tb,add:Tb,clear:Tb,delete:Tb}),Object.freeze(t),e&&Object.values(t).forEach(n=>qC(n,!0))),t}function VY(){ja(2)}var Tb={value:VY};function yS(t){return t===null||typeof t!="object"?!0:Object.isFrozen(t)}var GY={};function Lh(t){const e=GY[t];return e||ja(0,t),e}var py;function E4(){return py}function WY(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function xk(t,e){e&&(Lh("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function hP(t){pP(t),t.drafts_.forEach($Y),t.drafts_=null}function pP(t){t===py&&(py=t.parent_)}function bk(t){return py=WY(py,t)}function $Y(t){const e=t[Eo];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function _k(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[Eo].modified_&&(hP(e),ja(4)),Oh(t)&&(t=bw(e,t),e.parent_||_w(e,t)),e.patches_&&Lh("Patches").generateReplacementPatches_(n[Eo].base_,t,e.patches_,e.inversePatches_)):t=bw(e,n,[]),hP(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==w4?t:void 0}function bw(t,e,n){if(yS(e))return e;const r=t.immer_.shouldUseStrictIteration(),i=e[Eo];if(!i)return xw(e,(s,o)=>wk(t,i,e,s,o,n),r),e;if(i.scope_!==t)return e;if(!i.modified_)return _w(t,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const s=i.copy_;let o=s,a=!1;i.type_===3&&(o=new Set(s),s.clear(),a=!0),xw(o,(l,c)=>wk(t,i,s,l,c,n,a),r),_w(t,s,!1),n&&t.patches_&&Lh("Patches").generatePatches_(i,n,t.patches_,t.inversePatches_)}return i.copy_}function wk(t,e,n,r,i,s,o){if(i==null||typeof i!="object"&&!o)return;const a=yS(i);if(!(a&&!o)){if(Mg(i)){const l=s&&e&&e.type_!==3&&!dP(e.assigned_,r)?s.concat(r):void 0,c=bw(t,i,l);if(M4(n,r,c),Mg(c))t.canAutoFreeze_=!1;else return}else o&&n.add(i);if(Oh(i)&&!a){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1||e&&e.base_&&e.base_[r]===i&&a)return;bw(t,i),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&(Ky(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&_w(t,i)}}}function _w(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&qC(e,n)}function XY(t,e){const n=Array.isArray(t),r={type_:n?1:0,scope_:e?e.scope_:E4(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,s=KC;n&&(i=[r],s=my);const{revoke:o,proxy:a}=Proxy.revocable(i,s);return r.draft_=a,r.revoke_=o,a}var KC={get(t,e){if(e===Eo)return t;const n=$f(t);if(!dP(n,e))return qY(t,n,e);const r=n[e];return t.finalized_||!Oh(r)?r:r===bE(t.base_,e)?(_E(t),t.copy_[e]=gP(r,t)):r},has(t,e){return e in $f(t)},ownKeys(t){return Reflect.ownKeys($f(t))},set(t,e,n){const r=A4($f(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=bE($f(t),e),s=i==null?void 0:i[Eo];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(HY(n,i)&&(n!==void 0||dP(t.base_,e)))return!0;_E(t),mP(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return bE(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,_E(t),mP(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=$f(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:r.enumerable,value:n[e]}},defineProperty(){ja(11)},getPrototypeOf(t){return hy(t.base_)},setPrototypeOf(){ja(12)}},my={};xw(KC,(t,e)=>{my[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});my.deleteProperty=function(t,e){return my.set.call(this,t,e,void 0)};my.set=function(t,e,n){return KC.set.call(this,t[0],e,n,t[0])};function bE(t,e){const n=t[Eo];return(n?$f(n):t)[e]}function qY(t,e,n){var i;const r=A4(e,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function A4(t,e){if(!(e in t))return;let n=hy(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=hy(n)}}function mP(t){t.modified_||(t.modified_=!0,t.parent_&&mP(t.parent_))}function _E(t){t.copy_||(t.copy_=fP(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var KY=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,n,r)=>{if(typeof e=="function"&&typeof n!="function"){const s=n;n=e;const o=this;return function(l=s,...c){return o.produce(l,d=>n.call(this,d,...c))}}typeof n!="function"&&ja(6),r!==void 0&&typeof r!="function"&&ja(7);let i;if(Oh(e)){const s=bk(this),o=gP(e,void 0);let a=!0;try{i=n(o),a=!1}finally{a?hP(s):pP(s)}return xk(s,r),_k(i,s)}else if(!e||typeof e!="object"){if(i=n(e),i===void 0&&(i=e),i===w4&&(i=void 0),this.autoFreeze_&&qC(i,!0),r){const s=[],o=[];Lh("Patches").generateReplacementPatches_(e,i,s,o),r(s,o)}return i}else ja(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(o,...a)=>this.produceWithPatches(o,l=>e(l,...a));let r,i;return[this.produce(e,n,(o,a)=>{r=o,i=a}),r,i]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),typeof(t==null?void 0:t.useStrictIteration)=="boolean"&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Oh(t)||ja(8),Mg(t)&&(t=YY(t));const e=bk(this),n=gP(t,void 0);return n[Eo].isManual_=!0,pP(e),n}finishDraft(t,e){const n=t&&t[Eo];(!n||!n.isManual_)&&ja(9);const{scope_:r}=n;return xk(r,e),_k(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const i=e[n];if(i.path.length===0&&i.op==="replace"){t=i.value;break}}n>-1&&(e=e.slice(n+1));const r=Lh("Patches").applyPatches_;return Mg(t)?r(t,e):this.produce(t,i=>r(i,e))}};function gP(t,e){const n=Ky(t)?Lh("MapSet").proxyMap_(t,e):vS(t)?Lh("MapSet").proxySet_(t,e):XY(t,e);return(e?e.scope_:E4()).drafts_.push(n),n}function YY(t){return Mg(t)||ja(10,t),T4(t)}function T4(t){if(!Oh(t)||yS(t))return t;const e=t[Eo];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=fP(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=fP(t,!0);return xw(n,(i,s)=>{M4(n,i,T4(s))},r),e&&(e.finalized_=!1),n}var ZY=new KY;ZY.produce;var QY={settings:{layout:"horizontal",align:"center",verticalAlign:"bottom",itemSorter:"value"},size:{width:0,height:0},payload:[]},P4=cs({name:"legend",initialState:QY,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:or()},replaceLegendPayload:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=Go(t).payload.indexOf(r);s>-1&&(t.payload[s]=i)},prepare:or()},removeLegendPayload:{reducer(t,e){var n=Go(t).payload.indexOf(e.payload);n>-1&&t.payload.splice(n,1)},prepare:or()}}}),Yy=P4.actions;Yy.setLegendSize;Yy.setLegendSettings;var JY=Yy.addLegendPayload,eZ=Yy.replaceLegendPayload,tZ=Yy.removeLegendPayload,nZ=P4.reducer,wE={exports:{}},SE={};/**
|
||
* @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 Sk;function rZ(){if(Sk)return SE;Sk=1;var t=Xh();function e(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,i=t.useRef,s=t.useEffect,o=t.useMemo,a=t.useDebugValue;return SE.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=o(function(){function w(O){if(!_){if(_=!0,E=O,O=f(O),p!==void 0&&x.hasValue){var N=x.value;if(p(N,O))return T=N}return T=O}if(N=T,n(E,O))return N;var D=f(O);return p!==void 0&&p(N,D)?(E=O,N):(E=O,T=D)}var _=!1,E,T,P=d===void 0?null:d;return[function(){return w(c())},P===null?void 0:function(){return w(P())}]},[c,d,f,p]);var S=r(l,y[0],y[1]);return s(function(){x.hasValue=!0,x.value=S},[S]),a(S),S},SE}var Mk;function iZ(){return Mk||(Mk=1,wE.exports=rZ()),wE.exports}iZ();function sZ(t){t()}function oZ(){let t=null,e=null;return{clear(){t=null,e=null},notify(){sZ(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=t;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=e={callback:n,next:null,prev:e};return i.prev?i.prev.next=i:t=i,function(){!r||t===null||(r=!1,i.next?i.next.prev=i.prev:e=i.prev,i.prev?i.prev.next=i.next:t=i.next)}}}}var Ek={notify(){},get:()=>[]};function aZ(t,e){let n,r=Ek,i=0,s=!1;function o(S){d();const w=r.subscribe(S);let _=!1;return()=>{_||(_=!0,w(),f())}}function a(){r.notify()}function l(){x.onStateChange&&x.onStateChange()}function c(){return s}function d(){i++,n||(n=t.subscribe(l),r=oZ())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=Ek)}function p(){s||(s=!0,d())}function y(){s&&(s=!1,f())}const x={addNestedSub:o,notifyNestedSubs:a,handleChangeWrapper:l,isSubscribed:c,trySubscribe:p,tryUnsubscribe:y,getListeners:()=>r};return x}var lZ=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",cZ=lZ(),uZ=()=>typeof navigator<"u"&&navigator.product==="ReactNative",dZ=uZ(),fZ=()=>cZ||dZ?R.useLayoutEffect:R.useEffect,hZ=fZ();function Ak(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function pZ(t,e){if(Ak(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let i=0;i<n.length;i++)if(!Object.prototype.hasOwnProperty.call(e,n[i])||!Ak(t[n[i]],e[n[i]]))return!1;return!0}var ME=Symbol.for("react-redux-context"),EE=typeof globalThis<"u"?globalThis:{};function mZ(){if(!R.createContext)return{};const t=EE[ME]??(EE[ME]=new Map);let e=t.get(R.createContext);return e||(e=R.createContext(null),t.set(R.createContext,e)),e}var gZ=mZ();function vZ(t){const{children:e,context:n,serverState:r,store:i}=t,s=R.useMemo(()=>{const l=aZ(i);return{store:i,subscription:l,getServerState:r?()=>r:void 0}},[i,r]),o=R.useMemo(()=>i.getState(),[i]);hZ(()=>{const{subscription:l}=s;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),o!==i.getState()&&l.notifyNestedSubs(),()=>{l.tryUnsubscribe(),l.onStateChange=void 0}},[s,o]);const a=n||gZ;return R.createElement(a.Provider,{value:s},e)}var yZ=vZ,xZ=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius","throttledEvents"]);function bZ(t,e){return t==null&&e==null?!0:typeof t=="number"&&typeof e=="number"?t===e||t!==t&&e!==e:t===e}function xS(t,e){var n=new Set([...Object.keys(t),...Object.keys(e)]);for(var r of n)if(xZ.has(r)){if(t[r]==null&&e[r]==null)continue;if(!pZ(t[r],e[r]))return!1}else if(!bZ(t[r],e[r]))return!1;return!0}function vP(){return vP=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},vP.apply(null,arguments)}function Tk(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 i0(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Tk(Object(n),!0).forEach(function(r){_Z(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Tk(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function _Z(t,e,n){return(e=wZ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function wZ(t){var e=SZ(t,"string");return typeof e=="symbol"?e:e+""}function SZ(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 MZ(t,e){return PZ(t)||TZ(t,e)||AZ(t,e)||EZ()}function EZ(){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 AZ(t,e){if(t){if(typeof t=="string")return Pk(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)?Pk(t,e):void 0}}function Pk(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 TZ(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function PZ(t){if(Array.isArray(t))return t}function CZ(t){return Array.isArray(t)&&Nl(t[0])&&Nl(t[1])?t.join(" ~ "):t}var om={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 RZ(t,e){return e==null?t:eS(t,e)}var NZ=t=>{var e=t.separator,n=e===void 0?om.separator:e,r=t.contentStyle,i=t.itemStyle,s=t.labelStyle,o=s===void 0?om.labelStyle:s,a=t.payload,l=t.formatter,c=t.itemSorter,d=t.wrapperClassName,f=t.labelClassName,p=t.label,y=t.labelFormatter,x=t.accessibilityLayer,S=x===void 0?om.accessibilityLayer:x,w=()=>{if(a&&a.length){var z={padding:0,margin:0},G=RZ(a,c),k=G.map((j,H)=>{if(!j||j.type==="none")return null;var ee=j.formatter||l||CZ,te=j.value,he=j.name,se=te,fe=he;if(ee){var B=ee(te,he,j,H,a);if(Array.isArray(B)){var J=MZ(B,2);se=J[0],fe=J[1]}else if(B!=null)se=B;else return null}var Y=i0(i0({},om.itemStyle),{},{color:j.color||om.itemStyle.color},i);return R.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(H),style:Y},Nl(fe)?R.createElement("span",{className:"recharts-tooltip-item-name"},fe):null,Nl(fe)?R.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,R.createElement("span",{className:"recharts-tooltip-item-value"},se),R.createElement("span",{className:"recharts-tooltip-item-unit"},j.unit||""))});return R.createElement("ul",{className:"recharts-tooltip-item-list",style:z},k)}return null},_=i0(i0({},om.contentStyle),r),E=i0({margin:0},o),T=!Vi(p),P=T?p:"",O=tr("recharts-default-tooltip",d),N=tr("recharts-tooltip-label",f);T&&y&&a!==void 0&&a!==null&&(P=y(p,a));var D=S?{role:"status","aria-live":"assertive"}:{};return R.createElement("div",vP({className:O,style:_},D),R.createElement("p",{className:N,style:E},R.isValidElement(P)?P:"".concat(P)),w())},s0="recharts-tooltip-wrapper",IZ={visibility:"hidden"};function kZ(t){var e=t.coordinate,n=t.translateX,r=t.translateY;return tr(s0,{["".concat(s0,"-right")]:kt(n)&&e&&kt(e.x)&&n>=e.x,["".concat(s0,"-left")]:kt(n)&&e&&kt(e.x)&&n<e.x,["".concat(s0,"-bottom")]:kt(r)&&e&&kt(e.y)&&r>=e.y,["".concat(s0,"-top")]:kt(r)&&e&&kt(e.y)&&r<e.y})}function Ck(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.key,i=t.offset,s=t.position,o=t.reverseDirection,a=t.tooltipDimension,l=t.viewBox,c=t.viewBoxDimension;if(s&&kt(s[r]))return s[r];var d=n[r]-a-(i>0?i:0),f=n[r]+i;if(e[r])return o[r]?d:f;var p=l[r];if(p==null)return 0;if(o[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+a,w=p+c;return S>w?Math.max(d,p):Math.max(f,p)}function OZ(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 LZ(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.offsetTop,i=t.offsetLeft,s=t.position,o=t.reverseDirection,a=t.tooltipBox,l=t.useTranslate3d,c=t.viewBox,d,f,p;return a.height>0&&a.width>0&&n?(f=Ck({allowEscapeViewBox:e,coordinate:n,key:"x",offset:i,position:s,reverseDirection:o,tooltipDimension:a.width,viewBox:c,viewBoxDimension:c.width}),p=Ck({allowEscapeViewBox:e,coordinate:n,key:"y",offset:r,position:s,reverseDirection:o,tooltipDimension:a.height,viewBox:c,viewBoxDimension:c.height}),d=OZ({translateX:f,translateY:p,useTranslate3d:l})):d=IZ,{cssProperties:d,cssClasses:kZ({translateX:f,translateY:p,coordinate:n})}}var DZ=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Zy={isSsr:DZ()};function UZ(t,e){return BZ(t)||zZ(t,e)||FZ(t,e)||jZ()}function jZ(){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 FZ(t,e){if(t){if(typeof t=="string")return Rk(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Rk(t,e):void 0}}function Rk(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function zZ(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function BZ(t){if(Array.isArray(t))return t}function C4(){var t=R.useState(()=>Zy.isSsr||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches),e=UZ(t,2),n=e[0],r=e[1];return R.useEffect(()=>{if(window.matchMedia){var i=window.matchMedia("(prefers-reduced-motion: reduce)"),s=()=>{r(i.matches)};return i.addEventListener("change",s),()=>{i.removeEventListener("change",s)}}},[]),n}function Nk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function am(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Nk(Object(n),!0).forEach(function(r){HZ(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Nk(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function HZ(t,e,n){return(e=VZ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function VZ(t){var e=GZ(t,"string");return typeof e=="symbol"?e:e+""}function GZ(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 WZ(t,e){return KZ(t)||qZ(t,e)||XZ(t,e)||$Z()}function $Z(){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 XZ(t,e){if(t){if(typeof t=="string")return Ik(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ik(t,e):void 0}}function Ik(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function qZ(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function KZ(t){if(Array.isArray(t))return t}function YZ(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 ZZ(t){var e,n,r,i,s,o,a=C4(),l=R.useState(()=>({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}})),c=WZ(l,2),d=c[0],f=c[1];R.useEffect(()=>{var _=E=>{if(E.key==="Escape"){var T,P,O,N;f({dismissed:!0,dismissedAtCoordinate:{x:(T=(P=t.coordinate)===null||P===void 0?void 0:P.x)!==null&&T!==void 0?T:0,y:(O=(N=t.coordinate)===null||N===void 0?void 0:N.y)!==null&&O!==void 0?O:0}})}};return document.addEventListener("keydown",_),()=>{document.removeEventListener("keydown",_)}},[(e=t.coordinate)===null||e===void 0?void 0:e.x,(n=t.coordinate)===null||n===void 0?void 0:n.y]),d.dismissed&&(((r=(i=t.coordinate)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)!==d.dismissedAtCoordinate.x||((s=(o=t.coordinate)===null||o===void 0?void 0:o.y)!==null&&s!==void 0?s:0)!==d.dismissedAtCoordinate.y)&&f(am(am({},d),{},{dismissed:!1}));var p=LZ({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?{}:am(am({transition:YZ({prefersReducedMotion:a,isAnimationActive:t.isAnimationActive,active:t.active,animationDuration:t.animationDuration,animationEasing:t.animationEasing})},x),{},{pointerEvents:"none",position:"absolute",top:0,left:0}),w=am(am({},S),{},{visibility:!d.dismissed&&t.active&&t.hasPayload?"visible":"hidden"},t.wrapperStyle);return R.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:y,style:w,ref:t.innerRef},t.children)}var QZ=R.memo(ZZ),R4=()=>{var t;return(t=Ft(e=>e.rootProps.accessibilityLayer))!==null&&t!==void 0?t:!0};function yP(){return yP=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},yP.apply(null,arguments)}function kk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ok(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?kk(Object(n),!0).forEach(function(r){JZ(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):kk(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function JZ(t,e,n){return(e=eQ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function eQ(t){var e=tQ(t,"string");return typeof e=="symbol"?e:e+""}function tQ(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Lk={curveBasisClosed:J7,curveBasisOpen:eX,curveBasis:Q7,curveBumpX:Y7,curveBumpY:Z7,curveLinearClosed:tX,curveLinear:Q1,curveMonotoneX:nX,curveMonotoneY:rX,curveNatural:iX,curveStep:sX,curveStepAfter:aX,curveStepBefore:oX},ww=t=>wn(t.x)&&wn(t.y),Dk=t=>t.base!=null&&ww(t.base)&&ww(t),o0=t=>t.x,a0=t=>t.y,nQ=(t,e)=>{if(typeof t=="function")return t;var n="curve".concat(LC(t));if((n==="curveMonotone"||n==="curveBump")&&e){var r=Lk["".concat(n).concat(e==="vertical"?"Y":"X")];if(r)return r}return Lk[n]||Q1},Uk={connectNulls:!1,type:"linear"},rQ=t=>{var e=t.type,n=e===void 0?Uk.type:e,r=t.points,i=r===void 0?[]:r,s=t.baseLine,o=t.layout,a=t.connectNulls,l=a===void 0?Uk.connectNulls:a,c=nQ(n,o),d=l?i.filter(ww):i;if(Array.isArray(s)){var f,p=i.map((_,E)=>Ok(Ok({},_),{},{base:s[E]}));o==="vertical"?f=bb().y(a0).x1(o0).x0(_=>_.base.x):f=bb().x(o0).y1(a0).y0(_=>_.base.y);var y=f.defined(Dk).curve(c),x=l?p.filter(Dk):p;return y(x)}var S;o==="vertical"&&kt(s)?S=bb().y(a0).x1(o0).x0(s):kt(s)?S=bb().x(o0).y1(a0).y0(s):S=s5().x(o0).y(a0);var w=S.defined(ww).curve(c);return w(d)},H_=t=>{var e=t.className,n=t.points,r=t.path,i=t.pathRef,s=Vg();if((!n||!n.length)&&!r)return null;var o={type:t.type,points:t.points,baseLine:t.baseLine,layout:t.layout||s,connectNulls:t.connectNulls},a=n&&n.length?rQ(o):r;return R.createElement("path",yP({},za(t),DC(t),{className:tr("recharts-curve",e),d:a===null?void 0:a,ref:i}))},iQ=["x","y","top","left","width","height","className"];function xP(){return xP=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},xP.apply(null,arguments)}function jk(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 sQ(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?jk(Object(n),!0).forEach(function(r){oQ(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):jk(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function oQ(t,e,n){return(e=aQ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function aQ(t){var e=lQ(t,"string");return typeof e=="symbol"?e:e+""}function lQ(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 cQ(t,e){if(t==null)return{};var n,r,i=uQ(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 uQ(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 dQ=(t,e,n,r,i,s)=>"M".concat(t,",").concat(i,"v").concat(r,"M").concat(s,",").concat(e,"h").concat(n),fQ=t=>{var e=t.x,n=e===void 0?0:e,r=t.y,i=r===void 0?0:r,s=t.top,o=s===void 0?0:s,a=t.left,l=a===void 0?0:a,c=t.width,d=c===void 0?0:c,f=t.height,p=f===void 0?0:f,y=t.className,x=cQ(t,iQ),S=sQ({x:n,y:i,top:o,left:l,width:d,height:p},x);return!kt(n)||!kt(i)||!kt(d)||!kt(p)||!kt(o)||!kt(l)?null:R.createElement("path",xP({},qo(S),{className:tr("recharts-cross",y),d:dQ(n,i,d,p,o,l)}))};function hQ(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 Sw=1e-4,N4=(t,e)=>[0,3*t,3*e-6*t,3*t-3*e+1],I4=(t,e)=>t.map((n,r)=>n*e**r).reduce((n,r)=>n+r),Fk=(t,e)=>n=>{var r=N4(t,e);return I4(r,n)},pQ=(t,e)=>n=>{var r=N4(t,e),i=[...r.map((s,o)=>s*o).slice(1),0];return I4(i,n)},mQ=t=>{var e,n=t.split("(");if(n.length!==2||n[0]!=="cubic-bezier")return null;var r=(e=n[1])===null||e===void 0||(e=e.split(")")[0])===null||e===void 0?void 0:e.split(",");if(r==null||r.length!==4)return null;var i=r.map(s=>parseFloat(s));return[i[0],i[1],i[2],i[3]]},gQ=function(){for(var e=arguments.length,n=new Array(e),r=0;r<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=mQ(n[0]);if(i)return i}}return n.length===4?n:[0,0,1,1]},vQ=(t,e,n,r)=>{var i=Fk(t,n),s=Fk(e,r),o=pQ(t,n),a=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=o(f);if(Math.abs(y-d)<Sw||x<Sw)return s(f);f=a(f-y/x)}return s(f)};return l.isStepper=!1,l},zk=function(){return vQ(...gQ(...arguments))},yQ=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,o=e.dt,a=o===void 0?16.67:o,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)*a/1e3,d+=f*a/1e3,c.push(d),Math.abs(d-l)<Sw&&Math.abs(f)<Sw)break;y++}c[c.length-1]=l;var w=c.length-1;return _=>{var E,T,P;if(_<=0)return 0;if(_>=1)return l;var O=_*w,N=Math.floor(O),D=O-N;return((E=c[N])!==null&&E!==void 0?E:0)+(((T=c[N+1])!==null&&T!==void 0?T:0)-((P=c[N])!==null&&P!==void 0?P:0))*D}},xQ=t=>{if(typeof t=="string")switch(t){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return zk(t);case"spring":return yQ();default:if(t.split("(")[0]==="cubic-bezier")return zk(t)}return typeof t=="function"?t:null},bQ=(t,e,n)=>{var r,i=s=>{var o=e.tick(s);if(e.getState()==="active"){if(n(e.getInterpolated()),e.getProgress()===1){e.complete(),r=void 0;return}r=t.setTimeout(i,o);return}r=t.setTimeout(i,o)};return r=t.setTimeout(i,0),()=>{var s;return(s=r)===null||s===void 0?void 0:s()}},k4=R.createContext(bQ);k4.Provider;function _Q(t){var e=R.useContext(k4);return R.useMemo(()=>t??e,[t,e])}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)}var Bk="init",Hk="pending",Vk="active",EQ="completed";function AE(t){return Math.max(0,t)}class AQ{getAnimationStartedTime(){return this.animationStartedTime}getBeginStartedTime(){return this.beginStartedTime}constructor(e){var n;wQ(this,"state",Bk),this.animationId=e.animationId,this.onAnimationEnd=e.onAnimationEnd,this.animationDuration=AE(e.animationDuration),this.animationBegin=AE(e.animationBegin),this.progress=0,this.from=e.from,this.to=e.to,this.easing=e.easing,(n=e.onAnimationStart)===null||n===void 0||n.call(e)}getState(){return this.state}getEasing(){return this.easing}getAnimationDuration(){return this.animationDuration}tick(e){if(this.getState()===Bk)return this.state=Hk,this.beginStartedTime=e,this.animationBegin;if(this.getState()===Hk){if(this.beginStartedTime==null)throw new Error;var n=e-this.beginStartedTime;return n>=this.animationBegin?(this.state=Vk,this.animationStartedTime=e,this.nextAnimationUpdate(0)):AE(this.animationBegin-n)}if(this.getState()===Vk){if(this.animationStartedTime==null)throw new Error;var r=e-this.animationStartedTime;return this.setProgress(r/this.animationDuration),this.nextAnimationUpdate(r)}return 0}setProgress(e){this.progress=Math.min(1,Math.max(0,e))}getProgress(){return this.progress}complete(){if(this.progress=1,this.state==="active"){var e;(e=this.onAnimationEnd)===null||e===void 0||e.call(this)}this.state=EQ}getFrom(){return this.from}getTo(){return this.to}getAnimationId(){return this.animationId}getAnimationBegin(){return this.animationBegin}}class TQ extends AQ{nextAnimationUpdate(){return 0}getInterpolated(){return this.easing(Dc(this.getFrom(),this.getTo(),this.getProgress()))}}class PQ{setTimeout(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,s=o=>{o-r>=n?e(o):i=requestAnimationFrame(s)};return i=requestAnimationFrame(s),()=>{i!=null&&cancelAnimationFrame(i)}}}function CQ(t,e){return kQ(t)||IQ(t,e)||NQ(t,e)||RQ()}function RQ(){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 NQ(t,e){if(t){if(typeof t=="string")return Gk(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gk(t,e):void 0}}function Gk(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function IQ(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function kQ(t){if(Array.isArray(t))return t}var OQ={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},Wk=0,TE=1;function O4(t){var e=Qo(t,OQ),n=e.animationId,r=e.isActive,i=e.canBegin,s=e.duration,o=e.easing,a=e.begin,l=e.onAnimationEnd,c=e.onAnimationStart,d=e.children,f=C4(),p=r==="auto"?!Zy.isSsr&&!f:r,y=_Q(e.animationController),x=R.useState(p?Wk:TE),S=CQ(x,2),w=S[0],_=S[1];return R.useEffect(()=>{p||_(TE)},[p]),R.useEffect(()=>{var E=xQ(o);if(!p||!i||E==null)return Hg;var T=new PQ,P=new TQ({animationId:n,easing:E,animationDuration:s,animationBegin:a,onAnimationStart:c,onAnimationEnd:l,from:Wk,to:TE});return y(T,P,_)},[y,n,p,i,s,o,a,c,l]),d(Number(w))}function L4(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=R.useRef(cy(e)),r=R.useRef(t);return r.current!==t&&(n.current=cy(e),r.current=t),n.current}var LQ=t=>t.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase())),DQ=(t,e,n)=>t.map(r=>"".concat(LQ(r)," ").concat(e,"ms ").concat(n)).join(","),UQ=["radius"],jQ=["radius"],$k,Xk,qk,Kk,Yk,Zk,Qk,Jk,eO,tO;function nO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function rO(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?nO(Object(n),!0).forEach(function(r){FQ(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 FQ(t,e,n){return(e=zQ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function zQ(t){var e=BQ(t,"string");return typeof e=="symbol"?e:e+""}function BQ(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 Mw(){return Mw=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},Mw.apply(null,arguments)}function iO(t,e){if(t==null)return{};var n,r,i=HQ(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 HQ(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 VQ(t,e){return XQ(t)||$Q(t,e)||WQ(t,e)||GQ()}function GQ(){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 WQ(t,e){if(t){if(typeof t=="string")return sO(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?sO(t,e):void 0}}function sO(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function $Q(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function XQ(t){if(Array.isArray(t))return t}function fl(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var oO=(t,e,n,r,i)=>{var s=vd(n),o=vd(r),a=Math.min(Math.abs(s)/2,Math.abs(o)/2),l=o>=0?1:-1,c=s>=0?1:-1,d=o>=0&&s>=0||o<0&&s<0?1:0,f;if(a>0&&Array.isArray(i)){for(var 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>a?a:w}f=Ui($k||($k=fl(["M",",",""])),t,e+l*p[0]),p[0]>0&&(f+=Ui(Xk||(Xk=fl(["A ",",",",0,0,",",",",",""])),p[0],p[0],d,t+c*p[0],e)),f+=Ui(qk||(qk=fl(["L ",",",""])),t+n-c*p[1],e),p[1]>0&&(f+=Ui(Kk||(Kk=fl(["A ",",",",0,0,",`,
|
||
`,",",""])),p[1],p[1],d,t+n,e+l*p[1])),f+=Ui(Yk||(Yk=fl(["L ",",",""])),t+n,e+r-l*p[2]),p[2]>0&&(f+=Ui(Zk||(Zk=fl(["A ",",",",0,0,",`,
|
||
`,",",""])),p[2],p[2],d,t+n-c*p[2],e+r)),f+=Ui(Qk||(Qk=fl(["L ",",",""])),t+c*p[3],e+r),p[3]>0&&(f+=Ui(Jk||(Jk=fl(["A ",",",",0,0,",`,
|
||
`,",",""])),p[3],p[3],d,t,e+r-l*p[3])),f+="Z"}else if(a>0&&i===+i&&i>0){var _=Math.min(a,i);f=Ui(eO||(eO=fl(["M ",",",`
|
||
A `,",",",0,0,",",",",",`
|
||
L `,",",`
|
||
A `,",",",0,0,",",",",",`
|
||
L `,",",`
|
||
A `,",",",0,0,",",",",",`
|
||
L `,",",`
|
||
A `,",",",0,0,",",",","," Z"])),t,e+l*_,_,_,d,t+c*_,e,t+n-c*_,e,_,_,d,t+n,e+l*_,t+n,e+r-l*_,_,_,d,t+n-c*_,e+r,t+c*_,e+r,_,_,d,t,e+r-l*_)}else f=Ui(tO||(tO=fl(["M ",","," h "," v "," h "," Z"])),t,e,n,r,-n);return f},aO={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},qQ=t=>{var e=Qo(t,aO),n=R.useRef(null),r=R.useState(-1),i=VQ(r,2),s=i[0],o=i[1];R.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var B=n.current.getTotalLength();B&&o(B)}catch{}},[]);var a=e.x,l=e.y,c=e.width,d=e.height,f=e.radius,p=e.className,y=e.animationEasing,x=e.animationDuration,S=e.animationBegin,w=e.isAnimationActive,_=e.isUpdateAnimationActive,E=R.useRef(c),T=R.useRef(d),P=R.useRef(a),O=R.useRef(l),N=R.useMemo(()=>({x:a,y:l,width:c,height:d,radius:f}),[a,l,c,d,f]),D=L4(N,"rectangle-");if(a!==+a||l!==+l||c!==+c||d!==+d||c===0||d===0)return null;var z=tr("recharts-rectangle",p);if(!_){var G=qo(e);G.radius;var k=iO(G,UQ);return R.createElement("path",Mw({},k,{x:vd(a),y:vd(l),width:vd(c),height:vd(d),radius:typeof f=="number"?f:void 0,className:z,d:oO(a,l,c,d,f)}))}var j=E.current,H=T.current,ee=P.current,te=O.current,he="0px ".concat(s===-1?1:s,"px"),se="".concat(s,"px ").concat(s,"px"),fe=DQ(["strokeDasharray"],x,typeof y=="string"?y:aO.animationEasing);return R.createElement(O4,{animationId:D,key:D,canBegin:s>0,duration:x,easing:y,isActive:_,begin:S},B=>{var J=Dc(j,c,B),Y=Dc(H,d,B),V=Dc(ee,a,B),q=Dc(te,l,B);n.current&&(E.current=J,T.current=Y,P.current=V,O.current=q);var pe;w?B>0?pe={transition:fe,strokeDasharray:se}:pe={strokeDasharray:he}:pe={strokeDasharray:se};var ae=qo(e);ae.radius;var ce=iO(ae,jQ);return R.createElement("path",Mw({},ce,{radius:typeof f=="number"?f:void 0,className:z,d:oO(V,q,J,Y,f),ref:n,style:rO(rO({},pe),e.style)}))})};function lO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function cO(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?lO(Object(n),!0).forEach(function(r){KQ(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):lO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function KQ(t,e,n){return(e=YQ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function YQ(t){var e=ZQ(t,"string");return typeof e=="symbol"?e:e+""}function ZQ(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ew=Math.PI/180,QQ=t=>t*180/Math.PI,Bi=(t,e,n,r)=>({x:t+Math.cos(-Ew*r)*n,y:e+Math.sin(-Ew*r)*n}),JQ=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},eJ=(t,e)=>{var n=t.x,r=t.y,i=e.x,s=e.y;return Math.sqrt((n-i)**2+(r-s)**2)},tJ=(t,e)=>{var n=t.x,r=t.y,i=e.cx,s=e.cy,o=eJ({x:n,y:r},{x:i,y:s});if(o<=0)return{radius:o,angle:0};var a=(n-i)/o,l=Math.acos(a);return r>s&&(l=2*Math.PI-l),{radius:o,angle:QQ(l),angleInRadian:l}},nJ=t=>{var e=t.startAngle,n=t.endAngle,r=Math.floor(e/360),i=Math.floor(n/360),s=Math.min(r,i);return{startAngle:e-s*360,endAngle:n-s*360}},rJ=(t,e)=>{var n=e.startAngle,r=e.endAngle,i=Math.floor(n/360),s=Math.floor(r/360),o=Math.min(i,s);return t+o*360},iJ=(t,e)=>{var n=t.relativeX,r=t.relativeY,i=tJ({x:n,y:r},e),s=i.radius,o=i.angle,a=e.innerRadius,l=e.outerRadius;if(s<a||s>l||s===0)return null;var c=nJ(e),d=c.startAngle,f=c.endAngle,p=o,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?cO(cO({},e),{},{radius:s,angle:rJ(p,e)}):null};function D4(t){var e=t.cx,n=t.cy,r=t.radius,i=t.startAngle,s=t.endAngle,o=Bi(e,n,r,i),a=Bi(e,n,r,s);return{points:[o,a],cx:e,cy:n,radius:r,startAngle:i,endAngle:s}}var uO,dO,fO,hO,pO,mO,gO;function bP(){return bP=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},bP.apply(null,arguments)}function nh(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var sJ=(t,e)=>{var n=Vo(e-t),r=Math.min(Math.abs(e-t),359.999);return n*r},Pb=t=>{var e=t.cx,n=t.cy,r=t.radius,i=t.angle,s=t.sign,o=t.isExternal,a=t.cornerRadius,l=t.cornerIsExternal,c=a*(o?1:-1)+r,d=Math.asin(a/c)/Ew,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*Ew),x);return{center:p,circleTangency:y,lineTangency:S,theta:d}},U4=t=>{var e=t.cx,n=t.cy,r=t.innerRadius,i=t.outerRadius,s=t.startAngle,o=t.endAngle,a=sJ(s,o),l=s+a,c=Bi(e,n,i,s),d=Bi(e,n,i,l),f=Ui(uO||(uO=nh(["M ",",",`
|
||
A `,",",`,0,
|
||
`,",",`,
|
||
`,",",`
|
||
`])),c.x,c.y,i,i,+(Math.abs(a)>180),+(s>l),d.x,d.y);if(r>0){var p=Bi(e,n,r,s),y=Bi(e,n,r,l);f+=Ui(dO||(dO=nh(["L ",",",`
|
||
A `,",",`,0,
|
||
`,",",`,
|
||
`,","," Z"])),y.x,y.y,r,r,+(Math.abs(a)>180),+(s<=l),p.x,p.y)}else f+=Ui(fO||(fO=nh(["L ",","," Z"])),e,n);return f},oJ=t=>{var e=t.cx,n=t.cy,r=t.innerRadius,i=t.outerRadius,s=t.cornerRadius,o=t.forceCornerRadius,a=t.cornerIsExternal,l=t.startAngle,c=t.endAngle,d=Vo(c-l),f=Pb({cx:e,cy:n,radius:i,angle:l,sign:d,cornerRadius:s,cornerIsExternal:a}),p=f.circleTangency,y=f.lineTangency,x=f.theta,S=Pb({cx:e,cy:n,radius:i,angle:c,sign:-d,cornerRadius:s,cornerIsExternal:a}),w=S.circleTangency,_=S.lineTangency,E=S.theta,T=a?Math.abs(l-c):Math.abs(l-c)-x-E;if(T<0)return o?Ui(hO||(hO=nh(["M ",",",`
|
||
a`,",",",0,0,1,",`,0
|
||
a`,",",",0,0,1,",`,0
|
||
`])),y.x,y.y,s,s,s*2,s,s,-s*2):U4({cx:e,cy:n,innerRadius:r,outerRadius:i,startAngle:l,endAngle:c});var P=Ui(pO||(pO=nh(["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),_.x,_.y);if(r>0){var O=Pb({cx:e,cy:n,radius:r,angle:l,sign:d,isExternal:!0,cornerRadius:s,cornerIsExternal:a}),N=O.circleTangency,D=O.lineTangency,z=O.theta,G=Pb({cx:e,cy:n,radius:r,angle:c,sign:-d,isExternal:!0,cornerRadius:s,cornerIsExternal:a}),k=G.circleTangency,j=G.lineTangency,H=G.theta,ee=a?Math.abs(l-c):Math.abs(l-c)-z-H;if(ee<0&&s===0)return"".concat(P,"L").concat(e,",").concat(n,"Z");P+=Ui(mO||(mO=nh(["L",",",`
|
||
A`,",",",0,0,",",",",",`
|
||
A`,",",",0,",",",",",",",`
|
||
A`,",",",0,0,",",",",","Z"])),j.x,j.y,s,s,+(d<0),k.x,k.y,r,r,+(ee>180),+(d>0),N.x,N.y,s,s,+(d<0),D.x,D.y)}else P+=Ui(gO||(gO=nh(["L",",","Z"])),e,n);return P},aJ={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},lJ=t=>{var e=Qo(t,aJ),n=e.cx,r=e.cy,i=e.innerRadius,s=e.outerRadius,o=e.cornerRadius,a=e.forceCornerRadius,l=e.cornerIsExternal,c=e.startAngle,d=e.endAngle,f=e.className;if(s<i||c===d)return null;var p=tr("recharts-sector",f),y=s-i,x=Ad(o,y,0,!0),S;return x>0&&Math.abs(c-d)<360?S=oJ({cx:n,cy:r,innerRadius:i,outerRadius:s,cornerRadius:Math.min(x,y/2),forceCornerRadius:a,cornerIsExternal:l,startAngle:c,endAngle:d}):S=U4({cx:n,cy:r,innerRadius:i,outerRadius:s,startAngle:c,endAngle:d}),R.createElement("path",bP({},qo(e),{className:p,d:S}))};function cJ(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(y5(e)){if(t==="centric"){var r=e.cx,i=e.cy,s=e.innerRadius,o=e.outerRadius,a=e.angle,l=Bi(r,i,s,a),c=Bi(r,i,o,a);return[{x:l.x,y:l.y},{x:c.x,y:c.y}]}return D4(e)}}function uJ(t){return I5(t)?NaN:Number(t)}function PE(t){return t?(t=uJ(t),t===1/0||t===-1/0?(t<0?-1:1)*Number.MAX_VALUE:t===t?t:0):t===0?t:0}function j4(t,e,n){n&&typeof n!="number"&&eP(t,e,n)&&(e=n=void 0),t=PE(t),e===void 0?(e=t,t=0):e=PE(e),n=n===void 0?t<e?1:-1:PE(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 $a=t=>t.chartData,YC=ke([$a],t=>{var e=t.chartData!=null?t.chartData.length-1:0;return{chartData:t.chartData,computedData:t.computedData,dataEndIndex:e,dataStartIndex:0}}),bS=(t,e,n,r)=>r?YC(t):$a(t),dJ=(t,e,n)=>n?YC(t):$a(t),fJ=ke([bS],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});ke([YC],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});var hJ=ke([$a],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});function ZC(t,e){return vJ(t)||gJ(t,e)||mJ(t,e)||pJ()}function pJ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mJ(t,e){if(t){if(typeof t=="string")return vO(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vO(t,e):void 0}}function vO(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function gJ(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function vJ(t){if(Array.isArray(t))return t}function El(t){if(Array.isArray(t)&&t.length===2){var e=ZC(t,2),n=e[0],r=e[1];if(wn(n)&&wn(r))return!0}return!1}function yO(t,e,n){return n?t:[Math.min(t[0],e[0]),Math.max(t[1],e[1])]}function F4(t,e){if(e&&typeof t!="function"&&Array.isArray(t)&&t.length===2){var n=ZC(t,2),r=n[0],i=n[1],s,o;if(wn(r))s=r;else if(typeof r=="function")return;if(wn(i))o=i;else if(typeof i=="function")return;var a=[s,o];if(El(a))return a}}function yJ(t,e,n){if(!(!n&&e==null)){if(typeof t=="function"&&e!=null)try{var r=t(e,n);if(El(r))return yO(r,e,n)}catch{}if(Array.isArray(t)&&t.length===2){var i=ZC(t,2),s=i[0],o=i[1],a,l;if(s==="auto")e!=null&&(a=Math.min(...e));else if(kt(s))a=s;else if(typeof s=="function")try{e!=null&&(a=s(e==null?void 0:e[0]))}catch{}else if(typeof s=="string"&&uk.test(s)){var c=uk.exec(s);if(c==null||c[1]==null||e==null)a=void 0;else{var d=+c[1];a=e[0]-d}}else a=e==null?void 0:e[0];if(o==="auto")e!=null&&(l=Math.max(...e));else if(kt(o))l=o;else if(typeof o=="function")try{e!=null&&(l=o(e==null?void 0:e[1]))}catch{}else if(typeof o=="string"&&dk.test(o)){var f=dk.exec(o);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=[a,l];if(El(y))return e==null?y:yO(y,e,n)}}}var Gg=1e9,xJ={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},JC,dr=!0,Yo="[DecimalError] ",Sh=Yo+"Invalid argument: ",QC=Yo+"Exponent out of range: ",Wg=Math.floor,Xf=Math.pow,bJ=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,yo,vi=1e7,ar=7,z4=9007199254740991,Aw=Wg(z4/ar),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)*ar;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};Tt.dividedBy=Tt.div=function(t){return Bc(this,new this.constructor(t))};Tt.dividedToIntegerBy=Tt.idiv=function(t){var e=this,n=e.constructor;return Zn(Bc(e,new n(t),0,1),n.precision)};Tt.equals=Tt.eq=function(t){return!this.cmp(t)};Tt.exponent=function(){return Vr(this)};Tt.greaterThan=Tt.gt=function(t){return this.cmp(t)>0};Tt.greaterThanOrEqualTo=Tt.gte=function(t){return this.cmp(t)>=0};Tt.isInteger=Tt.isint=function(){return this.e>this.d.length-2};Tt.isNegative=Tt.isneg=function(){return this.s<0};Tt.isPositive=Tt.ispos=function(){return this.s>0};Tt.isZero=function(){return this.s===0};Tt.lessThan=Tt.lt=function(t){return this.cmp(t)<0};Tt.lessThanOrEqualTo=Tt.lte=function(t){return this.cmp(t)<1};Tt.logarithm=Tt.log=function(t){var e,n=this,r=n.constructor,i=r.precision,s=i+5;if(t===void 0)t=new r(10);else if(t=new r(t),t.s<1||t.eq(yo))throw Error(Yo+"NaN");if(n.s<1)throw Error(Yo+(n.s?"NaN":"-Infinity"));return n.eq(yo)?new r(0):(dr=!1,e=Bc(gy(n,s),gy(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?V4(e,t):B4(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(Yo+"NaN");return n.s?(dr=!1,e=Bc(n,t,0,1).times(t),dr=!0,n.minus(e)):Zn(new r(n),i)};Tt.naturalExponential=Tt.exp=function(){return H4(this)};Tt.naturalLogarithm=Tt.ln=function(){return gy(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?B4(e,t):V4(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(Sh+t);if(e=Vr(i)+1,r=i.d.length-1,n=r*ar+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return t&&e>n?e:n};Tt.squareRoot=Tt.sqrt=function(){var t,e,n,r,i,s,o,a=this,l=a.constructor;if(a.s<1){if(!a.s)return new l(0);throw Error(Yo+"NaN")}for(t=Vr(a),dr=!1,i=Math.sqrt(+a),i==0||i==1/0?(e=Sl(a.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=Wg((t+1)/2)-(t<0||t%2),i==1/0?e="5e"+t:(e=i.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),r=new l(e)):r=new l(i.toString()),n=l.precision,i=o=n+3;;)if(s=r,r=s.plus(Bc(a,s,o+2)).times(.5),Sl(s.d).slice(0,o)===(e=Sl(r.d)).slice(0,o)){if(e=e.slice(o-3,o+1),i==o&&e=="4999"){if(Zn(s,n+1,0),s.times(s).eq(a)){r=s;break}}else if(e!="9999")break;o+=4}return dr=!0,Zn(r,n)};Tt.times=Tt.mul=function(t){var e,n,r,i,s,o,a,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,o=l,l=c,c=o),s=[],o=l+c,r=o;r--;)s.push(0);for(r=c;--r>=0;){for(e=0,i=l+r;i>r;)a=s[i]+y[r]*p[i-r-1]+e,s[i--]=a%vi|0,e=a/vi|0;s[i]=(s[i]+e)%vi|0}for(;!s[--o];)s.pop();return e?++n:s.shift(),t.d=s,t.e=n,dr?Zn(t,f.precision):t};Tt.toDecimalPlaces=Tt.todp=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(kl(t,0,Gg),e===void 0?e=r.rounding:kl(e,0,8),Zn(n,t+Vr(n)+1,e))};Tt.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=Dh(r,!0):(kl(t,0,Gg),e===void 0?e=i.rounding:kl(e,0,8),r=Zn(new i(r),t+1,e),n=Dh(r,!0,t+1)),n};Tt.toFixed=function(t,e){var n,r,i=this,s=i.constructor;return t===void 0?Dh(i):(kl(t,0,Gg),e===void 0?e=s.rounding:kl(e,0,8),r=Zn(new s(i),t+Vr(i)+1,e),n=Dh(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,o,a=this,l=a.constructor,c=12,d=+(t=new l(t));if(!t.s)return new l(yo);if(a=new l(a),!a.s){if(t.s<1)throw Error(Yo+"Infinity");return a}if(a.eq(yo))return a;if(r=l.precision,t.eq(yo))return Zn(a,r);if(e=t.e,n=t.d.length-1,o=e>=n,s=a.s,o){if((n=d<0?-d:d)<=z4){for(i=new l(yo),e=Math.ceil(r/ar+4),dr=!1;n%2&&(i=i.times(a),bO(i.d,e)),n=Wg(n/2),n!==0;)a=a.times(a),bO(a.d,e);return dr=!0,t.s<0?new l(yo).div(i):Zn(i,r)}}else if(s<0)throw Error(Yo+"NaN");return s=s<0&&t.d[Math.max(e,n)]&1?-1:1,a.s=1,dr=!1,i=t.times(gy(a,r+c)),dr=!0,i=H4(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=Dh(i,n<=s.toExpNeg||n>=s.toExpPos)):(kl(t,1,Gg),e===void 0?e=s.rounding:kl(e,0,8),i=Zn(new s(i),t,e),n=Vr(i),r=Dh(i,t<=n||n<=s.toExpNeg,t)),r};Tt.toSignificantDigits=Tt.tosd=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(kl(t,1,Gg),e===void 0?e=r.rounding:kl(e,0,8)),Zn(new r(n),t,e)};Tt.toString=Tt.valueOf=Tt.val=Tt.toJSON=Tt[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=Vr(t),n=t.constructor;return Dh(t,e<=n.toExpNeg||e>=n.toExpPos)};function B4(t,e){var n,r,i,s,o,a,l,c,d=t.constructor,f=d.precision;if(!t.s||!e.s)return e.s||(e=new d(t)),dr?Zn(e,f):e;if(l=t.d,c=e.d,o=t.e,i=e.e,l=l.slice(),s=o-i,s){for(s<0?(r=l,s=-s,a=c.length):(r=c,i=o,a=l.length),o=Math.ceil(f/ar),a=o>a?o+1:a+1,s>a&&(s=a,r.length=1),r.reverse();s--;)r.push(0);r.reverse()}for(a=l.length,s=c.length,a-s<0&&(s=a,r=c,c=l,l=r),n=0;s;)n=(l[--s]=l[s]+c[s]+n)/vi|0,l[s]%=vi;for(n&&(l.unshift(n),++i),a=l.length;l[--a]==0;)l.pop();return e.d=l,e.e=i,dr?Zn(e,f):e}function kl(t,e,n){if(t!==~~t||t<e||t>n)throw Error(Sh+t)}function Sl(t){var e,n,r,i=t.length-1,s="",o=t[0];if(i>0){for(s+=o,e=1;e<i;e++)r=t[e]+"",n=ar-r.length,n&&(s+=sd(n)),s+=r;o=t[e],r=o+"",n=ar-r.length,n&&(s+=sd(n))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}var Bc=(function(){function t(r,i){var s,o=0,a=r.length;for(r=r.slice();a--;)s=r[a]*i+o,r[a]=s%vi|0,o=s/vi|0;return o&&r.unshift(o),r}function e(r,i,s,o){var a,l;if(s!=o)l=s>o?1:-1;else for(a=l=0;a<s;a++)if(r[a]!=i[a]){l=r[a]>i[a]?1:-1;break}return l}function n(r,i,s){for(var o=0;s--;)r[s]-=o,o=r[s]<i[s]?1:0,r[s]=o*vi+r[s]-i[s];for(;!r[0]&&r.length>1;)r.shift()}return function(r,i,s,o){var a,l,c,d,f,p,y,x,S,w,_,E,T,P,O,N,D,z,G=r.constructor,k=r.s==i.s?1:-1,j=r.d,H=i.d;if(!r.s)return new G(r);if(!i.s)throw Error(Yo+"Division by zero");for(l=r.e-i.e,D=H.length,O=j.length,y=new G(k),x=y.d=[],c=0;H[c]==(j[c]||0);)++c;if(H[c]>(j[c]||0)&&--l,s==null?E=s=G.precision:o?E=s+(Vr(r)-Vr(i))+1:E=s,E<0)return new G(0);if(E=E/ar+2|0,c=0,D==1)for(d=0,H=H[0],E++;(c<O||d)&&E--;c++)T=d*vi+(j[c]||0),x[c]=T/H|0,d=T%H|0;else{for(d=vi/(H[0]+1)|0,d>1&&(H=t(H,d),j=t(j,d),D=H.length,O=j.length),P=D,S=j.slice(0,D),w=S.length;w<D;)S[w++]=0;z=H.slice(),z.unshift(0),N=H[0],H[1]>=vi/2&&++N;do d=0,a=e(H,S,D,w),a<0?(_=S[0],D!=w&&(_=_*vi+(S[1]||0)),d=_/N|0,d>1?(d>=vi&&(d=vi-1),f=t(H,d),p=f.length,w=S.length,a=e(f,S,p,w),a==1&&(d--,n(f,D<p?z:H,p))):(d==0&&(a=d=1),f=H.slice()),p=f.length,p<w&&f.unshift(0),n(S,f,w),a==-1&&(w=S.length,a=e(H,S,D,w),a<1&&(d++,n(S,D<w?z:H,w))),w=S.length):a===0&&(d++,S=[0]),x[c++]=d,a&&S[0]?S[w++]=j[P]||0:(S=[j[P]],w=1);while((P++<O||S[0]!==void 0)&&E--)}return x[0]||x.shift(),y.e=l,Zn(y,o?s+Vr(y)+1:s)}})();function H4(t,e){var n,r,i,s,o,a,l=0,c=0,d=t.constructor,f=d.precision;if(Vr(t)>16)throw Error(QC+Vr(t));if(!t.s)return new d(yo);for(dr=!1,a=f,o=new d(.03125);t.abs().gte(.1);)t=t.times(o),c+=5;for(r=Math.log(Xf(2,c))/Math.LN10*2+5|0,a+=r,n=i=s=new d(yo),d.precision=a;;){if(i=Zn(i.times(t),a),n=n.times(++l),o=s.plus(Bc(i,n,a)),Sl(o.d).slice(0,a)===Sl(s.d).slice(0,a)){for(;c--;)s=Zn(s.times(s),a);return d.precision=f,e==null?(dr=!0,Zn(s,f)):s}s=o}}function Vr(t){for(var e=t.e*ar,n=t.d[0];n>=10;n/=10)e++;return e}function CE(t,e,n){if(e>t.LN10.sd())throw dr=!0,n&&(t.precision=n),Error(Yo+"LN10 precision limit exceeded");return Zn(new t(t.LN10),e)}function sd(t){for(var e="";t--;)e+="0";return e}function gy(t,e){var n,r,i,s,o,a,l,c,d,f=1,p=10,y=t,x=y.d,S=y.constructor,w=S.precision;if(y.s<1)throw Error(Yo+(y.s?"NaN":"-Infinity"));if(y.eq(yo))return new S(0);if(e==null?(dr=!1,c=w):c=e,y.eq(10))return e==null&&(dr=!0),CE(S,c);if(c+=p,S.precision=c,n=Sl(x),r=n.charAt(0),s=Vr(y),Math.abs(s)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)y=y.times(t),n=Sl(y.d),r=n.charAt(0),f++;s=Vr(y),r>1?(y=new S("0."+n),s++):y=new S(r+"."+n.slice(1))}else return l=CE(S,c+2,w).times(s+""),y=gy(new S(r+"."+n.slice(1)),c-p).plus(l),S.precision=w,e==null?(dr=!0,Zn(y,w)):y;for(a=o=y=Bc(y.minus(yo),y.plus(yo),c),d=Zn(y.times(y),c),i=3;;){if(o=Zn(o.times(d),c),l=a.plus(Bc(o,new S(i),c)),Sl(l.d).slice(0,c)===Sl(a.d).slice(0,c))return a=a.times(2),s!==0&&(a=a.plus(CE(S,c+2,w).times(s+""))),a=Bc(a,new S(f),c),S.precision=w,e==null?(dr=!0,Zn(a,w)):a;a=l,i+=2}}function xO(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charCodeAt(r)===48;)++r;for(i=e.length;e.charCodeAt(i-1)===48;)--i;if(e=e.slice(r,i),e){if(i-=r,n=n-r-1,t.e=Wg(n/ar),t.d=[],r=(n+1)%ar,n<0&&(r+=ar),r<i){for(r&&t.d.push(+e.slice(0,r)),i-=ar;r<i;)t.d.push(+e.slice(r,r+=ar));e=e.slice(r),r=ar-e.length}else r-=i;for(;r--;)e+="0";if(t.d.push(+e),dr&&(t.e>Aw||t.e<-Aw))throw Error(QC+n)}else t.s=0,t.e=0,t.d=[0];return t}function Zn(t,e,n){var r,i,s,o,a,l,c,d,f=t.d;for(o=1,s=f[0];s>=10;s/=10)o++;if(r=e-o,r<0)r+=ar,i=e,c=f[d=0];else{if(d=Math.ceil((r+1)/ar),s=f.length,d>=s)return t;for(c=s=f[d],o=1;s>=10;s/=10)o++;r%=ar,i=r-ar+o}if(n!==void 0&&(s=Xf(10,o-i-1),a=c/s%10|0,l=e<0||f[d+1]!==void 0||c%s,l=n<4?(a||l)&&(n==0||n==(t.s<0?3:2)):a>5||a==5&&(n==4||l||n==6&&(r>0?i>0?c/Xf(10,o-i):0:f[d-1])%10&1||n==(t.s<0?8:7))),e<1||!f[0])return l?(s=Vr(t),f.length=1,e=e-s-1,f[0]=Xf(10,(ar-e%ar)%ar),t.e=Wg(-e/ar)||0):(f.length=1,f[0]=t.e=t.s=0),t;if(r==0?(f.length=d,s=1,d--):(f.length=d+1,s=Xf(10,ar-r),f[d]=i>0?(c/Xf(10,o-i)%Xf(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>Aw||t.e<-Aw))throw Error(QC+Vr(t));return t}function V4(t,e){var n,r,i,s,o,a,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(),o=c-r,o){for(d=o<0,d?(n=l,o=-o,a=f.length):(n=f,r=c,a=l.length),i=Math.max(Math.ceil(y/ar),a)+2,o>i&&(o=i,n.length=1),n.reverse(),i=o;i--;)n.push(0);n.reverse()}else{for(i=l.length,a=f.length,d=i<a,d&&(a=i),i=0;i<a;i++)if(l[i]!=f[i]){d=l[i]<f[i];break}o=0}for(d&&(n=l,l=f,f=n,e.s=-e.s),a=l.length,i=f.length-a;i>0;--i)l[a++]=0;for(i=f.length;i>o;){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[--a]===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 Dh(t,e,n){var r,i=Vr(t),s=Sl(t.d),o=s.length;return e?(n&&(r=n-o)>0?s=s.charAt(0)+"."+s.slice(1)+sd(r):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(i<0?"e":"e+")+i):i<0?(s="0."+sd(-i-1)+s,n&&(r=n-o)>0&&(s+=sd(r))):i>=o?(s+=sd(i+1-o),n&&(r=n-i-1)>0&&(s=s+"."+sd(r))):((r=i+1)<o&&(s=s.slice(0,r)+"."+s.slice(r)),n&&(r=n-o)>0&&(i+1===o&&(s+="."),s+=sd(r))),t.s<0?"-"+s:s}function bO(t,e){if(t.length>e)return t.length=e,!0}function G4(t){var e,n,r;function i(s){var o=this;if(!(o instanceof i))return new i(s);if(o.constructor=i,s instanceof i){o.s=s.s,o.e=s.e,o.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(Sh+s);if(s>0)o.s=1;else if(s<0)s=-s,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(s===~~s&&s<1e7){o.e=0,o.d=[s];return}return xO(o,s.toString())}else if(typeof s!="string")throw Error(Sh+s);if(s.charCodeAt(0)===45?(s=s.slice(1),o.s=-1):o.s=1,bJ.test(s))xO(o,s);else throw Error(Sh+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=G4,i.config=i.set=_J,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 _J(t){if(!t||typeof t!="object")throw Error(Yo+"Object expected");var e,n,r,i=["precision",1,Gg,"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(Wg(r)===r&&r>=i[e+1]&&r<=i[e+2])this[n]=r;else throw Error(Sh+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(Sh+n+": "+r);return this}var JC=G4(xJ);yo=new JC(1);const Tn=JC;function W4(t){var e;return t===0?e=1:e=Math.floor(new Tn(t).abs().log(10).toNumber())+1,e}function $4(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 vy(t,e){return EJ(t)||MJ(t,e)||SJ(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 SJ(t,e){if(t){if(typeof t=="string")return _O(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_O(t,e):void 0}}function _O(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function MJ(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function EJ(t){if(Array.isArray(t))return t}var X4=t=>{var e=vy(t,2),n=e[0],r=e[1],i=n,s=r;return n>r&&(i=r,s=n),[i,s]},e2=(t,e,n)=>{if(t.lte(0))return new Tn(0);var r=W4(t.toNumber()),i=new Tn(10).pow(r),s=t.div(i),o=r!==1?.05:.1,a=new Tn(Math.ceil(s.div(o).toNumber())).add(n).mul(o),l=a.mul(i);return e?new Tn(l.toNumber()):new Tn(Math.ceil(l.toNumber()))},q4=(t,e,n)=>{var r;if(t.lte(0))return new Tn(0);var i=[1,2,2.5,5],s=t.toNumber(),o=Math.floor(new Tn(s).abs().log(10).toNumber()),a=new Tn(10).pow(o),l=t.div(a).toNumber(),c=i.findIndex(y=>y>=l-1e-10);if(c===-1&&(a=a.mul(10),c=0),c+=n,c>=i.length){var d=Math.floor(c/i.length);c%=i.length,a=a.mul(new Tn(10).pow(d))}var f=(r=i[c])!==null&&r!==void 0?r:1,p=new Tn(f).mul(a);return e?p:new Tn(Math.ceil(p.toNumber()))},AJ=(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(W4(t)-1),i=new Tn(Math.floor(i.div(r).toNumber())).mul(r)):s>1&&(i=new Tn(Math.floor(t)))}else t===0?i=new Tn(Math.floor((e-1)/2)):n||(i=new Tn(Math.floor(t)));for(var o=Math.floor((e-1)/2),a=[],l=0;l<e;l++)a.push(i.add(new Tn(l-o).mul(r)).toNumber());return a},K4=function(e,n,r,i){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:e2;if(!Number.isFinite((n-e)/(r-1)))return{step:new Tn(0),tickMin:new Tn(0),tickMax:new Tn(0)};var a=o(new Tn(n).sub(e).div(r-1),i,s),l;e<=0&&n>=0?l=new Tn(0):(l=new Tn(e).add(n).div(2),l=l.sub(new Tn(l).mod(a)));var c=Math.ceil(l.sub(e).div(a).toNumber()),d=Math.ceil(new Tn(n).sub(l).div(a).toNumber()),f=c+d+1;return f>r?K4(e,n,r,i,s+1,o):(f<r&&(d=n>0?d+(r-f):d,c=n>0?c:c+(r-f)),{step:a,tickMin:l.sub(new Tn(c).mul(a)),tickMax:l.add(new Tn(d).mul(a))})},wO=function(e){var n=vy(e,2),r=n[0],i=n[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",l=Math.max(s,2),c=X4([r,i]),d=vy(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 AJ(f,s,o);var x=a==="snap125"?q4:e2,S=K4(f,p,l,o,0,x),w=S.step,_=S.tickMin,E=S.tickMax,T=$4(_,E.add(new Tn(.1).mul(w)),w);return r>i?T.reverse():T},SO=function(e,n){var r=vy(e,2),i=r[0],s=r[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",l=X4([i,s]),c=vy(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=a==="snap125"?q4:e2,y=Math.max(n,2),x=p(new Tn(f).sub(d).div(y-1),o,0),S=[...$4(new Tn(d),new Tn(f),x),f];return o===!1&&(S=S.map(w=>Math.round(w))),i>s?S.reverse():S},TJ=t=>t.rootProps.barCategoryGap,_S=t=>t.rootProps.stackOffset,Y4=t=>t.rootProps.reverseStackOrder,t2=t=>t.options.chartName,n2=t=>t.rootProps.syncId,Z4=t=>t.rootProps.syncMethod,r2=t=>t.options.eventEmitter,PJ=t=>t.rootProps.baseValue,Ms={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},Sf={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},hl={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},wS=(t,e)=>{if(!(!t||!e))return t!=null&&t.reversed?[e[1],e[0]]:e};function SS(t,e,n){if(n!=="auto")return n;if(t!=null)return jl(t,e)?"category":"number"}function MO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Tw(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?MO(Object(n),!0).forEach(function(r){CJ(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):MO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function CJ(t,e,n){return(e=RJ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function RJ(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 EO={allowDataOverflow:Sf.allowDataOverflow,allowDecimals:Sf.allowDecimals,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:Sf.angleAxisId,includeHidden:!1,name:void 0,reversed:Sf.reversed,scale:Sf.scale,tick:Sf.tick,tickCount:void 0,ticks:void 0,type:Sf.type,unit:void 0,niceTicks:"auto"},AO={allowDataOverflow:hl.allowDataOverflow,allowDecimals:hl.allowDecimals,allowDuplicatedCategory:hl.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:hl.radiusAxisId,includeHidden:hl.includeHidden,name:void 0,reversed:hl.reversed,scale:hl.scale,tick:hl.tick,tickCount:hl.tickCount,ticks:void 0,type:hl.type,unit:void 0,niceTicks:"auto"},IJ=(t,e)=>{if(e!=null)return t.polarAxis.angleAxis[e]},i2=ke([IJ,_4],(t,e)=>{var n;if(t!=null)return t;var r=(n=SS(e,"angleAxis",EO.type))!==null&&n!==void 0?n:"category";return Tw(Tw({},EO),{},{type:r})}),kJ=(t,e)=>t.polarAxis.radiusAxis[e],s2=ke([kJ,_4],(t,e)=>{var n;if(t!=null)return t;var r=(n=SS(e,"radiusAxis",AO.type))!==null&&n!==void 0?n:"category";return Tw(Tw({},AO),{},{type:r})}),MS=t=>t.polarOptions,o2=ke([Jc,eu,Wi],JQ),Q4=ke([MS,o2],(t,e)=>{if(t!=null)return Ad(t.innerRadius,e,0)}),J4=ke([MS,o2],(t,e)=>{if(t!=null)return Ad(t.outerRadius,e,e*.8)}),OJ=t=>{if(t==null)return[0,0];var e=t.startAngle,n=t.endAngle;return[e,n]},ez=ke([MS],OJ);ke([i2,ez],wS);var tz=ke([o2,Q4,J4],(t,e,n)=>{if(!(t==null||e==null||n==null))return[e,n]});ke([s2,tz],wS);var nz=ke([hr,MS,Q4,J4,Jc,eu],(t,e,n,r,i,s)=>{if(!(t!=="centric"&&t!=="radial"||e==null||n==null||r==null)){var o=e.cx,a=e.cy,l=e.startAngle,c=e.endAngle;return{cx:Ad(o,i,i/2),cy:Ad(a,s,s/2),innerRadius:n,outerRadius:r,startAngle:l,endAngle:c,clockWise:!1}}}),_i=(t,e)=>e,ES=(t,e,n)=>n;function a2(t){return t==null?void 0:t.id}function rz(t,e,n){var r=e.chartData,i=r===void 0?[]:r,s=n.allowDuplicatedCategory,o=n.dataKey,a=new Map;return t.forEach(l=>{var c,d=(c=l.data)!==null&&c!==void 0?c:i;if(!(d==null||d.length===0)){var f=a2(l);d.forEach((p,y)=>{var x=o==null||s?y:String(yi(p,o,null)),S=yi(p,l.dataKey,0),w;a.has(x)?w=a.get(x):w={},Object.assign(w,{[f]:S}),a.set(x,w)})}}),Array.from(a.values())}function l2(t){return"stackId"in t&&t.stackId!=null&&t.dataKey!=null}var AS=(t,e)=>t===e?!0:t==null||e==null?!1:t[0]===e[0]&&t[1]===e[1];function TS(t,e){return Array.isArray(t)&&Array.isArray(e)&&t.length===0&&e.length===0?!0:t===e}function LJ(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"},$g=t=>t.tooltip.settings.axisId;function c2(t){if(t!=null){var e=t.ticks,n=t.bandwidth,r=t.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>t.domain(),range:(function(s){function o(){return s.apply(this,arguments)}return o.toString=function(){return s.toString()},o})(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(s){var o=i[0],a=i[1];return o<=a?s>=o&&s<=a:s>=a&&s<=o},bandwidth:n?()=>n.call(t):void 0,ticks:e?s=>e.call(t,s):void 0,map:(s,o)=>{var a=t(s);if(a!=null){if(t.bandwidth&&o!==null&&o!==void 0&&o.position){var l=t.bandwidth();switch(o.position){case"middle":a+=l/2;break;case"end":a+=l;break}}return a}}}}}var DJ=(t,e)=>{if(e!=null)switch(t){case"linear":{if(!El(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 bd(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function UJ(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function u2(t){let e,n,r;t.length!==2?(e=bd,n=(a,l)=>bd(t(a),l),r=(a,l)=>t(a)-l):(e=t===bd||t===UJ?t:jJ,n=t,r=t);function i(a,l,c=0,d=a.length){if(c<d){if(e(l,l)!==0)return d;do{const f=c+d>>>1;n(a[f],l)<0?c=f+1:d=f}while(c<d)}return c}function s(a,l,c=0,d=a.length){if(c<d){if(e(l,l)!==0)return d;do{const f=c+d>>>1;n(a[f],l)<=0?c=f+1:d=f}while(c<d)}return c}function o(a,l,c=0,d=a.length){const f=i(a,l,c,d-1);return f>c&&r(a[f-1],l)>-r(a[f],l)?f-1:f}return{left:i,center:o,right:s}}function jJ(){return 0}function iz(t){return t===null?NaN:+t}function*FJ(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const zJ=u2(bd),Qy=zJ.right;u2(iz).center;class TO extends Map{constructor(e,n=VJ){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(PO(this,e))}has(e){return super.has(PO(this,e))}set(e,n){return super.set(BJ(this,e),n)}delete(e){return super.delete(HJ(this,e))}}function PO({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function BJ({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function HJ({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function VJ(t){return t!==null&&typeof t=="object"?t.valueOf():t}function GJ(t=bd){if(t===bd)return sz;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 sz(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}const WJ=Math.sqrt(50),$J=Math.sqrt(10),XJ=Math.sqrt(2);function Pw(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),s=r/Math.pow(10,i),o=s>=WJ?10:s>=$J?5:s>=XJ?2:1;let a,l,c;return i<0?(c=Math.pow(10,-i)/o,a=Math.round(t*c),l=Math.round(e*c),a/c<t&&++a,l/c>e&&--l,c=-c):(c=Math.pow(10,i)*o,a=Math.round(t/c),l=Math.round(e/c),a*c<t&&++a,l*c>e&&--l),l<a&&.5<=n&&n<2?Pw(t,e,n*2):[a,l,c]}function _P(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];const r=e<t,[i,s,o]=r?Pw(e,t,n):Pw(t,e,n);if(!(s>=i))return[];const a=s-i+1,l=new Array(a);if(r)if(o<0)for(let c=0;c<a;++c)l[c]=(s-c)/-o;else for(let c=0;c<a;++c)l[c]=(s-c)*o;else if(o<0)for(let c=0;c<a;++c)l[c]=(i+c)/-o;else for(let c=0;c<a;++c)l[c]=(i+c)*o;return l}function wP(t,e,n){return e=+e,t=+t,n=+n,Pw(t,e,n)[2]}function SP(t,e,n){e=+e,t=+t,n=+n;const r=e<t,i=r?wP(e,t,n):wP(t,e,n);return(r?-1:1)*(i<0?1/-i:i)}function CO(t,e){let n;for(const r of t)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);return n}function RO(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function oz(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?sz:GJ(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));oz(t,e,y,x,i)}const s=t[e];let o=n,a=r;for(l0(t,n,e),i(t[r],s)>0&&l0(t,n,r);o<a;){for(l0(t,o,a),++o,--a;i(t[o],s)<0;)++o;for(;i(t[a],s)>0;)--a}i(t[n],s)===0?l0(t,n,a):(++a,l0(t,a,r)),a<=e&&(n=a+1),e<=a&&(r=a-1)}return t}function l0(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function qJ(t,e,n){if(t=Float64Array.from(FJ(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return RO(t);if(e>=1)return CO(t);var r,i=(r-1)*e,s=Math.floor(i),o=CO(oz(t,s).subarray(0,s+1)),a=RO(t.subarray(s+1));return o+(a-o)*(i-s)}}function KJ(t,e,n=iz){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,s=Math.floor(i),o=+n(t[s],s,t),a=+n(t[s+1],s+1,t);return o+(a-o)*(i-s)}}function YJ(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 Jo(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function tu(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 MP=Symbol("implicit");function d2(){var t=new TO,e=[],n=[],r=MP;function i(s){let o=t.get(s);if(o===void 0){if(r!==MP)return r;t.set(s,o=e.push(s)-1)}return n[o%n.length]}return i.domain=function(s){if(!arguments.length)return e.slice();e=[],t=new TO;for(const o of s)t.has(o)||t.set(o,e.push(o)-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 d2(e,n).unknown(r)},Jo.apply(i,arguments),i}function f2(){var t=d2().unknown(void 0),e=t.domain,n=t.range,r=0,i=1,s,o,a=!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),a&&(s=Math.floor(s)),x+=(S-x-s*(p-l))*d,o=s*(1-l),a&&(x=Math.round(x),o=Math.round(o));var w=YJ(p).map(function(_){return x+s*_});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,a=!0,f()},t.bandwidth=function(){return o},t.step=function(){return s},t.round=function(p){return arguments.length?(a=!!p,f()):a},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 f2(e(),[r,i]).round(a).paddingInner(l).paddingOuter(c).align(d)},Jo.apply(f(),arguments)}function az(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return az(e())},t}function ZJ(){return az(f2.apply(null,arguments).paddingInner(1))}function h2(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function lz(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Jy(){}var yy=.7,Cw=1/yy,Jm="\\s*([+-]?\\d+)\\s*",xy="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Al="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",QJ=/^#([0-9a-f]{3,8})$/,JJ=new RegExp(`^rgb\\(${Jm},${Jm},${Jm}\\)$`),eee=new RegExp(`^rgb\\(${Al},${Al},${Al}\\)$`),tee=new RegExp(`^rgba\\(${Jm},${Jm},${Jm},${xy}\\)$`),nee=new RegExp(`^rgba\\(${Al},${Al},${Al},${xy}\\)$`),ree=new RegExp(`^hsl\\(${xy},${Al},${Al}\\)$`),iee=new RegExp(`^hsla\\(${xy},${Al},${Al},${xy}\\)$`),NO={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};h2(Jy,by,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:IO,formatHex:IO,formatHex8:see,formatHsl:oee,formatRgb:kO,toString:kO});function IO(){return this.rgb().formatHex()}function see(){return this.rgb().formatHex8()}function oee(){return cz(this).formatHsl()}function kO(){return this.rgb().formatRgb()}function by(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=QJ.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?OO(e):n===3?new Zs(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Cb(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Cb(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=JJ.exec(t))?new Zs(e[1],e[2],e[3],1):(e=eee.exec(t))?new Zs(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=tee.exec(t))?Cb(e[1],e[2],e[3],e[4]):(e=nee.exec(t))?Cb(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=ree.exec(t))?UO(e[1],e[2]/100,e[3]/100,1):(e=iee.exec(t))?UO(e[1],e[2]/100,e[3]/100,e[4]):NO.hasOwnProperty(t)?OO(NO[t]):t==="transparent"?new Zs(NaN,NaN,NaN,0):null}function OO(t){return new Zs(t>>16&255,t>>8&255,t&255,1)}function Cb(t,e,n,r){return r<=0&&(t=e=n=NaN),new Zs(t,e,n,r)}function aee(t){return t instanceof Jy||(t=by(t)),t?(t=t.rgb(),new Zs(t.r,t.g,t.b,t.opacity)):new Zs}function EP(t,e,n,r){return arguments.length===1?aee(t):new Zs(t,e,n,r??1)}function Zs(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}h2(Zs,EP,lz(Jy,{brighter(t){return t=t==null?Cw:Math.pow(Cw,t),new Zs(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?yy:Math.pow(yy,t),new Zs(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Zs(Mh(this.r),Mh(this.g),Mh(this.b),Rw(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:LO,formatHex:LO,formatHex8:lee,formatRgb:DO,toString:DO}));function LO(){return`#${rh(this.r)}${rh(this.g)}${rh(this.b)}`}function lee(){return`#${rh(this.r)}${rh(this.g)}${rh(this.b)}${rh((isNaN(this.opacity)?1:this.opacity)*255)}`}function DO(){const t=Rw(this.opacity);return`${t===1?"rgb(":"rgba("}${Mh(this.r)}, ${Mh(this.g)}, ${Mh(this.b)}${t===1?")":`, ${t})`}`}function Rw(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Mh(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function rh(t){return t=Mh(t),(t<16?"0":"")+t.toString(16)}function UO(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Fa(t,e,n,r)}function cz(t){if(t instanceof Fa)return new Fa(t.h,t.s,t.l,t.opacity);if(t instanceof Jy||(t=by(t)),!t)return new Fa;if(t instanceof Fa)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),s=Math.max(e,n,r),o=NaN,a=s-i,l=(s+i)/2;return a?(e===s?o=(n-r)/a+(n<r)*6:n===s?o=(r-e)/a+2:o=(e-n)/a+4,a/=l<.5?s+i:2-s-i,o*=60):a=l>0&&l<1?0:o,new Fa(o,a,l,t.opacity)}function cee(t,e,n,r){return arguments.length===1?cz(t):new Fa(t,e,n,r??1)}function Fa(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}h2(Fa,cee,lz(Jy,{brighter(t){return t=t==null?Cw:Math.pow(Cw,t),new Fa(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?yy:Math.pow(yy,t),new Fa(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Zs(RE(t>=240?t-240:t+120,i,r),RE(t,i,r),RE(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Fa(jO(this.h),Rb(this.s),Rb(this.l),Rw(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=Rw(this.opacity);return`${t===1?"hsl(":"hsla("}${jO(this.h)}, ${Rb(this.s)*100}%, ${Rb(this.l)*100}%${t===1?")":`, ${t})`}`}}));function jO(t){return t=(t||0)%360,t<0?t+360:t}function Rb(t){return Math.max(0,Math.min(1,t||0))}function RE(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const p2=t=>()=>t;function uee(t,e){return function(n){return t+n*e}}function dee(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function fee(t){return(t=+t)==1?uz:function(e,n){return n-e?dee(e,n,t):p2(isNaN(e)?n:e)}}function uz(t,e){var n=e-t;return n?uee(t,n):p2(isNaN(t)?e:t)}const FO=(function t(e){var n=fee(e);function r(i,s){var o=n((i=EP(i)).r,(s=EP(s)).r),a=n(i.g,s.g),l=n(i.b,s.b),c=uz(i.opacity,s.opacity);return function(d){return i.r=o(d),i.g=a(d),i.b=l(d),i.opacity=c(d),i+""}}return r.gamma=t,r})(1);function hee(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 pee(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function mee(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,i=new Array(r),s=new Array(n),o;for(o=0;o<r;++o)i[o]=Xg(t[o],e[o]);for(;o<n;++o)s[o]=e[o];return function(a){for(o=0;o<r;++o)s[o]=i[o](a);return s}}function gee(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function Nw(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function vee(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]=Xg(t[i],e[i]):r[i]=e[i];return function(s){for(i in n)r[i]=n[i](s);return r}}var AP=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,NE=new RegExp(AP.source,"g");function yee(t){return function(){return t}}function xee(t){return function(e){return t(e)+""}}function bee(t,e){var n=AP.lastIndex=NE.lastIndex=0,r,i,s,o=-1,a=[],l=[];for(t=t+"",e=e+"";(r=AP.exec(t))&&(i=NE.exec(e));)(s=i.index)>n&&(s=e.slice(n,s),a[o]?a[o]+=s:a[++o]=s),(r=r[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,l.push({i:o,x:Nw(r,i)})),n=NE.lastIndex;return n<e.length&&(s=e.slice(n),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?xee(l[0].x):yee(e):(e=l.length,function(c){for(var d=0,f;d<e;++d)a[(f=l[d]).i]=f.x(c);return a.join("")})}function Xg(t,e){var n=typeof e,r;return e==null||n==="boolean"?p2(e):(n==="number"?Nw:n==="string"?(r=by(e))?(e=r,FO):bee:e instanceof by?FO:e instanceof Date?gee:pee(e)?hee:Array.isArray(e)?mee:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?vee:Nw)(t,e)}function m2(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function _ee(t,e){e===void 0&&(e=t,t=Xg);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(o){var a=Math.max(0,Math.min(r-1,Math.floor(o*=r)));return s[a](o-a)}}function wee(t){return function(){return t}}function Iw(t){return+t}var zO=[0,1];function Es(t){return t}function TP(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:wee(isNaN(e)?NaN:.5)}function See(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function Mee(t,e,n){var r=t[0],i=t[1],s=e[0],o=e[1];return i<r?(r=TP(i,r),s=n(o,s)):(r=TP(r,i),s=n(s,o)),function(a){return s(r(a))}}function Eee(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),s=new Array(r),o=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<r;)i[o]=TP(t[o],t[o+1]),s[o]=n(e[o],e[o+1]);return function(a){var l=Qy(t,a,1,r)-1;return s[l](i[l](a))}}function ex(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function PS(){var t=zO,e=zO,n=Xg,r,i,s,o=Es,a,l,c;function d(){var p=Math.min(t.length,e.length);return o!==Es&&(o=See(t[0],t[p-1])),a=p>2?Eee:Mee,l=c=null,f}function f(p){return p==null||isNaN(p=+p)?s:(l||(l=a(t.map(r),e,n)))(r(o(p)))}return f.invert=function(p){return o(i((c||(c=a(e,t.map(r),Nw)))(p)))},f.domain=function(p){return arguments.length?(t=Array.from(p,Iw),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=m2,d()},f.clamp=function(p){return arguments.length?(o=p?!0:Es,d()):o!==Es},f.interpolate=function(p){return arguments.length?(n=p,d()):n},f.unknown=function(p){return arguments.length?(s=p,f):s},function(p,y){return r=p,i=y,d()}}function g2(){return PS()(Es,Es)}function Aee(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function kw(t,e){if(!isFinite(t)||t===0)return null;var n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"),r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Eg(t){return t=kw(Math.abs(t)),t?t[1]:NaN}function Tee(t,e){return function(n,r){for(var i=n.length,s=[],o=0,a=t[0],l=0;i>0&&a>0&&(l+a+1>r&&(a=Math.max(1,r-l)),s.push(n.substring(i-=a,i+a)),!((l+=a+1)>r));)a=t[o=(o+1)%t.length];return s.reverse().join(e)}}function Pee(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var Cee=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function _y(t){if(!(e=Cee.exec(t)))throw new Error("invalid format: "+t);var e;return new v2({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}_y.prototype=v2.prototype;function v2(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}v2.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Ree(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 Ow;function Nee(t,e){var n=kw(t,e);if(!n)return Ow=void 0,t.toPrecision(e);var r=n[0],i=n[1],s=i-(Ow=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return s===o?r:s>o?r+new Array(s-o+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+kw(t,Math.max(0,e+s-1))[0]}function BO(t,e){var n=kw(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const HO={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:Aee,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>BO(t*100,e),r:BO,s:Nee,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function VO(t){return t}var GO=Array.prototype.map,WO=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Iee(t){var e=t.grouping===void 0||t.thousands===void 0?VO:Tee(GO.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",s=t.numerals===void 0?VO:Pee(GO.call(t.numerals,String)),o=t.percent===void 0?"%":t.percent+"",a=t.minus===void 0?"−":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function c(f,p){f=_y(f);var y=f.fill,x=f.align,S=f.sign,w=f.symbol,_=f.zero,E=f.width,T=f.comma,P=f.precision,O=f.trim,N=f.type;N==="n"?(T=!0,N="g"):HO[N]||(P===void 0&&(P=12),O=!0,N="g"),(_||y==="0"&&x==="=")&&(_=!0,y="0",x="=");var D=(p&&p.prefix!==void 0?p.prefix:"")+(w==="$"?n:w==="#"&&/[boxX]/.test(N)?"0"+N.toLowerCase():""),z=(w==="$"?r:/[%p]/.test(N)?o:"")+(p&&p.suffix!==void 0?p.suffix:""),G=HO[N],k=/[defgprs%]/.test(N);P=P===void 0?6:/[gprs]/.test(N)?Math.max(1,Math.min(21,P)):Math.max(0,Math.min(20,P));function j(H){var ee=D,te=z,he,se,fe;if(N==="c")te=G(H)+te,H="";else{H=+H;var B=H<0||1/H<0;if(H=isNaN(H)?l:G(Math.abs(H),P),O&&(H=Ree(H)),B&&+H==0&&S!=="+"&&(B=!1),ee=(B?S==="("?S:a:S==="-"||S==="("?"":S)+ee,te=(N==="s"&&!isNaN(H)&&Ow!==void 0?WO[8+Ow/3]:"")+te+(B&&S==="("?")":""),k){for(he=-1,se=H.length;++he<se;)if(fe=H.charCodeAt(he),48>fe||fe>57){te=(fe===46?i+H.slice(he+1):H.slice(he))+te,H=H.slice(0,he);break}}}T&&!_&&(H=e(H,1/0));var J=ee.length+H.length+te.length,Y=J<E?new Array(E-J+1).join(y):"";switch(T&&_&&(H=e(Y+H,Y.length?E-te.length:1/0),Y=""),x){case"<":H=ee+H+te+Y;break;case"=":H=ee+Y+H+te;break;case"^":H=Y.slice(0,J=Y.length>>1)+ee+H+te+Y.slice(J);break;default:H=Y+ee+H+te;break}return s(H)}return j.toString=function(){return f+""},j}function d(f,p){var y=Math.max(-8,Math.min(8,Math.floor(Eg(p)/3)))*3,x=Math.pow(10,-y),S=c((f=_y(f),f.type="f",f),{suffix:WO[8+y/3]});return function(w){return S(x*w)}}return{format:c,formatPrefix:d}}var Nb,y2,dz;kee({thousands:",",grouping:[3],currency:["$",""]});function kee(t){return Nb=Iee(t),y2=Nb.format,dz=Nb.formatPrefix,Nb}function Oee(t){return Math.max(0,-Eg(Math.abs(t)))}function Lee(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Eg(e)/3)))*3-Eg(Math.abs(t)))}function Dee(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Eg(e)-Eg(t))+1}function fz(t,e,n,r){var i=SP(t,e,n),s;switch(r=_y(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(s=Lee(i,o))&&(r.precision=s),dz(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=Dee(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=Oee(i))&&(r.precision=s-(r.type==="%")*2);break}}return y2(r)}function Nd(t){var e=t.domain;return t.ticks=function(n){var r=e();return _P(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return fz(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,s=r.length-1,o=r[i],a=r[s],l,c,d=10;for(a<o&&(c=o,o=a,a=c,c=i,i=s,s=c);d-- >0;){if(c=wP(o,a,n),c===l)return r[i]=o,r[s]=a,e(r);if(c>0)o=Math.floor(o/c)*c,a=Math.ceil(a/c)*c;else if(c<0)o=Math.ceil(o*c)/c,a=Math.floor(a*c)/c;else break;l=c}return t},t}function hz(){var t=g2();return t.copy=function(){return ex(t,hz())},Jo.apply(t,arguments),Nd(t)}function pz(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,Iw),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return pz(t).unknown(e)},t=arguments.length?Array.from(t,Iw):[0,1],Nd(n)}function mz(t,e){t=t.slice();var n=0,r=t.length-1,i=t[n],s=t[r],o;return s<i&&(o=n,n=r,r=o,o=i,i=s,s=o),t[n]=e.floor(i),t[r]=e.ceil(s),t}function $O(t){return Math.log(t)}function XO(t){return Math.exp(t)}function Uee(t){return-Math.log(-t)}function jee(t){return-Math.exp(-t)}function Fee(t){return isFinite(t)?+("1e"+t):t<0?0:t}function zee(t){return t===10?Fee:t===Math.E?Math.exp:e=>Math.pow(t,e)}function Bee(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function qO(t){return(e,n)=>-t(-e,n)}function x2(t){const e=t($O,XO),n=e.domain;let r=10,i,s;function o(){return i=Bee(r),s=zee(r),n()[0]<0?(i=qO(i),s=qO(s),t(Uee,jee)):t($O,XO),e}return e.base=function(a){return arguments.length?(r=+a,o()):r},e.domain=function(a){return arguments.length?(n(a),o()):n()},e.ticks=a=>{const l=n();let c=l[0],d=l[l.length-1];const f=d<c;f&&([c,d]=[d,c]);let p=i(c),y=i(d),x,S;const w=a==null?10:+a;let _=[];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;_.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;_.push(S)}_.length*2<w&&(_=_P(c,d,w))}else _=_P(p,y,Math.min(y-p,w)).map(s);return f?_.reverse():_},e.tickFormat=(a,l)=>{if(a==null&&(a=10),l==null&&(l=r===10?"s":","),typeof l!="function"&&(!(r%1)&&(l=_y(l)).precision==null&&(l.trim=!0),l=y2(l)),a===1/0)return l;const c=Math.max(1,r*a/e.ticks().length);return d=>{let f=d/s(Math.round(i(d)));return f*r<r-.5&&(f*=r),f<=c?l(d):""}},e.nice=()=>n(mz(n(),{floor:a=>s(Math.floor(i(a))),ceil:a=>s(Math.ceil(i(a)))})),e}function gz(){const t=x2(PS()).domain([1,10]);return t.copy=()=>ex(t,gz()).base(t.base()),Jo.apply(t,arguments),t}function KO(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function YO(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function b2(t){var e=1,n=t(KO(e),YO(e));return n.constant=function(r){return arguments.length?t(KO(e=+r),YO(e)):e},Nd(n)}function vz(){var t=b2(PS());return t.copy=function(){return ex(t,vz()).constant(t.constant())},Jo.apply(t,arguments)}function ZO(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function Hee(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function Vee(t){return t<0?-t*t:t*t}function _2(t){var e=t(Es,Es),n=1;function r(){return n===1?t(Es,Es):n===.5?t(Hee,Vee):t(ZO(n),ZO(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},Nd(e)}function w2(){var t=_2(PS());return t.copy=function(){return ex(t,w2()).exponent(t.exponent())},Jo.apply(t,arguments),t}function Gee(){return w2.apply(null,arguments).exponent(.5)}function QO(t){return Math.sign(t)*t*t}function Wee(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function yz(){var t=g2(),e=[0,1],n=!1,r;function i(s){var o=Wee(t(s));return isNaN(o)?r:n?Math.round(o):o}return i.invert=function(s){return t.invert(QO(s))},i.domain=function(s){return arguments.length?(t.domain(s),i):t.domain()},i.range=function(s){return arguments.length?(t.range((e=Array.from(s,Iw)).map(QO)),i):e.slice()},i.rangeRound=function(s){return i.range(s).round(!0)},i.round=function(s){return arguments.length?(n=!!s,i):n},i.clamp=function(s){return arguments.length?(t.clamp(s),i):t.clamp()},i.unknown=function(s){return arguments.length?(r=s,i):r},i.copy=function(){return yz(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},Jo.apply(i,arguments),Nd(i)}function xz(){var t=[],e=[],n=[],r;function i(){var o=0,a=Math.max(1,e.length);for(n=new Array(a-1);++o<a;)n[o-1]=KJ(t,o/a);return s}function s(o){return o==null||isNaN(o=+o)?r:e[Qy(n,o)]}return s.invertExtent=function(o){var a=e.indexOf(o);return a<0?[NaN,NaN]:[a>0?n[a-1]:t[0],a<n.length?n[a]:t[t.length-1]]},s.domain=function(o){if(!arguments.length)return t.slice();t=[];for(let a of o)a!=null&&!isNaN(a=+a)&&t.push(a);return t.sort(bd),i()},s.range=function(o){return arguments.length?(e=Array.from(o),i()):e.slice()},s.unknown=function(o){return arguments.length?(r=o,s):r},s.quantiles=function(){return n.slice()},s.copy=function(){return xz().domain(t).range(e).unknown(r)},Jo.apply(s,arguments)}function bz(){var t=0,e=1,n=1,r=[.5],i=[0,1],s;function o(l){return l!=null&&l<=l?i[Qy(r,l,0,n)]:s}function a(){var l=-1;for(r=new Array(n);++l<n;)r[l]=((l+1)*e-(l-n)*t)/(n+1);return o}return o.domain=function(l){return arguments.length?([t,e]=l,t=+t,e=+e,a()):[t,e]},o.range=function(l){return arguments.length?(n=(i=Array.from(l)).length-1,a()):i.slice()},o.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]]},o.unknown=function(l){return arguments.length&&(s=l),o},o.thresholds=function(){return r.slice()},o.copy=function(){return bz().domain([t,e]).range(i).unknown(s)},Jo.apply(Nd(o),arguments)}function _z(){var t=[.5],e=[0,1],n,r=1;function i(s){return s!=null&&s<=s?e[Qy(t,s,0,r)]:n}return i.domain=function(s){return arguments.length?(t=Array.from(s),r=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(s){return arguments.length?(e=Array.from(s),r=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(s){var o=e.indexOf(s);return[t[o-1],t[o]]},i.unknown=function(s){return arguments.length?(n=s,i):n},i.copy=function(){return _z().domain(t).range(e).unknown(n)},Jo.apply(i,arguments)}const IE=new Date,kE=new Date;function oi(t,e,n,r){function i(s){return t(s=arguments.length===0?new Date:new Date(+s)),s}return i.floor=s=>(t(s=new Date(+s)),s),i.ceil=s=>(t(s=new Date(s-1)),e(s,1),t(s),s),i.round=s=>{const o=i(s),a=i.ceil(s);return s-o<a-s?o:a},i.offset=(s,o)=>(e(s=new Date(+s),o==null?1:Math.floor(o)),s),i.range=(s,o,a)=>{const l=[];if(s=i.ceil(s),a=a==null?1:Math.floor(a),!(s<o)||!(a>0))return l;let c;do l.push(c=new Date(+s)),e(s,a),t(s);while(c<s&&s<o);return l},i.filter=s=>oi(o=>{if(o>=o)for(;t(o),!s(o);)o.setTime(o-1)},(o,a)=>{if(o>=o)if(a<0)for(;++a<=0;)for(;e(o,-1),!s(o););else for(;--a>=0;)for(;e(o,1),!s(o););}),n&&(i.count=(s,o)=>(IE.setTime(+s),kE.setTime(+o),t(IE),t(kE),Math.floor(n(IE,kE))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?o=>r(o)%s===0:o=>i.count(0,o)%s===0):i)),i}const Lw=oi(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Lw.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?oi(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Lw);Lw.range;const Uc=1e3,Wo=Uc*60,jc=Wo*60,qc=jc*24,S2=qc*7,JO=qc*30,OE=qc*365,ih=oi(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Uc)},(t,e)=>(e-t)/Uc,t=>t.getUTCSeconds());ih.range;const M2=oi(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Uc)},(t,e)=>{t.setTime(+t+e*Wo)},(t,e)=>(e-t)/Wo,t=>t.getMinutes());M2.range;const E2=oi(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Wo)},(t,e)=>(e-t)/Wo,t=>t.getUTCMinutes());E2.range;const A2=oi(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Uc-t.getMinutes()*Wo)},(t,e)=>{t.setTime(+t+e*jc)},(t,e)=>(e-t)/jc,t=>t.getHours());A2.range;const T2=oi(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*jc)},(t,e)=>(e-t)/jc,t=>t.getUTCHours());T2.range;const tx=oi(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Wo)/qc,t=>t.getDate()-1);tx.range;const CS=oi(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/qc,t=>t.getUTCDate()-1);CS.range;const wz=oi(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 Yh(t){return oi(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*Wo)/S2)}const RS=Yh(0),Dw=Yh(1),$ee=Yh(2),Xee=Yh(3),Ag=Yh(4),qee=Yh(5),Kee=Yh(6);RS.range;Dw.range;$ee.range;Xee.range;Ag.range;qee.range;Kee.range;function Zh(t){return oi(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/S2)}const NS=Zh(0),Uw=Zh(1),Yee=Zh(2),Zee=Zh(3),Tg=Zh(4),Qee=Zh(5),Jee=Zh(6);NS.range;Uw.range;Yee.range;Zee.range;Tg.range;Qee.range;Jee.range;const P2=oi(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());P2.range;const C2=oi(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());C2.range;const Kc=oi(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Kc.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:oi(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});Kc.range;const Yc=oi(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Yc.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:oi(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});Yc.range;function Sz(t,e,n,r,i,s){const o=[[ih,1,Uc],[ih,5,5*Uc],[ih,15,15*Uc],[ih,30,30*Uc],[s,1,Wo],[s,5,5*Wo],[s,15,15*Wo],[s,30,30*Wo],[i,1,jc],[i,3,3*jc],[i,6,6*jc],[i,12,12*jc],[r,1,qc],[r,2,2*qc],[n,1,S2],[e,1,JO],[e,3,3*JO],[t,1,OE]];function a(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=u2(([,,w])=>w).right(o,p);if(y===o.length)return t.every(SP(c/OE,d/OE,f));if(y===0)return Lw.every(Math.max(SP(c,d,f),1));const[x,S]=o[p/o[y-1][2]<o[y][2]/p?y-1:y];return x.every(S)}return[a,l]}const[ete,tte]=Sz(Yc,C2,NS,wz,T2,E2),[nte,rte]=Sz(Kc,P2,RS,tx,A2,M2);function LE(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 DE(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 c0(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function ite(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,s=t.days,o=t.shortDays,a=t.months,l=t.shortMonths,c=u0(i),d=d0(i),f=u0(s),p=d0(s),y=u0(o),x=d0(o),S=u0(a),w=d0(a),_=u0(l),E=d0(l),T={a:fe,A:B,b:J,B:Y,c:null,d:sL,e:sL,f:Tte,g:Ute,G:Fte,H:Mte,I:Ete,j:Ate,L:Mz,m:Pte,M:Cte,p:V,q,Q:lL,s:cL,S:Rte,u:Nte,U:Ite,V:kte,w:Ote,W:Lte,x:null,X:null,y:Dte,Y:jte,Z:zte,"%":aL},P={a:pe,A:ae,b:ce,B:Se,c:null,d:oL,e:oL,f:Gte,g:ene,G:nne,H:Bte,I:Hte,j:Vte,L:Az,m:Wte,M:$te,p:Ee,q:$e,Q:lL,s:cL,S:Xte,u:qte,U:Kte,V:Yte,w:Zte,W:Qte,x:null,X:null,y:Jte,Y:tne,Z:rne,"%":aL},O={a:k,A:j,b:H,B:ee,c:te,d:rL,e:rL,f:bte,g:nL,G:tL,H:iL,I:iL,j:gte,L:xte,m:mte,M:vte,p:G,q:pte,Q:wte,s:Ste,S:yte,u:cte,U:ute,V:dte,w:lte,W:fte,x:he,X:se,y:nL,Y:tL,Z:hte,"%":_te};T.x=N(n,T),T.X=N(r,T),T.c=N(e,T),P.x=N(n,P),P.X=N(r,P),P.c=N(e,P);function N(Me,Ge){return function(We){var ue=[],Z=-1,Ve=0,Le=Me.length,re,Ce,qe;for(We instanceof Date||(We=new Date(+We));++Z<Le;)Me.charCodeAt(Z)===37&&(ue.push(Me.slice(Ve,Z)),(Ce=eL[re=Me.charAt(++Z)])!=null?re=Me.charAt(++Z):Ce=re==="e"?" ":"0",(qe=Ge[re])&&(re=qe(We,Ce)),ue.push(re),Ve=Z+1);return ue.push(Me.slice(Ve,Z)),ue.join("")}}function D(Me,Ge){return function(We){var ue=c0(1900,void 0,1),Z=z(ue,Me,We+="",0),Ve,Le;if(Z!=We.length)return null;if("Q"in ue)return new Date(ue.Q);if("s"in ue)return new Date(ue.s*1e3+("L"in ue?ue.L:0));if(Ge&&!("Z"in ue)&&(ue.Z=0),"p"in ue&&(ue.H=ue.H%12+ue.p*12),ue.m===void 0&&(ue.m="q"in ue?ue.q:0),"V"in ue){if(ue.V<1||ue.V>53)return null;"w"in ue||(ue.w=1),"Z"in ue?(Ve=DE(c0(ue.y,0,1)),Le=Ve.getUTCDay(),Ve=Le>4||Le===0?Uw.ceil(Ve):Uw(Ve),Ve=CS.offset(Ve,(ue.V-1)*7),ue.y=Ve.getUTCFullYear(),ue.m=Ve.getUTCMonth(),ue.d=Ve.getUTCDate()+(ue.w+6)%7):(Ve=LE(c0(ue.y,0,1)),Le=Ve.getDay(),Ve=Le>4||Le===0?Dw.ceil(Ve):Dw(Ve),Ve=tx.offset(Ve,(ue.V-1)*7),ue.y=Ve.getFullYear(),ue.m=Ve.getMonth(),ue.d=Ve.getDate()+(ue.w+6)%7)}else("W"in ue||"U"in ue)&&("w"in ue||(ue.w="u"in ue?ue.u%7:"W"in ue?1:0),Le="Z"in ue?DE(c0(ue.y,0,1)).getUTCDay():LE(c0(ue.y,0,1)).getDay(),ue.m=0,ue.d="W"in ue?(ue.w+6)%7+ue.W*7-(Le+5)%7:ue.w+ue.U*7-(Le+6)%7);return"Z"in ue?(ue.H+=ue.Z/100|0,ue.M+=ue.Z%100,DE(ue)):LE(ue)}}function z(Me,Ge,We,ue){for(var Z=0,Ve=Ge.length,Le=We.length,re,Ce;Z<Ve;){if(ue>=Le)return-1;if(re=Ge.charCodeAt(Z++),re===37){if(re=Ge.charAt(Z++),Ce=O[re in eL?Ge.charAt(Z++):re],!Ce||(ue=Ce(Me,We,ue))<0)return-1}else if(re!=We.charCodeAt(ue++))return-1}return ue}function G(Me,Ge,We){var ue=c.exec(Ge.slice(We));return ue?(Me.p=d.get(ue[0].toLowerCase()),We+ue[0].length):-1}function k(Me,Ge,We){var ue=y.exec(Ge.slice(We));return ue?(Me.w=x.get(ue[0].toLowerCase()),We+ue[0].length):-1}function j(Me,Ge,We){var ue=f.exec(Ge.slice(We));return ue?(Me.w=p.get(ue[0].toLowerCase()),We+ue[0].length):-1}function H(Me,Ge,We){var ue=_.exec(Ge.slice(We));return ue?(Me.m=E.get(ue[0].toLowerCase()),We+ue[0].length):-1}function ee(Me,Ge,We){var ue=S.exec(Ge.slice(We));return ue?(Me.m=w.get(ue[0].toLowerCase()),We+ue[0].length):-1}function te(Me,Ge,We){return z(Me,e,Ge,We)}function he(Me,Ge,We){return z(Me,n,Ge,We)}function se(Me,Ge,We){return z(Me,r,Ge,We)}function fe(Me){return o[Me.getDay()]}function B(Me){return s[Me.getDay()]}function J(Me){return l[Me.getMonth()]}function Y(Me){return a[Me.getMonth()]}function V(Me){return i[+(Me.getHours()>=12)]}function q(Me){return 1+~~(Me.getMonth()/3)}function pe(Me){return o[Me.getUTCDay()]}function ae(Me){return s[Me.getUTCDay()]}function ce(Me){return l[Me.getUTCMonth()]}function Se(Me){return a[Me.getUTCMonth()]}function Ee(Me){return i[+(Me.getUTCHours()>=12)]}function $e(Me){return 1+~~(Me.getUTCMonth()/3)}return{format:function(Me){var Ge=N(Me+="",T);return Ge.toString=function(){return Me},Ge},parse:function(Me){var Ge=D(Me+="",!1);return Ge.toString=function(){return Me},Ge},utcFormat:function(Me){var Ge=N(Me+="",P);return Ge.toString=function(){return Me},Ge},utcParse:function(Me){var Ge=D(Me+="",!0);return Ge.toString=function(){return Me},Ge}}}var eL={"-":"",_:" ",0:"0"},Si=/^\s*\d+/,ste=/^%/,ote=/[\\^$*+?|[\]().{}]/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 ate(t){return t.replace(ote,"\\$&")}function u0(t){return new RegExp("^(?:"+t.map(ate).join("|")+")","i")}function d0(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function lte(t,e,n){var r=Si.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function cte(t,e,n){var r=Si.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function ute(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function dte(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function fte(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function tL(t,e,n){var r=Si.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function nL(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 hte(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 pte(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 mte(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 rL(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function gte(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 iL(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function vte(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function yte(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function xte(t,e,n){var r=Si.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function bte(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 _te(t,e,n){var r=ste.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function wte(t,e,n){var r=Si.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Ste(t,e,n){var r=Si.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function sL(t,e){return Un(t.getDate(),e,2)}function Mte(t,e){return Un(t.getHours(),e,2)}function Ete(t,e){return Un(t.getHours()%12||12,e,2)}function Ate(t,e){return Un(1+tx.count(Kc(t),t),e,3)}function Mz(t,e){return Un(t.getMilliseconds(),e,3)}function Tte(t,e){return Mz(t,e)+"000"}function Pte(t,e){return Un(t.getMonth()+1,e,2)}function Cte(t,e){return Un(t.getMinutes(),e,2)}function Rte(t,e){return Un(t.getSeconds(),e,2)}function Nte(t){var e=t.getDay();return e===0?7:e}function Ite(t,e){return Un(RS.count(Kc(t)-1,t),e,2)}function Ez(t){var e=t.getDay();return e>=4||e===0?Ag(t):Ag.ceil(t)}function kte(t,e){return t=Ez(t),Un(Ag.count(Kc(t),t)+(Kc(t).getDay()===4),e,2)}function Ote(t){return t.getDay()}function Lte(t,e){return Un(Dw.count(Kc(t)-1,t),e,2)}function Dte(t,e){return Un(t.getFullYear()%100,e,2)}function Ute(t,e){return t=Ez(t),Un(t.getFullYear()%100,e,2)}function jte(t,e){return Un(t.getFullYear()%1e4,e,4)}function Fte(t,e){var n=t.getDay();return t=n>=4||n===0?Ag(t):Ag.ceil(t),Un(t.getFullYear()%1e4,e,4)}function zte(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Un(e/60|0,"0",2)+Un(e%60,"0",2)}function oL(t,e){return Un(t.getUTCDate(),e,2)}function Bte(t,e){return Un(t.getUTCHours(),e,2)}function Hte(t,e){return Un(t.getUTCHours()%12||12,e,2)}function Vte(t,e){return Un(1+CS.count(Yc(t),t),e,3)}function Az(t,e){return Un(t.getUTCMilliseconds(),e,3)}function Gte(t,e){return Az(t,e)+"000"}function Wte(t,e){return Un(t.getUTCMonth()+1,e,2)}function $te(t,e){return Un(t.getUTCMinutes(),e,2)}function Xte(t,e){return Un(t.getUTCSeconds(),e,2)}function qte(t){var e=t.getUTCDay();return e===0?7:e}function Kte(t,e){return Un(NS.count(Yc(t)-1,t),e,2)}function Tz(t){var e=t.getUTCDay();return e>=4||e===0?Tg(t):Tg.ceil(t)}function Yte(t,e){return t=Tz(t),Un(Tg.count(Yc(t),t)+(Yc(t).getUTCDay()===4),e,2)}function Zte(t){return t.getUTCDay()}function Qte(t,e){return Un(Uw.count(Yc(t)-1,t),e,2)}function Jte(t,e){return Un(t.getUTCFullYear()%100,e,2)}function ene(t,e){return t=Tz(t),Un(t.getUTCFullYear()%100,e,2)}function tne(t,e){return Un(t.getUTCFullYear()%1e4,e,4)}function nne(t,e){var n=t.getUTCDay();return t=n>=4||n===0?Tg(t):Tg.ceil(t),Un(t.getUTCFullYear()%1e4,e,4)}function rne(){return"+0000"}function aL(){return"%"}function lL(t){return+t}function cL(t){return Math.floor(+t/1e3)}var lm,Pz,Cz;ine({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function ine(t){return lm=ite(t),Pz=lm.format,lm.parse,Cz=lm.utcFormat,lm.utcParse,lm}function sne(t){return new Date(t)}function one(t){return t instanceof Date?+t:+new Date(+t)}function R2(t,e,n,r,i,s,o,a,l,c){var d=g2(),f=d.invert,p=d.domain,y=c(".%L"),x=c(":%S"),S=c("%I:%M"),w=c("%I %p"),_=c("%a %d"),E=c("%b %d"),T=c("%B"),P=c("%Y");function O(N){return(l(N)<N?y:a(N)<N?x:o(N)<N?S:s(N)<N?w:r(N)<N?i(N)<N?_:E:n(N)<N?T:P)(N)}return d.invert=function(N){return new Date(f(N))},d.domain=function(N){return arguments.length?p(Array.from(N,one)):p().map(sne)},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?O: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(mz(D,N)):d},d.copy=function(){return ex(d,R2(t,e,n,r,i,s,o,a,l,c))},d}function ane(){return Jo.apply(R2(nte,rte,Kc,P2,RS,tx,A2,M2,ih,Pz).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function lne(){return Jo.apply(R2(ete,tte,Yc,C2,NS,CS,T2,E2,ih,Cz).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function IS(){var t=0,e=1,n,r,i,s,o=Es,a=!1,l;function c(f){return f==null||isNaN(f=+f)?l:o(i===0?.5:(f=(s(f)-n)*i,a?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?(a=!!f,c):a},c.interpolator=function(f){return arguments.length?(o=f,c):o};function d(f){return function(p){var y,x;return arguments.length?([y,x]=p,o=f(y,x),c):[o(0),o(1)]}}return c.range=d(Xg),c.rangeRound=d(m2),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 Id(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function Rz(){var t=Nd(IS()(Es));return t.copy=function(){return Id(t,Rz())},tu.apply(t,arguments)}function Nz(){var t=x2(IS()).domain([1,10]);return t.copy=function(){return Id(t,Nz()).base(t.base())},tu.apply(t,arguments)}function Iz(){var t=b2(IS());return t.copy=function(){return Id(t,Iz()).constant(t.constant())},tu.apply(t,arguments)}function N2(){var t=_2(IS());return t.copy=function(){return Id(t,N2()).exponent(t.exponent())},tu.apply(t,arguments)}function cne(){return N2.apply(null,arguments).exponent(.5)}function kz(){var t=[],e=Es;function n(r){if(r!=null&&!isNaN(r=+r))return e((Qy(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(bd),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)=>qJ(t,s/r))},n.copy=function(){return kz(e).domain(t)},tu.apply(n,arguments)}function kS(){var t=0,e=.5,n=1,r=1,i,s,o,a,l,c=Es,d,f=!1,p;function y(S){return isNaN(S=+S)?p:(S=.5+((S=+d(S))-s)*(r*S<r*s?a: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),o=d(n=+n),a=i===s?0:.5/(s-i),l=s===o?0:.5/(o-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 _,E,T;return arguments.length?([_,E,T]=w,c=_ee(S,[_,E,T]),y):[c(0),c(.5),c(1)]}}return y.range=x(Xg),y.rangeRound=x(m2),y.unknown=function(S){return arguments.length?(p=S,y):p},function(S){return d=S,i=S(t),s=S(e),o=S(n),a=i===s?0:.5/(s-i),l=s===o?0:.5/(o-s),r=s<i?-1:1,y}}function Oz(){var t=Nd(kS()(Es));return t.copy=function(){return Id(t,Oz())},tu.apply(t,arguments)}function Lz(){var t=x2(kS()).domain([.1,1,10]);return t.copy=function(){return Id(t,Lz()).base(t.base())},tu.apply(t,arguments)}function Dz(){var t=b2(kS());return t.copy=function(){return Id(t,Dz()).constant(t.constant())},tu.apply(t,arguments)}function I2(){var t=_2(kS());return t.copy=function(){return Id(t,I2()).exponent(t.exponent())},tu.apply(t,arguments)}function une(){return I2.apply(null,arguments).exponent(.5)}const Uz=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:f2,scaleDiverging:Oz,scaleDivergingLog:Lz,scaleDivergingPow:I2,scaleDivergingSqrt:une,scaleDivergingSymlog:Dz,scaleIdentity:pz,scaleImplicit:MP,scaleLinear:hz,scaleLog:gz,scaleOrdinal:d2,scalePoint:ZJ,scalePow:w2,scaleQuantile:xz,scaleQuantize:bz,scaleRadial:yz,scaleSequential:Rz,scaleSequentialLog:Nz,scaleSequentialPow:N2,scaleSequentialQuantile:kz,scaleSequentialSqrt:cne,scaleSequentialSymlog:Iz,scaleSqrt:Gee,scaleSymlog:vz,scaleThreshold:_z,scaleTime:ane,scaleUtc:lne,tickFormat:fz},Symbol.toStringTag,{value:"Module"}));function dne(t){var e=Uz;if(t in e&&typeof e[t]=="function")return e[t]();var n="scale".concat(LC(t));if(n in e&&typeof e[n]=="function")return e[n]()}function uL(t,e,n){if(typeof t=="function")return t.copy().domain(e).range(n);if(t!=null){var r=dne(t);if(r!=null)return r.domain(e).range(n),r}}function k2(t,e,n,r){if(!(n==null||r==null))return typeof t.scale=="function"?uL(t.scale,n,r):uL(e,n,r)}function fne(t){return"scale".concat(LC(t))}function hne(t){return fne(t)in Uz}var jz=(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 hne(r)?r:"point"}};function pne(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 Fz(t,e){if(t){var n=e??t.domain(),r=n.map(s=>{var o;return(o=t(s))!==null&&o!==void 0?o:0}),i=t.range();if(!(n.length===0||i.length<2))return s=>{var o,a,l=pne(r,s);if(l<=0)return n[0];if(l>=n.length)return n[n.length-1];var c=(o=r[l-1])!==null&&o!==void 0?o:0,d=(a=r[l])!==null&&a!==void 0?a:0;return Math.abs(s-c)<=Math.abs(s-d)?n[l-1]:n[l]}}}function mne(t){if(t!=null)return"invert"in t&&typeof t.invert=="function"?t.invert.bind(t):Fz(t,void 0)}function dL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function jw(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?dL(Object(n),!0).forEach(function(r){gne(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):dL(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function gne(t,e,n){return(e=vne(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function vne(t){var e=yne(t,"string");return typeof e=="symbol"?e:e+""}function yne(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 zz(t,e){return wne(t)||_ne(t,e)||bne(t,e)||xne()}function xne(){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 bne(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 _ne(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function wne(t){if(Array.isArray(t))return t}var PP=[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"},Bz=(t,e)=>t.cartesianAxis.xAxis[e],nu=(t,e)=>{var n=Bz(t,e);return n??ti},ni={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:PP,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,niceTicks:"auto",width:Xy},Hz=(t,e)=>t.cartesianAxis.yAxis[e],ru=(t,e)=>{var n=Hz(t,e);return n??ni},Sne={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},O2=(t,e)=>{var n=t.cartesianAxis.zAxis[e];return n??Sne},Cs=(t,e,n)=>{switch(e){case"xAxis":return nu(t,n);case"yAxis":return ru(t,n);case"zAxis":return O2(t,n);case"angleAxis":return i2(t,n);case"radiusAxis":return s2(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},Mne=(t,e,n)=>{switch(e){case"xAxis":return nu(t,n);case"yAxis":return ru(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},nx=(t,e,n)=>{switch(e){case"xAxis":return nu(t,n);case"yAxis":return ru(t,n);case"angleAxis":return i2(t,n);case"radiusAxis":return s2(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},Vz=t=>t.graphicalItems.cartesianItems.some(e=>e.type==="bar")||t.graphicalItems.polarItems.some(e=>e.type==="radialBar");function Gz(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 Wz=t=>t.graphicalItems.cartesianItems,Ene=ke([_i,ES],Gz),$z=(t,e,n)=>t.filter(n).filter(r=>(e==null?void 0:e.includeHidden)===!0?!0:!r.hide),qg=ke([Wz,Cs,Ene],$z,{memoizeOptions:{resultEqualityCheck:TS}}),Xz=ke([qg],t=>t.filter(e=>e.type==="area"||e.type==="bar").filter(l2)),qz=t=>t.filter(e=>!("stackId"in e)||e.stackId===void 0),Ane=ke([qg],qz),Kz=t=>t.map(e=>e.data).filter(Boolean).flat(1),Tne=ke([qg],t=>t.some(e=>!e.data)),Yz=ke([qg],Kz,{memoizeOptions:{resultEqualityCheck:TS}}),Zz=(t,e)=>{var n=e.chartData,r=n===void 0?[]:n,i=e.dataStartIndex,s=e.dataEndIndex;return t.length>0?t:r.slice(i,s+1)},L2=ke([Yz,bS],Zz),Pne=(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})),Qz=(t,e,n,r,i,s)=>{var o=r.chartData,a=o===void 0?[]:o,l=r.dataStartIndex,c=r.dataEndIndex,d=Pne(t,e,n);if(i&&(e==null?void 0:e.dataKey)!=null&&s.length>0){var f=a.slice(l,c+1),p=f.map(y=>({value:yi(y,e.dataKey)})).filter(y=>y.value!=null);return[...p,...d]}return d},rx=ke([L2,Cs,qg,bS,Tne,Yz],Qz);function eg(t){if(Nl(t)||t instanceof Date){var e=Number(t);if(wn(e))return e}}function hL(t){if(Array.isArray(t)){var e=[eg(t[0]),eg(t[1])];return El(e)?e:void 0}var n=eg(t);if(n!=null)return[n,n]}function Ol(t){return t.map(eg).filter(Ys)}function Cne(t,e){var n=eg(t),r=eg(e);return n==null&&r==null?0:n==null?-1:r==null?1:n-r}var Rne=ke([rx],t=>t==null?void 0:t.map(e=>e.value).sort(Cne));function Jz(t,e){switch(t){case"xAxis":return e.direction==="x";case"yAxis":return e.direction==="y";default:return!1}}function Nne(t,e,n){if(!n)return[];if(!n.length)return[];var r;if(typeof e=="number"&&!Rl(e))r=e;else if(Array.isArray(e)){var i=Ol(e);i.length>0&&(r=Math.max(...i))}return r==null?[]:Ol(n.flatMap(s=>{var o=yi(t,s.dataKey),a,l;if(Array.isArray(o)){var c=zz(o,2);a=c[0],l=c[1]}else a=l=o;if(!(!wn(a)||!wn(l)))return[r-a,r+l]}))}var ai=t=>{var e=wi(t),n=$g(t);return nx(t,e,n)},Pg=ke([ai],t=>t==null?void 0:t.dataKey),Ine=ke([Xz,bS,ai],rz),eB=(t,e,n,r)=>{var i={},s=e.reduce((o,a)=>{if(a.stackId==null)return o;var l=o[a.stackId];return l==null&&(l=[]),l.push(a),o[a.stackId]=l,o},i);return Object.fromEntries(Object.entries(s).map(o=>{var a=zz(o,2),l=a[0],c=a[1],d=r?[...c].reverse():c,f=d.map(a2);return[l,{stackedData:YK(t,f,n),graphicalItems:d}]}))},tB=ke([Ine,Xz,_S,Y4],eB),nB=(t,e,n,r)=>{var i=e.dataStartIndex,s=e.dataEndIndex;if(r==null&&n!=="zAxis")return eY(t,i,s)},kne=ke([Cs],t=>t.allowDataOverflow),D2=t=>{var e;if(t==null||!("domain"in t))return PP;if(t.domain!=null)return t.domain;if("ticks"in t&&t.ticks!=null){if(t.type==="number"){var n=Ol(t.ticks);return[Math.min(...n),Math.max(...n)]}if(t.type==="category")return t.ticks.map(String)}return(e=t==null?void 0:t.domain)!==null&&e!==void 0?e:PP},rB=ke([Cs],D2),iB=ke([rB,kne],F4),One=ke([tB,$a,_i,iB],nB,{memoizeOptions:{resultEqualityCheck:AS}}),U2=t=>t.errorBars,Lne=(t,e,n)=>t.flatMap(r=>e[r.id]).filter(Boolean).filter(r=>Jz(n,r)),Fw=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(),o=Math.min(...s),a=Math.max(...s);return[o,a]}},sB=function(e,n,r,i,s){var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:[],a,l;if(r.length>0&&r.forEach(c=>{var d,f=c.data!=null?[...c.data]:o,p=(d=i[c.id])===null||d===void 0?void 0:d.filter(y=>Jz(s,y));f.forEach(y=>{var x,S=yi(y,(x=n.dataKey)!==null&&x!==void 0?x:c.dataKey),w=Nne(y,S,p);if(w.length>=2){var _=Math.min(...w),E=Math.max(...w);(a==null||_<a)&&(a=_),(l==null||E>l)&&(l=E)}var T=hL(S);T!=null&&(a=a==null?T[0]:Math.min(a,T[0]),l=l==null?T[1]:Math.max(l,T[1]))})}),(n==null?void 0:n.dataKey)!=null&&r.length===0&&e.forEach(c=>{var d=hL(yi(c,n.dataKey));d!=null&&(a=a==null?d[0]:Math.min(a,d[0]),l=l==null?d[1]:Math.max(l,d[1]))}),wn(a)&&wn(l))return[a,l]},Dne=ke([L2,Cs,Ane,U2,_i,fJ],sB,{memoizeOptions:{resultEqualityCheck:AS}});function Une(t){var e=t.value;if(Nl(e)||e instanceof Date)return e}var jne=(t,e,n)=>{var r=t.map(Une).filter(i=>i!=null);return n&&(e.dataKey==null||e.allowDuplicatedCategory&&g5(r))?j4(0,t.length):e.allowDuplicatedCategory?r:Array.from(new Set(r))},oB=t=>t.referenceElements.dots,Kg=(t,e,n)=>t.filter(r=>r.ifOverflow==="extendDomain").filter(r=>e==="xAxis"?r.xAxisId===n:r.yAxisId===n),Fne=ke([oB,_i,ES],Kg),aB=t=>t.referenceElements.areas,zne=ke([aB,_i,ES],Kg),lB=t=>t.referenceElements.lines,Bne=ke([lB,_i,ES],Kg),cB=(t,e)=>{if(t!=null){var n=Ol(t.map(r=>e==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},Hne=ke(Fne,_i,cB),uB=(t,e)=>{if(t!=null){var n=Ol(t.flatMap(r=>[e==="xAxis"?r.x1:r.y1,e==="xAxis"?r.x2:r.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},Vne=ke([zne,_i],uB);function Gne(t){var e;if(t.x!=null)return Ol([t.x]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(r=>r.x);return n==null||n.length===0?[]:Ol(n)}function Wne(t){var e;if(t.y!=null)return Ol([t.y]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(r=>r.y);return n==null||n.length===0?[]:Ol(n)}var dB=(t,e)=>{if(t!=null){var n=t.flatMap(r=>e==="xAxis"?Gne(r):Wne(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},$ne=ke([Bne,_i],dB),Xne=ke(Hne,$ne,Vne,(t,e,n)=>Fw(t,n,e)),fB=(t,e,n,r,i,s,o,a)=>{if(n!=null)return n;var l=o==="vertical"&&a==="xAxis"||o==="horizontal"&&a==="yAxis",c=l?Fw(r,s,i):Fw(s,i);return yJ(e,c,t.allowDataOverflow)},qne=ke([Cs,rB,iB,One,Dne,Xne,hr,_i],fB,{memoizeOptions:{resultEqualityCheck:AS}}),Kne=[0,1],hB=(t,e,n,r,i,s,o)=>{if(!((t==null||n==null||n.length===0)&&o===void 0)){var a=t.dataKey,l=t.type,c=jl(e,s);if(c&&a==null){var d;return j4(0,(d=n==null?void 0:n.length)!==null&&d!==void 0?d:0)}return l==="category"?jne(r,t,c):i==="expand"&&!c?Kne:o}},j2=ke([Cs,hr,L2,rx,_S,_i,qne],hB),Yg=ke([Cs,Vz,t2],jz),pB=(t,e,n)=>{var r=e.niceTicks;if(r!=="none"){var i=D2(e),s=Array.isArray(i)&&(i[0]==="auto"||i[1]==="auto");if((r==="snap125"||r==="adaptive")&&e!=null&&e.tickCount&&El(t)){if(s)return wO(t,e.tickCount,e.allowDecimals,r);if(e.type==="number")return SO(t,e.tickCount,e.allowDecimals,r)}if(r==="auto"&&n==="linear"&&e!=null&&e.tickCount){if(s&&El(t))return wO(t,e.tickCount,e.allowDecimals,"adaptive");if(e.type==="number"&&El(t))return SO(t,e.tickCount,e.allowDecimals,"adaptive")}}},F2=ke([j2,nx,Yg],pB),mB=(t,e,n,r)=>{if(r!=="angleAxis"&&(t==null?void 0:t.type)==="number"&&El(e)&&Array.isArray(n)&&n.length>0){var i,s,o=e[0],a=(i=n[0])!==null&&i!==void 0?i:0,l=e[1],c=(s=n[n.length-1])!==null&&s!==void 0?s:0;return[Math.min(o,a),Math.max(l,c)]}return e},Yne=ke([Cs,j2,F2,_i],mB),Zne=ke(rx,Cs,(t,e)=>{if(!(!e||e.type!=="number")){var n=1/0,r=Array.from(Ol(t.map(f=>f.value))).sort((f,p)=>f-p),i=r[0],s=r[r.length-1];if(i==null||s==null)return 1/0;var o=s-i;if(o===0)return 1/0;for(var a=0;a<r.length-1;a++){var l=r[a],c=r[a+1];if(!(l==null||c==null)){var d=c-l;n=Math.min(n,d)}}return n/o}}),gB=ke(Zne,hr,TJ,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 o=Ad(n,t*s),a=t*s/2;return a-o-(a-o)/s*o}return 0}),Qne=(t,e,n)=>{var r=nu(t,e);return r==null||typeof r.padding!="string"?0:gB(t,"xAxis",e,n,r.padding)},Jne=(t,e,n)=>{var r=ru(t,e);return r==null||typeof r.padding!="string"?0:gB(t,"yAxis",e,n,r.padding)},ere=ke(nu,Qne,(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}}),tre=ke(ru,Jne,(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}}),vB=ke([Wi,ere,pS,hS,(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]}),yB=ke([Wi,hr,tre,pS,hS,(t,e,n)=>n],(t,e,n,r,i,s)=>{var o=i.padding;return s?[r.height-o.bottom,o.top]:e==="horizontal"?[t.top+t.height-n.bottom,t.top+n.top]:[t.top+n.top,t.top+t.height-n.bottom]}),ix=(t,e,n,r)=>{var i;switch(e){case"xAxis":return vB(t,n,r);case"yAxis":return yB(t,n,r);case"zAxis":return(i=O2(t,n))===null||i===void 0?void 0:i.range;case"angleAxis":return ez(t);case"radiusAxis":return tz(t,n);default:return}},xB=ke([Cs,ix],wS),nre=ke([Yg,Yne],DJ),z2=ke([Cs,Yg,nre,xB],k2),bB=(t,e,n,r)=>{if(!(n==null||n.dataKey==null)){var i=n.type,s=n.scale,o=jl(t,r);if(o&&(i==="number"||s!=="auto"))return e.map(a=>a.value)}},B2=ke([hr,rx,nx,_i],bB),OS=ke([z2],c2);ke([z2],mne);ke([z2,Rne],Fz);ke([qg,U2,_i],Lne);function _B(t,e){return t.id<e.id?-1:t.id>e.id?1:0}var LS=(t,e)=>e,DS=(t,e,n)=>n,rre=ke(dS,LS,DS,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(_B)),ire=ke(fS,LS,DS,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(_B)),wB=(t,e)=>({width:t.width,height:e.height}),sre=(t,e)=>{var n=typeof e.width=="number"?e.width:Xy;return{width:n,height:t.height}},ore=ke(Wi,nu,wB),are=(t,e,n)=>{switch(e){case"top":return t.top;case"bottom":return n-t.bottom;default:return 0}},lre=(t,e,n)=>{switch(e){case"left":return t.left;case"right":return n-t.right;default:return 0}},cre=ke(eu,Wi,rre,LS,DS,(t,e,n,r,i)=>{var s={},o;return n.forEach(a=>{var l=wB(e,a);o==null&&(o=are(e,r,t));var c=r==="top"&&!i||r==="bottom"&&i;s[a.id]=o-Number(c)*l.height,o+=(c?-1:1)*l.height}),s}),ure=ke(Jc,Wi,ire,LS,DS,(t,e,n,r,i)=>{var s={},o;return n.forEach(a=>{var l=sre(e,a);o==null&&(o=lre(e,r,t));var c=r==="left"&&!i||r==="right"&&i;s[a.id]=o-Number(c)*l.width,o+=(c?-1:1)*l.width}),s}),dre=(t,e)=>{var n=nu(t,e);if(n!=null)return cre(t,n.orientation,n.mirror)},fre=ke([Wi,nu,dre,(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}}}),hre=(t,e)=>{var n=ru(t,e);if(n!=null)return ure(t,n.orientation,n.mirror)},pre=ke([Wi,ru,hre,(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}}}),mre=ke(Wi,ru,(t,e)=>{var n=typeof e.width=="number"?e.width:Xy;return{width:n,height:t.height}}),SB=(t,e,n,r)=>{if(n!=null){var i=n.allowDuplicatedCategory,s=n.type,o=n.dataKey,a=jl(t,r),l=e.map(d=>d.value),c=l.filter(d=>d!=null);if(o&&a&&s==="category"&&i&&g5(c))return l}},H2=ke([hr,rx,Cs,_i],SB),pL=ke([hr,Mne,Yg,OS,H2,B2,ix,F2,_i],(t,e,n,r,i,s,o,a,l)=>{if(e!=null){var c=jl(t,l);return{angle:e.angle,interval:e.interval,minTickGap:e.minTickGap,orientation:e.orientation,tick:e.tick,tickCount:e.tickCount,tickFormatter:e.tickFormatter,ticks:e.ticks,type:e.type,unit:e.unit,axisType:l,categoricalDomain:s,duplicateDomain:i,isCategorical:c,niceTicks:a,range:o,realScaleType:n,scale:r}}}),gre=(t,e,n,r,i,s,o,a,l)=>{if(!(e==null||r==null)){var c=jl(t,l),d=e.type,f=e.ticks,p=e.tickCount,y=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,x=d==="category"&&r.bandwidth?r.bandwidth()/y:0;x=l==="angleAxis"&&s!=null&&s.length>=2?Vo(s[0]-s[1])*2*x:x;var S=f||i;return S?S.map((w,_)=>{var E=o?o.indexOf(w):w,T=r.map(E);return wn(T)?{index:_,coordinate:T+x,value:w,offset:x}:null}).filter(Ys):c&&a?a.map((w,_)=>{var E=r.map(w);return wn(E)?{coordinate:E+x,value:w,index:_,offset:x}:null}).filter(Ys):r.ticks?r.ticks(p).map((w,_)=>{var E=r.map(w);return wn(E)?{coordinate:E+x,value:w,index:_,offset:x}:null}).filter(Ys):r.domain().map((w,_)=>{var E=r.map(w);return wn(E)?{coordinate:E+x,value:o?o[w]:w,index:_,offset:x}:null}).filter(Ys)}},MB=ke([hr,nx,Yg,OS,F2,ix,H2,B2,_i],gre),vre=(t,e,n,r,i,s,o)=>{if(!(e==null||n==null||r==null||r[0]===r[1])){var a=jl(t,o),l=e.tickCount,c=0;return c=o==="angleAxis"&&(r==null?void 0:r.length)>=2?Vo(r[0]-r[1])*2*c:c,a&&s?s.map((d,f)=>{var p=n.map(d);return wn(p)?{coordinate:p+c,value:d,index:f,offset:c}:null}).filter(Ys):n.ticks?n.ticks(l).map((d,f)=>{var p=n.map(d);return wn(p)?{coordinate:p+c,value:d,index:f,offset:c}:null}).filter(Ys):n.domain().map((d,f)=>{var p=n.map(d);return wn(p)?{coordinate:p+c,value:i?i[d]:d,index:f,offset:c}:null}).filter(Ys)}},EB=ke([hr,nx,OS,ix,H2,B2,_i],vre),AB=ke(Cs,OS,(t,e)=>{if(!(t==null||e==null))return jw(jw({},t),{},{scale:e})}),yre=ke([Cs,Yg,j2,xB],k2),xre=ke([yre],c2);ke((t,e,n)=>O2(t,n),xre,(t,e)=>{if(!(t==null||e==null))return jw(jw({},t),{},{scale:e})});var bre=ke([hr,dS,fS],(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}}),_re=(t,e,n)=>{var r;return(r=t.renderedTicks[e])===null||r===void 0?void 0:r[n]};ke([_re],t=>{if(!(!t||t.length===0))return e=>{var n,r=1/0,i=t[0];for(var s of t){var o=Math.abs(s.coordinate-e);o<r&&(r=o,i=s)}return(n=i)===null||n===void 0?void 0:n.value}});var TB=t=>t.options.defaultTooltipEventType,PB=t=>t.options.validateTooltipEventTypes;function CB(t,e,n){if(t==null)return e;var r=t?"axis":"item";return n==null?e:n.includes(r)?r:e}function sx(t,e){var n=TB(t),r=PB(t);return CB(e,n,r)}function wre(t){return Ft(e=>sx(e,t))}var RB=(t,e)=>{var n,r=Number(e);if(!(Rl(r)||e==null))return r>=0?t==null||(n=t[r])===null||n===void 0?void 0:n.value:void 0},Sre=t=>t.tooltip.settings,ad={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},Mre={itemInteraction:{click:ad,hover:ad},axisInteraction:{click:ad,hover:ad},keyboardInteraction:ad,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}},NB=cs({name:"tooltip",initialState:Mre,reducers:{addTooltipEntrySettings:{reducer(t,e){t.tooltipItemPayloads.push(e.payload)},prepare:or()},replaceTooltipEntrySettings:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=Go(t).tooltipItemPayloads.indexOf(r);s>-1&&(t.tooltipItemPayloads[s]=i)},prepare:or()},removeTooltipEntrySettings:{reducer(t,e){var n=Go(t).tooltipItemPayloads.indexOf(e.payload);n>-1&&t.tooltipItemPayloads.splice(n,1)},prepare:or()},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}}}),ea=NB.actions,Ere=ea.addTooltipEntrySettings,Are=ea.replaceTooltipEntrySettings,Tre=ea.removeTooltipEntrySettings,Pre=ea.setTooltipSettingsState,Cre=ea.setActiveMouseOverItemIndex;ea.mouseLeaveItem;var IB=ea.mouseLeaveChart;ea.setActiveClickItemIndex;var kB=ea.setMouseOverAxisIndex,Rre=ea.setMouseClickAxisIndex,B0=ea.setSyncInteraction,zw=ea.setKeyboardInteraction,Nre=NB.reducer;function mL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ib(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){Ire(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 Ire(t,e,n){return(e=kre(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function kre(t){var e=Ore(t,"string");return typeof e=="symbol"?e:e+""}function Ore(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 Lre(t,e,n){return e==="axis"?n==="click"?t.axisInteraction.click:t.axisInteraction.hover:n==="click"?t.itemInteraction.click:t.itemInteraction.hover}function Dre(t){return t.index!=null}var OB=(t,e,n,r)=>{if(e==null)return ad;var i=Lre(t,e,n);if(i==null)return ad;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(Dre(i)){if(s)return Ib(Ib({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return Ib(Ib({},ad),{},{coordinate:i.coordinate})};function Ure(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 jre(t,e){var n=Ure(t),r=e[0],i=e[1];if(n===void 0)return!1;var s=Math.min(r,i),o=Math.max(r,i);return n>=s&&n<=o}function Fre(t,e,n){if(n==null||e==null)return!0;var r=yi(t,e);return r==null||!El(n)?!0:jre(r,n)}var $0=(t,e,n,r)=>{var i=t==null?void 0:t.index;if(i==null)return null;var s=Number(i);if(!wn(s))return i;var o=0,a=1/0;e.length>0&&(a=e.length-1);var l=Math.max(o,Math.min(s,a)),c=e[l];return c==null||Fre(c,n,r)?String(l):null},LB=(t,e,n,r,i,s,o)=>{if(s!=null){var a=o[0],l=a==null?void 0:a.getPosition(s);if(l!=null)return l;var c=i==null?void 0:i[Number(s)];if(c)switch(n){case"horizontal":return{x:c.coordinate,y:(r.top+e)/2};default:return{x:(r.left+t)/2,y:c.coordinate}}}},DB=(t,e,n,r)=>{if(e==="axis")return t.tooltipItemPayloads;if(t.tooltipItemPayloads.length===0)return[];var i;if(n==="hover"?i=t.itemInteraction.hover.graphicalItemId:i=t.itemInteraction.click.graphicalItemId,t.syncInteraction.active&&i==null)return t.tooltipItemPayloads;if(i==null&&(r!=null||t.keyboardInteraction.active)){var s=t.tooltipItemPayloads[0];return s!=null?[s]:[]}return t.tooltipItemPayloads.filter(o=>{var a;return((a=o.settings)===null||a===void 0?void 0:a.graphicalItemId)===i})},UB=t=>t.options.tooltipPayloadSearcher,Zg=t=>t.tooltip;function gL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function vL(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?gL(Object(n),!0).forEach(function(r){zre(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):gL(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function zre(t,e,n){return(e=Bre(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Bre(t){var e=Hre(t,"string");return typeof e=="symbol"?e:e+""}function Hre(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 Vre(t){if(typeof t=="string"||typeof t=="number")return t}function Gre(t){if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")return t}function Wre(t){if(typeof t=="string"||typeof t=="number")return t;if(typeof t=="function")return e=>t(e)}function yL(t){if(typeof t=="string")return t}function $re(t){if(!(t==null||typeof t!="object")){var e="name"in t?Vre(t.name):void 0,n="unit"in t?Gre(t.unit):void 0,r="dataKey"in t?Wre(t.dataKey):void 0,i="payload"in t?t.payload:void 0,s="color"in t?yL(t.color):void 0,o="fill"in t?yL(t.fill):void 0;return{name:e,unit:n,dataKey:r,payload:i,color:s,fill:o}}}function Xre(t,e){return t??e}var jB=(t,e,n,r,i,s,o)=>{if(!(e==null||s==null)){var a=n.chartData,l=n.computedData,c=n.dataStartIndex,d=n.dataEndIndex,f=[];return t.reduce((p,y)=>{var x,S=y.dataDefinedOnItem,w=y.settings,_=Xre(S,a),E=Array.isArray(_)?c4(_,c,d):_,T=(x=w==null?void 0:w.dataKey)!==null&&x!==void 0?x:r,P=w==null?void 0:w.nameKey,O;if(r&&Array.isArray(E)&&!Array.isArray(E[0])&&o==="axis"?O=v5(E,r,i):O=s(E,e,l,P),Array.isArray(O))O.forEach(D=>{var z,G,k=$re(D),j=k==null?void 0:k.name,H=k==null?void 0:k.dataKey,ee=k==null?void 0:k.payload,te=vL(vL({},w),{},{name:j,unit:k==null?void 0:k.unit,color:(z=k==null?void 0:k.color)!==null&&z!==void 0?z:w==null?void 0:w.color,fill:(G=k==null?void 0:k.fill)!==null&&G!==void 0?G:w==null?void 0:w.fill});p.push(fk({tooltipEntrySettings:te,dataKey:H,payload:ee,value:yi(ee,H),name:j==null?void 0:String(j)}))});else{var N;p.push(fk({tooltipEntrySettings:w,dataKey:T,payload:O,value:yi(O,T),name:(N=yi(O,P))!==null&&N!==void 0?N:w==null?void 0:w.name}))}return p},f)}},V2=ke([ai,Vz,t2],jz),qre=ke([t=>t.graphicalItems.cartesianItems,t=>t.graphicalItems.polarItems],(t,e)=>[...t,...e]),Kre=ke([wi,$g],Gz),Qh=ke([qre,ai,Kre],$z,{memoizeOptions:{resultEqualityCheck:TS}}),Yre=ke([Qh],t=>t.filter(l2)),FB=ke([Qh],Kz,{memoizeOptions:{resultEqualityCheck:TS}}),Zre=ke([Qh],t=>t.some(e=>!e.data)),Uh=ke([FB,$a],Zz),Qre=ke([Yre,$a,ai],rz),G2=ke([Uh,ai,Qh,$a,Zre,FB],Qz),zB=ke([ai],D2),Jre=ke([ai],t=>t.allowDataOverflow),BB=ke([zB,Jre],F4),eie=ke([Qh],t=>t.filter(l2)),tie=ke([Qre,eie,_S,Y4],eB),nie=ke([tie,$a,wi,BB],nB),rie=ke([Qh],qz),iie=ke([Uh,ai,rie,U2,wi,hJ],sB,{memoizeOptions:{resultEqualityCheck:AS}}),sie=ke([oB,wi,$g],Kg),oie=ke([sie,wi],cB),aie=ke([aB,wi,$g],Kg),lie=ke([aie,wi],uB),cie=ke([lB,wi,$g],Kg),uie=ke([cie,wi],dB),die=ke([oie,uie,lie],Fw),fie=ke([ai,zB,BB,nie,iie,die,hr,wi],fB),Cg=ke([ai,hr,Uh,G2,_S,wi,fie],hB),hie=ke([Cg,ai,V2],pB),pie=ke([ai,Cg,hie,wi],mB),HB=t=>{var e=wi(t),n=$g(t),r=!1;return ix(t,e,n,r)},VB=ke([ai,HB],wS),mie=ke([ai,V2,pie,VB],k2),GB=ke([mie],c2),gie=ke([hr,G2,ai,wi],SB),vie=ke([hr,G2,ai,wi],bB),yie=(t,e,n,r,i,s,o,a)=>{if(e){var l=e.type,c=jl(t,a);if(r){var d=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,f=l==="category"&&r.bandwidth?r.bandwidth()/d:0;return f=a==="angleAxis"&&i!=null&&(i==null?void 0:i.length)>=2?Vo(i[0]-i[1])*2*f:f,c&&o?o.map((p,y)=>{var x=r.map(p);return wn(x)?{coordinate:x+f,value:p,index:y,offset:f}:null}).filter(Ys):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(Ys)}}},iu=ke([hr,ai,V2,GB,HB,gie,vie,wi],yie),W2=ke([TB,PB,Sre],(t,e,n)=>CB(n.shared,t,e)),WB=t=>t.tooltip.settings.trigger,$2=t=>t.tooltip.settings.defaultIndex,ox=ke([Zg,W2,WB,$2],OB),wy=ke([ox,Uh,Pg,Cg],$0),$B=ke([iu,wy],RB),xie=ke([ox],t=>{if(t)return t.dataKey}),bie=ke([ox],t=>{if(t)return t.graphicalItemId}),XB=ke([Zg,W2,WB,$2],DB),_ie=ke([Jc,eu,hr,Wi,iu,$2,XB],LB),wie=ke([ox,_ie],(t,e)=>t!=null&&t.coordinate?t.coordinate:e),Sie=ke([ox],t=>{var e;return(e=t==null?void 0:t.active)!==null&&e!==void 0?e:!1}),Mie=ke([XB,wy,$a,Pg,$B,UB,W2],jB),Eie=ke([Mie],t=>{if(t!=null){var e=t.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(e))}});function xL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function bL(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?xL(Object(n),!0).forEach(function(r){Aie(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):xL(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Aie(t,e,n){return(e=Tie(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Tie(t){var e=Pie(t,"string");return typeof e=="symbol"?e:e+""}function Pie(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 Cie=()=>Ft(ai),Rie=()=>{var t=Cie(),e=Ft(iu),n=Ft(GB);return gw(!t||!n?void 0:bL(bL({},t),{},{scale:n}),e)};function _L(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function cm(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?_L(Object(n),!0).forEach(function(r){Nie(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):_L(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Nie(t,e,n){return(e=Iie(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Iie(t){var e=kie(t,"string");return typeof e=="symbol"?e:e+""}function kie(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 Oie=(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}},Lie=(t,e,n,r)=>{var i=e.find(c=>c&&c.index===n);if(i){if(t==="centric"){var s=i.coordinate,o=r.radius;return cm(cm(cm({},r),Bi(r.cx,r.cy,o,s)),{},{angle:s,radius:o})}var a=i.coordinate,l=r.angle;return cm(cm(cm({},r),Bi(r.cx,r.cy,a,l)),{},{angle:l,radius:a})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function Die(t,e){var n=t.relativeX,r=t.relativeY;return n>=e.left&&n<=e.left+e.width&&r>=e.top&&r<=e.top+e.height}var qB=(t,e,n,r,i)=>{var s,o=(s=e==null?void 0:e.length)!==null&&s!==void 0?s:0;if(o<=1||t==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var a=0;a<o;a++){var l,c,d,f,p,y=a>0?(l=n[a-1])===null||l===void 0?void 0:l.coordinate:(c=n[o-1])===null||c===void 0?void 0:c.coordinate,x=(d=n[a])===null||d===void 0?void 0:d.coordinate,S=a>=o-1?(f=n[0])===null||f===void 0?void 0:f.coordinate:(p=n[a+1])===null||p===void 0?void 0:p.coordinate,w=void 0;if(!(y==null||x==null||S==null))if(Vo(x-y)!==Vo(S-x)){var _=[];if(Vo(S-x)===Vo(i[1]-i[0])){w=S;var E=x+i[1]-i[0];_[0]=Math.min(E,(E+y)/2),_[1]=Math.max(E,(E+y)/2)}else{w=y;var T=S+i[1]-i[0];_[0]=Math.min(x,(T+x)/2),_[1]=Math.max(x,(T+x)/2)}var P=[Math.min(x,(w+x)/2),Math.max(x,(w+x)/2)];if(t>P[0]&&t<=P[1]||t>=_[0]&&t<=_[1]){var O;return(O=n[a])===null||O===void 0?void 0:O.index}}else{var N=Math.min(y,S),D=Math.max(y,S);if(t>(N+x)/2&&t<=(D+x)/2){var z;return(z=n[a])===null||z===void 0?void 0:z.index}}}else if(e)for(var G=0;G<o;G++){var k=e[G];if(k!=null){var j=e[G+1],H=e[G-1];if(G===0&&j!=null&&t<=(k.coordinate+j.coordinate)/2||G===o-1&&H!=null&&t>(k.coordinate+H.coordinate)/2||G>0&&G<o-1&&H!=null&&j!=null&&t>(k.coordinate+H.coordinate)/2&&t<=(k.coordinate+j.coordinate)/2)return k.index}}return-1},KB=()=>Ft(t2),X2=(t,e)=>e,YB=(t,e,n)=>n,q2=(t,e,n,r)=>r,Uie=ke(iu,t=>eS(t,e=>e.coordinate)),K2=ke([Zg,X2,YB,q2],OB),Y2=ke([K2,Uh,Pg,Cg],$0),jie=(t,e,n)=>{if(e!=null){var r=Zg(t);return e==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},ZB=ke([Zg,X2,YB,q2],DB),Bw=ke([Jc,eu,hr,Wi,iu,q2,ZB],LB),Fie=ke([K2,Bw],(t,e)=>{var n;return(n=t.coordinate)!==null&&n!==void 0?n:e}),QB=ke([iu,Y2],RB),zie=ke([ZB,Y2,$a,Pg,QB,UB,X2],jB),Bie=ke([K2,Y2],(t,e)=>({isActive:t.active&&e!=null,activeIndex:e})),Hie=(t,e,n,r,i,s,o)=>{if(!(!t||!n||!r||!i)&&Die(t,o)){var a=tY(t,e),l=qB(a,s,i,n,r),c=Oie(e,i,l,t);return{activeIndex:String(l),activeCoordinate:c}}},Vie=(t,e,n,r,i,s,o)=>{if(!(!t||!r||!i||!s||!n)){var a=iJ(t,n);if(a){var l=nY(a,e),c=qB(l,o,s,r,i),d=Lie(e,s,c,a);return{activeIndex:String(c),activeCoordinate:d}}}},Gie=(t,e,n,r,i,s,o,a)=>{if(!(!t||!e||!r||!i||!s))return e==="horizontal"||e==="vertical"?Hie(t,e,r,i,s,o,a):Vie(t,e,n,r,i,s,o)},Wie=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}}),$ie=ke(t=>t.zIndex.zIndexMap,t=>{var e=Object.keys(t).map(r=>parseInt(r,10)).concat(Object.values(Ms)),n=Array.from(new Set(e));return n.sort((r,i)=>r-i)},{memoizeOptions:{resultEqualityCheck:LJ}});function wL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function SL(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?wL(Object(n),!0).forEach(function(r){Xie(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wL(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Xie(t,e,n){return(e=qie(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function qie(t){var e=Kie(t,"string");return typeof e=="symbol"?e:e+""}function Kie(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 Yie={},Zie={zIndexMap:Object.values(Ms).reduce((t,e)=>SL(SL({},t),{},{[e]:{element:void 0,panoramaElement:void 0,consumers:0}}),Yie)},Qie=new Set(Object.values(Ms));function Jie(t){return Qie.has(t)}var JB=cs({name:"zIndex",initialState:Zie,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:or()},unregisterZIndexPortal:{reducer:(t,e)=>{var n=e.payload.zIndex;t.zIndexMap[n]&&(t.zIndexMap[n].consumers-=1,t.zIndexMap[n].consumers<=0&&!Jie(n)&&delete t.zIndexMap[n])},prepare:or()},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:or()},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:or()}}}),US=JB.actions,ese=US.registerZIndexPortal,UE=US.unregisterZIndexPortal,tse=US.registerZIndexPortalElement,nse=US.unregisterZIndexPortalElement,rse=JB.reducer;function su(t){var e=t.zIndex,n=t.children,r=zY(),i=r&&e!==void 0&&e!==0,s=Js(),o=R.useRef(void 0),a=R.useRef(new Set),l=Wr(),c=Ft(f=>Wie(f,e,s));if(R.useLayoutEffect(()=>{if(!i){var f=a.current;f.forEach(y=>{l(UE({zIndex:y}))}),f.clear(),o.current=void 0;return}if(a.current.has(e)||(l(ese({zIndex:e})),a.current.add(e)),c){o.current=c;var p=a.current;p.forEach(y=>{y!==e&&(l(UE({zIndex:y})),p.delete(y))})}},[l,e,i,c]),R.useLayoutEffect(()=>{var f=a.current;return()=>{f.forEach(p=>{l(UE({zIndex:p}))}),f.clear()}},[l]),!i)return n;var d=c??o.current;return d?W1.createPortal(n,d):null}function CP(){return CP=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},CP.apply(null,arguments)}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 kb(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){ise(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 ise(t,e,n){return(e=sse(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function sse(t){var e=ose(t,"string");return typeof e=="symbol"?e:e+""}function ose(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 ase(t){var e=t.cursor,n=t.cursorComp,r=t.cursorProps;return R.isValidElement(e)?R.cloneElement(e,r):R.createElement(n,r)}function lse(t){var e,n=t.coordinate,r=t.payload,i=t.index,s=t.offset,o=t.tooltipAxisBandSize,a=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=fQ,w=Ms.cursorLine;else if(d==="BarChart")x=hQ(a,f,s,o),S=qQ,w=Ms.cursorRectangle;else if(a==="radial"&&y5(f)){var _=D4(f),E=_.cx,T=_.cy,P=_.radius,O=_.startAngle,N=_.endAngle;x={cx:E,cy:T,startAngle:O,endAngle:N,innerRadius:P,outerRadius:P},S=lJ,w=Ms.cursorLine}else x={points:cJ(a,f,s)},S=H_,w=Ms.cursorLine;var D=typeof l=="object"&&"className"in l?l.className:void 0,z=kb(kb(kb(kb({stroke:"#ccc",pointerEvents:"none"},s),x),Z1(l)),{},{payload:p,payloadIndex:y,className:tr("recharts-tooltip-cursor",D)});return R.createElement(su,{zIndex:(e=t.zIndex)!==null&&e!==void 0?e:w},R.createElement(ase,{cursor:l,cursorComp:S,cursorProps:z}))}function cse(t){var e=Rie(),n=y4(),r=Vg(),i=KB();return e==null||n==null||r==null||i==null?null:R.createElement(lse,CP({},t,{offset:n,layout:r,tooltipAxisBandSize:e,chartName:i}))}var eH=R.createContext(null),use=()=>R.useContext(eH),jE={exports:{}},EL;function dse(){return EL||(EL=1,(function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(l,c,d){this.fn=l,this.context=c,this.once=d||!1}function s(l,c,d,f,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 o(l,c){--l._eventsCount===0?l._events=new r:delete l._events[c]}function a(){this._events=new r,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],d,f;if(this._eventsCount===0)return c;for(f in d=this._events)e.call(d,f)&&c.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(d)):c},a.prototype.listeners=function(c){var d=n?n+c:c,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var p=0,y=f.length,x=new Array(y);p<y;p++)x[p]=f[p].fn;return x},a.prototype.listenerCount=function(c){var d=n?n+c:c,f=this._events[d];return f?f.fn?1:f.length:0},a.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],_=arguments.length,E,T;if(w.fn){switch(w.once&&this.removeListener(c,w.fn,void 0,!0),_){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,E=new Array(_-1);T<_;T++)E[T-1]=arguments[T];w.fn.apply(w.context,E)}else{var P=w.length,O;for(T=0;T<P;T++)switch(w[T].once&&this.removeListener(c,w[T].fn,void 0,!0),_){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(!E)for(O=1,E=new Array(_-1);O<_;O++)E[O-1]=arguments[O];w[T].fn.apply(w[T].context,E)}}return!0},a.prototype.on=function(c,d,f){return s(this,c,d,f,!1)},a.prototype.once=function(c,d,f){return s(this,c,d,f,!0)},a.prototype.removeListener=function(c,d,f,p){var y=n?n+c:c;if(!this._events[y])return this;if(!d)return o(this,y),this;var x=this._events[y];if(x.fn)x.fn===d&&(!p||x.once)&&(!f||x.context===f)&&o(this,y);else{for(var S=0,w=[],_=x.length;S<_;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:o(this,y)}return this},a.prototype.removeAllListeners=function(c){var d;return c?(d=n?n+c:c,this._events[d]&&o(this,d)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,t.exports=a})(jE)),jE.exports}var fse=dse();const hse=B1(fse);var Sy=new hse,RP="recharts.syncEvent.tooltip",AL="recharts.syncEvent.brush",pse=(t,e)=>{if(e&&Array.isArray(t)){var n=Number.parseInt(e,10);if(!Rl(n))return t[n]}},mse={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},tH=cs({name:"options",initialState:mse,reducers:{createEventEmitter:t=>{t.eventEmitter==null&&(t.eventEmitter=Symbol("rechartsEventEmitter"))}}}),gse=tH.reducer,vse=tH.actions.createEventEmitter;function yse(t){return t.tooltip.syncInteraction}var xse={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},nH=cs({name:"chartData",initialState:xse,reducers:{setChartData(t,e){if(t.chartData=e.payload,e.payload==null){t.dataStartIndex=0,t.dataEndIndex=0;return}e.payload.length>0&&t.dataEndIndex!==e.payload.length-1&&(t.dataEndIndex=e.payload.length-1)},setComputedData(t,e){t.computedData=e.payload},setDataStartEndIndexes(t,e){var n=e.payload,r=n.startIndex,i=n.endIndex;r!=null&&(t.dataStartIndex=r),i!=null&&(t.dataEndIndex=i)}}}),Z2=nH.actions,TL=Z2.setChartData,bse=Z2.setDataStartEndIndexes;Z2.setComputedData;var _se=nH.reducer,wse=["x","y"];function PL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function um(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?PL(Object(n),!0).forEach(function(r){Sse(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):PL(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Sse(t,e,n){return(e=Mse(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Mse(t){var e=Ese(t,"string");return typeof e=="symbol"?e:e+""}function Ese(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 Ase(t,e){if(t==null)return{};var n,r,i=Tse(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 Tse(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 Pse(){var t=Ft(n2),e=Ft(r2),n=Wr(),r=Ft(Z4),i=Ft(iu),s=Vg(),o=mS(),a=Ft(l=>l.rootProps.className);R.useEffect(()=>{if(t==null)return Hg;var l=(c,d,f)=>{if(e!==f&&t===c){if(d.payload.active===!1){n(B0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(r==="index"){var p;if(o&&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=Ase(y,wse),_=d.payload.sourceViewBox,E=_.x,T=_.y,P=_.width,O=_.height,N=um(um({},w),{},{x:o.x+(P?(x-E)/P:0)*o.width,y:o.y+(O?(S-T)/O:0)*o.height});n(um(um({},d),{},{payload:um(um({},d.payload),{},{coordinate:N})}))}else n(d);return}if(i!=null){var D;if(typeof r=="function"){var z={activeTooltipIndex:d.payload.index==null?void 0:Number(d.payload.index),isTooltipActive:d.payload.active,activeIndex:d.payload.index==null?void 0:Number(d.payload.index),activeLabel:d.payload.label,activeDataKey:d.payload.dataKey,activeCoordinate:d.payload.coordinate},G=r(i,z);D=i[G]}else r==="value"&&(D=i.find(fe=>String(fe.value)===d.payload.label));var k=d.payload.coordinate;if(k==null||o==null){n(B0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(D==null){n(B0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:void 0}));return}var j=k.x,H=k.y,ee=Math.min(j,o.x+o.width),te=Math.min(H,o.y+o.height),he={x:s==="horizontal"?D.coordinate:ee,y:s==="horizontal"?te:D.coordinate},se=B0({active:d.payload.active,coordinate:he,dataKey:d.payload.dataKey,index:String(D.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n(se)}}};return Sy.on(RP,l),()=>{Sy.off(RP,l)}},[a,n,e,t,r,i,s,o])}function Cse(){var t=Ft(n2),e=Ft(r2),n=Wr();R.useEffect(()=>{if(t==null)return Hg;var r=(i,s,o)=>{e!==o&&t===i&&n(bse(s))};return Sy.on(AL,r),()=>{Sy.off(AL,r)}},[n,e,t])}function Rse(){var t=Wr();R.useEffect(()=>{t(vse())},[t]),Pse(),Cse()}function Nse(t,e,n,r,i,s){var o=Ft(x=>jie(x,t,e)),a=Ft(bie),l=Ft(r2),c=Ft(n2),d=Ft(Z4),f=Ft(yse),p=(f==null?void 0:f.sourceViewBox)!=null,y=mS();R.useEffect(()=>{if(!p&&c!=null&&l!=null){var x=B0({active:s,coordinate:n,dataKey:o,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:y,graphicalItemId:a});Sy.emit(RP,c,x,l)}},[p,n,o,a,i,r,l,c,d,s,y])}function CL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function RL(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){Ise(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 Ise(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=Ose(t,"string");return typeof e=="symbol"?e:e+""}function Ose(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 Lse(t,e){return Fse(t)||jse(t,e)||Use(t,e)||Dse()}function Dse(){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 Use(t,e){if(t){if(typeof t=="string")return NL(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)?NL(t,e):void 0}}function NL(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 jse(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function Fse(t){if(Array.isArray(t))return t}function zse(t){return t.dataKey}function Bse(t,e){return R.isValidElement(t)?R.cloneElement(t,e):typeof t=="function"?R.createElement(t,e):R.createElement(NZ,e)}var IL=[],Hse={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 Vse(t){var e,n,r=Qo(t,Hse),i=r.active,s=r.allowEscapeViewBox,o=r.animationDuration,a=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,_=r.cursor,E=r.shared,T=r.trigger,P=r.defaultIndex,O=r.portal,N=r.axisId,D=Wr(),z=typeof P=="number"?String(P):P;R.useEffect(()=>{D(Pre({shared:E,trigger:T,axisId:N,active:i,defaultIndex:z}))},[D,E,T,N,i,z]);var G=mS(),k=R4(),j=wre(E),H=(e=Ft(We=>Bie(We,j,T,z)))!==null&&e!==void 0?e:{},ee=H.activeIndex,te=H.isActive,he=Ft(We=>zie(We,j,T,z)),se=Ft(We=>QB(We,j,T,z)),fe=Ft(We=>Fie(We,j,T,z)),B=he,J=use(),Y=(n=i??te)!==null&&n!==void 0?n:!1,V=Bq([B,Y]),q=Lse(V,2),pe=q[0],ae=q[1],ce=j==="axis"?se:void 0;Nse(j,T,fe,ce,ee,Y);var Se=O??J;if(Se==null||G==null||j==null)return null;var Ee=B??IL;Y||(Ee=IL),c&&Ee.length&&(Ee=uq(Ee.filter(We=>We.value!=null&&(We.hide!==!0||r.includeHidden)),p,zse));var $e=Ee.length>0,Me=RL(RL({},r),{},{payload:Ee,label:ce,active:Y,activeIndex:ee,coordinate:fe,accessibilityLayer:k}),Ge=R.createElement(QZ,{allowEscapeViewBox:s,animationDuration:o,animationEasing:a,isAnimationActive:d,active:Y,coordinate:fe,hasPayload:$e,offset:f,position:y,reverseDirection:x,useTranslate3d:S,viewBox:G,wrapperStyle:w,lastBoundingBox:pe,innerRef:ae,hasPortalFromProps:!!O},Bse(l,Me));return R.createElement(R.Fragment,null,W1.createPortal(Ge,Se),Y&&R.createElement(cse,{cursor:_,tooltipEventType:j,coordinate:fe,payload:Ee,index:ee}))}function Gse(t,e,n){return(e=Wse(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Wse(t){var e=$se(t,"string");return typeof e=="symbol"?e:e+""}function $se(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 Xse{constructor(e){Gse(this,"cache",new Map),this.maxSize=e}get(e){var n=this.cache.get(e);return n!==void 0&&(this.cache.delete(e),this.cache.set(e,n)),n}set(e,n){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;r!=null&&this.cache.delete(r)}this.cache.set(e,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function kL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function qse(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?kL(Object(n),!0).forEach(function(r){Kse(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):kL(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Kse(t,e,n){return(e=Yse(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Yse(t){var e=Zse(t,"string");return typeof e=="symbol"?e:e+""}function Zse(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Qse={cacheSize:2e3,enableCache:!0},rH=qse({},Qse),OL=new Xse(rH.cacheSize),Jse={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},LL="recharts_measurement_span";function eoe(t,e){var n=e.fontSize||"",r=e.fontFamily||"",i=e.fontWeight||"",s=e.fontStyle||"",o=e.letterSpacing||"",a=e.textTransform||"";return"".concat(t,"|").concat(n,"|").concat(r,"|").concat(i,"|").concat(s,"|").concat(o,"|").concat(a)}var DL=(t,e)=>{try{var n=document.getElementById(LL);n||(n=document.createElement("span"),n.setAttribute("id",LL),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,Jse,e),n.textContent="".concat(t);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},X0=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||Zy.isSsr)return{width:0,height:0};if(!rH.enableCache)return DL(e,n);var r=eoe(e,n),i=OL.get(r);if(i)return i;var s=DL(e,n);return OL.set(r,s),s},iH;function Hw(t,e){return ioe(t)||roe(t,e)||noe(t,e)||toe()}function toe(){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 noe(t,e){if(t){if(typeof t=="string")return UL(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)?UL(t,e):void 0}}function UL(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 roe(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],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)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function ioe(t){if(Array.isArray(t))return t}function soe(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=aoe(t,"string");return typeof e=="symbol"?e:e+""}function aoe(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 jL=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,FL=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,loe=/^(px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q)$/,coe=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,uoe={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},doe=["cm","mm","pt","pc","in","Q","px"];function foe(t){return doe.includes(t)}var Wm="NaN";function hoe(t,e){return t*uoe[e]}class ji{static parse(e){var n,r=(n=coe.exec(e))!==null&&n!==void 0?n:[],i=Hw(r,3),s=i[1],o=i[2];return s==null?ji.NaN:new ji(parseFloat(s),o??"")}constructor(e,n){this.num=e,this.unit=n,this.num=e,this.unit=n,Rl(e)&&(this.unit=""),n!==""&&!loe.test(n)&&(this.num=NaN,this.unit=""),foe(n)&&(this.num=hoe(e,n),this.unit="px")}add(e){return this.unit!==e.unit?new ji(NaN,""):new ji(this.num+e.num,this.unit)}subtract(e){return this.unit!==e.unit?new ji(NaN,""):new ji(this.num-e.num,this.unit)}multiply(e){return this.unit!==""&&e.unit!==""&&this.unit!==e.unit?new ji(NaN,""):new ji(this.num*e.num,this.unit||e.unit)}divide(e){return this.unit!==""&&e.unit!==""&&this.unit!==e.unit?new ji(NaN,""):new ji(this.num/e.num,this.unit||e.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return Rl(this.num)}}iH=ji;soe(ji,"NaN",new iH(NaN,""));function sH(t){if(t==null||t.includes(Wm))return Wm;for(var e=t;e.includes("*")||e.includes("/");){var n,r=(n=jL.exec(e))!==null&&n!==void 0?n:[],i=Hw(r,4),s=i[1],o=i[2],a=i[3],l=ji.parse(s??""),c=ji.parse(a??""),d=o==="*"?l.multiply(c):l.divide(c);if(d.isNaN())return Wm;e=e.replace(jL,d.toString())}for(;e.includes("+")||/.-\d+(?:\.\d+)?/.test(e);){var f,p=(f=FL.exec(e))!==null&&f!==void 0?f:[],y=Hw(p,4),x=y[1],S=y[2],w=y[3],_=ji.parse(x??""),E=ji.parse(w??""),T=S==="+"?_.add(E):_.subtract(E);if(T.isNaN())return Wm;e=e.replace(FL,T.toString())}return e}var zL=/\(([^()]*)\)/;function poe(t){for(var e=t,n;(n=zL.exec(e))!=null;){var r=n,i=Hw(r,2),s=i[1];e=e.replace(zL,sH(s))}return e}function moe(t){var e=t.replace(/\s+/g,"");return e=poe(e),e=sH(e),e}function goe(t){try{return moe(t)}catch{return Wm}}function FE(t){var e=goe(t.slice(5,-1));return e===Wm?"":e}var voe=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],yoe=["dx","dy","angle","className","breakAll"];function NP(){return NP=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},NP.apply(null,arguments)}function BL(t,e){if(t==null)return{};var n,r,i=xoe(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 xoe(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 HL(t,e){return Soe(t)||woe(t,e)||_oe(t,e)||boe()}function boe(){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 _oe(t,e){if(t){if(typeof t=="string")return VL(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)?VL(t,e):void 0}}function VL(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 woe(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],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)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function Soe(t){if(Array.isArray(t))return t}var oH=/[ \f\n\r\t\v\u2028\u2029]+/,aH=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(oH));var s=i.map(a=>({word:a,width:X0(a,r).width})),o=n?0:X0(" ",r).width;return{wordsWithComputedWidth:s,spaceWidth:o}}catch{return null}};function lH(t){return t==="start"||t==="middle"||t==="end"||t==="inherit"}function Moe(t){return Vi(t)||typeof t=="string"||typeof t=="number"||typeof t=="boolean"}var cH=(t,e,n,r)=>t.reduce((i,s)=>{var o=s.word,a=s.width,l=i[i.length-1];if(l&&a!=null&&(e==null||r||l.width+a+n<Number(e)))l.words.push(o),l.width+=a+n;else{var c={words:[o],width:a};i.push(c)}return i},[]),uH=t=>t.reduce((e,n)=>e.width>n.width?e:n),Eoe="…",GL=(t,e,n,r,i,s,o,a)=>{var l=t.slice(0,e),c=aH({breakAll:n,style:r,children:l+Eoe});if(!c)return[!1,[]];var d=cH(c.wordsWithComputedWidth,s,o,a),f=d.length>i||uH(d).width>Number(s);return[f,d]},Aoe=(t,e,n,r,i)=>{var s=t.maxLines,o=t.children,a=t.style,l=t.breakAll,c=kt(s),d=String(o),f=cH(e,r,n,i);if(!c||i)return f;var p=f.length>s||uH(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 _=Math.floor((y+x)/2),E=_-1,T=GL(d,E,l,a,s,r,n,i),P=HL(T,2),O=P[0],N=P[1],D=GL(d,_,l,a,s,r,n,i),z=HL(D,1),G=z[0];if(!O&&!G&&(y=_+1),O&&G&&(x=_-1),!O&&G){w=N;break}S++}return w||f},WL=t=>{var e=Vi(t)?[]:t.toString().split(oH);return[{words:e,width:void 0}]},Toe=t=>{var e=t.width,n=t.scaleToFit,r=t.children,i=t.style,s=t.breakAll,o=t.maxLines;if((e||n)&&!Zy.isSsr){var a,l,c=aH({breakAll:s,children:r,style:i});if(c){var d=c.wordsWithComputedWidth,f=c.spaceWidth;a=d,l=f}else return WL(r);return Aoe({breakAll:s,children:r,maxLines:o,style:i},a,l,e,!!n)}return WL(r)},dH="#808080",Poe={angle:0,breakAll:!1,capHeight:"0.71em",fill:dH,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},Q2=R.forwardRef((t,e)=>{var n=Qo(t,Poe),r=n.x,i=n.y,s=n.lineHeight,o=n.capHeight,a=n.fill,l=n.scaleToFit,c=n.textAnchor,d=n.verticalAnchor,f=BL(n,voe),p=R.useMemo(()=>Toe({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:l,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,l,f.style,f.width]),y=f.dx,x=f.dy,S=f.angle,w=f.className,_=f.breakAll,E=BL(f,yoe);if(!Nl(r)||!Nl(i)||p.length===0)return null;var T=Number(r)+(kt(y)?y:0),P=Number(i)+(kt(x)?x:0);if(!wn(T)||!wn(P))return null;var O;switch(d){case"start":O=FE("calc(".concat(o,")"));break;case"middle":O=FE("calc(".concat((p.length-1)/2," * -").concat(s," + (").concat(o," / 2))"));break;default:O=FE("calc(".concat(p.length-1," * -").concat(s,")"));break}var N=[],D=p[0];if(l&&D!=null){var z=D.width,G=f.width;N.push("scale(".concat(kt(G)&&kt(z)?G/z:1,")"))}return S&&N.push("rotate(".concat(S,", ").concat(T,", ").concat(P,")")),N.length&&(E.transform=N.join(" ")),R.createElement("text",NP({},qo(E),{ref:e,x:T,y:P,className:tr("recharts-text",w),textAnchor:c,fill:a.includes("url")?dH:a}),p.map((k,j)=>{var H=k.words.join(_?"":" ");return R.createElement("tspan",{x:T,dy:j===0?O:s,key:"".concat(H,"-").concat(j)},H)}))});Q2.displayName="Text";function $L(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function pl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?$L(Object(n),!0).forEach(function(r){Coe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$L(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Coe(t,e,n){return(e=Roe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Roe(t){var e=Noe(t,"string");return typeof e=="symbol"?e:e+""}function Noe(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,o=$C(e),a=o.x,l=o.y,c=o.height,d=o.upperWidth,f=o.lowerWidth,p=a,y=a+(d-f)/2,x=(p+y)/2,S=(d+f)/2,w=p+d/2,_=c>=0?1:-1,E=_*i,T=_>0?"end":"start",P=_>0?"start":"end",O=d>=0?1:-1,N=O*i,D=O>0?"end":"start",z=O>0?"start":"end",G=s;if(n==="top"){var k={x:p+d/2,y:l-E,horizontalAnchor:"middle",verticalAnchor:T};return G&&(k.height=Math.max(l-G.y,0),k.width=d),k}if(n==="bottom"){var j={x:y+f/2,y:l+c+E,horizontalAnchor:"middle",verticalAnchor:P};return G&&(j.height=Math.max(G.y+G.height-(l+c),0),j.width=f),j}if(n==="left"){var H={x:x-N,y:l+c/2,horizontalAnchor:D,verticalAnchor:"middle"};return G&&(H.width=Math.max(H.x-G.x,0),H.height=c),H}if(n==="right"){var ee={x:x+S+N,y:l+c/2,horizontalAnchor:z,verticalAnchor:"middle"};return G&&(ee.width=Math.max(G.x+G.width-ee.x,0),ee.height=c),ee}var te=G?{width:S,height:c}:{};return n==="insideLeft"?pl({x:x+N,y:l+c/2,horizontalAnchor:z,verticalAnchor:"middle"},te):n==="insideRight"?pl({x:x+S-N,y:l+c/2,horizontalAnchor:D,verticalAnchor:"middle"},te):n==="insideTop"?pl({x:p+d/2,y:l+E,horizontalAnchor:"middle",verticalAnchor:P},te):n==="insideBottom"?pl({x:y+f/2,y:l+c-E,horizontalAnchor:"middle",verticalAnchor:T},te):n==="insideTopLeft"?pl({x:p+N,y:l+E,horizontalAnchor:z,verticalAnchor:P},te):n==="insideTopRight"?pl({x:p+d-N,y:l+E,horizontalAnchor:D,verticalAnchor:P},te):n==="insideBottomLeft"?pl({x:y+N,y:l+c-E,horizontalAnchor:z,verticalAnchor:T},te):n==="insideBottomRight"?pl({x:y+f-N,y:l+c-E,horizontalAnchor:D,verticalAnchor:T},te):n&&typeof n=="object"&&(kt(n.x)||Ih(n.x))&&(kt(n.y)||Ih(n.y))?pl({x:a+Ad(n.x,S),y:l+Ad(n.y,c),horizontalAnchor:"end",verticalAnchor:"end"},te):pl({x:w,y:l+c/2,horizontalAnchor:"middle",verticalAnchor:"middle"},te)},koe=["labelRef"],Ooe=["content"];function XL(t,e){if(t==null)return{};var n,r,i=Loe(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 Loe(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 qL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function H0(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?qL(Object(n),!0).forEach(function(r){Doe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):qL(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Doe(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=joe(t,"string");return typeof e=="symbol"?e:e+""}function joe(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 kc(){return kc=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},kc.apply(null,arguments)}var fH=R.createContext(null),Foe=t=>{var e=t.x,n=t.y,r=t.upperWidth,i=t.lowerWidth,s=t.width,o=t.height,a=t.children,l=R.useMemo(()=>({x:e,y:n,upperWidth:r,lowerWidth:i,width:s,height:o}),[e,n,r,i,s,o]);return R.createElement(fH.Provider,{value:l},a)},hH=()=>{var t=R.useContext(fH),e=mS();return t||(e?$C(e):void 0)},zoe=R.createContext(null),Boe=()=>{var t=R.useContext(zoe),e=Ft(nz);return t||e},Hoe=t=>{var e=t.value,n=t.formatter,r=Vi(t.children)?e:t.children;return typeof n=="function"?n(r):r},J2=t=>t!=null&&typeof t=="function",Voe=(t,e)=>{var n=Vo(e-t),r=Math.min(Math.abs(e-t),360);return n*r},Goe=(t,e,n,r,i)=>{var s=t.offset,o=t.className,a=i.cx,l=i.cy,c=i.innerRadius,d=i.outerRadius,f=i.startAngle,p=i.endAngle,y=i.clockWise,x=(c+d)/2,S=Voe(f,p),w=S>=0?1:-1,_,E;switch(e){case"insideStart":_=f+w*s,E=y;break;case"insideEnd":_=p-w*s,E=!y;break;case"end":_=p+w*s,E=y;break;default:throw new Error("Unsupported position ".concat(e))}E=S<=0?E:!E;var T=Bi(a,l,x,_),P=Bi(a,l,x,_+(E?1:-1)*359),O="M".concat(T.x,",").concat(T.y,`
|
||
A`).concat(x,",").concat(x,",0,1,").concat(E?0:1,`,
|
||
`).concat(P.x,",").concat(P.y),N=Vi(t.id)?cy("recharts-radial-line-"):t.id;return R.createElement("text",kc({},r,{dominantBaseline:"central",className:tr("recharts-radial-bar-label",o)}),R.createElement("defs",null,R.createElement("path",{id:N,d:O})),R.createElement("textPath",{xlinkHref:"#".concat(N)},n))},Woe=(t,e,n)=>{var r=t.cx,i=t.cy,s=t.innerRadius,o=t.outerRadius,a=t.startAngle,l=t.endAngle,c=(a+l)/2;if(n==="outside"){var d=Bi(r,i,o+e,c),f=d.x,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+o)/2,x=Bi(r,i,y,c),S=x.x,w=x.y;return{x:S,y:w,textAnchor:"middle",verticalAnchor:"middle"}},V_=t=>t!=null&&"cx"in t&&kt(t.cx),$oe={angle:0,offset:5,zIndex:Ms.label,position:"middle",textBreakAll:!1};function Xoe(t){if(!V_(t))return t;var e=t.cx,n=t.cy,r=t.outerRadius,i=r*2;return{x:e-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function od(t){var e=Qo(t,$oe),n=e.viewBox,r=e.parentViewBox,i=e.position,s=e.value,o=e.children,a=e.content,l=e.className,c=l===void 0?"":l,d=e.textBreakAll,f=e.labelRef,p=Boe(),y=hH(),x=i==="center"?y:p??y,S,w,_;n==null?S=x:V_(n)?S=n:S=$C(n);var E=Xoe(S);if(!S||Vi(s)&&Vi(o)&&!R.isValidElement(a)&&typeof a!="function")return null;var T=H0(H0({},e),{},{viewBox:S});if(R.isValidElement(a)){T.labelRef;var P=XL(T,koe);return R.cloneElement(a,P)}if(typeof a=="function"){T.content;var O=XL(T,Ooe);if(w=R.createElement(a,O),R.isValidElement(w))return w}else w=Hoe(e);var N=qo(e);if(V_(S)){if(i==="insideStart"||i==="insideEnd"||i==="end")return Goe(e,i,w,N,S);_=Woe(S,e.offset,e.position)}else{if(!E)return null;var D=Ioe({viewBox:E,position:i,offset:e.offset,parentViewBox:V_(r)?void 0:r});_=H0(H0({x:D.x,y:D.y,textAnchor:D.horizontalAnchor,verticalAnchor:D.verticalAnchor},D.width!==void 0?{width:D.width}:{}),D.height!==void 0?{height:D.height}:{})}return R.createElement(su,{zIndex:e.zIndex},R.createElement(Q2,kc({ref:f,className:tr("recharts-label",c)},N,_,{textAnchor:lH(N.textAnchor)?N.textAnchor:_.textAnchor,breakAll:d}),w))}od.displayName="Label";var qoe=(t,e,n)=>{if(!t)return null;var r={viewBox:e,labelRef:n};return t===!0?R.createElement(od,kc({key:"label-implicit"},r)):Nl(t)?R.createElement(od,kc({key:"label-implicit",value:t},r)):R.isValidElement(t)?t.type===od?R.cloneElement(t,H0({key:"label-implicit"},r)):R.createElement(od,kc({key:"label-implicit",content:t},r)):J2(t)?R.createElement(od,kc({key:"label-implicit",content:t},r)):t&&typeof t=="object"?R.createElement(od,kc({},t,{key:"label-implicit"},r)):null};function Koe(t){var e=t.label,n=t.labelRef,r=hH();return qoe(e,r,n)||null}var Yoe=["valueAccessor"],Zoe=["dataKey","clockWise","id","textBreakAll","zIndex"];function Vw(){return Vw=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},Vw.apply(null,arguments)}function KL(t,e){if(t==null)return{};var n,r,i=Qoe(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 Qoe(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 Joe=t=>{var e=Array.isArray(t.value)?t.value[t.value.length-1]:t.value;if(Moe(e))return e},pH=R.createContext(void 0),eae=pH.Provider,mH=R.createContext(void 0);mH.Provider;function tae(){return R.useContext(pH)}function nae(){return R.useContext(mH)}function G_(t){var e=t.valueAccessor,n=e===void 0?Joe:e,r=KL(t,Yoe),i=r.dataKey;r.clockWise;var s=r.id,o=r.textBreakAll,a=r.zIndex,l=KL(r,Zoe),c=tae(),d=nae(),f=c||d;return!f||!f.length?null:R.createElement(su,{zIndex:a??Ms.label},R.createElement(Ko,{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 R.createElement(od,Vw({key:"label-".concat(y)},qo(p),l,w,{fill:(x=r.fill)!==null&&x!==void 0?x:p.fill,parentViewBox:p.parentViewBox,value:S,textBreakAll:o,viewBox:p.viewBox,index:y,zIndex:0}))})))}G_.displayName="LabelList";function rae(t){var e=t.label;return e?e===!0?R.createElement(G_,{key:"labelList-implicit"}):R.isValidElement(e)||J2(e)?R.createElement(G_,{key:"labelList-implicit",content:e}):typeof e=="object"?R.createElement(G_,Vw({key:"labelList-implicit"},e,{type:String(e.type)})):null:null}function IP(){return IP=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},IP.apply(null,arguments)}var gH=t=>{var e=t.cx,n=t.cy,r=t.r,i=t.className,s=tr("recharts-dot",i);return kt(e)&&kt(n)&&kt(r)?R.createElement("circle",IP({},za(t),DC(t),{className:s,cx:e,cy:n,r})):null},iae={radiusAxis:{},angleAxis:{}},vH=cs({name:"polarAxis",initialState:iae,reducers:{addRadiusAxis(t,e){t.radiusAxis[e.payload.id]=e.payload},removeRadiusAxis(t,e){delete t.radiusAxis[e.payload.id]},addAngleAxis(t,e){t.angleAxis[e.payload.id]=e.payload},removeAngleAxis(t,e){delete t.angleAxis[e.payload.id]}}}),jS=vH.actions;jS.addRadiusAxis;jS.removeRadiusAxis;jS.addAngleAxis;jS.removeAngleAxis;var sae=vH.reducer;function oae(t){return t&&typeof t=="object"&&"className"in t&&typeof t.className=="string"?t.className:""}var yH=t=>t&&typeof t=="object"&&"clipDot"in t?!!t.clipDot:!0;function YL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ZL(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?YL(Object(n),!0).forEach(function(r){aae(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):YL(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function aae(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=cae(t,"string");return typeof e=="symbol"?e:e+""}function cae(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 xH(t,e){return ZL(ZL({},e),t)}function uae(t){return R.isValidElement(t)?t.props:t}function dae(t,e){return R.cloneElement(t,xH(uae(t),e))}function fae(t){if("index"in t){var e=t.index;return typeof e=="number"||typeof e=="string"?e:void 0}}function hae(t){return"isActive"in t&&t.isActive===!0}function pae(t){var e=t.option,n=t.DefaultShape,r=t.shapeProps,i=t.activeClassName,s=i===void 0?"recharts-active-shape":i,o=t.inActiveClassName,a=o===void 0?"recharts-shape":o,l=fae(r),c;return R.isValidElement(e)?c=dae(e,r):e===n?c=R.createElement(n,r):typeof e=="function"?c=e(r,l):typeof e=="object"?c=R.createElement(n,xH(e,r)):c=R.createElement(n,r),hae(r)?R.createElement(Ko,{className:s},c):R.createElement(Ko,{className:a},c)}function mae(t){var e=t.tooltipEntrySettings,n=Wr(),r=Js(),i=R.useRef(null);return R.useLayoutEffect(()=>{r||(i.current===null?n(Ere(e)):i.current!==e&&n(Are({prev:i.current,next:e})),i.current=e)},[e,n,r]),R.useLayoutEffect(()=>()=>{i.current&&(n(Tre(i.current)),i.current=null)},[n]),null}function gae(t){var e=t.legendPayload,n=Wr(),r=Js(),i=R.useRef(null);return R.useLayoutEffect(()=>{r||(i.current===null?n(JY(e)):i.current!==e&&n(eZ({prev:i.current,next:e})),i.current=e)},[n,r,e]),R.useLayoutEffect(()=>()=>{i.current&&(n(tZ(i.current)),i.current=null)},[n]),null}function vae(t,e){return _ae(t)||bae(t,e)||xae(t,e)||yae()}function yae(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xae(t,e){if(t){if(typeof t=="string")return QL(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?QL(t,e):void 0}}function QL(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function bae(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function _ae(t){if(Array.isArray(t))return t}var eR="index",wae="append";function tR(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 o=t[s],a=e[s];o!=null?r.push({status:"matched",prev:o,next:a}):r.push({status:"added",next:a})}return r}function Sae(t,e){var n=t.length/e.length,r=e.map((i,s)=>t[Math.floor(s*n)]);return tR(r,e)}function Mae(t,e){var n=e.map((r,i)=>t[i]);return tR(n,e)}function Eae(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 Aae(t,e,n){var r=Eae(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}}),o=[];for(var a of r){var l=vae(a,2),c=l[0],d=l[1];i.has(c)||o.push(d)}return tR(s,e,o)}function kP(t,e,n){return e==null?null:t==null?e.map(r=>({status:"added",next:r})):n===eR?Sae(t,e):n===wae?Mae(t,e):Aae(t,e,n)}function bH(t,e){var n=R.useRef(t),r=R.useRef(e.current),i=R.useRef(!0);n.current!==t&&(n.current=t,r.current=e.current,i.current=!1);var s=R.useCallback(function(o,a){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(a===0){i.current=!0;return}a===1&&(r.current=o),a>0&&i.current&&l&&(e.current=o)},[e]);return{startValue:r.current,syncStepValue:s}}function Tae(t,e){return Nae(t)||Rae(t,e)||Cae(t,e)||Pae()}function Pae(){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 Cae(t,e){if(t){if(typeof t=="string")return JL(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?JL(t,e):void 0}}function JL(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Rae(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function Nae(t){if(Array.isArray(t))return t}function Iae(t,e){var n=R.useState(!1),r=Tae(n,2),i=r[0],s=r[1],o=R.useCallback(()=>{typeof t=="function"&&t(),s(!0)},[t]),a=R.useCallback(()=>{typeof e=="function"&&e(),s(!1)},[e]);return{isAnimating:i,handleAnimationStart:o,handleAnimationEnd:a}}function kae(t){var e,n=t.animationInput,r=t.animationIdPrefix,i=t.items,s=t.previousItemsRef,o=t.isAnimationActive,a=t.animationBegin,l=t.animationDuration,c=t.animationEasing,d=t.onAnimationStart,f=t.onAnimationEnd,p=t.animationInterpolateFn,y=t.animationMatchBy,x=t.shouldUpdatePreviousRef,S=t.children,w=t.layout,_=L4(n,r),E=bH(_,s),T=(e=E.startValue)!==null&&e!==void 0?e:null,P=kP(T,i,y??eR);return R.createElement(O4,{animationId:_,begin:a,duration:l,isActive:o,easing:c,onAnimationEnd:f,onAnimationStart:d,key:_},O=>{var N=T==null,D=i==null?i:p(P,O,w),z=x?x(O):O>0;return E.syncStepValue(D,O,z),D==null?null:S(D,O,N)})}var zE;function Oae(t,e){return jae(t)||Uae(t,e)||Dae(t,e)||Lae()}function Lae(){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 Dae(t,e){if(t){if(typeof t=="string")return e3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e3(t,e):void 0}}function e3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Uae(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function jae(t){if(Array.isArray(t))return t}var Fae=()=>{var t=R.useState(()=>cy("uid-")),e=Oae(t,1),n=e[0];return n},_H=(zE=H1.useId)!==null&&zE!==void 0?zE:Fae;function zae(t,e){var n=_H();return e||(t?"".concat(t,"-").concat(n):n)}var Bae=R.createContext(void 0),Hae=t=>{var e=t.id,n=t.type,r=t.children,i=zae("recharts-".concat(n),e);return R.createElement(Bae.Provider,{value:i},r(i))},Vae={cartesianItems:[],polarItems:[]},wH=cs({name:"graphicalItems",initialState:Vae,reducers:{addCartesianGraphicalItem:{reducer(t,e){t.cartesianItems.push(e.payload)},prepare:or()},replaceCartesianGraphicalItem:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=Go(t).cartesianItems.indexOf(r);s>-1&&(t.cartesianItems[s]=i)},prepare:or()},removeCartesianGraphicalItem:{reducer(t,e){var n=Go(t).cartesianItems.indexOf(e.payload);n>-1&&t.cartesianItems.splice(n,1)},prepare:or()},addPolarGraphicalItem:{reducer(t,e){t.polarItems.push(e.payload)},prepare:or()},removePolarGraphicalItem:{reducer(t,e){var n=Go(t).polarItems.indexOf(e.payload);n>-1&&t.polarItems.splice(n,1)},prepare:or()},replacePolarGraphicalItem:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=Go(t).polarItems.indexOf(r);s>-1&&(t.polarItems[s]=i)},prepare:or()}}}),Qg=wH.actions,Gae=Qg.addCartesianGraphicalItem,Wae=Qg.replaceCartesianGraphicalItem,$ae=Qg.removeCartesianGraphicalItem;Qg.addPolarGraphicalItem;Qg.removePolarGraphicalItem;Qg.replacePolarGraphicalItem;var Xae=wH.reducer,qae=t=>{var e=Wr(),n=R.useRef(null);return R.useLayoutEffect(()=>{n.current===null?e(Gae(t)):n.current!==t&&e(Wae({prev:n.current,next:t})),n.current=t},[e,t]),R.useLayoutEffect(()=>()=>{n.current&&(e($ae(n.current)),n.current=null)},[e]),null},Kae=R.memo(qae),Yae=["points"];function t3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function BE(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){Zae(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 Zae(t,e,n){return(e=Qae(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Qae(t){var e=Jae(t,"string");return typeof e=="symbol"?e:e+""}function Jae(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 Gw(){return Gw=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},Gw.apply(null,arguments)}function ele(t,e){if(t==null)return{};var n,r,i=tle(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 tle(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 nle(t){var e=t.option,n=t.dotProps,r=t.className;if(R.isValidElement(e))return R.cloneElement(e,n);if(typeof e=="function")return e(n);var i=tr(r,typeof e!="boolean"?e.className:""),s=n??{};s.points;var o=ele(s,Yae);return R.createElement(gH,Gw({},o,{className:i}))}function rle(t,e){return t==null?!1:e?!0:t.length===1}function ile(t){var e=t.points,n=t.dot,r=t.className,i=t.dotClassName,s=t.dataKey,o=t.baseProps,a=t.needClip,l=t.clipPathId,c=t.zIndex,d=c===void 0?Ms.scatter:c;if(!rle(e,n))return null;var f=yH(n),p=F7(n),y=e.map((S,w)=>{var _,E,T=BE(BE(BE({r:3},o),p),{},{index:w,cx:(_=S.x)!==null&&_!==void 0?_:void 0,cy:(E=S.y)!==null&&E!==void 0?E:void 0,dataKey:s,value:S.value,payload:S.payload,points:e});return R.createElement(nle,{key:"dot-".concat(w),option:n,dotProps:T,className:i})}),x={};return a&&l!=null&&(x.clipPath="url(#clipPath-".concat(f?"":"dots-").concat(l,")")),R.createElement(su,{zIndex:d},R.createElement(Ko,Gw({className:r},x),y))}function n3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function r3(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?n3(Object(n),!0).forEach(function(r){sle(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):n3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function sle(t,e,n){return(e=ole(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ole(t){var e=ale(t,"string");return typeof e=="symbol"?e:e+""}function ale(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 SH=0,lle={xAxis:{},yAxis:{},zAxis:{}},MH=cs({name:"cartesianAxis",initialState:lle,reducers:{addXAxis:{reducer(t,e){t.xAxis[e.payload.id]=e.payload},prepare:or()},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:or()},removeXAxis:{reducer(t,e){delete t.xAxis[e.payload.id]},prepare:or()},addYAxis:{reducer(t,e){t.yAxis[e.payload.id]=e.payload},prepare:or()},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:or()},removeYAxis:{reducer(t,e){delete t.yAxis[e.payload.id]},prepare:or()},addZAxis:{reducer(t,e){t.zAxis[e.payload.id]=e.payload},prepare:or()},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:or()},removeZAxis:{reducer(t,e){delete t.zAxis[e.payload.id]},prepare:or()},updateYAxisWidth(t,e){var n=e.payload,r=n.id,i=n.width,s=t.yAxis[r];if(s){var o,a=s.widthHistory||[];if(a.length===3&&a[0]===a[2]&&i===a[1]&&i!==s.width&&Math.abs(i-((o=a[0])!==null&&o!==void 0?o:0))<=1)return;var l=[...a,i].slice(-3);t.yAxis[r]=r3(r3({},s),{},{width:i,widthHistory:l})}}}}),Fl=MH.actions,cle=Fl.addXAxis,ule=Fl.replaceXAxis,dle=Fl.removeXAxis,fle=Fl.addYAxis,hle=Fl.replaceYAxis,ple=Fl.removeYAxis;Fl.addZAxis;Fl.replaceZAxis;Fl.removeZAxis;var mle=Fl.updateYAxisWidth,gle=MH.reducer,vle=ke([Wi],t=>({top:t.top,bottom:t.bottom,left:t.left,right:t.right})),yle=ke([vle,Jc,eu],(t,e,n)=>{if(!(!t||e==null||n==null))return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}),nR=()=>Ft(yle),xle=()=>Ft(Eie);function i3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function HE(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?i3(Object(n),!0).forEach(function(r){ble(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):i3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ble(t,e,n){return(e=_le(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _le(t){var e=wle(t,"string");return typeof e=="symbol"?e:e+""}function wle(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 Sle=t=>{var e=t.point,n=t.childIndex,r=t.mainColor,i=t.activeDot,s=t.dataKey,o=t.clipPath;if(i===!1||e.x==null||e.y==null)return null;var a={index:n,dataKey:s,cx:e.x,cy:e.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:e.payload,value:e.value},l=HE(HE(HE({},a),Z1(i)),DC(i)),c;return R.isValidElement(i)?c=R.cloneElement(i,l):typeof i=="function"?c=i(l):c=R.createElement(gH,l),R.createElement(Ko,{className:"recharts-active-dot",clipPath:o},c)};function s3(t){var e=t.points,n=t.mainColor,r=t.activeDot,i=t.itemDataKey,s=t.clipPath,o=t.zIndex,a=o===void 0?Ms.activeDot:o,l=Ft(wy),c=xle();if(e==null||c==null)return null;var d=e.find(f=>c.includes(f.payload));return Vi(d)?null:R.createElement(su,{zIndex:a},R.createElement(Sle,{point:d,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r,clipPath:s}))}var Mle=t=>{var e=t.chartData,n=Wr(),r=Js();return R.useEffect(()=>r?()=>{}:(n(TL(e)),()=>{n(TL(void 0))}),[e,n,r]),null},o3={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},EH=cs({name:"brush",initialState:o3,reducers:{setBrushSettings(t,e){return e.payload==null?o3:e.payload}}});EH.actions.setBrushSettings;var Ele=EH.reducer;function Ale(t){return(t%180+180)%180}var Tle=function(e){var n=e.width,r=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=Ale(i),o=s*Math.PI/180,a=Math.atan(r/n),l=o>a&&o<Math.PI-a?r/Math.sin(o):n/Math.cos(o);return Math.abs(l)},Ple={dots:[],areas:[],lines:[]},AH=cs({name:"referenceElements",initialState:Ple,reducers:{addDot:(t,e)=>{t.dots.push(e.payload)},removeDot:(t,e)=>{var n=Go(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=Go(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=Go(t).lines.findIndex(r=>r===e.payload);n!==-1&&t.lines.splice(n,1)}}}),Jg=AH.actions;Jg.addDot;Jg.removeDot;Jg.addArea;Jg.removeArea;Jg.addLine;Jg.removeLine;var Cle=AH.reducer;function Rle(t,e){return Ole(t)||kle(t,e)||Ile(t,e)||Nle()}function Nle(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ile(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 kle(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function Ole(t){if(Array.isArray(t))return t}var Lle=R.createContext(void 0),Dle=t=>{var e=t.children,n=R.useState("".concat(cy("recharts"),"-clip")),r=Rle(n,1),i=r[0],s=nR();if(s==null)return null;var o=s.x,a=s.y,l=s.width,c=s.height;return R.createElement(Lle.Provider,{value:i},R.createElement("defs",null,R.createElement("clipPath",{id:i},R.createElement("rect",{x:o,y:a,height:c,width:l}))),e)};function TH(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 Ule(t,e,n){var r={width:t.width+e.width,height:t.height+e.height};return Tle(r,n)}function jle(t,e,n){var r=n==="width",i=t.x,s=t.y,o=t.width,a=t.height;return e===1?{start:r?i:s,end:r?i+o:s+a}:{start:r?i+o:s+a,end:r?i:s}}function My(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 Fle(t,e){return TH(t,e+1)}function zle(t,e,n,r,i){for(var s=(r||[]).slice(),o=e.start,a=e.end,l=0,c=1,d=o,f=function(){var x=r==null?void 0:r[l];if(x===void 0)return{v:TH(r,c)};var S=l,w,_=()=>(w===void 0&&(w=n(x,S)),w),E=x.coordinate,T=l===0||My(t,E,_,d,a);T||(l=0,d=o,c+=1),T&&(d=E+t*(_()/2+i),l+=c)},p;c<=s.length;)if(p=f(),p)return p.v;return[]}function Ble(t,e,n,r,i){var s=(r||[]).slice(),o=s.length;if(o===0)return[];for(var a=e.start,l=e.end,c=1;c<=o;c++){for(var d=(o-1)%c,f=a,p=!0,y=function(){var P=r[S];if(P==null)return 0;var O=S,N,D=()=>(N===void 0&&(N=n(P,O)),N),z=P.coordinate,G=S===d||My(t,z,D,f,l);if(!G)return p=!1,1;G&&(f=z+t*(D()/2+i))},x,S=d;S<o&&(x=y(),!(x!==0&&x===1));S+=c);if(p){for(var w=[],_=d;_<o;_+=c){var E=r[_];E!=null&&w.push(E)}return w}}return[]}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 rs(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){Hle(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 Hle(t,e,n){return(e=Vle(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Vle(t){var e=Gle(t,"string");return typeof e=="symbol"?e:e+""}function Gle(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 Wle(t,e,n,r,i){for(var s=(r||[]).slice(),o=s.length,a=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===o-1){var _=t*(x.coordinate+t*w()/2-l);s[p]=x=rs(rs({},x),{},{tickCoord:_>0?x.coordinate-_*t:x.coordinate})}else s[p]=x=rs(rs({},x),{},{tickCoord:x.coordinate});if(x.tickCoord!=null){var E=My(t,x.tickCoord,w,a,l);E&&(l=x.tickCoord-t*(w()/2+i),s[p]=rs(rs({},x),{},{isShow:!0}))}},d=o-1;d>=0;d--)c(d);return s}function $le(t,e,n,r,i,s){var o=(r||[]).slice(),a=o.length,l=e.start,c=e.end;if(s){var d=r[a-1];if(d!=null){var f=n(d,a-1),p=t*(d.coordinate+t*f/2-c);if(o[a-1]=d=rs(rs({},d),{},{tickCoord:p>0?d.coordinate-p*t:d.coordinate}),d.tickCoord!=null){var y=My(t,d.tickCoord,()=>f,l,c);y&&(c=d.tickCoord-t*(f/2+i),o[a-1]=rs(rs({},d),{},{isShow:!0}))}}}for(var x=s?a-1:a,S=function(E){var T=o[E];if(T==null)return 1;var P=T,O,N=()=>(O===void 0&&(O=n(T,E)),O);if(E===0){var D=t*(P.coordinate-t*N()/2-l);o[E]=P=rs(rs({},P),{},{tickCoord:D<0?P.coordinate-D*t:P.coordinate})}else o[E]=P=rs(rs({},P),{},{tickCoord:P.coordinate});if(P.tickCoord!=null){var z=My(t,P.tickCoord,N,l,c);z&&(l=P.tickCoord+t*(N()/2+i),o[E]=rs(rs({},P),{},{isShow:!0}))}},w=0;w<x;w++)S(w);return o}function rR(t,e,n){var r=t.tick,i=t.ticks,s=t.viewBox,o=t.minTickGap,a=t.orientation,l=t.interval,c=t.tickFormatter,d=t.unit,f=t.angle;if(!i||!i.length||!r)return[];if(kt(l)||Zy.isSsr){var p;return(p=Fle(i,kt(l)?l:0))!==null&&p!==void 0?p:[]}var y=[],x=a==="top"||a==="bottom"?"width":"height",S=d&&x==="width"?X0(d,{fontSize:e,letterSpacing:n}):{width:0,height:0},w=(O,N)=>{var D=typeof c=="function"?c(O.value,N):O.value;return x==="width"?Ule(X0(D,{fontSize:e,letterSpacing:n}),S,f):X0(D,{fontSize:e,letterSpacing:n})[x]},_=i[0],E=i[1],T=i.length>=2&&_!=null&&E!=null?Vo(E.coordinate-_.coordinate):1,P=jle(s,T,x);return l==="equidistantPreserveStart"?zle(T,P,w,i,o):l==="equidistantPreserveEnd"?Ble(T,P,w,i,o):(l==="preserveStart"||l==="preserveStartEnd"?y=$le(T,P,w,i,o,l==="preserveStartEnd"):y=Wle(T,P,w,i,o),y.filter(O=>O.isShow))}var Xle=t=>{var e=t.ticks,n=t.label,r=t.labelGapWithTick,i=r,s=t.tickSize,o=s===void 0?0:s,a=t.tickMargin,l=a===void 0?0:a,c=0;if(e){Array.from(e).forEach(y=>{if(y){var x=y.getBoundingClientRect();x.width>c&&(c=x.width)}});var d=n?n.getBoundingClientRect().width:0,f=o+l,p=c+f+d+(n?i:0);return Math.round(p)}return 0},qle={xAxis:{},yAxis:{}},PH=cs({name:"renderedTicks",initialState:qle,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]}}}),CH=PH.actions,Kle=CH.setRenderedTicks,Yle=CH.removeRenderedTicks,Zle=PH.reducer,Qle=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function c3(t,e){return nce(t)||tce(t,e)||ece(t,e)||Jle()}function Jle(){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 ece(t,e){if(t){if(typeof t=="string")return u3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u3(t,e):void 0}}function u3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function tce(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function nce(t){if(Array.isArray(t))return t}function rce(t,e){if(t==null)return{};var n,r,i=ice(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 ice(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 jh(){return jh=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},jh.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 Ar(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){sce(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 sce(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=ace(t,"string");return typeof e=="symbol"?e:e+""}function ace(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 Hc={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:Ms.axis};function lce(t){var e=t.x,n=t.y,r=t.width,i=t.height,s=t.orientation,o=t.mirror,a=t.axisLine,l=t.otherSvgProps;if(!a)return null;var c=Ar(Ar(Ar({},l),za(a)),{},{fill:"none"});if(s==="top"||s==="bottom"){var d=+(s==="top"&&!o||s==="bottom"&&o);c=Ar(Ar({},c),{},{x1:e,y1:n+d*i,x2:e+r,y2:n+d*i})}else{var f=+(s==="left"&&!o||s==="right"&&o);c=Ar(Ar({},c),{},{x1:e+f*r,y1:n,x2:e+f*r,y2:n+i})}return R.createElement("line",jh({},c,{className:tr("recharts-cartesian-axis-line",Kh(a,"className"))}))}function cce(t,e,n,r,i,s,o,a,l){var c,d,f,p,y,x,S=a?-1:1,w=t.tickSize||o,_=kt(t.tickCoord)?t.tickCoord:t.coordinate;switch(s){case"top":c=d=t.coordinate,p=n+ +!a*i,f=p-S*w,x=f-S*l,y=_;break;case"left":f=p=t.coordinate,d=e+ +!a*r,c=d-S*w,y=c-S*l,x=_;break;case"right":f=p=t.coordinate,d=e+ +a*r,c=d+S*w,y=c+S*l,x=_;break;default:c=d=t.coordinate,p=n+ +a*i,f=p+S*w,x=f+S*l,y=_;break}return{line:{x1:c,y1:f,x2:d,y2:p},tick:{x:y,y:x}}}function uce(t,e){switch(t){case"left":return e?"start":"end";case"right":return e?"end":"start";default:return"middle"}}function dce(t,e){switch(t){case"left":case"right":return"middle";case"top":return e?"start":"end";default:return e?"end":"start"}}function fce(t){var e=t.option,n=t.tickProps,r=t.value,i,s=tr(n.className,"recharts-cartesian-axis-tick-value");if(R.isValidElement(e))i=R.cloneElement(e,Ar(Ar({},n),{},{className:s}));else if(typeof e=="function")i=e(Ar(Ar({},n),{},{className:s}));else{var o="recharts-cartesian-axis-tick-value";typeof e!="boolean"&&(o=tr(o,oae(e))),i=R.createElement(Q2,jh({},n,{className:o}),r)}return i}function hce(t){var e=t.ticks,n=t.axisType,r=t.axisId,i=Wr();return R.useEffect(()=>{if(r==null||n==null)return Hg;var s=e.map(o=>({value:o.value,coordinate:o.coordinate,offset:o.offset,index:o.index}));return i(Kle({ticks:s,axisId:r,axisType:n})),()=>{i(Yle({axisId:r,axisType:n}))}},[i,e,r,n]),null}var pce=R.forwardRef((t,e)=>{var n=t.ticks,r=n===void 0?[]:n,i=t.tick,s=t.tickLine,o=t.stroke,a=t.tickFormatter,l=t.unit,c=t.padding,d=t.tickTextProps,f=t.orientation,p=t.mirror,y=t.x,x=t.y,S=t.width,w=t.height,_=t.tickSize,E=t.tickMargin,T=t.fontSize,P=t.letterSpacing,O=t.getTicksConfig,N=t.events,D=t.axisType,z=t.axisId,G=rR(Ar(Ar({},O),{},{ticks:r}),T,P),k=za(O),j=Z1(i),H=lH(k.textAnchor)?k.textAnchor:uce(f,p),ee=dce(f,p),te={};typeof s=="object"&&(te=s);var he=Ar(Ar({},k),{},{fill:"none"},te),se=G.map(J=>Ar({entry:J},cce(J,y,x,S,w,f,_,p,E))),fe=se.map(J=>{var Y=J.entry,V=J.line;return R.createElement(Ko,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(Y.value,"-").concat(Y.coordinate,"-").concat(Y.tickCoord)},s&&R.createElement("line",jh({},he,V,{className:tr("recharts-cartesian-axis-tick-line",Kh(s,"className"))})))}),B=se.map((J,Y)=>{var V,q,pe=J.entry,ae=J.tick,ce=Ar(Ar(Ar(Ar({verticalAnchor:ee},k),{},{textAnchor:H,stroke:"none",fill:o},ae),{},{index:Y,payload:pe,visibleTicksCount:G.length,tickFormatter:a,padding:c},d),{},{angle:(V=(q=d==null?void 0:d.angle)!==null&&q!==void 0?q:k.angle)!==null&&V!==void 0?V:0}),Se=Ar(Ar({},ce),j);return R.createElement(Ko,jh({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(pe.value,"-").concat(pe.coordinate,"-").concat(pe.tickCoord)},yX(N,pe,Y)),i&&R.createElement(fce,{option:i,tickProps:Se,value:"".concat(typeof a=="function"?a(pe.value,Y):pe.value).concat(l||"")}))});return R.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(D,"-ticks")},R.createElement(hce,{ticks:G,axisId:z,axisType:D}),B.length>0&&R.createElement(su,{zIndex:Ms.label},R.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(D,"-tick-labels"),ref:e},B)),fe.length>0&&R.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(D,"-tick-lines")},fe))}),mce=R.forwardRef((t,e)=>{var n=t.axisLine,r=t.width,i=t.height,s=t.className,o=t.hide,a=t.ticks,l=t.axisType,c=t.axisId,d=rce(t,Qle),f=R.useState(""),p=c3(f,2),y=p[0],x=p[1],S=R.useState(""),w=c3(S,2),_=w[0],E=w[1],T=R.useRef(null);R.useImperativeHandle(e,()=>({getCalculatedWidth:()=>{var O;return Xle({ticks:T.current,label:(O=t.labelRef)===null||O===void 0?void 0:O.current,labelGapWithTick:5,tickSize:t.tickSize,tickMargin:t.tickMargin})}}));var P=R.useCallback(O=>{if(O){var N=O.getElementsByClassName("recharts-cartesian-axis-tick-value");T.current=N;var D=N[0];if(D){var z=window.getComputedStyle(D),G=z.fontSize,k=z.letterSpacing;(G!==y||k!==_)&&(x(G),E(k))}}},[y,_]);return o||r!=null&&r<=0||i!=null&&i<=0?null:R.createElement(su,{zIndex:t.zIndex},R.createElement(Ko,{className:tr("recharts-cartesian-axis",s)},R.createElement(lce,{x:t.x,y:t.y,width:r,height:i,orientation:t.orientation,mirror:t.mirror,axisLine:n,otherSvgProps:za(t)}),R.createElement(pce,{ref:P,axisType:l,events:d,fontSize:y,getTicksConfig:t,height:t.height,letterSpacing:_,mirror:t.mirror,orientation:t.orientation,padding:t.padding,stroke:t.stroke,tick:t.tick,tickFormatter:t.tickFormatter,tickLine:t.tickLine,tickMargin:t.tickMargin,tickSize:t.tickSize,tickTextProps:t.tickTextProps,ticks:a,unit:t.unit,width:t.width,x:t.x,y:t.y,axisId:c}),R.createElement(Foe,{x:t.x,y:t.y,width:t.width,height:t.height,lowerWidth:t.width,upperWidth:t.width},R.createElement(Koe,{label:t.label,labelRef:t.labelRef}),t.children)))}),iR=R.forwardRef((t,e)=>{var n=Qo(t,Hc);return R.createElement(mce,jh({},n,{ref:e}))});iR.displayName="CartesianAxis";var gce=["x1","y1","x2","y2","key"],vce=["offset"],yce=["xAxisId","yAxisId"],xce=["xAxisId","yAxisId"];function f3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function is(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?f3(Object(n),!0).forEach(function(r){bce(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):f3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function bce(t,e,n){return(e=_ce(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _ce(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 sh(){return sh=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},sh.apply(null,arguments)}function Ww(t,e){if(t==null)return{};var n,r,i=Sce(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 Sce(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 Mce=t=>{var e=t.fill;if(!e||e==="none")return null;var n=t.fillOpacity,r=t.x,i=t.y,s=t.width,o=t.height,a=t.ry;return R.createElement("rect",{x:r,y:i,ry:a,width:s,height:o,stroke:"none",fill:e,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function RH(t){var e=t.option,n=t.lineItemProps,r;if(R.isValidElement(e))r=R.cloneElement(e,n);else if(typeof e=="function")r=e(n);else{var i,s=n.x1,o=n.y1,a=n.x2,l=n.y2,c=n.key,d=Ww(n,gce),f=(i=za(d))!==null&&i!==void 0?i:{};f.offset;var p=Ww(f,vce);r=R.createElement("line",sh({},p,{x1:s,y1:o,x2:a,y2:l,fill:"none",key:c}))}return r}function Ece(t){var e=t.x,n=t.width,r=t.horizontal,i=r===void 0?!0:r,s=t.horizontalPoints;if(!i||!s||!s.length)return null;t.xAxisId,t.yAxisId;var o=Ww(t,yce),a=s.map((l,c)=>{var d=is(is({},o),{},{x1:e,y1:l,x2:e+n,y2:l,key:"line-".concat(c),index:c});return R.createElement(RH,{key:"line-".concat(c),option:i,lineItemProps:d})});return R.createElement("g",{className:"recharts-cartesian-grid-horizontal"},a)}function Ace(t){var e=t.y,n=t.height,r=t.vertical,i=r===void 0?!0:r,s=t.verticalPoints;if(!i||!s||!s.length)return null;t.xAxisId,t.yAxisId;var o=Ww(t,xce),a=s.map((l,c)=>{var d=is(is({},o),{},{x1:l,y1:e,x2:l,y2:e+n,key:"line-".concat(c),index:c});return R.createElement(RH,{option:i,lineItemProps:d,key:"line-".concat(c)})});return R.createElement("g",{className:"recharts-cartesian-grid-vertical"},a)}function Tce(t){var e=t.horizontalFill,n=t.fillOpacity,r=t.x,i=t.y,s=t.width,o=t.height,a=t.horizontalPoints,l=t.horizontal,c=l===void 0?!0:l;if(!c||!e||!e.length||a==null)return null;var d=a.map(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+o-p:x-p;if(w<=0)return null;var _=y%e.length;return R.createElement("rect",{key:"react-".concat(y),y:p,x:r,height:w,width:s,stroke:"none",fill:e[_],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return R.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function Pce(t){var e=t.vertical,n=e===void 0?!0:e,r=t.verticalFill,i=t.fillOpacity,s=t.x,o=t.y,a=t.width,l=t.height,c=t.verticalPoints;if(!n||!r||!r.length)return null;var d=c.map(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+a-p:x-p;if(w<=0)return null;var _=y%r.length;return R.createElement("rect",{key:"react-".concat(y),x:p,y:o,width:w,height:l,stroke:"none",fill:r[_],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return R.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var Cce=(t,e)=>{var n=t.xAxis,r=t.width,i=t.height,s=t.offset;return u4(rR(is(is(is({},Hc),n),{},{ticks:d4(n),viewBox:{x:0,y:0,width:r,height:i}})),s.left,s.left+s.width,e)},Rce=(t,e)=>{var n=t.yAxis,r=t.width,i=t.height,s=t.offset;return u4(rR(is(is(is({},Hc),n),{},{ticks:d4(n),viewBox:{x:0,y:0,width:r,height:i}})),s.top,s.top+s.height,e)},Nce={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Ms.grid};function NH(t){var e=x4(),n=b4(),r=y4(),i=is(is({},Qo(t,Nce)),{},{x:kt(t.x)?t.x:r.left,y:kt(t.y)?t.y:r.top,width:kt(t.width)?t.width:r.width,height:kt(t.height)?t.height:r.height}),s=i.xAxisId,o=i.yAxisId,a=i.x,l=i.y,c=i.width,d=i.height,f=i.syncWithTicks,p=i.horizontalValues,y=i.verticalValues,x=Js(),S=Ft(G=>pL(G,"xAxis",s,x)),w=Ft(G=>pL(G,"yAxis",o,x));if(!Il(c)||!Il(d)||!kt(a)||!kt(l))return null;var _=i.verticalCoordinatesGenerator||Cce,E=i.horizontalCoordinatesGenerator||Rce,T=i.horizontalPoints,P=i.verticalPoints;if((!T||!T.length)&&typeof E=="function"){var O=p&&p.length,N=E({yAxis:w?is(is({},w),{},{ticks:O?p:w.ticks}):void 0,width:e??c,height:n??d,offset:r},O?!0:f);vw(Array.isArray(N),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof N,"]")),Array.isArray(N)&&(T=N)}if((!P||!P.length)&&typeof _=="function"){var D=y&&y.length,z=_({xAxis:S?is(is({},S),{},{ticks:D?y:S.ticks}):void 0,width:e??c,height:n??d,offset:r},D?!0:f);vw(Array.isArray(z),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof z,"]")),Array.isArray(z)&&(P=z)}return R.createElement(su,{zIndex:i.zIndex},R.createElement("g",{className:"recharts-cartesian-grid"},R.createElement(Mce,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),R.createElement(Tce,sh({},i,{horizontalPoints:T})),R.createElement(Pce,sh({},i,{verticalPoints:P})),R.createElement(Ece,sh({},i,{offset:r,horizontalPoints:T,xAxis:S,yAxis:w})),R.createElement(Ace,sh({},i,{offset:r,verticalPoints:P,xAxis:S,yAxis:w}))))}NH.displayName="CartesianGrid";var Ice={},IH=cs({name:"errorBars",initialState:Ice,reducers:{addErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,i=n.errorBar;t[r]||(t[r]=[]),t[r].push(i)},replaceErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,i=n.prev,s=n.next;t[r]&&(t[r]=t[r].map(o=>o.dataKey===i.dataKey&&o.direction===i.direction?s:o))},removeErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,i=n.errorBar;t[r]&&(t[r]=t[r].filter(s=>s.dataKey!==i.dataKey||s.direction!==i.direction))}}}),sR=IH.actions;sR.addErrorBar;sR.replaceErrorBar;sR.removeErrorBar;var kce=IH.reducer;function kH(t,e){var n,r,i=Ft(c=>nu(c,t)),s=Ft(c=>ru(c,e)),o=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:ti.allowDataOverflow,a=(r=s==null?void 0:s.allowDataOverflow)!==null&&r!==void 0?r:ni.allowDataOverflow,l=o||a;return{needClip:l,needClipX:o,needClipY:a}}function Oce(t){var e=t.xAxisId,n=t.yAxisId,r=t.clipPathId,i=nR(),s=kH(e,n),o=s.needClipX,a=s.needClipY,l=s.needClip,c=Ft(T=>vB(T,e,!1)),d=Ft(T=>yB(T,n,!1));if(!l||!i)return null;var f=i.x,p=i.y,y=i.width,x=i.height,S=o&&c?Math.min(c[0],c[1]):f-y/2,w=a&&d?Math.min(d[0],d[1]):p-x/2,_=o&&c?Math.abs(c[1]-c[0]):y*2,E=a&&d?Math.abs(d[1]-d[0]):x*2;return R.createElement("clipPath",{id:"clipPath-".concat(r)},R.createElement("rect",{x:S,y:w,width:_,height:E}))}function Lce(t){var e=Z1(t),n=3,r=2;if(e!=null){var i=e.r,s=e.strokeWidth,o=Number(i),a=Number(s);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(a)||a<0)&&(a=r),{r:o,strokeWidth:a}}return{r:n,strokeWidth:r}}function oR(t,e){var n,r;return(n=(r=t.graphicalItems.cartesianItems.find(i=>i.id===e))===null||r===void 0?void 0:r.xAxisId)!==null&&n!==void 0?n:SH}function aR(t,e){var n,r;return(n=(r=t.graphicalItems.cartesianItems.find(i=>i.id===e))===null||r===void 0?void 0:r.yAxisId)!==null&&n!==void 0?n:SH}var OH=(t,e,n)=>AB(t,"xAxis",oR(t,e),n),LH=(t,e,n)=>EB(t,"xAxis",oR(t,e),n),DH=(t,e,n)=>AB(t,"yAxis",aR(t,e),n),UH=(t,e,n)=>EB(t,"yAxis",aR(t,e),n),Dce=ke([hr,OH,DH,LH,UH],(t,e,n,r,i)=>jl(t,"xAxis")?gw(e,r,!1):gw(n,i,!1)),Uce=(t,e)=>e,jH=ke([Wz,Uce],(t,e)=>t.filter(n=>n.type==="area").find(n=>n.id===e)),FH=t=>{var e=hr(t),n=jl(e,"xAxis");return n?"yAxis":"xAxis"},jce=(t,e)=>{var n=FH(t);return n==="yAxis"?aR(t,e):oR(t,e)},Fce=(t,e,n)=>tB(t,FH(t),jce(t,e),n),zce=ke([jH,Fce],(t,e)=>{var n;if(!(t==null||e==null)){var r=t.stackId,i=a2(t);if(!(r==null||i==null)){var s=(n=e[r])===null||n===void 0?void 0:n.stackedData,o=s==null?void 0:s.find(a=>a.key===i);if(o!=null)return o.map(a=>[a[0],a[1]])}}}),Bce=ke([hr,OH,DH,LH,UH,zce,dJ,Dce,jH,PJ],(t,e,n,r,i,s,o,a,l,c)=>{var d=o.chartData,f=o.dataStartIndex,p=o.dataEndIndex;if(!(l==null||t!=="horizontal"&&t!=="vertical"||e==null||n==null||r==null||i==null||r.length===0||i.length===0||a==null)){var y=l.data,x;if(y&&y.length>0?x=y:x=d==null?void 0:d.slice(f,p+1),x!=null)return hue({layout:t,xAxis:e,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:l,stackedData:s,displayedData:x,chartBaseValue:c,bandSize:a})}}),Hce=["animationElapsedTime","isAnimating","isEntrance","layout","isRange","stroke","connectNulls"],Vce=["id","baseLine"];function q0(){return q0=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},q0.apply(null,arguments)}function h3(t,e){if(t==null)return{};var n,r,i=Gce(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 Gce(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 Wce(t){var e,n,r=t.alpha,i=t.baseLine,s=t.points,o=t.strokeWidth,a=(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(a)||!wn(l))return null;var c=r*Math.abs(a-l),d=Math.max(...s.map(f=>f.y||0));return kt(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.y||0),d)),kt(d)?R.createElement("rect",{x:a<l?a:a-c,y:0,width:c,height:Math.floor(d+(o?parseInt("".concat(o),10):1))}):null}function $ce(t){var e,n,r=t.alpha,i=t.baseLine,s=t.points,o=t.strokeWidth,a=(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(a)||!wn(l))return null;var c=r*Math.abs(a-l),d=Math.max(...s.map(f=>f.x||0));return kt(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.x||0),d)),kt(d)?R.createElement("rect",{x:0,y:a<l?a:a-c,width:d+(o?parseInt("".concat(o),10):1),height:Math.floor(c)}):null}function Xce(t){var e=t.alpha,n=t.layout,r=t.points,i=t.baseLine,s=t.strokeWidth;return n==="vertical"?R.createElement($ce,{alpha:e,points:r,baseLine:i,strokeWidth:s}):R.createElement(Wce,{alpha:e,points:r,baseLine:i,strokeWidth:s})}function qce(t){var e=t.animationElapsedTime,n=e===void 0?1:e,r=t.isAnimating,i=r===void 0?!1:r,s=t.isEntrance,o=s===void 0?!1:s,a=t.layout,l=t.isRange,c=t.stroke,d=t.connectNulls,f=h3(t,Hce),p=a==="vertical"?"vertical":"horizontal",y=d??!1,x=_H(),S=f.id,w=f.baseLine,_=h3(f,Vce),E=za(_),T=R.createElement(H_,q0({},f,{id:S,baseLine:w,connectNulls:y,stroke:"none",className:"recharts-area-area",layout:p})),P=c!=="none"&&R.createElement(H_,q0({},E,{className:"recharts-area-curve",layout:p,type:f.type,connectNulls:y,fill:"none",stroke:c,points:f.points})),O=c!=="none"&&l&&Array.isArray(w)&&R.createElement(H_,q0({},E,{className:"recharts-area-curve",layout:p,type:f.type,connectNulls:y,fill:"none",stroke:c,points:w}));if(o&&(i||n<1)){var N;return R.createElement(Ko,null,R.createElement("defs",null,R.createElement("clipPath",{id:x},R.createElement(Xce,{alpha:n,points:(N=f.points)!==null&&N!==void 0?N:[],baseLine:w,layout:p,strokeWidth:f.strokeWidth}))),R.createElement(Ko,{clipPath:"url(#".concat(x,")")},T,P,O))}return R.createElement(R.Fragment,null,T,P,O)}var Kce=["id"],Yce=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function $w(){return $w=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},$w.apply(null,arguments)}function zH(t,e){if(t==null)return{};var n,r,i=Zce(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 Zce(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 p3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Rg(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?p3(Object(n),!0).forEach(function(r){Qce(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):p3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Qce(t,e,n){return(e=Jce(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Jce(t){var e=eue(t,"string");return typeof e=="symbol"?e:e+""}function eue(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 tue=(t,e)=>t==null?[]:e===1?t.flatMap(n=>n.status==="removed"?[]:[n.next]):t.flatMap(n=>n.status==="matched"?[Rg(Rg({},n.next),{},{x:Dc(n.prev.x,n.next.x,e),y:Dc(n.prev.y,n.next.y,e)})]:n.status==="added"?[n.next]:[]),BH={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",animationMatchBy:eR,animationInterpolateFn:tue,connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,shape:qce,xAxisId:0,yAxisId:0,zIndex:Ms.area};function Xw(t,e){return t&&t!=="none"?t:e}var nue=t=>{var e=t.dataKey,n=t.name,r=t.stroke,i=t.fill,s=t.legendType,o=t.hide;return[{inactive:o,dataKey:e,type:s,color:Xw(r,i),value:f4(n,e),payload:t}]},rue=R.memo(t=>{var e=t.dataKey,n=t.data,r=t.stroke,i=t.strokeWidth,s=t.fill,o=t.name,a=t.hide,l=t.unit,c=t.tooltipType,d=t.id,f={dataDefinedOnItem:n,getPosition:Hg,settings:{stroke:r,strokeWidth:i,fill:s,dataKey:e,nameKey:void 0,name:f4(o,e),hide:a,type:c,color:Xw(r,s),unit:l,graphicalItemId:d}};return R.createElement(mae,{tooltipEntrySettings:f})});function iue(t){var e=t.clipPathId,n=t.points,r=t.props,i=r.needClip,s=r.dot,o=r.dataKey,a=za(r);return R.createElement(ile,{points:n,dot:s,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:a,needClip:i,clipPathId:e})}function sue(t){var e=t.showLabels,n=t.children,r=t.points,i=r.map(s=>{var o,a,l={x:(o=s.x)!==null&&o!==void 0?o:0,y:(a=s.y)!==null&&a!==void 0?a:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Rg(Rg({},l),{},{value:s.value,payload:s.payload,parentViewBox:void 0,viewBox:l,fill:void 0})});return R.createElement(eae,{value:e?i:void 0},n)}function oue(t){var e=t.points,n=t.baseLine,r=t.needClip,i=t.clipPathId,s=t.props,o=t.animationElapsedTime,a=t.isAnimating,l=t.isEntrance,c=s.layout,d=s.type,f=s.stroke,p=s.connectNulls,y=s.isRange,x=s.shape,S=s.id,w=zH(s,Kce),_=qo(w),E=Rg(Rg({},_),{},{id:S,points:e,connectNulls:p,type:d,baseLine:n,layout:c,stroke:f,isRange:y,animationElapsedTime:o,isAnimating:a,isEntrance:l});return R.createElement(R.Fragment,null,(e==null?void 0:e.length)>1&&R.createElement(Ko,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},R.createElement(pae,{option:x,DefaultShape:BH.shape,shapeProps:E})),R.createElement(iue,{points:e,props:w,clipPathId:i}))}function aue(t,e,n){if(kt(t)){var r=kt(e)?e:void 0;return Dc(r,t,n)}if(Vi(t)||Rl(t)){var i=kt(e)?e:void 0;return Dc(i,0,n)}return t}function lue(t){var e=t.needClip,n=t.clipPathId,r=t.props,i=t.previousPointsRef,s=t.previousBaselineRef,o=r.points,a=r.baseLine,l=r.isAnimationActive,c=r.animationBegin,d=r.animationDuration,f=r.animationEasing,p=r.animationMatchBy,y=r.animationInterpolateFn,x=R.useMemo(()=>({points:o,baseLine:a}),[o,a]),S=bH(x,s),w=XC(),_=Iae(r.onAnimationStart,r.onAnimationEnd),E=_.isAnimating,T=_.handleAnimationStart,P=_.handleAnimationEnd,O=S.startValue;if(w==null)return null;var N;return Array.isArray(a)&&Array.isArray(O)?N=kP(O,a,p):Array.isArray(a)?N=kP(null,a,p):N=null,R.createElement(kae,{animationInput:x,animationIdPrefix:"recharts-area-",items:o,previousItemsRef:i,isAnimationActive:l,animationBegin:c,animationDuration:d,animationEasing:f,onAnimationStart:T,onAnimationEnd:P,animationInterpolateFn:y,animationMatchBy:p,layout:w},(D,z,G)=>{var k;return z===1?k=a:Array.isArray(a)?k=y(N,z,w):k=G?a:aue(a,O,z),S.syncStepValue(k,z),R.createElement(sue,{showLabels:!E,points:o},r.children,R.createElement(oue,{points:D,baseLine:k,needClip:e,clipPathId:n,props:r,animationElapsedTime:z,isAnimating:E||z<1,isEntrance:G}),R.createElement(rae,{label:r.label}))})}function cue(t){var e=t.needClip,n=t.clipPathId,r=t.props,i=R.useRef(null),s=R.useRef();return R.createElement(lue,{needClip:e,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:s})}class uue extends R.PureComponent{render(){var e=this.props,n=e.hide,r=e.dot,i=e.points,s=e.className,o=e.top,a=e.left,l=e.needClip,c=e.xAxisId,d=e.yAxisId,f=e.width,p=e.height,y=e.id,x=e.baseLine,S=e.zIndex;if(n)return null;var w=tr("recharts-area",s),_=y,E=Lce(r),T=E.r,P=E.strokeWidth,O=yH(r),N=T*2+P,D=l?"url(#clipPath-".concat(O?"":"dots-").concat(_,")"):void 0;return R.createElement(su,{zIndex:S},R.createElement(Ko,{className:w},l&&R.createElement("defs",null,R.createElement(Oce,{clipPathId:_,xAxisId:c,yAxisId:d}),!O&&R.createElement("clipPath",{id:"clipPath-dots-".concat(_)},R.createElement("rect",{x:a-N/2,y:o-N/2,width:f+N,height:p+N}))),R.createElement(cue,{needClip:l,clipPathId:_,props:this.props})),R.createElement(s3,{points:i,mainColor:Xw(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:D}),this.props.isRange&&Array.isArray(x)&&R.createElement(s3,{points:x,mainColor:Xw(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:D}))}}function due(t){var e,n=t.activeDot,r=t.animationBegin,i=t.animationDuration,s=t.animationEasing,o=t.connectNulls,a=t.dot,l=t.fill,c=t.fillOpacity,d=t.hide,f=t.isAnimationActive,p=t.legendType,y=t.stroke,x=t.xAxisId,S=t.yAxisId,w=zH(t,Yce),_=Vg(),E=KB(),T=kH(x,S),P=T.needClip,O=Js(),N=(e=Ft(he=>Bce(he,t.id,O)))!==null&&e!==void 0?e:{},D=N.points,z=N.isRange,G=N.baseLine,k=nR();if(_!=="horizontal"&&_!=="vertical"||k==null||E!=="AreaChart"&&E!=="ComposedChart")return null;var j=k.height,H=k.width,ee=k.x,te=k.y;return!D||!D.length?null:R.createElement(uue,$w({},w,{activeDot:n,animationBegin:r,animationDuration:i,animationEasing:s,baseLine:G,connectNulls:o,dot:a,fill:l,fillOpacity:c,height:j,hide:d,layout:_,isAnimationActive:f,isRange:z,legendType:p,needClip:P,points:D,stroke:y,width:H,left:ee,top:te,xAxisId:x,yAxisId:S}))}var fue=(t,e,n,r,i)=>{var s=n??e;if(kt(s))return s;var o=t==="horizontal"?i:r,a=o.scale.domain();if(o.type==="number"){var l=Math.max(a[0],a[1]),c=Math.min(a[0],a[1]);return s==="dataMin"?c:s==="dataMax"||l<0?l:Math.max(Math.min(a[0],a[1]),0)}return s==="dataMin"?a[0]:s==="dataMax"?a[1]:a[0]};function hue(t){var e=t.areaSettings,n=e.connectNulls,r=e.baseValue,i=e.dataKey,s=t.stackedData,o=t.layout,a=t.chartBaseValue,l=t.xAxis,c=t.yAxis,d=t.displayedData,f=t.dataStartIndex,p=t.xAxisTicks,y=t.yAxisTicks,x=t.bandSize,S=s&&s.length,w=fue(o,a,r,l,c),_=o==="horizontal",E=!1,T=d.map((O,N)=>{var D,z,G,k;if(S)k=s[f+N];else{var j=yi(O,i);Array.isArray(j)?(k=j,E=!0):k=[w,j]}var H=(D=(z=k)===null||z===void 0?void 0:z[1])!==null&&D!==void 0?D:null,ee=H==null||S&&!n&&yi(O,i)==null;if(_){var te;return{x:ck({axis:l,ticks:p,bandSize:x,entry:O,index:N}),y:ee?null:(te=c.scale.map(H))!==null&&te!==void 0?te:null,value:k,payload:O}}return{x:ee?null:(G=l.scale.map(H))!==null&&G!==void 0?G:null,y:ck({axis:c,ticks:y,bandSize:x,entry:O,index:N}),value:k,payload:O}}),P;return S||E?P=T.map(O=>{var N,D=Array.isArray(O.value)?O.value[0]:null;if(_){var z;return{x:O.x,y:D!=null&&O.y!=null&&(z=c.scale.map(D))!==null&&z!==void 0?z:null,payload:O.payload}}return{x:D!=null&&(N=l.scale.map(D))!==null&&N!==void 0?N:null,y:O.y,payload:O.payload}}):P=_?c.scale.map(w):l.scale.map(w),{points:T,baseLine:P??0,isRange:E}}function pue(t){var e=Qo(t,BH),n=Js();return R.createElement(Hae,{id:e.id,type:"area"},r=>R.createElement(R.Fragment,null,R.createElement(gae,{legendPayload:nue(e)}),R.createElement(rue,{dataKey:e.dataKey,data:e.data,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,unit:e.unit,tooltipType:e.tooltipType,id:r}),R.createElement(Kae,{type:"area",id:r,data:e.data,dataKey:e.dataKey,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,stackId:ZK(e.stackId),hide:e.hide,barSize:void 0,baseValue:e.baseValue,isPanorama:n,connectNulls:e.connectNulls}),R.createElement(due,$w({},e,{id:r}))))}var HH=R.memo(pue,xS);HH.displayName="Area";var mue=["domain","range"],gue=["domain","range"];function m3(t,e){if(t==null)return{};var n,r,i=vue(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 vue(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 g3(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 VH(t,e){if(t===e)return!0;var n=t.domain,r=t.range,i=m3(t,mue),s=e.domain,o=e.range,a=m3(e,gue);return!g3(n,s)||!g3(r,o)?!1:xS(i,a)}var yue=["type"],xue=["dangerouslySetInnerHTML","ticks","scale"],bue=["id","scale"];function OP(){return OP=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},OP.apply(null,arguments)}function v3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function y3(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?v3(Object(n),!0).forEach(function(r){_ue(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):v3(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 LP(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}function Eue(t){var e=Wr(),n=R.useRef(null),r=XC(),i=t.type,s=LP(t,yue),o=SS(r,"xAxis",i),a=R.useMemo(()=>{if(o!=null)return y3(y3({},s),{},{type:o})},[s,o]);return R.useLayoutEffect(()=>{a!=null&&(n.current===null?e(cle(a)):n.current!==a&&e(ule({prev:n.current,next:a})),n.current=a)},[a,e]),R.useLayoutEffect(()=>()=>{n.current&&(e(dle(n.current)),n.current=null)},[e]),null}var Aue=t=>{var e=t.xAxisId,n=t.className,r=Ft(p4),i=Js(),s="xAxis",o=Ft(p=>MB(p,s,e,i)),a=Ft(p=>ore(p,e)),l=Ft(p=>fre(p,e)),c=Ft(p=>Bz(p,e));if(a==null||l==null||c==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var d=LP(t,xue);c.id,c.scale;var f=LP(c,bue);return R.createElement(iR,OP({},d,f,{x:l.x,y:l.y,width:a.width,height:a.height,className:tr("recharts-".concat(s," ").concat(s),n),viewBox:r,ticks:o,axisType:s,axisId:e}))},Tue={allowDataOverflow:ti.allowDataOverflow,allowDecimals:ti.allowDecimals,allowDuplicatedCategory:ti.allowDuplicatedCategory,angle:ti.angle,axisLine:Hc.axisLine,height:ti.height,hide:!1,includeHidden:ti.includeHidden,interval:ti.interval,label:!1,minTickGap:ti.minTickGap,mirror:ti.mirror,orientation:ti.orientation,padding:ti.padding,reversed:ti.reversed,scale:ti.scale,tick:ti.tick,tickCount:ti.tickCount,tickLine:Hc.tickLine,tickSize:Hc.tickSize,type:ti.type,niceTicks:ti.niceTicks,xAxisId:0},Pue=t=>{var e=Qo(t,Tue);return R.createElement(R.Fragment,null,R.createElement(Eue,{allowDataOverflow:e.allowDataOverflow,allowDecimals:e.allowDecimals,allowDuplicatedCategory:e.allowDuplicatedCategory,angle:e.angle,dataKey:e.dataKey,domain:e.domain,height:e.height,hide:e.hide,id:e.xAxisId,includeHidden:e.includeHidden,interval:e.interval,minTickGap:e.minTickGap,mirror:e.mirror,name:e.name,orientation:e.orientation,padding:e.padding,reversed:e.reversed,scale:e.scale,tick:e.tick,tickCount:e.tickCount,tickFormatter:e.tickFormatter,ticks:e.ticks,type:e.type,unit:e.unit,niceTicks:e.niceTicks}),R.createElement(Aue,e))},GH=R.memo(Pue,VH);GH.displayName="XAxis";var Cue=["type"],Rue=["dangerouslySetInnerHTML","ticks","scale"],Nue=["id","scale"];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)}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 b3(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){Iue(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 Iue(t,e,n){return(e=kue(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function kue(t){var e=Oue(t,"string");return typeof e=="symbol"?e:e+""}function Oue(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 UP(t,e){if(t==null)return{};var n,r,i=Lue(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 Lue(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 Due(t){var e=Wr(),n=R.useRef(null),r=XC(),i=t.type,s=UP(t,Cue),o=SS(r,"yAxis",i),a=R.useMemo(()=>{if(o!=null)return b3(b3({},s),{},{type:o})},[o,s]);return R.useLayoutEffect(()=>{a!=null&&(n.current===null?e(fle(a)):n.current!==a&&e(hle({prev:n.current,next:a})),n.current=a)},[a,e]),R.useLayoutEffect(()=>()=>{n.current&&(e(ple(n.current)),n.current=null)},[e]),null}function Uue(t){var e=t.yAxisId,n=t.className,r=t.width,i=t.label,s=R.useRef(null),o=R.useRef(null),a=Ft(p4),l=Js(),c=Wr(),d="yAxis",f=Ft(_=>mre(_,e)),p=Ft(_=>pre(_,e)),y=Ft(_=>MB(_,d,e,l)),x=Ft(_=>Hz(_,e));if(R.useLayoutEffect(()=>{if(!(r!=="auto"||!f||J2(i)||R.isValidElement(i)||x==null)){var _=s.current;if(_){var E=_.getCalculatedWidth();Math.round(f.width)!==Math.round(E)&&c(mle({id:e,width:E}))}}},[y,f,c,i,e,r,x]),f==null||p==null||x==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var S=UP(t,Rue);x.id,x.scale;var w=UP(x,Nue);return R.createElement(iR,DP({},S,w,{ref:s,labelRef:o,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:a,ticks:y,axisType:d,axisId:e}))}var jue={allowDataOverflow:ni.allowDataOverflow,allowDecimals:ni.allowDecimals,allowDuplicatedCategory:ni.allowDuplicatedCategory,angle:ni.angle,axisLine:Hc.axisLine,hide:!1,includeHidden:ni.includeHidden,interval:ni.interval,label:!1,minTickGap:ni.minTickGap,mirror:ni.mirror,orientation:ni.orientation,padding:ni.padding,reversed:ni.reversed,scale:ni.scale,tick:ni.tick,tickCount:ni.tickCount,tickLine:Hc.tickLine,tickSize:Hc.tickSize,type:ni.type,niceTicks:ni.niceTicks,width:ni.width,yAxisId:0},Fue=t=>{var e=Qo(t,jue);return R.createElement(R.Fragment,null,R.createElement(Due,{interval:e.interval,id:e.yAxisId,scale:e.scale,type:e.type,domain:e.domain,allowDataOverflow:e.allowDataOverflow,dataKey:e.dataKey,allowDuplicatedCategory:e.allowDuplicatedCategory,allowDecimals:e.allowDecimals,tickCount:e.tickCount,padding:e.padding,includeHidden:e.includeHidden,reversed:e.reversed,ticks:e.ticks,width:e.width,orientation:e.orientation,mirror:e.mirror,hide:e.hide,unit:e.unit,name:e.name,angle:e.angle,minTickGap:e.minTickGap,tick:e.tick,tickFormatter:e.tickFormatter,niceTicks:e.niceTicks}),R.createElement(Uue,e))},WH=R.memo(Fue,VH);WH.displayName="YAxis";var zue=(t,e)=>e,lR=ke([zue,hr,nz,wi,VB,iu,Uie,Wi],Gie);function Bue(t){return"getBBox"in t.currentTarget&&typeof t.currentTarget.getBBox=="function"}function cR(t){var e=t.currentTarget.getBoundingClientRect(),n,r;if(Bue(t)){var i=t.currentTarget.getBBox();n=i.width>0?e.width/i.width:1,r=i.height>0?e.height/i.height:1}else{var s=t.currentTarget;n=s.offsetWidth>0?e.width/s.offsetWidth:1,r=s.offsetHeight>0?e.height/s.offsetHeight:1}var o=(a,l)=>({relativeX:Math.round((a-e.left)/n),relativeY:Math.round((l-e.top)/r)});return"touches"in t?Array.from(t.touches).map(a=>o(a.clientX,a.clientY)):o(t.clientX,t.clientY)}var $H=Mo("mouseClick"),XH=$y();XH.startListening({actionCreator:$H,effect:(t,e)=>{var n=t.payload,r=lR(e.getState(),cR(n));(r==null?void 0:r.activeIndex)!=null&&e.dispatch(Rre({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var jP=Mo("mouseMove"),qH=$y(),dm=null,Mf=null,VE=null;qH.startListening({actionCreator:jP,effect:(t,e)=>{var n=t.payload,r=e.getState(),i=r.eventSettings,s=i.throttleDelay,o=i.throttledEvents,a=o==="all"||(o==null?void 0:o.includes("mousemove"));dm!==null&&(cancelAnimationFrame(dm),dm=null),Mf!==null&&(typeof s!="number"||!a)&&(clearTimeout(Mf),Mf=null),VE=cR(n);var l=()=>{var c=e.getState(),d=sx(c,c.tooltip.settings.shared);if(!VE){dm=null,Mf=null;return}if(d==="axis"){var f=lR(c,VE);(f==null?void 0:f.activeIndex)!=null?e.dispatch(kB({activeIndex:f.activeIndex,activeDataKey:void 0,activeCoordinate:f.activeCoordinate})):e.dispatch(IB())}dm=null,Mf=null};if(!a){l();return}s==="raf"?dm=requestAnimationFrame(l):typeof s=="number"&&Mf===null&&(Mf=setTimeout(l,s))}});function Hue(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 _3={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},KH=cs({name:"rootProps",initialState:_3,reducers:{updateOptions:(t,e)=>{var n;t.accessibilityLayer=e.payload.accessibilityLayer,t.barCategoryGap=e.payload.barCategoryGap,t.barGap=(n=e.payload.barGap)!==null&&n!==void 0?n:_3.barGap,t.barSize=e.payload.barSize,t.maxBarSize=e.payload.maxBarSize,t.stackOffset=e.payload.stackOffset,t.syncId=e.payload.syncId,t.syncMethod=e.payload.syncMethod,t.className=e.payload.className,t.baseValue=e.payload.baseValue,t.reverseStackOrder=e.payload.reverseStackOrder}}}),Vue=KH.reducer,Gue=KH.actions.updateOptions,Wue=null,$ue={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)},YH=cs({name:"polarOptions",initialState:Wue,reducers:$ue});YH.actions.updatePolarOptions;var Xue=YH.reducer,ZH=Mo("keyDown"),QH=Mo("focus"),JH=Mo("blur"),FS=$y(),fm=null,Ef=null,Ob=null;FS.startListening({actionCreator:ZH,effect:(t,e)=>{Ob=t.payload,fm!==null&&(cancelAnimationFrame(fm),fm=null);var n=e.getState(),r=n.eventSettings,i=r.throttleDelay,s=r.throttledEvents,o=s==="all"||s.includes("keydown");Ef!==null&&(typeof i!="number"||!o)&&(clearTimeout(Ef),Ef=null);var a=()=>{try{var l=e.getState(),c=l.rootProps.accessibilityLayer!==!1;if(!c)return;var d=l.tooltip.keyboardInteraction,f=Ob;if(f!=="ArrowRight"&&f!=="ArrowLeft"&&f!=="Enter")return;var p=$0(d,Uh(l),Pg(l),Cg(l)),y=p==null?-1:Number(p),x=!Number.isFinite(y)||y<0,S=iu(l),w=Uh(l),_=sx(l,l.tooltip.settings.shared);if(f==="Enter"){if(x)return;var E=Bw(l,_,"hover",String(d.index));e.dispatch(zw({active:!d.active,activeIndex:d.index,activeCoordinate:E}));return}var T=bre(l),P=T==="left-to-right"?1:-1,O=f==="ArrowRight"?1:-1,N;if(x){var D=Pg(l),z=Cg(l),G=O*P,k=he=>({active:!1,index:String(he),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(N=-1,G>0){for(var j=0;j<w.length;j++)if($0(k(j),w,D,z)!=null){N=j;break}}else for(var H=w.length-1;H>=0;H--)if($0(k(H),w,D,z)!=null){N=H;break}if(N<0)return}else{N=y+O*P;var ee=(S==null?void 0:S.length)||w.length;if(ee===0||N>=ee||N<0)return}var te=Bw(l,_,"hover",String(N));e.dispatch(zw({active:!0,activeIndex:N.toString(),activeCoordinate:te}))}finally{fm=null,Ef=null}};if(!o){a();return}i==="raf"?fm=requestAnimationFrame(a):typeof i=="number"&&Ef===null&&(a(),Ob=null,Ef=setTimeout(()=>{Ob?a():(Ef=null,fm=null)},i))}});FS.startListening({actionCreator:QH,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var i=n.tooltip.keyboardInteraction;if(!i.active&&i.index==null){var s="0",o=sx(n,n.tooltip.settings.shared),a=Bw(n,o,"hover",String(s));e.dispatch(zw({active:!0,activeIndex:s,activeCoordinate:a}))}}}});FS.startListening({actionCreator:JH,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var i=n.tooltip.keyboardInteraction;i.active&&e.dispatch(zw({active:!1,activeIndex:i.index,activeCoordinate:i.coordinate}))}}});function eV(t){t.persist();var e=t.currentTarget;return new Proxy(t,{get:(n,r)=>{if(r==="currentTarget")return e;var i=Reflect.get(n,r);return typeof i=="function"?i.bind(n):i}})}var zo=Mo("externalEvent"),tV=$y(),Lb=new Map,f0=new Map,GE=new Map;tV.startListening({actionCreator:zo,effect:(t,e)=>{var n=t.payload,r=n.handler,i=n.reactEvent;if(r!=null){var s=i.type,o=eV(i);GE.set(s,{handler:r,reactEvent:o});var a=Lb.get(s);a!==void 0&&(cancelAnimationFrame(a),Lb.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=f0.get(s);x!==void 0&&(typeof d!="number"||!y)&&(clearTimeout(x),f0.delete(s));var S=()=>{var E=GE.get(s);try{if(!E)return;var T=E.handler,P=E.reactEvent,O=e.getState(),N={activeCoordinate:wie(O),activeDataKey:xie(O),activeIndex:wy(O),activeLabel:$B(O),activeTooltipIndex:wy(O),isTooltipActive:Sie(O)};T&&T(N,P)}finally{Lb.delete(s),f0.delete(s),GE.delete(s)}};if(!y){S();return}if(d==="raf"){var w=requestAnimationFrame(S);Lb.set(s,w)}else if(typeof d=="number"){if(!f0.has(s)){S();var _=setTimeout(S,d);f0.set(s,_)}}else S()}}});var que=ke([Zg],t=>t.tooltipItemPayloads),Kue=ke([que,(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)}}}),nV=Mo("touchMove"),rV=$y(),Af=null,Hu=null,w3=null,h0=null;rV.startListening({actionCreator:nV,effect:(t,e)=>{var n=t.payload;if(!(n.touches==null||n.touches.length===0)){h0=eV(n);var r=e.getState(),i=r.eventSettings,s=i.throttleDelay,o=i.throttledEvents,a=o==="all"||o.includes("touchmove");Af!==null&&(cancelAnimationFrame(Af),Af=null),Hu!==null&&(typeof s!="number"||!a)&&(clearTimeout(Hu),Hu=null),w3=Array.from(n.touches).map(c=>cR({clientX:c.clientX,clientY:c.clientY,currentTarget:n.currentTarget}));var l=()=>{if(h0!=null){var c=e.getState(),d=sx(c,c.tooltip.settings.shared);if(d==="axis"){var f,p=(f=w3)===null||f===void 0?void 0:f[0];if(p==null){Af=null,Hu=null;return}var y=lR(c,p);(y==null?void 0:y.activeIndex)!=null&&e.dispatch(kB({activeIndex:y.activeIndex,activeDataKey:void 0,activeCoordinate:y.activeCoordinate}))}else if(d==="item"){var x,S=h0.touches[0];if(document.elementFromPoint==null||S==null)return;var w=document.elementFromPoint(S.clientX,S.clientY);if(!w||!w.getAttribute)return;var _=w.getAttribute(iY),E=(x=w.getAttribute(sY))!==null&&x!==void 0?x:void 0,T=Qh(c).find(N=>N.id===E);if(_==null||T==null||E==null)return;var P=T.dataKey,O=Kue(c,_,E);e.dispatch(Cre({activeDataKey:P,activeIndex:_,activeCoordinate:O,activeGraphicalItemId:E}))}Af=null,Hu=null}};if(!a){l();return}s==="raf"?Af=requestAnimationFrame(l):typeof s=="number"&&Hu===null&&(l(),h0=null,Hu=setTimeout(()=>{h0?l():(Hu=null,Af=null)},s))}}});var iV={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},sV=cs({name:"eventSettings",initialState:iV,reducers:{setEventSettings:(t,e)=>{e.payload.throttleDelay!=null&&(t.throttleDelay=e.payload.throttleDelay),e.payload.throttledEvents!=null&&(t.throttledEvents=e.payload.throttledEvents)}}}),Yue=sV.actions.setEventSettings,Zue=sV.reducer,Que=L5({brush:Ele,cartesianAxis:gle,chartData:_se,errorBars:kce,eventSettings:Zue,graphicalItems:Xae,layout:HK,legend:nZ,options:gse,polarAxis:sae,polarOptions:Xue,referenceElements:Cle,renderedTicks:Zle,rootProps:Vue,tooltip:Nre,zIndex:rse}),Jue=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return hK({reducer:Que,preloadedState:e,middleware:r=>{var i;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([XH.middleware,qH.middleware,FS.middleware,tV.middleware,rV.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(Y5({type:"raf"}))},devTools:{serialize:{replacer:Hue},name:"recharts-".concat(n)}})};function ede(t){var e=t.preloadedState,n=t.children,r=t.reduxStoreName,i=Js(),s=R.useRef(null);if(i)return n;s.current==null&&(s.current=Jue(e,r));var o=jC;return R.createElement(yZ,{context:o,store:s.current},n)}function tde(t){var e=t.layout,n=t.margin,r=Wr(),i=Js();return R.useEffect(()=>{i||(r(FK(e)),r(jK(n)))},[r,i,e,n]),null}var nde=R.memo(tde,xS);function rde(t){var e=Wr();return R.useEffect(()=>{e(Gue(t))},[e,t]),null}var ide=t=>{var e=Wr();return R.useEffect(()=>{e(Yue(t))},[e,t]),null},sde=R.memo(ide,xS);function S3(t){var e=t.zIndex,n=t.isPanorama,r=R.useRef(null),i=Wr();return R.useLayoutEffect(()=>(r.current&&i(tse({zIndex:e,element:r.current,isPanorama:n})),()=>{i(nse({zIndex:e,isPanorama:n}))}),[i,e,n]),R.createElement("g",{tabIndex:-1,ref:r,className:"recharts-zIndex-layer_".concat(e)})}function M3(t){var e=t.children,n=t.isPanorama,r=Ft($ie);if(!r||r.length===0)return e;var i=r.filter(o=>o<0),s=r.filter(o=>o>0);return R.createElement(R.Fragment,null,i.map(o=>R.createElement(S3,{key:o,zIndex:o,isPanorama:n})),e,s.map(o=>R.createElement(S3,{key:o,zIndex:o,isPanorama:n})))}var ode=["children"];function ade(t,e){if(t==null)return{};var n,r,i=lde(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function lde(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 qw(){return qw=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},qw.apply(null,arguments)}var cde={width:"100%",height:"100%",display:"block"},ude=R.forwardRef((t,e)=>{var n=x4(),r=b4(),i=R4();if(!Il(n)||!Il(r))return null;var s=t.children,o=t.otherAttributes,a=t.title,l=t.desc,c,d;return o!=null&&(typeof o.tabIndex=="number"?c=o.tabIndex:c=i?0:void 0,typeof o.role=="string"?d=o.role:d=i?"application":void 0),R.createElement(JF,qw({},o,{title:a,desc:l,role:d,tabIndex:c,width:n,height:r,style:cde,ref:e}),s)}),dde=t=>{var e=t.children,n=Ft(pS);if(!n)return null;var r=n.width,i=n.height,s=n.y,o=n.x;return R.createElement(JF,{width:r,height:i,x:o,y:s},e)},E3=R.forwardRef((t,e)=>{var n=t.children,r=ade(t,ode),i=Js();return i?R.createElement(dde,null,R.createElement(M3,{isPanorama:!0},n)):R.createElement(ude,qw({ref:e},r),R.createElement(M3,{isPanorama:!1},n))});function fde(t,e){return gde(t)||mde(t,e)||pde(t,e)||hde()}function hde(){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 pde(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 mde(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function gde(t){if(Array.isArray(t))return t}function vde(){var t=Wr(),e=R.useState(null),n=fde(e,2),r=n[0],i=n[1],s=Ft(rY);return R.useEffect(()=>{if(r!=null){var o=r.getBoundingClientRect(),a=o.width/r.offsetWidth;wn(a)&&a!==s&&t(BK(a))}},[r,t,s]),i}function T3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function yde(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){xde(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 xde(t,e,n){return(e=bde(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function bde(t){var e=_de(t,"string");return typeof e=="symbol"?e:e+""}function _de(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 _d(){return _d=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},_d.apply(null,arguments)}function Kw(t,e){return Ede(t)||Mde(t,e)||Sde(t,e)||wde()}function wde(){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 Sde(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 Mde(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function Ede(t){if(Array.isArray(t))return t}var Ade=()=>(Rse(),null);function Yw(t){if(typeof t=="number")return t;if(typeof t=="string"){var e=parseFloat(t);if(!Number.isNaN(e))return e}return 0}var Tde=R.forwardRef((t,e)=>{var n,r,i=R.useRef(null),s=R.useState({containerWidth:Yw((n=t.style)===null||n===void 0?void 0:n.width),containerHeight:Yw((r=t.style)===null||r===void 0?void 0:r.height)}),o=Kw(s,2),a=o[0],l=o[1],c=R.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=R.useCallback(f=>{if(typeof e=="function"&&e(f),i.current!=null&&(i.current.disconnect(),i.current=null),f!=null&&typeof ResizeObserver<"u"){var p=f.getBoundingClientRect(),y=p.width,x=p.height;c(y,x);var S=_=>{var E=_[0];if(E!=null){var T=E.contentRect,P=T.width,O=T.height;c(P,O)}},w=new ResizeObserver(S);w.observe(f),i.current=w}},[e,c]);return R.useEffect(()=>()=>{var f=i.current;f!=null&&f.disconnect()},[c]),R.createElement(R.Fragment,null,R.createElement(qy,{width:a.containerWidth,height:a.containerHeight}),R.createElement("div",_d({ref:d},t)))}),Pde=R.forwardRef((t,e)=>{var n=t.width,r=t.height,i=R.useState({containerWidth:Yw(n),containerHeight:Yw(r)}),s=Kw(i,2),o=s[0],a=s[1],l=R.useCallback((d,f)=>{a(p=>{var y=Math.round(d),x=Math.round(f);return p.containerWidth===y&&p.containerHeight===x?p:{containerWidth:y,containerHeight:x}})},[]),c=R.useCallback(d=>{if(typeof e=="function"&&e(d),d!=null){var f=d.getBoundingClientRect(),p=f.width,y=f.height;l(p,y)}},[e,l]);return R.createElement(R.Fragment,null,R.createElement(qy,{width:o.containerWidth,height:o.containerHeight}),R.createElement("div",_d({ref:c},t)))}),Cde=R.forwardRef((t,e)=>{var n=t.width,r=t.height;return R.createElement(R.Fragment,null,R.createElement(qy,{width:n,height:r}),R.createElement("div",_d({ref:e},t)))}),Rde=R.forwardRef((t,e)=>{var n=t.width,r=t.height;return typeof n=="string"||typeof r=="string"?R.createElement(Pde,_d({},t,{ref:e})):typeof n=="number"&&typeof r=="number"?R.createElement(Cde,_d({},t,{width:n,height:r,ref:e})):R.createElement(R.Fragment,null,R.createElement(qy,{width:n,height:r}),R.createElement("div",_d({ref:e},t)))});function Nde(t){return t?Tde:Rde}var Ide=R.forwardRef((t,e)=>{var n=t.children,r=t.className,i=t.height,s=t.onClick,o=t.onContextMenu,a=t.onDoubleClick,l=t.onMouseDown,c=t.onMouseEnter,d=t.onMouseLeave,f=t.onMouseMove,p=t.onMouseUp,y=t.onTouchEnd,x=t.onTouchMove,S=t.onTouchStart,w=t.style,_=t.width,E=t.responsive,T=t.dispatchTouchEvents,P=T===void 0?!0:T,O=R.useRef(null),N=Wr(),D=R.useState(null),z=Kw(D,2),G=z[0],k=z[1],j=R.useState(null),H=Kw(j,2),ee=H[0],te=H[1],he=vde(),se=WC(),fe=(se==null?void 0:se.width)>0?se.width:_,B=(se==null?void 0:se.height)>0?se.height:i,J=R.useCallback(Le=>{he(Le),typeof e=="function"&&e(Le),k(Le),te(Le),Le!=null&&(O.current=Le)},[he,e,k,te]),Y=R.useCallback(Le=>{N($H(Le)),N(zo({handler:s,reactEvent:Le}))},[N,s]),V=R.useCallback(Le=>{N(jP(Le)),N(zo({handler:c,reactEvent:Le}))},[N,c]),q=R.useCallback(Le=>{N(IB()),N(zo({handler:d,reactEvent:Le}))},[N,d]),pe=R.useCallback(Le=>{N(jP(Le)),N(zo({handler:f,reactEvent:Le}))},[N,f]),ae=R.useCallback(()=>{N(QH())},[N]),ce=R.useCallback(()=>{N(JH())},[N]),Se=R.useCallback(Le=>{N(ZH(Le.key))},[N]),Ee=R.useCallback(Le=>{N(zo({handler:o,reactEvent:Le}))},[N,o]),$e=R.useCallback(Le=>{N(zo({handler:a,reactEvent:Le}))},[N,a]),Me=R.useCallback(Le=>{N(zo({handler:l,reactEvent:Le}))},[N,l]),Ge=R.useCallback(Le=>{N(zo({handler:p,reactEvent:Le}))},[N,p]),We=R.useCallback(Le=>{N(zo({handler:S,reactEvent:Le}))},[N,S]),ue=R.useCallback(Le=>{P&&N(nV(Le)),N(zo({handler:x,reactEvent:Le}))},[N,P,x]),Z=R.useCallback(Le=>{N(zo({handler:y,reactEvent:Le}))},[N,y]),Ve=Nde(E);return R.createElement(eH.Provider,{value:G},R.createElement($7.Provider,{value:ee},R.createElement(Ve,{width:fe??(w==null?void 0:w.width),height:B??(w==null?void 0:w.height),className:tr("recharts-wrapper",r),style:yde({position:"relative",cursor:"default",width:fe,height:B},w),onClick:Y,onContextMenu:Ee,onDoubleClick:$e,onFocus:ae,onBlur:ce,onKeyDown:Se,onMouseDown:Me,onMouseEnter:V,onMouseLeave:q,onMouseMove:pe,onMouseUp:Ge,onTouchEnd:Z,onTouchMove:ue,onTouchStart:We,ref:J},R.createElement(Ade,null),n)))}),kde=["width","height","responsive","children","className","style","compact","title","desc"];function Ode(t,e){if(t==null)return{};var n,r,i=Lde(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Lde(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 Dde=R.forwardRef((t,e)=>{var n=t.width,r=t.height,i=t.responsive,s=t.children,o=t.className,a=t.style,l=t.compact,c=t.title,d=t.desc,f=Ode(t,kde),p=za(f);return l?R.createElement(R.Fragment,null,R.createElement(qy,{width:n,height:r}),R.createElement(E3,{otherAttributes:p,title:c,desc:d},s)):R.createElement(Ide,{className:o,style:a,width:n,height:r,responsive:i??!1,onClick:t.onClick,onMouseLeave:t.onMouseLeave,onMouseEnter:t.onMouseEnter,onMouseMove:t.onMouseMove,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onContextMenu:t.onContextMenu,onDoubleClick:t.onDoubleClick,onTouchStart:t.onTouchStart,onTouchMove:t.onTouchMove,onTouchEnd:t.onTouchEnd},R.createElement(E3,{otherAttributes:p,title:c,desc:d,ref:e},R.createElement(Dle,null,s)))});function FP(){return FP=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},FP.apply(null,arguments)}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 Ude(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){jde(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 jde(t,e,n){return(e=Fde(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Fde(t){var e=zde(t,"string");return typeof e=="symbol"?e:e+""}function zde(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 Bde={top:5,right:5,bottom:5,left:5},Hde=Ude({accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:Bde,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},iV),Vde=R.forwardRef(function(e,n){var r,i=Qo(e.categoricalChartProps,Hde),s=e.chartName,o=e.defaultTooltipEventType,a=e.validateTooltipEventTypes,l=e.tooltipPayloadSearcher,c=e.categoricalChartProps,d={chartName:s,defaultTooltipEventType:o,validateTooltipEventTypes:a,tooltipPayloadSearcher:l,eventEmitter:void 0};return R.createElement(ede,{preloadedState:{options:d},reduxStoreName:(r=c.id)!==null&&r!==void 0?r:s},R.createElement(Mle,{chartData:c.data}),R.createElement(nde,{layout:i.layout,margin:i.margin}),R.createElement(sde,{throttleDelay:i.throttleDelay,throttledEvents:i.throttledEvents}),R.createElement(rde,{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}),R.createElement(Dde,FP({},i,{ref:n})))}),Gde=["axis"],Wde=R.forwardRef((t,e)=>R.createElement(Vde,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Gde,tooltipPayloadSearcher:pse,categoricalChartProps:t,ref:e}));const $de="rgba(130,130,150,0.14)",R3="rgba(130,130,150,0.85)";function Xde(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 oV(t,e){return`${e==="%"?Math.round(t):t>=1e3?`${(t/1e3).toFixed(1)}k`:Math.round(t).toString()}${e}`}function qde({active:t,payload:e,unit:n}){return!t||!(e!=null&&e.length)?null:v.jsx("div",{className:"rounded-lg border border-border/70 bg-popover/95 px-3 py-2 shadow-xl backdrop-blur",children:v.jsx("div",{className:"space-y-1",children:e.map(r=>v.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono",children:[v.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:r.color}}),v.jsx("span",{className:"uppercase tracking-wider text-muted-foreground",children:r.name}),v.jsx("span",{className:"ml-auto pl-3 font-bold tabular-nums text-foreground",children:oV(r.value,n)})]},r.dataKey))})})}function aV({data:t,series:e,unit:n="%",yMode:r="percent",height:i=176}){const s=t.reduce((a,l)=>e.reduce((c,d)=>Math.max(c,Number(l[d.key])||0),a),0),o=r==="percent"?Math.min(100,Math.max(25,Math.ceil(s*1.2/25)*25)):Math.max(Xde(s*1.15),10);return v.jsx("div",{style:{height:i},className:"w-full",children:v.jsx(jY,{width:"100%",height:"100%",children:v.jsxs(Wde,{data:t,margin:{top:8,right:6,bottom:0,left:-12},children:[v.jsx("defs",{children:e.map(a=>v.jsxs("linearGradient",{id:`grad-${a.key}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[v.jsx("stop",{offset:"0%",stopColor:a.color,stopOpacity:.22}),v.jsx("stop",{offset:"100%",stopColor:a.color,stopOpacity:0})]},a.key))}),v.jsx(NH,{vertical:!1,stroke:$de}),v.jsx(GH,{dataKey:"t",hide:!0}),v.jsx(WH,{domain:[0,o],ticks:[0,o/2,o],tickFormatter:a=>oV(a,n),width:42,axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:R3}}),v.jsx(Vse,{content:v.jsx(qde,{unit:n}),cursor:{stroke:R3,strokeOpacity:.4,strokeDasharray:"3 3"}}),e.map(a=>v.jsx(HH,{type:"monotone",dataKey:a.key,name:a.label,stroke:a.color,strokeWidth:2,fill:`url(#grad-${a.key})`,dot:!1,activeDot:{r:3,strokeWidth:0},isAnimationActive:!1,connectNulls:!0},a.key))]})})})}const Kde=[{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 Yde(){var o,a,l,c;const{sys:t,hist:e}=O7(),n=!!(t!=null&&t.gpu&&t.gpu.busy_percent!=null&&t.gpu.gtt_used!=null&&t.gpu.gtt_total!=null),r=Kde.filter(d=>d.key!=="gpu"||n),i={cpu:(o=t==null?void 0:t.cpu)==null?void 0:o.percent,ram:(a=t==null?void 0:t.ram)==null?void 0:a.percent,gpu:n?t.gpu.busy_percent:null,disk:(l=t==null?void 0:t.disk)==null?void 0:l.percent},s={cpu:(c=t==null?void 0:t.cpu)!=null&&c.cores?`${t.cpu.cores} Cores`:"",ram:t?`${sm(t.ram.used)}/${sm(t.ram.total)} GB`:"",gpu:n?`${sm(t.gpu.gtt_used)}/${sm(t.gpu.gtt_total)} GB`:"",disk:t!=null&&t.disk?`${sm(t.disk.used)}/${sm(t.disk.total)} GB`:""};return v.jsxs("div",{className:"flex flex-col justify-between rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[v.jsxs("div",{children:[v.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[v.jsx(Sd,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"System-Status"}),v.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),t?v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"mb-2 grid grid-cols-2 gap-x-4 gap-y-1.5",children:r.map(d=>v.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{background:d.color}}),v.jsx("span",{className:"shrink-0 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:d.label}),v.jsxs("span",{className:"shrink-0 font-mono text-xs font-bold tabular-nums text-foreground",children:[Math.round(i[d.key]??0),"%"]}),s[d.key]&&v.jsx("span",{className:"truncate font-mono text-[10px] text-muted-foreground/60",children:s[d.key]})]},d.key))}),v.jsx(aV,{data:e,series:r,unit:"%",yMode:"percent",height:176})]}):v.jsx("div",{className:"flex h-44 items-center justify-center text-xs text-muted-foreground",children:"Lade Systemdaten…"})]}),(t==null?void 0:t.temp)&&(t.temp.cpu||t.temp.gpu)&&v.jsxs("div",{className:"mt-3 flex gap-4 border-t border-border/30 pt-3 font-mono text-xs text-muted-foreground/80",children:[t.temp.cpu!=null&&v.jsxs("span",{children:["CPU Temp: ",t.temp.cpu," °C"]}),t.temp.gpu!=null&&v.jsxs("span",{children:["GPU Temp: ",t.temp.gpu," °C"]})]})]})}const uR="-",Zde=t=>{const e=Jde(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const a=o.split(uR);return a[0]===""&&a.length!==1&&a.shift(),lV(a,e)||Qde(o)},getConflictingClassGroupIds:(o,a)=>{const l=n[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},lV=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?lV(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(uR);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},N3=/^\[(.+)\]$/,Qde=t=>{if(N3.test(t)){const e=N3.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},Jde=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return tfe(Object.entries(t.classGroups),n).forEach(([s,o])=>{zP(o,r,s,e)}),r},zP=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:I3(e,i);s.classGroupId=n;return}if(typeof i=="function"){if(efe(i)){zP(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,o])=>{zP(o,I3(e,s),n,r)})})},I3=(t,e)=>{let n=t;return e.split(uR).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},efe=t=>t.isThemeGetter,tfe=(t,e)=>e?t.map(([n,r])=>{const i=r.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[n,i]}):t,nfe=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(s,o)=>{n.set(s,o),e++,e>t&&(e=0,r=n,n=new Map)};return{get(s){let o=n.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){n.has(s)?n.set(s,o):i(s,o)}}},cV="!",rfe=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,i=e[0],s=e.length,o=a=>{const l=[];let c=0,d=0,f;for(let w=0;w<a.length;w++){let _=a[w];if(c===0){if(_===i&&(r||a.slice(w,w+s)===e)){l.push(a.slice(d,w)),d=w+s;continue}if(_==="/"){f=w;continue}}_==="["?c++:_==="]"&&c--}const p=l.length===0?a:a.substring(d),y=p.startsWith(cV),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?a=>n({className:a,parseClassName:o}):o},ife=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},sfe=t=>({cache:nfe(t.cacheSize),parseClassName:rfe(t),...Zde(t)}),ofe=/\s+/,afe=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(ofe);let a="";for(let l=o.length-1;l>=0;l-=1){const c=o[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){a=c+(a.length>0?" "+a:a);continue}if(S=r(p),!S){a=c+(a.length>0?" "+a:a);continue}x=!1}const w=ife(d).join(":"),_=f?w+cV:w,E=_+S;if(s.includes(E))continue;s.push(E);const T=i(S,x);for(let P=0;P<T.length;++P){const O=T[P];s.push(_+O)}a=c+(a.length>0?" "+a:a)}return a};function lfe(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=uV(e))&&(r&&(r+=" "),r+=n);return r}const uV=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=uV(t[r]))&&(n&&(n+=" "),n+=e);return n};function cfe(t,...e){let n,r,i,s=o;function o(l){const c=e.reduce((d,f)=>f(d),t());return n=sfe(c),r=n.cache.get,i=n.cache.set,s=a,a(l)}function a(l){const c=r(l);if(c)return c;const d=afe(l,n);return i(l,d),d}return function(){return s(lfe.apply(null,arguments))}}const ir=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},dV=/^\[(?:([a-z-]+):)?(.+)\]$/i,ufe=/^\d+\/\d+$/,dfe=new Set(["px","full","screen"]),ffe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,hfe=/\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$/,pfe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,mfe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,gfe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,bc=t=>tg(t)||dfe.has(t)||ufe.test(t),Vu=t=>ev(t,"length",Mfe),tg=t=>!!t&&!Number.isNaN(Number(t)),WE=t=>ev(t,"number",tg),p0=t=>!!t&&Number.isInteger(Number(t)),vfe=t=>t.endsWith("%")&&tg(t.slice(0,-1)),dn=t=>dV.test(t),Gu=t=>ffe.test(t),yfe=new Set(["length","size","percentage"]),xfe=t=>ev(t,yfe,fV),bfe=t=>ev(t,"position",fV),_fe=new Set(["image","url"]),wfe=t=>ev(t,_fe,Afe),Sfe=t=>ev(t,"",Efe),m0=()=>!0,ev=(t,e,n)=>{const r=dV.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},Mfe=t=>hfe.test(t)&&!pfe.test(t),fV=()=>!1,Efe=t=>mfe.test(t),Afe=t=>gfe.test(t),Tfe=()=>{const t=ir("colors"),e=ir("spacing"),n=ir("blur"),r=ir("brightness"),i=ir("borderColor"),s=ir("borderRadius"),o=ir("borderSpacing"),a=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"),_=ir("opacity"),E=ir("padding"),T=ir("saturate"),P=ir("scale"),O=ir("sepia"),N=ir("skew"),D=ir("space"),z=ir("translate"),G=()=>["auto","contain","none"],k=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto",dn,e],H=()=>[dn,e],ee=()=>["",bc,Vu],te=()=>["auto",tg,dn],he=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],se=()=>["solid","dashed","dotted","double","none"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],B=()=>["start","end","center","between","around","evenly","stretch"],J=()=>["","0",dn],Y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],V=()=>[tg,dn];return{cacheSize:500,separator:":",theme:{colors:[m0],spacing:[bc,Vu],blur:["none","",Gu,dn],brightness:V(),borderColor:[t],borderRadius:["none","","full",Gu,dn],borderSpacing:H(),borderWidth:ee(),contrast:V(),grayscale:J(),hueRotate:V(),invert:J(),gap:H(),gradientColorStops:[t],gradientColorStopPositions:[vfe,Vu],inset:j(),margin:j(),opacity:V(),padding:H(),saturate:V(),scale:V(),sepia:J(),skew:V(),space:H(),translate:H()},classGroups:{aspect:[{aspect:["auto","square","video",dn]}],container:["container"],columns:[{columns:[Gu]}],"break-after":[{"break-after":Y()}],"break-before":[{"break-before":Y()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...he(),dn]}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:G()}],"overscroll-x":[{"overscroll-x":G()}],"overscroll-y":[{"overscroll-y":G()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[S]}],"inset-x":[{"inset-x":[S]}],"inset-y":[{"inset-y":[S]}],start:[{start:[S]}],end:[{end:[S]}],top:[{top:[S]}],right:[{right:[S]}],bottom:[{bottom:[S]}],left:[{left:[S]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",p0,dn]}],basis:[{basis:j()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",dn]}],grow:[{grow:J()}],shrink:[{shrink:J()}],order:[{order:["first","last","none",p0,dn]}],"grid-cols":[{"grid-cols":[m0]}],"col-start-end":[{col:["auto",{span:["full",p0,dn]},dn]}],"col-start":[{"col-start":te()}],"col-end":[{"col-end":te()}],"grid-rows":[{"grid-rows":[m0]}],"row-start-end":[{row:["auto",{span:[p0,dn]},dn]}],"row-start":[{"row-start":te()}],"row-end":[{"row-end":te()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",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:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[D]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[D]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",dn,e]}],"min-w":[{"min-w":[dn,e,"min","max","fit"]}],"max-w":[{"max-w":[dn,e,"none","full","min","max","fit","prose",{screen:[Gu]},Gu]}],h:[{h:[dn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[dn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[dn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[dn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Gu,Vu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",WE]}],"font-family":[{font:[m0]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",dn]}],"line-clamp":[{"line-clamp":["none",tg,WE]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",bc,dn]}],"list-image":[{"list-image":["none",dn]}],"list-style-type":[{list:["none","disc","decimal",dn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",bc,Vu]}],"underline-offset":[{"underline-offset":["auto",bc,dn]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:H()}],"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":[_]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...he(),bfe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",xfe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},wfe]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...se(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:se()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...se()]}],"outline-offset":[{"outline-offset":[bc,dn]}],"outline-w":[{outline:[bc,Vu]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[bc,Vu]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Gu,Sfe]}],"shadow-color":[{shadow:[m0]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...fe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":fe()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Gu,dn]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[T]}],sepia:[{sepia:[O]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[T]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",dn]}],duration:[{duration:V()}],ease:[{ease:["linear","in","out","in-out",dn]}],delay:[{delay:V()}],animate:[{animate:["none","spin","ping","pulse","bounce",dn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[P]}],"scale-x":[{"scale-x":[P]}],"scale-y":[{"scale-y":[P]}],rotate:[{rotate:[p0,dn]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[N]}],"skew-y":[{"skew-y":[N]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",dn]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",dn]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",dn]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[bc,Vu,WE]}],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"]}}},Pfe=cfe(Tfe);function nt(...t){return Pfe(tr(t))}function Ng(t){return t?t.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}function g0({label:t,value:e,tone:n}){return v.jsxs("div",{className:nt("flex items-center justify-between rounded-lg border px-3 py-1.5 text-xs",n==="alert"?"border-amber-500/30 bg-amber-500/5 font-semibold text-amber-400":n==="accent"?"border-primary/30 bg-primary/5 font-semibold text-primary":"border-border/30 bg-background/25 text-muted-foreground"),children:[v.jsx("span",{className:"flex items-center gap-1.5",children:t}),v.jsx("span",{className:"font-mono text-[10px]",children:e})]})}function Cfe(){var n;const{data:t}=RC(3e3),e=()=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:"maintenance"}}));return v.jsxs("div",{className:"flex flex-col justify-between rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border/20 pb-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(r9,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Updates & Pflege"})]}),(t==null?void 0:t.last_check)&&v.jsxs("span",{className:"font-mono text-[9px] text-muted-foreground/80",children:["Zuletzt gesucht: ",new Date(t.last_check*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"})]})]}),t?v.jsxs("div",{className:"space-y-1.5",children:[v.jsx(g0,{label:"OS-Pakete",tone:t.os>0?"alert":"muted",value:t.os>0?`${t.os} verfügbar`:"aktuell"}),v.jsx(g0,{label:"Inferenz-Engine (llama.cpp)",tone:t.engine>0?"alert":"muted",value:t.engine>0?"Update verfügbar":"aktuell"}),v.jsx(g0,{label:"Router (llama-swap)",tone:t.swap>0?"alert":"muted",value:t.swap>0?"Update verfügbar":"aktuell"}),v.jsx(g0,{label:"Modell-Upgrades",tone:t.models>0?"accent":"muted",value:t.models>0?`${t.models} verfügbar`:"aktuell"}),(n=t.components)==null?void 0:n.map(r=>v.jsx(g0,{tone:r.update===!0?"alert":"muted",label:v.jsxs(v.Fragment,{children:[r.name,r.reachable===!1&&v.jsx("span",{className:"text-[8px] font-bold uppercase text-red-400/80",children:"offline"})]}),value:r.update===!0?`Update: ${r.latest}`:r.update===!1?"aktuell":r.latest?`neueste: ${r.latest}`:"—"},r.key))]}):v.jsx("div",{className:"flex h-24 items-center justify-center text-xs text-muted-foreground",children:"Lade Updates..."})]}),v.jsxs("button",{onClick:e,className:"mt-4 flex h-9 w-full items-center justify-center gap-1.5 rounded-lg bg-primary text-xs font-semibold text-primary-foreground shadow-md shadow-primary/10 transition-all hover:opacity-90 cursor-pointer",children:["Updates verwalten & Pflege ",v.jsx(aF,{className:"h-3.5 w-3.5"})]})]})}function hV({type:t,title:e,message:n,defaultValue:r,autoValue:i,autoLabel:s,onConfirm:o,onCancel:a}){const l=R.useRef(null);return v.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-sm rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:e}),v.jsx("button",{onClick:a||(()=>o()),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Md,{className:"h-4 w-4"})})]}),v.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:n}),t==="prompt"&&v.jsxs("div",{className:"flex gap-2",children:[v.jsx("input",{ref:l,type:"text",defaultValue:r,className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground",autoFocus:!0,onKeyDown:c=>{var d;c.key==="Enter"&&o((d=l.current)==null?void 0:d.value)}}),i!==void 0&&v.jsx("button",{type:"button",onClick:()=>{l.current&&(l.current.value=i)},title:"Setup-bewussten Optimalwert eintragen",className:"h-9 px-3 shrink-0 text-xs font-semibold text-primary border border-primary/50 bg-primary/10 hover:bg-primary/20 rounded-lg transition-colors cursor-pointer",children:s||"Auto"})]}),v.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(t==="confirm"||t==="prompt")&&v.jsx("button",{onClick:a,className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Abbrechen"}),v.jsx("button",{onClick:()=>{var d;const c=t==="prompt"?(d=l.current)==null?void 0:d.value:void 0;o(c)},className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-lg transition-colors cursor-pointer",children:t==="confirm"?"Ja, fortfahren":t==="prompt"?"Übernehmen":"OK"})]})]})})}function tv(){const[t,e]=R.useState(null),n=R.useCallback(()=>e(null),[]),r=R.useCallback((a,l,c)=>{e({type:"alert",title:a,message:l,onConfirm:()=>{e(null),c==null||c()}})},[]),i=R.useCallback((a,l,c,d)=>{e({type:"confirm",title:a,message:l,onConfirm:()=>{e(null),c()},onCancel:()=>{e(null),d==null||d()}})},[]),s=R.useCallback((a,l,c,d,f,p)=>{e({type:"prompt",title:a,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()}})},[]),o=t?v.jsx(hV,{...t}):null;return{showAlert:r,showConfirm:i,showPrompt:s,close:n,dialogElement:o}}function Rfe(){const t=Rd(),{data:e}=CC(3e3),{data:n}=Bg(),{showAlert:r,dialogElement:i}=tv(),[s,o]=R.useState(!1),a=(n==null?void 0:n.models)??[];async function l(c){try{await It("/api/agent/brain",{method:"POST",body:JSON.stringify({model:c})}),r("Erfolgreich",`Hermes-Gehirn wurde auf '${c}' geändert. Der Gateway-Dienst wurde neu gestartet.`),t.invalidateQueries({queryKey:qn.agentStatus}),o(!1)}catch(d){r("Fehler",`Fehler beim Wechseln des Gehirns: ${d.message}`)}}return v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center justify-between mb-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx($c,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Hermes Agent"})]}),(e==null?void 0:e.terminal_url)&&v.jsxs("a",{href:Ng(e.terminal_url),target:"_blank",rel:"noopener",className:nt("flex items-center gap-1 px-3 py-1 rounded-lg text-xs font-medium transition-all",e.terminal_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/20":"border border-border text-muted-foreground"),children:[v.jsx(xg,{className:"h-3 w-3"})," Terminal öffnen"]})]}),e?v.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[v.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[v.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gateway"}),v.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[v.jsx("span",{className:nt("h-2 w-2 rounded-full",e.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),v.jsx("span",{className:"text-xs font-medium",children:e.gateway_reachable?"Online":"Offline"})]})]}),v.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[v.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Terminal"}),v.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[v.jsx("span",{className:nt("h-2 w-2 rounded-full",e.terminal_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),v.jsx("span",{className:"text-xs font-medium",children:e.terminal_reachable?"Online":"Offline"})]})]}),v.jsxs("div",{onClick:()=>o(!0),className:"p-3 bg-background/20 rounded-xl border border-border/40 hover:border-primary/45 hover:bg-background/30 transition-all duration-300 cursor-pointer",children:[v.jsxs("div",{className:"flex justify-between items-center",children:[v.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gehirn"}),v.jsx(Sd,{className:"h-3 w-3 text-primary"})]}),v.jsxs("div",{className:"text-xs font-medium mt-1 font-mono text-primary truncate flex items-center gap-1",children:[v.jsx(_C,{className:"h-3 w-3 shrink-0"}),e.brain_model||"auto"]})]}),v.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[v.jsxs("div",{className:"flex justify-between items-center",children:[v.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Verdrahtung"}),v.jsx(SC,{className:"h-3 w-3 text-primary"})]}),v.jsxs("div",{className:"text-[10px] font-mono mt-1 space-y-0.5 text-muted-foreground",children:[v.jsxs("div",{children:["Config: ",e.has_config?v.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),v.jsxs("div",{children:["Skills: ",e.has_skills?v.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),v.jsxs("div",{children:["Memory: ",e.has_memories?v.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]})]})]})]}):v.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Agenten-Status…"})]}),e&&v.jsxs("div",{className:"mt-3 border-t border-border/30 pt-3 space-y-1.5",children:[v.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[v.jsx("span",{children:"Telegram"}),v.jsx("span",{className:nt("font-semibold",e.telegram_enabled?"text-emerald-400":""),children:e.telegram_enabled?"aktiv":"nicht konfiguriert"})]}),v.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[v.jsx("span",{children:"MCP-Server"}),v.jsxs("span",{className:"font-semibold text-foreground",children:[e.mcp_server_count??0," verbunden"]})]}),v.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[v.jsx("span",{children:"PC Executor"}),v.jsx("span",{className:nt("font-semibold",e.pc_executor_reachable?"text-emerald-400":""),children:e.pc_executor_reachable?"erreichbar":"nicht verbunden"})]})]}),e&&s&&v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[v.jsx(Sd,{className:"h-4 w-4"}),v.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),v.jsx("button",{onClick:()=>o(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Md,{className:"h-4 w-4"})})]}),v.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',v.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",v.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",v.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),v.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:["auto","fast","heavy",...a.map(c=>{var d;return((d=c.name.split("/").pop())==null?void 0:d.replace(".gguf",""))||c.name})].map(c=>{const d=["auto","fast","heavy"].includes(c);return v.jsxs("button",{onClick:()=>l(c),className:nt("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",e.brain_model===c||!e.brain_model&&c==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[v.jsxs("div",{className:"flex flex-col text-left",children:[v.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:c}),v.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:d?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(e.brain_model===c||!e.brain_model&&c==="auto")&&v.jsx(Xo,{className:"h-4 w-4 shrink-0 text-primary"})]},c)})})]})}),i]})}function Nfe(){const t=Rd(),{data:e=[]}=BT({limit:3}),[n,r]=R.useState(""),[i,s]=R.useState("stable"),[o,a]=R.useState(!1);async function l(){if(!(!n.trim()||o)){a(!0);try{await It("/api/memory",{method:"POST",body:JSON.stringify({content:n,category:i,source:"dashboard"})}),r(""),t.invalidateQueries({queryKey:["memory"]})}catch(c){console.error(c)}finally{a(!1)}}}return v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[v.jsx(V1,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Gedächtnis"})]}),v.jsxs("div",{className:"space-y-3",children:[v.jsx("textarea",{value:n,onChange:c=>r(c.target.value),placeholder:"Fakt / Regel im Pool speichern...",rows:2,className:"w-full resize-none rounded-xl border border-border/50 bg-background/30 p-2 text-[10px] outline-none focus:ring-1 focus:ring-primary transition-all leading-normal"}),v.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[v.jsxs("select",{value:i,onChange:c=>s(c.target.value),className:"h-7 rounded-lg border border-border/50 bg-background/50 px-2 text-[10px] outline-none cursor-pointer",children:[v.jsx("option",{value:"stable",children:"🔵 Fakt"}),v.jsx("option",{value:"instruction",children:"📋 Regel"}),v.jsx("option",{value:"user",children:"👤 User"}),v.jsx("option",{value:"versioned",children:"🟡 Version"})]}),v.jsxs("button",{onClick:l,disabled:!n.trim()||o,className:"flex h-7 items-center gap-1 rounded-lg bg-primary px-3 text-[10px] font-semibold text-primary-foreground hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[v.jsx(kT,{className:"h-3.5 w-3.5"})," Speichern"]})]})]}),v.jsxs("div",{className:"mt-3.5 space-y-1.5",children:[v.jsx("div",{className:"text-[9px] text-muted-foreground uppercase font-bold tracking-wider",children:"Zuletzt gespeichert:"}),v.jsx("div",{className:"max-h-20 overflow-y-auto space-y-1 pr-1 scrollbar-thin",children:e.length===0?v.jsx("div",{className:"text-[10px] text-muted-foreground/75 py-1",children:"Keine Einträge vorhanden."}):e.map(c=>v.jsxs("div",{className:"text-[10px] bg-background/10 border border-border/30 rounded p-1.5 flex items-start gap-1.5",children:[v.jsx("span",{className:"shrink-0 text-[8px] font-mono text-muted-foreground/80 px-1 py-0.5 rounded bg-muted/20",children:c.category}),v.jsx("span",{className:"truncate flex-1 text-muted-foreground hover:text-foreground transition-colors",title:c.content,children:c.content})]},c.id))})]})]}),v.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Steht allen Clients per MCP zur Verfügung."})]})}const k3=[{key:"prompt",label:"Prompt",color:"#f59e0b"},{key:"completion",label:"Antwort",color:"#2dd4bf"}];function Ife(){const{data:t}=PC(3e3),e=I7(),n=e[e.length-1],r=n?Math.round(n.prompt+n.completion):0;return v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[v.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(bC,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Token-Durchsatz"}),v.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),t&&v.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[v.jsx("span",{className:"font-space text-3xl font-bold tracking-tight text-foreground tabular-nums",children:r.toLocaleString("de-DE")}),v.jsx("span",{className:"text-xs text-muted-foreground",children:"tok/s aktuell"})]}),t&&v.jsxs("div",{className:"mt-0.5 space-y-0.5 font-mono text-[11px] text-muted-foreground/70",children:[v.jsxs("div",{children:[t.total_tokens.toLocaleString("de-DE")," Tokens gesamt · ",v.jsxs("span",{className:"text-emerald-400/90",children:[t.saved_eur.toLocaleString("de-DE",{minimumFractionDigits:2})," € gespart"]})]}),v.jsxs("div",{className:"text-muted-foreground/55",children:["Input ",t.prompt_tokens.toLocaleString("de-DE")," · Output ",t.completion_tokens.toLocaleString("de-DE")]})]})]}),v.jsx("div",{className:"flex shrink-0 flex-col items-end gap-1.5 pt-1",children:k3.map(i=>v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:i.color}}),v.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:i.label}),v.jsx("span",{className:"font-mono text-xs font-bold tabular-nums text-foreground",children:Math.round((n==null?void 0:n[i.key])??0)})]},i.key))})]}),t?v.jsx(aV,{data:e,series:k3,unit:" tok/s",yMode:"auto",height:150}):v.jsx("div",{className:"flex h-[150px] items-center justify-center text-xs text-muted-foreground",children:"Lade Durchsatz…"}),v.jsx("div",{className:"mt-2 border-t border-border/30 pt-2 text-[10px] text-muted-foreground/70",children:"Durchsatz aus dem Gateway abgeleitet (Prefill vs. Generierung). Flach bei Leerlauf."})]})}function kfe(){const{data:t}=x7(3e3),{showAlert:e,dialogElement:n}=tv(),[r,i]=R.useState({});async function s(o){i(a=>({...a,[o]:!0}));try{const a=await It("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:o})});a.ok||e("Fehler",`Neustart fehlgeschlagen: ${a.err||"Unbekannt"}`)}catch(a){e("Fehler",`Fehler: ${a.message}`)}finally{i(a=>({...a,[o]:!1}))}}return v.jsxs("div",{className:"flex flex-col rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[v.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(tw,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Dienste"})]}),v.jsx("button",{onClick:()=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:"logs"}})),className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground transition-colors hover:text-primary cursor-pointer",children:"Logs / Pflege"})]}),t?v.jsxs("div",{className:"flex flex-1 flex-col",children:[v.jsx("div",{className:"space-y-1.5",children:t.services.map(o=>v.jsxs("div",{className:"group flex items-center justify-between gap-2 rounded-xl border border-border/30 bg-background/20 p-2.5",children:[v.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[v.jsx("span",{className:nt("h-2.5 w-2.5 shrink-0 rounded-full ring-2 ring-black/40",o.ok?"bg-emerald-500":"bg-amber-500")}),v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"truncate text-xs font-bold text-foreground",children:o.name}),v.jsx("div",{className:"truncate font-mono text-[9px] text-muted-foreground/60",children:o.url})]})]}),v.jsx("button",{onClick:()=>s(o.name),disabled:r[o.name],className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border border-border/40 text-muted-foreground opacity-0 transition-all hover:bg-primary/5 hover:text-primary group-hover:opacity-100",title:"Dienst neu starten",children:v.jsx(Qf,{className:nt("h-3.5 w-3.5",r[o.name]&&"animate-spin")})})]},o.name))}),v.jsxs("div",{className:"mt-auto flex flex-wrap gap-3 border-t border-border/20 pt-2.5 text-[10px] font-semibold text-muted-foreground",children:[v.jsxs("a",{href:Ng(t.links.engine_ui),target:"_blank",rel:"noopener",className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-primary transition-colors hover:bg-primary/10",children:[v.jsx(xg,{className:"h-3 w-3"})," Engine"]}),v.jsxs("a",{href:Ng(t.links.gateway),target:"_blank",rel:"noopener",className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-primary transition-colors hover:bg-primary/10",children:[v.jsx(xg,{className:"h-3 w-3"})," Gateway"]})]})]}):v.jsx("div",{className:"flex h-24 items-center justify-center text-xs text-muted-foreground",children:"Lade Dienste…"}),n]})}const $E=[{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 Db(t){return t==null?"—":t>=1e3?`${(t/1e3).toFixed(2)} s`:`${Math.round(t)} ms`}function Ofe({stat:t,label:e,hint:n,maxP95:r}){const i=!!t&&t.count>0,s=i&&t.p95_ms&&r>0?Math.max(4,Math.min(100,t.p95_ms/r*100)):0;return v.jsxs("div",{className:"space-y-1.5",children:[v.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[v.jsxs("div",{className:"flex items-baseline gap-2 min-w-0",children:[v.jsx("span",{className:"text-xs font-semibold text-foreground",children:e}),v.jsx("span",{className:"truncate text-[10px] text-muted-foreground/60",children:n})]}),i?v.jsx("span",{className:"shrink-0 font-mono text-sm font-bold tabular-nums text-foreground",children:Db(t.p50_ms)}):v.jsx("span",{className:"shrink-0 text-[10px] italic text-muted-foreground/50",children:"noch keine Messungen"})]}),v.jsx("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-background/50 border border-border/30",children:v.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-teal-500 to-indigo-500 transition-all duration-500",style:{width:`${s}%`}})}),i&&v.jsxs("div",{className:"flex items-center gap-3 font-mono text-[10px] text-muted-foreground/65",children:[v.jsxs("span",{children:["p50 ",Db(t.p50_ms)]}),v.jsxs("span",{children:["p95 ",Db(t.p95_ms)]}),v.jsxs("span",{children:["zuletzt ",Db(t.last_ms)]}),v.jsxs("span",{className:"text-muted-foreground/45",children:["· n=",t.count]})]})]})}function Lfe(){const{data:t}=_7(5e3),e=Math.max(1,...$E.map(r=>{var i;return((i=t==null?void 0:t[r.key])==null?void 0:i.p95_ms)??0})),n=$E.some(r=>{var i;return(((i=t==null?void 0:t[r.key])==null?void 0:i.count)??0)>0});return v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[v.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[v.jsx(cF,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Sprach-Latenz"}),v.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),v.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:$E.map(r=>v.jsx(Ofe,{stat:t==null?void 0:t[r.key],label:r.label,hint:r.hint,maxP95:e},r.key))}),v.jsx("div",{className:"mt-4 border-t border-border/30 pt-2 text-[10px] text-muted-foreground/70",children:n?"Server-seitige Dauer je Pipeline-Stufe (p50 prominent). Rollender Schnitt über die letzten Turns; Reset bei Neustart.":"Noch keine Voice-Turns gemessen — sprich einmal über den „Sprechen“-Tab, dann erscheinen hier STT/Vision/Chat/TTS."})]})}const Dfe=["fast","heavy","coder","vision","scout"],Ufe={fast:"bg-cyan-500/15 text-cyan-400 border-cyan-500/25",heavy:"bg-amber-500/15 text-amber-400 border-amber-500/25",coder:"bg-violet-500/15 text-violet-400 border-violet-500/25",vision:"bg-pink-500/15 text-pink-400 border-pink-500/25",scout:"bg-teal-500/15 text-teal-400 border-teal-500/25",hermes:"bg-indigo-500/15 text-indigo-400 border-indigo-500/25"},pV=t=>t&&Ufe[t]||"bg-slate-500/15 text-slate-300 border-slate-500/25";function jfe({fit:t}){const e={perfect:"bg-emerald-500/15 text-emerald-400 border border-emerald-500/20",marginal:"bg-amber-500/15 text-amber-400 border border-amber-500/20",too_tight:"bg-red-500/15 text-red-400 border border-red-500/20"}[t.level];return v.jsxs("span",{className:nt("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",e),children:[t.text," • ",t.req_gb," GB RAM"]})}function O3(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 Ffe(){const{data:t}=Bg(2e3),{data:e}=PC(2e3),n=(t==null?void 0:t.models)??[],r=(t==null?void 0:t.running)??[],i=R.useRef(null),[s,o]=R.useState(!1);return R.useEffect(()=>{if(!e)return;const a=e.total_tokens;if(i.current!==null&&a>i.current){o(!0);const l=setTimeout(()=>o(!1),4e3);return i.current=a,()=>clearTimeout(l)}i.current=a},[e==null?void 0:e.total_tokens]),v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col",children:[v.jsxs("div",{className:"flex items-center justify-between mb-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(ew,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Modelle"})]}),v.jsxs("span",{className:nt("flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-wider font-mono px-2 py-0.5 rounded-full border transition-colors",s?"bg-emerald-500/10 text-emerald-400 border-emerald-500/30":"bg-background/30 text-muted-foreground/70 border-border/40"),children:[s?v.jsx(_h,{className:"h-3 w-3 animate-pulse"}):v.jsx(q8,{className:"h-3 w-3"}),s?"Inferenz aktiv":"Idle"]})]}),v.jsx("div",{className:"space-y-2 flex-1",children:Dfe.map(a=>{var d;const l=n.find(f=>f.role===a),c=l?r.includes(l.name):!1;return v.jsxs("div",{className:nt("flex items-center justify-between gap-2 p-2 rounded-xl border transition-all duration-300",c?"border-emerald-500/30 bg-emerald-500/5 shadow-sm shadow-emerald-500/5":l?"border-primary/20 bg-primary/5":"border-border/30 bg-background/10 opacity-60"),children:[v.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[v.jsx("span",{className:nt("text-[9px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",pV(a)),children:a}),v.jsxs("div",{className:"flex flex-col min-w-0",children:[v.jsx("span",{className:"text-xs font-semibold truncate font-mono text-foreground",children:l?(d=l.name.split("/").pop())==null?void 0:d.replace(/\.gguf$/i,""):"nicht zugewiesen"}),l&&v.jsxs("div",{className:"flex gap-1 items-center mt-0.5 flex-wrap text-muted-foreground/70",children:[v.jsx("span",{className:"text-[9px] font-mono",children:Ia(l.size_bytes)}),l.prompt_cache&&v.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-cyan-500/10 text-cyan-400 border border-cyan-500/20 px-1 py-0.5 rounded",title:"Prompt Caching aktiv",children:"PC"}),l.spec_active&&v.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 px-1 py-0.5 rounded",title:`Speculative Decoding aktiv (Draft: ${l.spec_draft_model})`,children:"SPEC"}),l.parallel_slots>1&&v.jsxs("span",{className:"text-[7px] leading-none font-mono font-bold bg-violet-500/10 text-violet-400 border border-violet-500/20 px-1 py-0.5 rounded",title:`${l.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",l.parallel_slots]}),l.incomplete&&v.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-amber-500/10 text-amber-400 border border-amber-500/20 px-1 py-0.5 rounded",title:"GGUF-Datei fehlt",children:"⚠ fehlt"})]})]})]}),v.jsx("span",{className:"shrink-0",children:l?c?v.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono",children:[v.jsx("span",{className:nt("h-1.5 w-1.5 rounded-full bg-emerald-500",s&&"animate-pulse")})," warm"]}):v.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground uppercase tracking-wider font-mono",children:"bereit"}):v.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground/60 uppercase tracking-wider font-mono",children:"—"})})]},a)})}),v.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Laden erfolgt automatisch per Auto-Swap. Details & Routing im Modell-Manager."})]})}function L3({children:t}){return v.jsx("p",{className:"mb-2 ml-0.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:t})}function zfe(){return v.jsxs("div",{className:"space-y-7",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Zentrale"}),v.jsx("p",{className:"text-sm text-muted-foreground",children:"Aktueller Status von System, Modellen und Agent."})]}),v.jsxs("div",{className:"grid items-stretch gap-6 lg:grid-cols-3",children:[v.jsx(Yde,{}),v.jsx(Ife,{}),v.jsx(Ffe,{})]}),v.jsxs("section",{children:[v.jsx(L3,{children:"Stack & Telemetrie"}),v.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[v.jsx(kfe,{}),v.jsx(Lfe,{})]})]}),v.jsxs("section",{children:[v.jsx(L3,{children:"Betrieb & Wissen"}),v.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[v.jsx(Cfe,{}),v.jsx(Rfe,{}),v.jsx(Nfe,{})]})]})]})}function Bfe(){const t=Rd(),{data:e=[]}=S7(2e3),{showAlert:n,dialogElement:r}=tv();async function i(a){try{await It(`/api/jobs/${a}/cancel`,{method:"POST"}),t.invalidateQueries({queryKey:qn.jobs})}catch(l){n("Fehler",l.message)}}const s=e.filter(a=>a.state==="running"||a.state==="queued"),o=e.filter(a=>a.state!=="running"&&a.state!=="queued").slice(-3);return s.length===0&&o.length===0?null:v.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 shadow-lg shadow-black/10",children:[v.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),s.map(a=>v.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[v.jsxs("div",{className:"flex justify-between items-center text-xs",children:[v.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:a.label}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("span",{className:"text-muted-foreground font-mono",children:[a.progress??0,"% • ",WT(a.done_bytes),"/",WT(a.total_bytes),a.eta_s?` • ETA ${L7(a.eta_s)}`:""]}),v.jsx("button",{onClick:()=>i(a.id),className:"text-[10px] text-red-400 hover:text-red-300 font-semibold border border-red-500/25 bg-red-500/5 px-2 py-0.5 rounded transition-all cursor-pointer",children:"Abbrechen"})]})]}),v.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:v.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${a.progress??0}%`}})})]},a.id)),o.map(a=>v.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[v.jsx("span",{className:"truncate",children:a.label}),v.jsx("span",{className:nt("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",a.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:a.state})]},a.id)),r]})}function Tf({children:t,tone:e="muted"}){const n={muted:"bg-muted text-muted-foreground",primary:"bg-primary/15 text-primary",warn:"bg-amber-500/15 text-amber-500"};return v.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${n[e]}`,children:t})}function D3({caps:t}){return t?v.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[t.coder&&v.jsx(Tf,{children:"💻 Code"}),t.vision&&v.jsx(Tf,{children:"👁 Bild"}),t.reasoning&&v.jsx(Tf,{children:"🧠 Reason"}),t.moe&&v.jsxs(Tf,{tone:"primary",children:["🧩 MoE",t.active_b?`·${t.active_b}b`:""]}),t.tools==="yes"&&v.jsx(Tf,{tone:"primary",children:"🛠 Tools"}),t.tools==="likely"&&v.jsx(Tf,{tone:"warn",children:"🛠 Tools?"}),t.embedding&&v.jsx(Tf,{children:"🔢 Embed"})]}):null}function Hfe({model:t,onClose:e,onChanged:n}){var S,w;const{data:r,isLoading:i}=A7(t.gguf_path),[s,o]=R.useState(null),[a,l]=R.useState(""),c=r==null?void 0:r.target_vocab,d=(r==null?void 0:r.drafts)??[],f=d.filter(_=>_.compatible===!0),p=t.spec_draft_model;async function y(_){o(_??"__clear__"),l("");try{await It(`/api/models/${encodeURIComponent(t.name)}/draft`,{method:"POST",body:JSON.stringify({draft_path:_})}),n(),e()}catch(E){l(String((E==null?void 0:E.message)||E)),o(null)}}const x=_=>{var E;return _?`${_.pre??"?"} · ${((E=_.n_vocab)==null?void 0:E.toLocaleString())??"?"} Tokens`:"—"};return v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-lg rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2",children:[v.jsx(_h,{className:"h-4 w-4"})," Speculative Draft"]}),v.jsx("button",{onClick:e,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Md,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed",children:['Beschleunigt die Token-Generierung mit einem kleinen "Draft"-Modell. Voraussetzung: der Draft muss den ',v.jsx("strong",{className:"text-foreground",children:"exakt gleichen Tokenizer (Vocab)"})," haben wie das Modell — sonst lehnt llama.cpp es ab."]}),v.jsxs("div",{className:"rounded-lg border border-border/40 bg-background/30 px-3 py-2 text-[11px] font-mono flex items-center justify-between",children:[v.jsx("span",{className:"text-muted-foreground",children:(S=t.name.split("/").pop())==null?void 0:S.replace(/\.gguf$/i,"")}),v.jsxs("span",{className:"text-foreground",children:["Vocab: ",x(c)]})]}),t.spec_active&&p&&v.jsxs("div",{className:"rounded-lg border border-emerald-500/30 bg-emerald-500/5 px-3 py-2 flex items-center justify-between gap-2",children:[v.jsxs("span",{className:"text-[11px] text-emerald-400 font-mono flex items-center gap-1.5 truncate",children:[v.jsx(Xo,{className:"h-3.5 w-3.5 shrink-0"})," Aktiv: ",p]}),v.jsx("button",{onClick:()=>y(null),disabled:s!==null,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Deaktivieren"})]}),!(r!=null&&r.target_exists)&&v.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 flex items-center gap-2",children:[v.jsx(bg,{className:"h-3.5 w-3.5 shrink-0"}),"Modell-GGUF noch nicht vorhanden — Spec-Draft ist nach dem Download konfigurierbar."]}),v.jsx("div",{className:"space-y-1.5 max-h-64 overflow-y-auto pr-1",children:i?v.jsx("div",{className:"text-xs text-muted-foreground py-6 text-center",children:"Prüfe Vocab-Kompatibilität…"}):d.length===0?v.jsxs("div",{className:"text-[11px] text-muted-foreground border border-dashed border-border/50 rounded-lg p-4 text-center",children:["Keine Draft-Modelle in ",v.jsx("code",{className:"font-mono",children:"/srv/models/drafts"}),". Lade ein kleines same-family-Modell (z.B. Qwen3-0.6B) und lege es dort ab."]}):d.map(_=>{var P,O;const E=_.filename===p,T=_.compatible===!0;return v.jsxs("div",{className:nt("rounded-lg border px-3 py-2 flex items-center justify-between gap-2 text-left",T?"border-border/40 bg-background/20":"border-border/20 bg-background/10 opacity-60",E&&"border-primary/40 bg-primary/10"),children:[v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"text-[11px] font-mono font-semibold text-foreground truncate",children:_.filename}),v.jsxs("div",{className:"text-[9px] text-muted-foreground font-mono",children:[Ia(_.size_bytes)," · Vocab: ",x(_.vocab)]})]}),T?E?v.jsxs("span",{className:"text-[9px] font-bold uppercase text-primary flex items-center gap-1 shrink-0",children:[v.jsx(Xo,{className:"h-3.5 w-3.5"})," Aktiv"]}):v.jsx("button",{onClick:()=>y(_.path),disabled:s!==null,className:"h-7 px-3 rounded-lg border border-emerald-500/30 bg-emerald-500/5 hover:bg-emerald-500/15 text-emerald-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Aktivieren"}):v.jsxs("span",{className:"text-[9px] font-bold uppercase text-amber-400/80 flex items-center gap-1 shrink-0",title:_.compatible===!1?`Inkompatibel: Tokenizer/Vocab weicht ab (Draft ${(P=_.vocab)==null?void 0:P.pre}/${(O=_.vocab)==null?void 0:O.n_vocab} ≠ Modell ${c==null?void 0:c.pre}/${c==null?void 0:c.n_vocab}).`:"Kompatibilität nicht prüfbar (Datei fehlt).",children:[v.jsx(bg,{className:"h-3.5 w-3.5"})," ",_.compatible===!1?"Vocab ≠":"n/a"]})]},_.path)})}),!i&&(r==null?void 0:r.target_exists)&&d.length>0&&f.length===0&&v.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 leading-relaxed",children:["Kein vocab-kompatibler Draft verfügbar — Speculative Decoding ist für dieses Modell nicht möglich. Es braucht einen Draft mit identischem Tokenizer (pre=",v.jsx("span",{className:"font-mono",children:c==null?void 0:c.pre}),", n_vocab=",v.jsx("span",{className:"font-mono",children:(w=c==null?void 0:c.n_vocab)==null?void 0:w.toLocaleString()}),")."]}),a&&v.jsx("div",{className:"text-[10px] text-red-400 font-mono",children:a})]})})}const Vfe=["fast","heavy","heavy_chars"],Gfe=["coder_lite","coder","coding_escalate_chars"];function Wfe(){const t=Rd(),{data:e,isLoading:n}=w7(),[r,i]=R.useState(null),[s,o]=R.useState(!1),[a,l]=R.useState(""),[c,d]=R.useState(0);if(R.useEffect(()=>{e!=null&&e.policy&&!r&&i({...e.policy})},[e,r]),n||!e||!r)return v.jsx("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 text-xs text-muted-foreground",children:"Lade Routing-Policy…"});const f=_=>e.fields.find(E=>E.key===_),p=Object.keys(r).some(_=>r[_]!==e.policy[_]),y=(_,E)=>{i(T=>T&&{...T,[_]:E}),l("")},x=_=>y(_,e.defaults[_]);async function S(){if(!r)return;const _={};for(const E of Object.keys(r))r[E]!==e.policy[E]&&(_[E]=r[E]);if(Object.keys(_).length!==0){o(!0),l("");try{const{policy:E}=await g7(_);i({...E}),t.invalidateQueries({queryKey:qn.routingPolicy}),t.invalidateQueries({queryKey:qn.routing}),d(Date.now()),setTimeout(()=>d(0),2e3)}catch(E){l(E.message||String(E))}finally{o(!1)}}}function w({k:_}){const E=f(_),T=r[_],P=r[_]===e.defaults[_];return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsx("label",{className:"text-[10px] font-semibold text-muted-foreground",children:E.label}),!P&&v.jsxs("button",{onClick:()=>x(_),className:"flex items-center gap-0.5 text-[9px] text-muted-foreground/60 hover:text-foreground transition-colors cursor-pointer",title:`Auf Default zurücksetzen (${String(e.defaults[_])||"leer"})`,children:[v.jsx(dF,{className:"h-2.5 w-2.5"})," Default"]})]}),E.type==="bool"?v.jsxs("button",{onClick:()=>y(_,!T),className:nt("flex h-8 w-full items-center justify-between rounded-lg border px-3 text-[11px] font-semibold transition-all cursor-pointer",T?"border-emerald-500/40 bg-emerald-500/10 text-emerald-300":"border-border/40 bg-background/40 text-muted-foreground"),children:[v.jsx("span",{children:T?"An":"Aus"}),v.jsx("span",{className:nt("h-3.5 w-3.5 rounded-full transition-colors",T?"bg-emerald-400":"bg-muted-foreground/40")})]}):E.type==="int"?v.jsx("input",{type:"number",value:T,min:E.min,max:E.max,onChange:O=>y(_,Number(O.target.value)),className:"h-8 w-full rounded-lg border border-border/40 bg-background/40 px-3 font-mono text-[11px] text-foreground outline-none focus:border-primary/50"}):v.jsx("input",{type:"text",value:T,placeholder:_==="coder_lite"?"(leer = aus)":"",onChange:O=>y(_,O.target.value),className:"h-8 w-full rounded-lg border border-border/40 bg-background/40 px-3 font-mono text-[11px] text-foreground outline-none focus:border-primary/50"})]})}return v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-4",children:[v.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(i9,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Lane-Routing & Policy"}),v.jsx("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded bg-emerald-500/10 text-emerald-300 border border-emerald-500/20",children:"hot-reload"})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[a&&v.jsx("span",{className:"text-[10px] text-red-400 max-w-[280px] truncate",title:a,children:a}),c>0&&v.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-emerald-400",children:[v.jsx(Xo,{className:"h-3.5 w-3.5"})," gespeichert"]}),v.jsxs("button",{onClick:S,disabled:!p||s,className:nt("h-8 px-4 rounded-lg text-[10px] font-bold uppercase tracking-wide transition-all flex items-center gap-1.5",p&&!s?"bg-primary text-primary-foreground hover:opacity-90 cursor-pointer shadow-md shadow-primary/10":"bg-background/40 text-muted-foreground/50 border border-border/40 cursor-not-allowed"),children:[s?v.jsx(G1,{className:"h-3.5 w-3.5 animate-spin"}):null,"Speichern"]})]})]}),v.jsxs("p",{className:"text-[10px] text-muted-foreground/70 leading-relaxed -mt-1",children:["Welches echte Modell hinter den virtuellen Lanes ",v.jsx("code",{className:"text-cyan-300",children:"chat"})," und"," ",v.jsx("code",{className:"text-cyan-300",children:"coding"})," steckt. Änderungen greifen sofort (kein Neustart). Die Keyword-Heuristiken bleiben im Code."]}),v.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[v.jsxs("div",{className:"rounded-xl border border-border/40 bg-background/25 p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center gap-2 border-b border-border/30 pb-2",children:[v.jsx($8,{className:"h-4 w-4 text-teal-400"}),v.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider text-foreground",children:"chat"}),v.jsx("span",{className:"text-[9px] text-muted-foreground/60 font-mono",children:"(= auto)"})]}),Vfe.map(_=>v.jsx(w,{k:_},_))]}),v.jsxs("div",{className:"rounded-xl border border-border/40 bg-background/25 p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center gap-2 border-b border-border/30 pb-2",children:[v.jsx(N8,{className:"h-4 w-4 text-indigo-400"}),v.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider text-foreground",children:"coding"}),v.jsx("span",{className:"text-[9px] text-muted-foreground/60 font-mono",children:"(agentisch → immer Coder)"})]}),Gfe.map(_=>v.jsx(w,{k:_},_))]})]}),v.jsx("div",{className:"rounded-xl border border-border/40 bg-background/25 p-4",children:v.jsx("div",{className:"max-w-xs",children:v.jsx(w,{k:"fast_no_think"})})})]})}function $fe(){var ue,Z,Ve,Le;const t=Rd(),{data:e,isLoading:n,error:r}=Bg(4e3),{data:i}=RC(4e3),{data:s}=M7(),{data:o}=Y1(),{data:a}=b7(),{showAlert:l,showConfirm:c,showPrompt:d,dialogElement:f}=tv(),p=(e==null?void 0:e.models)??[],y=(e==null?void 0:e.running)??[],x=r?String(r):"",S=()=>{t.invalidateQueries({queryKey:qn.models}),t.invalidateQueries({queryKey:qn.routing})},w=(ue=a==null?void 0:a.groups)==null?void 0:ue.brains,_=(w==null?void 0:w.members)??[],E=re=>_.includes(re),T=_.some(re=>y.includes(re));async function P(re){if(!w){l("Keine brains-Gruppe","Es existiert noch keine Ko-Residenz-Gruppe „brains“ in der Engine-Konfiguration. Lege sie erst über die Gruppen-Verwaltung an.");return}const qe=_.includes(re)?_.filter(Ze=>Ze!==re):[..._,re];try{await m7("brains",qe,w.swap??!1,w.persist??!0),t.invalidateQueries({queryKey:qn.groups}),S()}catch(Ze){l("Fehler",`Ko-Residenz konnte nicht geändert werden: ${Ze.message||Ze}`)}}const[O,N]=R.useState(null),[D,z]=R.useState(null),[G,k]=R.useState(null),[j,H]=R.useState("grid"),[ee,te]=R.useState("all"),he=p.filter(re=>ee==="in_use"?!!re.role||y.includes(re.name):!0);async function se(re){try{await It(`/api/models/${encodeURIComponent(re)}/load`,{method:"POST"}),S()}catch(Ce){l("Fehler",`Fehler beim Laden des Modells: ${Ce.message}`)}}async function fe(re){if(w&&T&&!E(re)){const Ce=_.filter(qe=>y.includes(qe)).map(qe=>qe.split("/").pop()).join(", ");c("Verdrängt das Hirn?",`„${re.split("/").pop()}“ ist nicht in der Ko-Residenz-Gruppe „brains“. Beim Laden wirft es das aktuell warme Hirn (${Ce}) raus — Lucy verliert Hirn bzw. Augen.
|
||
|
||
Trotzdem exklusiv laden? Tipp: Mit dem 🧠-Schalter machst du das Modell dauerhaft ko-resident, dann bleiben beide warm.`,()=>se(re));return}se(re)}async function B(re){try{await It(`/api/models/${encodeURIComponent(re)}/unload`,{method:"POST"}),S()}catch(Ce){l("Fehler",`Fehler beim Entladen des Modells: ${Ce.message}`)}}async function J(){try{await It("/api/models/unload",{method:"POST"}),S()}catch(re){l("Fehler",`Fehler beim Entladen aller Modelle: ${re.message}`)}}async function Y(re,Ce){try{await It(`/api/models/${encodeURIComponent(Ce)}/role`,{method:"POST",body:JSON.stringify({role:re||null})}),S()}catch(qe){l("Fehler",`Fehler beim Zuweisen der Rolle: ${qe.message||qe}`)}}function V(re){N(re),z(null),It(`/api/roles/${encodeURIComponent(re)}/recommend`).then(Ce=>z(Ce)).catch(()=>{})}async function q(re,Ce){let qe=null;try{qe=await It(`/api/models/${encodeURIComponent(re)}/ctx/auto`)}catch{}const Ze=qe?`Optimal für dein Setup: ${(qe.ctx/1024).toFixed(0)}k (${qe.ctx}) — GTT ${qe.gtt_gb} GB − reserviert ${qe.reserved_gb} GB (${qe.mode}) → ${qe.budget_gb} GB frei. »Auto« trägt diesen Wert ein.`:"Gib die gewünschte Kontextlänge in Tokens an:";d("Kontextlänge anpassen",Ze,String(Ce||32768),async Q=>{if(Q)try{await It(`/api/models/${encodeURIComponent(re)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(Q,10)})}),S()}catch(W){l("Fehler",`Fehler beim Setzen des Kontexts: ${W.message||W}`)}},void 0,qe?{autoValue:String(qe.ctx),autoLabel:`Auto (${(qe.ctx/1024).toFixed(0)}k)`}:void 0)}async function pe(re){c("Modell löschen?",`Modell '${re}' und alle zugehörigen GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await It(`/api/models/${encodeURIComponent(re)}`,{method:"DELETE"}),S()}catch(Ce){l("Fehler",`Fehler beim Löschen: ${Ce.message||Ce}`)}})}async function ae(re,Ce,qe,Ze){try{await It("/api/models/install",{method:"POST",body:JSON.stringify({repo:re,role:Ce,quant:qe,jinja:Ze})}),l("Herunterladen gestartet",`Download für '${re}' gestartet! Der Fortschritt wird oben angezeigt.`)}catch(Q){l("Fehler",`Fehler beim Starten des Upgrades: ${Q.message||Q}`)}}async function ce(re){const Ce=s==null?void 0:s.budget,qe=Ce&&!Ce.fits?`
|
||
|
||
⚠ Speicher-Warnung: Dieses Brain (~${Ce.brain_gb} GB) muss immer resident sein. Zusammen mit dem größten on-demand-Modell (~${Ce.largest_ondemand_gb} GB) sprengt das das Budget (${Ce.gtt_gb} GB) → heavy/coder würden das Brain verdrängen. Erwäge ein kleineres Brain oder weniger Kontext.`:"";c("Agent-Hirn aktualisieren?",`Neues Hermes-Modell '${re.split("/").pop()}' herunterladen und als Agent-Hirn (Rolle hermes) setzen? Hermes nutzt danach automatisch das neue Modell.${qe}`,async()=>{try{await It("/api/models/install",{method:"POST",body:JSON.stringify({repo:re,role:"hermes",quant:"Q4_K_M",jinja:!0})}),l("Download gestartet","Das neue Agent-Hirn wird geladen. Fortschritt oben."),S()}catch(Ze){l("Fehler",`Update fehlgeschlagen: ${Ze.message||Ze}`)}})}if(n)return v.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Initialisiere HUD Cockpit…"});if(x)return v.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Gateway oder Engine nicht erreichbar (",x,")."]});const Se=p.filter(re=>y.includes(re.name)),Ee=Se.reduce((re,Ce)=>re+(Ce.size_bytes||0),0),$e=((Z=o==null?void 0:o.gpu)==null?void 0:Z.gtt_total)||((Ve=o==null?void 0:o.gpu)==null?void 0:Ve.vram_total)||0,Me=((Le=o==null?void 0:o.gpu)==null?void 0:Le.gtt_used)||0,Ge=16*1024**3,We=$e>2*1024**3?$e:Ee>Ge?Ee*1.2:Ge;return v.jsxs("div",{className:"space-y-8",children:[v.jsx("style",{children:`
|
||
@keyframes flow-dash {
|
||
to {
|
||
stroke-dashoffset: -20;
|
||
}
|
||
}
|
||
.svg-flow-path {
|
||
stroke-dasharray: 4 6;
|
||
animation: flow-dash 1s linear infinite;
|
||
}
|
||
`}),v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[v.jsxs("div",{className:"flex justify-between items-center",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(nE,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"VRAM / Memory Belegung"})]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["Speicher-Pool: ",Ia(Ee)," Gewichte",Me>0?` · ${Ia(Me)} real belegt (inkl. KV)`:""," / ",Ia(We)]}),y.length>0&&v.jsx("button",{onClick:J,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase transition-all cursor-pointer",children:"Alle entladen"})]})]}),v.jsx("div",{className:"h-7 w-full rounded-xl bg-background/50 border border-border/40 overflow-hidden flex p-0.5 relative group",children:Se.length===0?v.jsx("div",{className:"w-full h-full flex items-center justify-center text-[10px] text-muted-foreground/60 italic font-mono select-none",children:"VRAM Leer — Auto-Swap lädt Modelle bei Anfrage"}):Se.map((re,Ce)=>{var Q;const qe=(re.size_bytes||0)/We*100,Ze=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][Ce%4];return v.jsxs("div",{style:{width:`${qe}%`},className:nt("h-full rounded bg-gradient-to-r flex items-center justify-between px-2.5 transition-all text-white/95 shrink-0 shadow-inner select-none",Ze),title:`${re.name} (${Ia(re.size_bytes)})`,children:[v.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[re.role?`[${re.role}] `:"",(Q=re.name.split("/").pop())==null?void 0:Q.replace(".gguf","")]}),v.jsx("span",{className:"text-[8px] font-mono opacity-80",children:Ia(re.size_bytes)})]},re.name)})})]}),v.jsx(Wfe,{}),v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[v.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),v.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:["fast","heavy","coder","vision","scout"].map(re=>{var Ze;const Ce=p.find(Q=>Q.role===re),qe=Ce?y.includes(Ce.name):!1;return v.jsxs("div",{onClick:()=>V(re),className:nt("rounded-xl border p-3 flex flex-col justify-between gap-2.5 transition-all cursor-pointer select-none text-left bg-background/25 hover:border-primary/45 hover:bg-background/40 group min-h-[90px]",qe?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":Ce?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("span",{className:nt("text-[9px] font-bold uppercase tracking-wider font-mono px-1.5 py-0.5 rounded border",pV(re)),children:re}),qe&&v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),v.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:Ce==null?void 0:Ce.name,children:Ce?(Ze=Ce.name.split("/").pop())==null?void 0:Ze.replace(/\.gguf$/i,""):"nicht zugewiesen"}),v.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},re)})})]}),(s==null?void 0:s.current)&&v.jsxs("div",{className:"rounded-2xl border border-indigo-500/30 bg-indigo-500/5 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[v.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx($c,{className:"h-4.5 w-4.5 text-indigo-400"}),v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Agent-Hirn (Hermes)"}),s.current.version!=null&&v.jsxs("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded bg-indigo-500/15 text-indigo-300 border border-indigo-500/25",children:["v",s.current.version]})]}),v.jsx("button",{onClick:()=>window.dispatchEvent(new CustomEvent("mc-navigate",{detail:{view:"agent"}})),className:"h-7 px-3 rounded-lg border border-indigo-500/30 bg-indigo-500/5 text-indigo-300 text-[9px] font-bold uppercase hover:bg-indigo-500/15 transition-all cursor-pointer",title:"Hirn-Wechsel passiert jetzt zentral im Hermes-Tab",children:"Im Hermes-Tab wechseln →"})]}),v.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 rounded-xl bg-background/30 border border-border/30 p-3.5",children:[v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:s.current.name,children:s.current.name.split("/").pop()}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[v.jsx("span",{children:s.current.params_b?`${s.current.params_b}B`:"—"}),v.jsx("span",{children:"•"}),v.jsx("span",{children:s.current.quant||"GGUF"}),v.jsx("span",{children:"•"}),v.jsx("span",{children:Ia(s.current.size_bytes||0)})]})]}),s.update_available&&s.recommended?v.jsxs("button",{onClick:()=>ce(s.recommended.repo),className:nt("h-8 px-3 shrink-0 flex items-center justify-center gap-1.5 rounded-lg text-[10px] font-bold uppercase transition-all cursor-pointer shadow-md",s.budget&&!s.budget.fits?"bg-red-500 text-white hover:bg-red-400 shadow-red-500/10":"bg-amber-500 text-black hover:bg-amber-400 shadow-amber-500/10"),children:[v.jsx(yg,{className:"h-3.5 w-3.5"})," Aktualisieren"]}):v.jsxs("span",{className:"h-8 px-3 shrink-0 flex items-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/15 rounded-lg select-none",children:[v.jsx(Xo,{className:"h-4 w-4"})," Neueste Generation"]})]}),s.update_available&&s.recommended&&v.jsxs("div",{className:"text-[10px] text-amber-400/90 flex items-center gap-1.5",children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),"Neuere Generation verfügbar: ",v.jsx("span",{className:"font-mono font-bold",children:s.recommended.name.replace(/-GGUF$/i,"")}),"(v",s.recommended.version,", ",s.recommended.params_b,"B) — von NousResearch."]}),s.budget&&v.jsxs("div",{className:nt("text-[10px] flex items-start gap-1.5 leading-relaxed",s.budget.fits?"text-muted-foreground/80":"text-red-400 font-semibold"),children:[v.jsx(nE,{className:"h-3 w-3 shrink-0 mt-0.5"}),v.jsxs("span",{children:["Always-On-Brain ~",s.budget.brain_gb," GB + größtes on-demand (~",s.budget.largest_ondemand_gb," GB) = ",(s.budget.brain_gb+s.budget.largest_ondemand_gb).toFixed(1)," / ",s.budget.gtt_gb," GB",s.budget.fits?" · passt gleichzeitig ✓":" · passt NICHT gleichzeitig ⚠ — heavy/coder würden das Brain verdrängen. Kleineres Brain oder weniger Kontext."]})]})]}),v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[v.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",he.length," von ",p.length,")"]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[v.jsx("button",{onClick:()=>te("all"),className:nt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ee==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),v.jsx("button",{onClick:()=>te("in_use"),className:nt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ee==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),v.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[v.jsx("button",{onClick:()=>H("grid"),className:nt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",j==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),v.jsx("button",{onClick:()=>H("list"),className:nt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",j==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),j==="grid"?v.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:he.length===0?v.jsx("div",{className:"col-span-full text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:ee==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):he.map(re=>{const Ce=y.includes(re.name),qe=i==null?void 0:i.model_list.find(Q=>Q.role===re.role),Ze=O3(re.name);return v.jsxs("div",{className:nt("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-4 transition-all duration-300 hover:border-primary/40 group relative overflow-hidden",Ce?"border-primary/45 shadow-primary/5":re.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[v.jsxs("div",{className:"space-y-3",children:[v.jsx("div",{className:"flex items-start justify-between gap-3",children:v.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[v.jsx("div",{className:nt("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",Ze.color),title:Ze.name,children:Ze.initial}),v.jsxs("div",{className:"min-w-0",children:[v.jsx("h3",{className:"text-xs font-bold tracking-tight text-foreground line-clamp-2 break-all font-mono",title:re.name,children:re.name.split("/").pop()}),v.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[v.jsx("span",{className:"text-[9px] font-mono text-muted-foreground bg-background/40 px-1.5 py-0.5 rounded border border-border/30",children:re.quant||"GGUF"}),Ce&&v.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[v.jsx(bC,{className:"h-3 w-3 animate-pulse"})," Warm"]}),re.role&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-mono text-primary font-bold uppercase",children:re.role}),E(re.name)&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-fuchsia-500/10 border border-fuchsia-500/30 text-[9px] font-mono text-fuchsia-300 font-bold uppercase",title:"Ko-resident in der brains-Gruppe — bleibt mit dem Hirn gemeinsam warm, verdrängt es nicht.",children:"🧠 Ko-resident"}),re.prompt_cache&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[9px] font-mono text-cyan-400 font-bold uppercase",title:"Prompt Caching aktiv",children:"PC"}),re.spec_active?v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[9px] font-mono text-emerald-400 font-bold uppercase",title:`Speculative Decoding aktiv (Draft: ${re.spec_draft_model})`,children:"SPEC"}):re.spec_draft_model?v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:`Draft gesetzt (${re.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel. Über 'Spec' neu konfigurieren.`,children:"SPEC?"}):null,re.parallel_slots>1&&v.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[9px] font-mono text-violet-400 font-bold uppercase",title:`${re.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",re.parallel_slots]}),re.incomplete&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:"GGUF-Datei fehlt — Modell kann nicht geladen werden",children:"⚠ Datei fehlt"})]})]})]})}),v.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:v.jsx(D3,{caps:re.capabilities})})]}),v.jsxs("div",{className:"space-y-3 pt-1",children:[v.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[v.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[v.jsx(nE,{className:"h-3.5 w-3.5 text-primary/80"}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),v.jsx("div",{className:"text-foreground font-semibold",children:Ia(re.size_bytes)})]})]}),v.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[v.jsx(Z8,{className:"h-3.5 w-3.5 text-primary/80"}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),v.jsx("div",{className:"text-foreground font-semibold",children:CI(re.ctx)})]})]})]}),qe&&v.jsxs("div",{className:"p-3 bg-amber-500/5 border border-amber-500/30 rounded-xl space-y-2 flex flex-col justify-between shrink-0",children:[v.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),v.jsxs("span",{children:["Upgrade verfügbar: ",qe.repo.split("/").pop()]})]}),v.jsxs("button",{onClick:()=>ae(qe.repo,re.role,re.quant||"Q4_K_M",re.capabilities.tools!=="no"),className:"h-7 w-full flex items-center justify-center gap-1 rounded-lg bg-amber-500 text-black text-[10px] font-bold hover:bg-amber-400 transition-colors cursor-pointer",children:[v.jsx(yg,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),v.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[v.jsx("button",{onClick:()=>Ce?B(re.name):fe(re.name),disabled:re.incomplete&&!Ce,className:nt("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center justify-center gap-1",re.incomplete&&!Ce?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":Ce?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400 cursor-pointer":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary cursor-pointer"),children:Ce?"Entladen":"Laden"}),v.jsx("button",{onClick:()=>q(re.name,re.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),w&&v.jsx("button",{onClick:()=>P(re.name),className:nt("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer",E(re.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:E(re.name)?"Ko-resident (brains): bleibt mit dem Hirn gemeinsam warm. Klick = aus der Gruppe nehmen.":"Zur brains-Gruppe hinzufügen — lädt dann ko-resident neben dem Hirn, statt es zu verdrängen.",children:"🧠"}),v.jsxs("button",{onClick:()=>k(re),className:nt("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer flex items-center gap-1",re.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":re.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),title:"Speculative Draft konfigurieren (Vocab-geprüft)",children:[v.jsx(_h,{className:"h-3 w-3"})," Spec"]}),v.jsx("button",{onClick:()=>pe(re.name),className:"h-7 w-7 rounded-lg border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 flex items-center justify-center transition-colors cursor-pointer",title:"Modell löschen",children:v.jsx(OT,{className:"h-3.5 w-3.5"})})]})]})]},re.name)})}):v.jsx("div",{className:"space-y-2",children:he.length===0?v.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:ee==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):he.map(re=>{const Ce=y.includes(re.name),qe=O3(re.name);return v.jsxs("div",{className:nt("rounded-xl border bg-card/45 backdrop-blur-md p-3.5 shadow-lg shadow-black/5 flex flex-col sm:flex-row sm:items-center justify-between gap-3 hover:border-primary/40 transition-all",Ce?"border-primary/45":re.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[v.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[v.jsx("div",{className:nt("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",qe.color),title:qe.name,children:qe.initial}),v.jsxs("div",{className:"min-w-0 text-left",children:[v.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[v.jsx("h4",{className:"text-xs font-bold text-foreground truncate max-w-[250px] sm:max-w-[400px] break-all font-mono",title:re.name,children:re.name.split("/").pop()}),re.role&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[8px] font-mono text-primary font-bold uppercase shrink-0",children:re.role}),E(re.name)&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-fuchsia-500/10 border border-fuchsia-500/30 text-[8px] font-mono text-fuchsia-300 font-bold uppercase shrink-0",title:"Ko-resident in der brains-Gruppe — bleibt mit dem Hirn gemeinsam warm.",children:"🧠 Ko-resident"}),re.prompt_cache&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[8px] font-mono text-cyan-400 font-bold uppercase shrink-0",title:"Prompt Caching aktiv",children:"PC"}),re.spec_active?v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[8px] font-mono text-emerald-400 font-bold uppercase shrink-0",title:`Speculative Decoding aktiv (Draft: ${re.spec_draft_model})`,children:"SPEC"}):re.spec_draft_model?v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:`Draft gesetzt (${re.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel.`,children:"SPEC?"}):null,re.parallel_slots>1&&v.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[8px] font-mono text-violet-400 font-bold uppercase shrink-0",title:`${re.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",re.parallel_slots]}),re.incomplete&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:"GGUF-Datei fehlt",children:"⚠ Datei fehlt"}),Ce&&v.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[v.jsxs("span",{children:["Größe: ",Ia(re.size_bytes)]}),v.jsx("span",{children:"•"}),v.jsxs("span",{children:["Kontext: ",CI(re.ctx)]}),v.jsx("span",{children:"•"}),v.jsx("span",{className:"font-mono text-[9px]",children:re.quant||"GGUF"})]})]})]}),v.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[v.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:v.jsx(D3,{caps:re.capabilities})}),v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("button",{onClick:()=>Ce?B(re.name):fe(re.name),disabled:re.incomplete&&!Ce,className:nt("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center gap-1",re.incomplete&&!Ce?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":Ce?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400 cursor-pointer":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary cursor-pointer"),children:Ce?"Entladen":"Laden"}),v.jsx("button",{onClick:()=>q(re.name,re.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-all cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),w&&v.jsx("button",{onClick:()=>P(re.name),className:nt("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer",E(re.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:E(re.name)?"Ko-resident (brains): bleibt mit dem Hirn gemeinsam warm. Klick = aus der Gruppe nehmen.":"Zur brains-Gruppe hinzufügen — lädt dann ko-resident neben dem Hirn, statt es zu verdrängen.",children:"🧠"}),v.jsxs("button",{onClick:()=>k(re),className:nt("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-all cursor-pointer flex items-center gap-1",re.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":re.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),title:"Speculative Draft konfigurieren (Vocab-geprüft)",children:[v.jsx(_h,{className:"h-3 w-3"})," Spec"]}),v.jsx("button",{onClick:()=>pe(re.name),className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all cursor-pointer",title:"Modell löschen",children:v.jsx(OT,{className:"h-3.5 w-3.5"})})]})]})]},re.name)})})]}),O&&(()=>{var Q,W;const re=D&&D.role===O?D:null,Ce={};re==null||re.models.forEach(be=>{Ce[be.name]=be});const qe=re?re.models.map(be=>p.find(Ue=>Ue.name===be.name)).filter(Boolean):p,Ze=be=>{Y(O,be),N(null)};return v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",O,"' konfigurieren"]}),v.jsx("button",{onClick:()=>N(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Md,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell für die Rolle ",v.jsx("strong",{className:"text-foreground",children:O}),":"]}),(re==null?void 0:re.recommended)&&v.jsxs("button",{onClick:()=>Ze(re.recommended),title:(Q=Ce[re.recommended])==null?void 0:Q.reason,className:"shrink-0 h-7 px-3 text-[11px] font-semibold text-primary border border-primary/50 bg-primary/10 hover:bg-primary/20 rounded-lg cursor-pointer flex items-center gap-1",children:[v.jsx(_h,{className:"h-3 w-3"})," Auto: ",(W=re.recommended.split("/").pop())==null?void 0:W.replace(/\.gguf$/i,"")]})]}),v.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[v.jsx("button",{onClick:()=>Ze(""),className:"w-full text-left px-3 py-2 rounded-lg text-xs hover:bg-accent text-red-400 font-semibold cursor-pointer border border-red-500/20 bg-red-500/5 flex items-center justify-between",children:v.jsx("span",{children:"Zuweisung entfernen"})}),qe.map(be=>{var rt;const Ue=Ce[be.name],ze=be.role===O,Fe=!!(Ue!=null&&Ue.recommended),bt=!!Ue&&!Ue.suitable;return v.jsxs("button",{onClick:()=>Ze(be.name),className:nt("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border",Fe?"border-primary/50 bg-primary/10":ze?"text-primary font-bold bg-primary/5 border-primary/30":bt?"border-border/20 bg-background/10 opacity-60":"text-foreground bg-background/20 border-border/30"),children:[v.jsxs("div",{className:"flex flex-col text-left min-w-0",children:[v.jsxs("span",{className:"truncate max-w-[260px] font-semibold flex items-center gap-1.5",children:[(rt=be.name.split("/").pop())==null?void 0:rt.replace(/\.gguf$/i,""),Fe&&v.jsx("span",{className:"text-[8px] font-bold uppercase tracking-wide text-primary bg-primary/15 px-1.5 py-0.5 rounded",children:"Empfohlen"})]}),v.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:Ue?`${Ue.params_b}B · ${be.quant} · ${Ue.reason}`:`${Ia(be.size_bytes)} · ${be.quant}`})]}),ze&&v.jsx(Xo,{className:"h-4 w-4 shrink-0 text-primary"})]},be.name)})]})]})})})(),G&&v.jsx(Hfe,{model:G,onClose:()=>k(null),onChanged:S}),f]})}function Xfe(){const[t,e]=R.useState(""),[n,r]=R.useState([]),[i,s]=R.useState("Q4_K_M"),[o,a]=R.useState(""),[l,c]=R.useState(""),[d,f]=R.useState(""),[p,y]=R.useState([]),[x,S]=R.useState(null),[w,_]=R.useState(!1),E=["fast","heavy","coder","vision","scout"],{data:T}=Bg(),P=l?T==null?void 0:T.models.find(H=>(H.role||"").toLowerCase()===l):void 0;async function O(H,ee,te){if(_(!1),!H.trim()){S(null);return}try{const he=await It(`/api/fit?params_b=0&quant=${encodeURIComponent(ee)}&ctx=8192&name=${encodeURIComponent(H)}&role=${encodeURIComponent(te)}`);S(he)}catch{S(null)}}async function N(H){const ee=H??t;if(ee.trim()){a("Analysiere HuggingFace Repository..."),S(null);try{const te=await It(`/api/hf/quants?repo=${encodeURIComponent(ee)}`);e(te.repo),r(te.quants);const he=te.quants.length?te.quants.includes("Q4_K_M")?"Q4_K_M":te.quants[0]:i;te.quants.length&&s(he),a(te.quants.length?"":"Keine GGUF-Dateien in diesem Repository gefunden."),te.quants.length&&O(te.repo,he,l)}catch(te){a(`Fehler: ${te}`)}}}function D(H){s(H),O(t,H,l)}function z(H){c(H),n.length&&O(t,i,H)}async function G(){if(d.trim()){a("Durchsuche HuggingFace...");try{const H=await It(`/api/hf/search?q=${encodeURIComponent(d)}`);y(H.results),a(H.results.length?"":"Keine Ergebnisse gefunden.")}catch(H){a(`Suche fehlgeschlagen: ${H}`)}}}async function k(){if(t.trim()){if((x==null?void 0:x.fit.level)==="too_tight"&&!w){_(!0);return}a("Download-Job wird initiiert...");try{await It("/api/models/install",{method:"POST",body:JSON.stringify({repo:t,quant:i,role:l||void 0,jinja:!0})}),_(!1),a(`Download gestartet: ${t} (${i})${l?`, Rolle: ${l}`:""}. Fortschritt oben.`+(P?` „${l}" wurde von ${P.name} übernommen.`:"")+(l==="fast"||l==="coder"?" Speculative Draft (Vocab-geprüft) kannst du nach dem Download an der Modellkarte (»Spec«) setzen.":""))}catch(H){a(`Download-Fehler: ${H}`)}}}const j=(x==null?void 0:x.fit.level)==="perfect"?"text-emerald-400 border-emerald-500/40 bg-emerald-500/10":(x==null?void 0:x.fit.level)==="marginal"?"text-amber-400 border-amber-500/40 bg-amber-500/10":"text-red-400 border-red-500/40 bg-red-500/10";return v.jsxs("div",{className:"space-y-4 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10",children:[v.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"HF Download & Suche"}),v.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[v.jsx("input",{value:t,onChange:H=>{e(H.target.value),S(null),_(!1)},placeholder:"HF-URL oder org/repo (z.B. unsloth/Qwen2.5-Coder-7B-Instruct-GGUF)",className:"flex-1 h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),v.jsxs("div",{className:"flex gap-2",children:[v.jsx("button",{onClick:()=>N(),className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer whitespace-nowrap",children:"Quants laden"}),n.length>0&&v.jsxs(v.Fragment,{children:[v.jsx("select",{value:i,onChange:H=>D(H.target.value),className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:n.map(H=>v.jsx("option",{value:H,className:"bg-popover text-foreground",children:H},H))}),v.jsxs("select",{value:l,onChange:H=>z(H.target.value),title:"Rolle (optional) — bestimmt Auto-Konfiguration + setup-bewussten Kontext",className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:[v.jsx("option",{value:"",className:"bg-popover text-foreground",children:"Rolle…"}),E.map(H=>v.jsx("option",{value:H,className:"bg-popover text-foreground",children:H},H))]}),v.jsx("button",{onClick:k,className:`h-9 px-4 rounded-lg text-xs font-semibold transition-all cursor-pointer flex items-center gap-1.5 ${w?"bg-red-500 text-white hover:opacity-90":"bg-primary text-primary-foreground hover:opacity-90"}`,children:w?v.jsxs(v.Fragment,{children:[v.jsx(bg,{className:"h-3.5 w-3.5"})," OOM-Risiko — trotzdem laden"]}):v.jsxs(v.Fragment,{children:[v.jsx(yg,{className:"h-3.5 w-3.5"})," Herunterladen"]})})]})]})]}),x&&v.jsxs("div",{className:`flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border px-3 py-2 text-[11px] font-medium ${j}`,children:[v.jsx("span",{className:"font-bold uppercase tracking-wide",children:x.fit.text}),v.jsxs("span",{className:"font-mono opacity-90",children:["~",x.params_b,"B · ~",x.fit.req_gb," GB / ",x.sys_ram_gb," GB RAM · ~",x.fit.tps," t/s"]}),x.fit.level!=="too_tight"&&v.jsxs("span",{className:"font-mono opacity-80",title:`Setup-bewusst: GTT ${x.budget.gtt_gb} GB − reserviert ${x.budget.reserved_gb} GB (${x.budget.mode}) → ${x.budget.budget_gb} GB frei`,children:["ctx → ",(x.assigned_ctx/1024).toFixed(0),"k"]}),x.fit.level==="too_tight"&&v.jsx("span",{className:"opacity-90",children:"— passt nicht in den Speicher, würde beim Laden abstürzen (OOM)."})]}),P&&v.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-[11px] font-medium text-amber-400",children:[v.jsx(bg,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),v.jsxs("span",{children:["Rolle ",v.jsxs("strong",{children:["„",l,'"']})," ist aktuell ",v.jsx("strong",{children:P.name})," zugewiesen. Beim Download übernimmt das neue Modell diese Rolle — ",P.name," bleibt installiert, verliert sie aber."]})]}),v.jsxs("div",{className:"flex gap-2 border-t border-border/20 pt-4",children:[v.jsxs("div",{className:"relative flex-1",children:[v.jsx("input",{value:d,onChange:H=>f(H.target.value),onKeyDown:H=>H.key==="Enter"&&G(),placeholder:"HuggingFace durchsuchen (z.B. Llama-3.1)...",className:"w-full h-9 pl-9 pr-3 rounded-lg border border-border/60 bg-background/40 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),v.jsx(wC,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),v.jsx("button",{onClick:G,className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer",children:"Suchen"})]}),p.length>0&&v.jsx("div",{className:"max-h-48 space-y-1.5 overflow-y-auto border border-border/40 bg-background/20 p-2 rounded-xl scrollbar-thin",children:p.map(H=>v.jsxs("button",{onClick:()=>{e(H.repo),y([]),f(""),N(H.repo)},className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left text-xs bg-background/10 border border-border/10 hover:border-primary/30 hover:bg-background/30 transition-all",children:[v.jsx("span",{className:"font-semibold truncate",children:H.repo}),v.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground flex items-center gap-1 shrink-0",children:[v.jsx(yg,{className:"h-3 w-3"})," ",H.downloads.toLocaleString()]})]},H.repo))}),o&&v.jsx("div",{className:"text-[10px] font-medium text-primary font-mono",children:o})]})}const qfe={fast:{title:"Schnelles Alltags-Hirn",desc:"Schnelle MoE-Antworten für Chat, Zusammenfassungen und alltägliche Aufgaben.",icon:_h},heavy:{title:"Schweres Reasoning",desc:"Große Modelle für komplexe Logik, Mathematik und tiefgründiges Planen.",icon:V1},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:lF},vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:NT},scout:{title:"Multimodal-Allrounder",desc:"Multimodaler Allrounder für schnelle Antworten, Übersetzungen und Alltag.",icon:CT}};function Kfe(){const{data:t,isLoading:e,error:n}=E7(),{data:r}=Bg(),{data:i}=RC(),s=(r==null?void 0:r.models)??[],o=n?String(n):"",[a,l]=R.useState({}),[c,d]=R.useState({}),[f,p]=R.useState(!1);async function y(x,S,w,_){l(E=>({...E,[x]:"Starte..."}));try{await It("/api/models/install",{method:"POST",body:JSON.stringify({repo:x,role:S,quant:w,jinja:_})}),l(E=>({...E,[x]:"Download läuft"}))}catch{l(T=>({...T,[x]:"Fehler"}))}}return e?v.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):o||!t?v.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Empfehlungsdienst temporär nicht erreichbar (",o,")."]}):v.jsxs("div",{className:"space-y-8",children:[v.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground bg-background/25 border border-border/40 p-4 rounded-xl flex flex-col sm:flex-row sm:items-center justify-between gap-3 shadow-sm",children:[v.jsxs("div",{children:["Modell-Registry geladen für ",v.jsxs("span",{className:"text-foreground font-bold",children:[t.sys_ram_gb," GB"]})," System-RAM."]}),v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx(s9,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),v.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),v.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:t.categories.map(x=>{const S=qfe[x.role]||{title:x.title||x.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:_C},w=S.icon,_=s.find(D=>D.role===x.role),E=i==null?void 0:i.model_list.find(D=>D.role===x.role),T=x.models.find(D=>D.repo===x.recommended)||x.models[0];if(!T)return null;const P=a[T.repo],O=x.models.filter(D=>D.repo!==x.recommended),N=!!c[x.role];return v.jsxs("div",{className:nt("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-5 transition-all duration-300 hover:border-primary/40",_?"border-border/60":"border-primary/20 shadow-primary/5"),children:[v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex items-start justify-between gap-3",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 border border-primary/20 flex items-center justify-center text-primary shadow-sm shrink-0",children:v.jsx(w,{className:"h-5.5 w-5.5"})}),v.jsxs("div",{children:[v.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:S.title}),v.jsxs("span",{className:"text-[9px] font-mono text-muted-foreground uppercase bg-background/50 px-1.5 py-0.5 rounded border border-border/30 inline-block mt-0.5",children:["Rolle: ",x.role]})]})]}),_?v.jsxs("span",{className:"flex items-center gap-1.5 text-[9px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-2.5 py-1 rounded-lg",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):v.jsx("span",{className:"text-[9px] font-bold text-primary/70 uppercase tracking-wider bg-primary/10 border border-primary/20 px-2.5 py-1 rounded-lg",children:"Frei"})]}),v.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:S.desc}),v.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:_?v.jsxs("div",{className:"space-y-1.5",children:[v.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),v.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:_.name,children:_.name.split("/").pop()}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[v.jsxs("span",{children:["Größe: ",WT(_.size_bytes||0)]}),v.jsx("span",{children:"•"}),v.jsxs("span",{children:["Quant: ",_.quant||"GGUF"]})]})]}):v.jsxs("div",{className:"space-y-1.5",children:[v.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),v.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:T.name,children:T.name}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[v.jsxs("span",{children:["Ersteller: ",T.author]}),v.jsx("span",{children:"•"}),v.jsxs("span",{children:["Quant: ",T.quant]})]}),v.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:v.jsx(jfe,{fit:T.fit})})]})}),v.jsx("div",{className:"pt-1",children:_?E?v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),v.jsxs("span",{children:["Bessere Version in der Registry: ",E.repo.split("/").pop()]})]}),v.jsxs("button",{onClick:()=>y(E.repo,x.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!a[E.repo],className:"h-8 w-full flex items-center justify-center gap-1.5 rounded-lg bg-amber-500 text-black text-xs font-bold hover:bg-amber-400 disabled:opacity-50 transition-all cursor-pointer shadow-md shadow-amber-500/10",children:[v.jsx(yg,{className:"h-3.5 w-3.5"}),a[E.repo]||"Auf neue Version aktualisieren"]})]}):v.jsxs("div",{className:"h-8 flex items-center justify-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/10 rounded-lg select-none",children:[v.jsx(Xo,{className:"h-4 w-4"})," Auf neuestem Stand"]}):v.jsxs("button",{onClick:()=>y(T.repo,x.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!P,className:nt("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",P?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[v.jsx(yg,{className:"h-3.5 w-3.5"}),P||"Optimales Modell einsetzen"]})})]}),O.length>0&&v.jsxs("div",{className:"border-t border-border/20 pt-3",children:[v.jsxs("button",{onClick:()=>d(D=>({...D,[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?v.jsx(A8,{className:"h-3 w-3"}):v.jsx(M8,{className:"h-3 w-3"}),v.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",O.length,")"]})]}),N&&v.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:O.map(D=>v.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:D.name,children:D.name}),v.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[v.jsxs("span",{children:["Quant: ",D.quant]}),v.jsx("span",{children:"•"}),v.jsx("span",{children:D.fit.text})]})]}),v.jsx("button",{onClick:()=>y(D.repo,x.role,D.quant||"Q4_K_M",D.caps.tools!=="no"),disabled:!!a[D.repo],className:"h-6 px-2.5 rounded bg-background/40 hover:bg-background/80 border border-border/40 text-[9px] font-bold text-foreground transition-all cursor-pointer shrink-0 disabled:opacity-50",children:a[D.repo]||"Installieren"})]},D.repo))})]})]},x.role)})}),v.jsxs("div",{className:"border border-border/50 bg-card/20 rounded-2xl overflow-hidden shadow-md mt-4",children:[v.jsxs("button",{onClick:()=>p(!f),className:"w-full px-5 py-4 flex items-center justify-between text-xs font-bold uppercase tracking-wider text-muted-foreground hover:bg-card/30 transition-colors cursor-pointer",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(wC,{className:"h-4 w-4 text-primary"}),v.jsx("span",{children:"Eigenes Modell von Hugging Face laden (Erweiterte Ansicht)"})]}),v.jsx("span",{className:"text-[10px] text-primary hover:underline",children:f?"Ausblenden ▲":"Anzeigen ▼"})]}),f&&v.jsx("div",{className:"p-5 border-t border-border/20 bg-card/10",children:v.jsx(Xfe,{})})]})]})}function Yfe(){const[t,e]=R.useState("cockpit");return v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Modell-Manager"}),v.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),v.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 self-start",children:["cockpit","discover"].map(n=>v.jsx("button",{onClick:()=>e(n),className:nt("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",t===n?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:n==="cockpit"?"Cockpit":"Modelle finden"},n))})]}),v.jsx(Bfe,{}),v.jsx("div",{className:"transition-all duration-300",children:t==="cockpit"?v.jsx($fe,{}):v.jsx(Kfe,{})})]})}const Zfe={cline:"cline_settings.json",cursor:"Settings → Models",opencode:"opencode.jsonc",zed:"settings.json",continue:"~/.continue/config.json",claude_code:"~/.zshrc / env"};function U3({line:t,loading:e}){return e||!t?v.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-muted-foreground",children:[v.jsx(G1,{className:"h-3 w-3 animate-spin"})," prüfe…"]}):t.ok?v.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-emerald-400",children:[v.jsx(T8,{className:"h-3 w-3"})," ",t.detail]}):v.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-red-400",children:[v.jsx(C8,{className:"h-3 w-3"})," ",t.detail]})}function j3({tool:t,fileName:e,accent:n,copied:r,onCopy:i}){return v.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[v.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80"}),v.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80"}),v.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80"})]}),v.jsx("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground/75 bg-background/30 px-3 py-1 rounded-md border border-border/20",children:v.jsx("span",{children:e})}),v.jsxs("button",{onClick:i,className:"flex h-7 px-2.5 items-center gap-1.5 rounded-lg border border-border/40 bg-background/30 text-[10px] font-semibold text-muted-foreground hover:text-foreground hover:bg-background/60 transition-all cursor-pointer",children:[r?v.jsx(Xo,{className:"h-3.5 w-3.5 text-emerald-400"}):v.jsx(RT,{className:"h-3.5 w-3.5"}),v.jsx("span",{children:r?"Kopiert":"Kopieren"})]})]}),v.jsx("pre",{className:nt("p-5 overflow-x-auto text-xs font-mono whitespace-pre leading-relaxed scrollbar-thin select-text bg-black/10",n==="teal"?"text-cyan-200/90":"text-violet-200/90"),children:v.jsx("code",{children:t.snippet})})]})}function Qfe(){const[t,e]=R.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[n,r]=R.useState(localStorage.getItem("mc_mcp_path")||""),[i,s]=R.useState("cline"),[o,a]=R.useState(null),l=new URLSearchParams({host:t});n&&l.set("mcp_path",n);const{data:c,error:d}=T7(l.toString()),{data:f,isLoading:p}=P7(),y=d?String(d):"";function x(E){e(E),E&&localStorage.setItem("mc_host",E)}function S(E){r(E),localStorage.setItem("mc_mcp_path",E)}const w=c==null?void 0:c.tools[i];async function _(E,T){T&&(await navigator.clipboard.writeText(T),a(E),setTimeout(()=>a(null),1500))}return v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Verbindung & Integration"}),v.jsxs("p",{className:"text-sm text-muted-foreground",children:["Binde deinen lokalen Agenten an die Box an — über ",v.jsx("span",{className:"text-foreground",children:"zwei getrennte Leitungen"}),": das Modell (Gateway) und das geteilte Gedächtnis (MCP)."]})]}),v.jsxs("div",{className:"p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[v.jsxs("div",{className:"grid gap-4 md:grid-cols-[170px_1fr] items-center",children:[v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-background/40 p-4 text-center",children:[v.jsx(z8,{className:"h-7 w-7 mx-auto text-muted-foreground"}),v.jsx("div",{className:"mt-2 text-sm font-semibold text-foreground",children:"Dein lokaler Agent"}),v.jsx("div",{className:"text-[11px] text-muted-foreground",children:"Cline · Cursor · Zed …"})]}),v.jsxs("div",{className:"flex flex-col gap-2.5",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(J_,{className:"h-4 w-4 text-muted-foreground shrink-0"}),v.jsxs("div",{className:"flex-1 rounded-xl border border-primary/25 bg-primary/5 px-3.5 py-2.5",children:[v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-primary",children:[v.jsx(Sd,{className:"h-3.5 w-3.5"})," Leitung 1 — Modell"]}),v.jsx(U3,{line:f==null?void 0:f.gateway,loading:p})]}),v.jsx("div",{className:"mt-1 text-[11px] font-mono text-primary/80",children:"Gateway · :9001/v1 · Lanes chat / coding"})]})]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(J_,{className:"h-4 w-4 text-muted-foreground shrink-0"}),v.jsxs("div",{className:"flex-1 rounded-xl border border-violet-500/25 bg-violet-500/5 px-3.5 py-2.5",children:[v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-violet-300",children:[v.jsx(V1,{className:"h-3.5 w-3.5"})," Leitung 2 — Gedächtnis"]}),v.jsx(U3,{line:f==null?void 0:f.memory,loading:p})]}),v.jsx("div",{className:"mt-1 text-[11px] font-mono text-violet-300/80",children:"MCP · mcp_memory.py · separat"})]})]})]})]}),v.jsxs("p",{className:"mt-3.5 text-[11px] text-muted-foreground leading-relaxed",children:["Der Gateway liefert ",v.jsx("span",{className:"text-foreground",children:"nur das LLM"}),". Das geteilte Gedächtnis läuft über einen",v.jsx("span",{className:"text-foreground",children:" eigenen MCP-Server"})," — beide werden unabhängig eingerichtet."]})]}),v.jsxs("div",{className:"grid gap-4 md:grid-cols-2 p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[v.jsxs("div",{className:"space-y-1.5",children:[v.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[v.jsx(j8,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),v.jsx("input",{value:t,onChange:E=>x(E.target.value),placeholder:"z.B. 192.168.178.151",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[v.jsx(D8,{className:"h-3.5 w-3.5 text-violet-400"})," Lokaler MCP-Scriptpfad",v.jsx("span",{className:"text-violet-400/70 normal-case font-semibold tracking-normal",children:"(nur Leitung 2)"})]}),v.jsx("input",{value:n,onChange:E=>S(E.target.value),placeholder:"z.B. F:\\Coding Stuff\\mission-control-2\\mcp\\mcp_memory.py",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-violet-500/50 text-foreground"})]})]}),y&&v.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler beim Generieren der Snippets: ",y]}),c&&v.jsxs("div",{className:"grid gap-5 lg:grid-cols-2",children:[v.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-primary/70 bg-card/30 p-4",children:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[v.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-primary/15 text-primary text-[11px]",children:"1"}),"Modell anbinden"]}),v.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"Wähle dein Tool — das Snippet zeigt auf den Gateway."})]}),v.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(c.tools).map(([E,T])=>v.jsx("button",{onClick:()=>s(E),className:nt("rounded-lg px-3 py-1.5 text-[11px] font-semibold tracking-wide transition-all cursor-pointer",i===E?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"border border-border/50 text-muted-foreground hover:text-foreground"),children:T.label},E))}),w&&v.jsxs(v.Fragment,{children:[w.note&&v.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-primary/5 border border-primary/20 text-[11px] text-muted-foreground leading-relaxed",children:[v.jsx(lI,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),v.jsx("span",{children:w.note})]}),v.jsx(j3,{tool:w,fileName:Zfe[i]||"config.json",accent:"teal",copied:o==="model",onCopy:()=>_("model",w.snippet)})]})]}),v.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-violet-500/70 bg-card/30 p-4",children:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[v.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-violet-500/15 text-violet-300 text-[11px]",children:"2"}),"Gedächtnis anbinden",v.jsx("span",{className:"text-[10px] font-medium text-muted-foreground normal-case",children:"optional"})]}),v.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:["Ein MCP-Block — gilt zusätzlich für ",v.jsx("em",{children:"jedes"})," Tool aus Schritt 1."]})]}),v.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-violet-500/5 border border-violet-500/20 text-[11px] text-muted-foreground leading-relaxed",children:[v.jsx(lI,{className:"h-4 w-4 text-violet-400 shrink-0 mt-0.5"}),v.jsx("span",{children:c.memory.note})]}),v.jsx(j3,{tool:c.memory,fileName:"mcp.json",accent:"violet",copied:o==="memory",onCopy:()=>_("memory",c.memory.snippet)})]})]})]})}const Jfe="modulepreload",ehe=function(t){return"/"+t},F3={},the=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(c){return Promise.all(c.map(d=>Promise.resolve(d).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=o(n.map(c=>{if(c=ehe(c),c in F3)return;F3[c]=!0;const d=c.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":Jfe,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(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};class nhe extends R.Component{constructor(){super(...arguments);Gs(this,"state",{error:null})}static getDerivedStateFromError(n){return{error:n}}render(){return this.state.error?v.jsxs("div",{className:"h-[480px] rounded-2xl border border-red-500/20 bg-red-500/5 p-6 text-xs text-red-400 overflow-auto",children:[v.jsx("div",{className:"font-semibold mb-2",children:"Graph konnte nicht gerendert werden"}),v.jsx("pre",{className:"whitespace-pre-wrap break-words text-[11px] leading-relaxed",children:this.state.error.message})]}):this.props.children}}const rhe=R.lazy(()=>the(()=>import("./GraphView-BHLXKfTN.js"),[]).then(t=>({default:t.GraphView}))),Ub=["identity","knowledge","rules","events"],z3=new Set(["auto","agent","hermes"]),XE={identity:{label:"Identität",icon:o9,bg:"bg-cyan-500/10",text:"text-cyan-400"},knowledge:{label:"Wissen",icon:Ym,bg:"bg-indigo-500/10",text:"text-indigo-400"},rules:{label:"Regeln",icon:e9,bg:"bg-violet-500/10",text:"text-violet-400"},events:{label:"Ereignisse",icon:R8,bg:"bg-amber-500/10",text:"text-amber-400"}},B3={label:"Gedächtnis",icon:PT,text:"text-muted-foreground"},ihe={identity:"border-l-cyan-500/80",knowledge:"border-l-indigo-500/80",rules:"border-l-violet-500/80",events:"border-l-amber-500/80"},H3=`Hi Hermes! Lass uns ein kurzes Onboarding machen, damit du dich künftig an mich erinnerst. Stell mir nacheinander ein paar kurze Fragen zu:
|
||
1) wer ich bin und woran ich gerade arbeite,
|
||
2) wie ich angesprochen werden möchte,
|
||
3) meine bevorzugten Tools, Sprachen und Arbeitsweise,
|
||
4) wichtige Regeln/Konventionen, die du beachten sollst,
|
||
5) meine Infrastruktur (Server, Dienste – ohne Geheimnisse).
|
||
Frag immer nur eine Sache auf einmal und fass am Ende zusammen, was du dir gemerkt hast.`;function she(){const[t,e]=R.useState(""),[n,r]=R.useState(""),[i,s]=R.useState(""),[o,a]=R.useState("knowledge"),[l,c]=R.useState(!1),[d,f]=R.useState(!1),[p,y]=R.useState("liste"),[x,S]=R.useState(!1),w=Rd(),{showAlert:_,showConfirm:E,dialogElement:T}=tv(),{data:P=[]}=BT({}),{data:O=[],error:N}=BT({q:n,category:t}),{data:D}=v7(p==="graph"),z=N?String(N):"",G=()=>{w.invalidateQueries({queryKey:["memory"]}),w.invalidateQueries({queryKey:["memory-graph"]})},k=R.useMemo(()=>{const V=P.length,q=P.filter(pe=>z3.has(pe.source)).length;return{total:V,auto:q,manual:V-q,cats:new Set(P.map(pe=>pe.category)).size}},[P]),j=P.length===0,H=R.useMemo(()=>{const V=D??{nodes:[],edges:[]};if(!n.trim())return V;const q=n.toLowerCase(),pe=V.nodes.filter(ce=>ce.content.toLowerCase().includes(q)),ae=new Set(pe.map(ce=>ce.id));return{nodes:pe,edges:V.edges.filter(ce=>ae.has(ce.source)&&ae.has(ce.target))}},[D,n]),ee=R.useMemo(()=>{const V={};return O.forEach(q=>{var pe;(V[pe=q.category]??(V[pe]=[])).push(q)}),V},[O]),te=R.useMemo(()=>O.filter(V=>!Ub.includes(V.category)),[O]);async function he(){i.trim()&&(await It("/api/memory",{method:"POST",body:JSON.stringify({content:i,category:o,source:"ui"})}),s(""),S(!1),G())}async function se(V){await It(`/api/memory/${V}`,{method:"DELETE"}),G()}async function fe(){try{await navigator.clipboard.writeText(H3),f(!0),setTimeout(()=>f(!1),1800)}catch{_("Kopieren fehlgeschlagen","Markiere den Prompt und kopiere ihn manuell (Strg+C).")}}function B(){fe(),window.dispatchEvent(new CustomEvent("mc-navigate",{detail:{view:"terminal"}}))}async function J(){c(!0);try{const V=await It("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if(V.duplicate_count===0){_("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}E("Deduplizierung bestätigen",`${V.duplicate_count} Dublette(n) in ${V.groups.length} Gruppe(n) gefunden. Entfernen?`,async()=>{try{await It("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),G()}catch(q){_("Fehler",`Fehler beim Löschen: ${q.message}`)}})}catch(V){_("Fehler",`Fehler bei der Deduplizierung: ${V.message}`)}finally{c(!1)}}const Y=({value:V,label:q,accent:pe})=>v.jsxs("span",{className:nt("flex items-center gap-1.5 text-[11px] rounded-lg px-2.5 py-1 border",pe==="auto"?"text-emerald-400 bg-emerald-500/[0.07] border-emerald-500/20":"text-muted-foreground bg-card/40 border-border/50"),children:[pe==="auto"&&v.jsx(Vm,{className:"h-3 w-3"}),v.jsx("b",{className:nt("font-semibold",pe==="auto"?"":"text-foreground"),children:V})," ",q]});return v.jsxs("div",{className:"space-y-5",children:[v.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Gedächtnis-Pool"}),v.jsx("p",{className:"text-sm text-muted-foreground",children:"Geteilte Konstitution — Hermes, IDEs & Gateway lesen und lernen hier per MCP."})]}),v.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[v.jsxs("div",{className:"relative",children:[v.jsx("input",{value:n,onChange:V=>r(V.target.value),placeholder:"Semantisch suchen…",className:"w-52 h-9 pl-8 pr-3 rounded-lg border border-border/60 bg-card/45 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),v.jsx(wC,{className:"absolute left-2.5 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),v.jsxs("button",{onClick:()=>S(V=>!V),className:"h-9 px-3 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer shadow-md shadow-primary/10",children:[v.jsx(kT,{className:"h-4 w-4"})," Eintrag"]}),v.jsx("div",{className:"flex items-center gap-1 p-1 bg-card/30 border border-border/40 rounded-lg",children:[["liste",G8,"Liste"],["graph",n9,"Graph"]].map(([V,q,pe])=>v.jsxs("button",{onClick:()=>y(V),className:nt("flex h-7 px-2.5 items-center gap-1.5 text-[11px] font-semibold rounded-md transition-all cursor-pointer",p===V?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[v.jsx(q,{className:"h-3.5 w-3.5"})," ",pe]},V))}),v.jsx("button",{onClick:J,disabled:l,className:"flex h-9 w-9 items-center justify-center rounded-lg border border-border/60 bg-card hover:border-primary/50 transition-all cursor-pointer shadow-md disabled:opacity-50",title:"Deduplizieren",children:v.jsx(Vm,{className:"h-4 w-4 text-primary"})})]})]}),!j&&v.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[v.jsx(Y,{value:k.total,label:"Fakten"}),v.jsx(Y,{value:k.auto,label:"auto gelernt",accent:"auto"}),v.jsx(Y,{value:k.manual,label:"manuell"}),v.jsx(Y,{value:k.cats,label:"Kategorien"}),v.jsxs("span",{className:"ml-auto text-[11px] text-muted-foreground/70 flex items-center gap-1.5",children:[v.jsx(Vm,{className:"h-3 w-3 text-emerald-400"})," lernt automatisch aus Hermes-Gesprächen"]})]}),x&&v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Neuen Eintrag anlegen"}),v.jsx("button",{onClick:()=>S(!1),className:"text-muted-foreground hover:text-foreground",children:v.jsx(Md,{className:"h-4 w-4"})})]}),v.jsx("textarea",{value:i,onChange:V=>s(V.target.value),rows:2,placeholder:"Eine Regel, Vorliebe oder einen stabilen Fakt über dich oder das Projekt…",className:"w-full resize-none rounded-xl border border-border/60 bg-background/30 p-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground leading-relaxed"}),v.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[v.jsx("select",{value:o,onChange:V=>a(V.target.value),className:"h-8 rounded-lg border border-border/60 bg-background/50 px-2 text-xs outline-none font-semibold text-foreground cursor-pointer",children:Ub.map(V=>{var q;return v.jsx("option",{value:V,className:"bg-popover text-foreground",children:((q=XE[V])==null?void 0:q.label)||V},V)})}),v.jsxs("button",{onClick:he,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer",children:[v.jsx(kT,{className:"h-4 w-4"})," Speichern"]})]})]}),z&&v.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler: ",z]}),j?v.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 bg-card/20 p-8 sm:p-10 flex flex-col items-center text-center gap-5",children:[v.jsx("div",{className:"h-14 w-14 rounded-2xl bg-primary/10 flex items-center justify-center",children:v.jsx(X8,{className:"h-7 w-7 text-primary"})}),v.jsxs("div",{className:"space-y-1.5 max-w-lg",children:[v.jsx("h3",{className:"text-base font-semibold text-foreground",children:"Lass Hermes dich kennenlernen"}),v.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Statt Fakten einzutippen: führ ein kurzes Onboarding-Gespräch mit Hermes. Was ihr besprecht, merkt sich das Gedächtnis automatisch — du musst nichts manuell pflegen."})]}),v.jsxs("div",{className:"w-full max-w-lg text-left",children:[v.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Sende das an Hermes"}),v.jsx("button",{onClick:fe,className:"flex items-center gap-1 text-[10px] font-semibold text-muted-foreground hover:text-foreground transition-colors",children:d?v.jsxs(v.Fragment,{children:[v.jsx(Xo,{className:"h-3 w-3 text-emerald-400"})," Kopiert"]}):v.jsxs(v.Fragment,{children:[v.jsx(RT,{className:"h-3 w-3"})," Kopieren"]})})]}),v.jsx("pre",{className:"w-full rounded-xl border border-border/60 bg-background/40 p-3.5 text-[11px] leading-relaxed text-foreground/90 whitespace-pre-wrap font-mono",children:H3})]}),v.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[v.jsxs("button",{onClick:B,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer",children:[v.jsx(hF,{className:"h-4 w-4"})," Im Terminal starten"]}),v.jsxs("button",{onClick:fe,className:"h-9 px-4 rounded-lg border border-border/60 bg-card text-xs font-semibold hover:border-primary/50 transition-all flex items-center gap-1.5 cursor-pointer",children:[d?v.jsx(Xo,{className:"h-4 w-4 text-emerald-400"}):v.jsx(RT,{className:"h-4 w-4"})," Prompt kopieren"]})]}),v.jsxs("p",{className:"text-[11px] text-muted-foreground/70 flex items-center gap-1.5",children:[v.jsx(t9,{className:"h-3 w-3"})," Funktioniert genauso über Telegram —"," ",v.jsx("button",{onClick:()=>S(!0),className:"underline hover:text-foreground",children:"oder lieber manuell anlegen"}),"."]})]}):p==="graph"?v.jsx(nhe,{children:v.jsx(R.Suspense,{fallback:v.jsx("div",{className:"h-[480px] rounded-2xl border border-border/60 bg-card/30 flex items-center justify-center text-xs text-muted-foreground",children:"Graph wird geladen…"}),children:v.jsx(rhe,{data:H,onDelete:se})})}):v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 p-1 bg-card/30 border border-border/40 rounded-xl w-fit",children:[v.jsx("button",{onClick:()=>e(""),className:nt("h-7 px-3 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer",t?"text-muted-foreground hover:text-foreground":"bg-primary text-primary-foreground"),children:"Alle"}),Ub.map(V=>{const q=XE[V]||B3,pe=q.icon;return v.jsxs("button",{onClick:()=>e(V),className:nt("h-7 px-2.5 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer flex items-center gap-1",t===V?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[v.jsx(pe,{className:"h-3 w-3"})," ",q.label]},V)})]}),O.length===0?v.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center",children:"Keine Einträge für die aktuellen Filterkriterien gefunden."}):v.jsx("div",{className:"space-y-5",children:[...Ub,"__other"].map(V=>{const q=V==="__other"?te:ee[V]||[];if(!q.length)return null;const pe=XE[V]||B3,ae=pe.icon;return v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2 mb-2 px-1",children:[v.jsx(ae,{className:nt("h-3.5 w-3.5",pe.text)}),v.jsx("span",{className:nt("text-[11px] font-bold uppercase tracking-wider",pe.text),children:pe.label}),v.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/60 bg-card/50 rounded px-1.5 py-0.5",children:q.length}),v.jsx("div",{className:"ml-1 h-px flex-1 bg-border/30"})]}),v.jsx("div",{className:"space-y-2",children:q.map(ce=>{const Se=z3.has(ce.source);return v.jsxs("div",{className:nt("flex items-start justify-between gap-4 p-3.5 rounded-xl border border-l-4 bg-card/45 backdrop-blur-md border-border/60 hover:border-primary/20 transition-all group",ihe[ce.category]||"border-l-muted"),children:[v.jsx("span",{className:"text-xs text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1 min-w-0",children:ce.content}),v.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[typeof ce.score=="number"&&v.jsxs("span",{className:"text-[9px] font-mono text-primary bg-primary/10 px-1.5 py-0.5 rounded",title:"Relevanz der semantischen Suche",children:[Math.round(ce.score*100),"%"]}),v.jsxs("span",{className:nt("flex items-center gap-1 text-[9px] font-mono px-1.5 py-0.5 rounded",Se?"text-emerald-400 bg-emerald-500/10":"text-muted-foreground/60 bg-background/20"),title:Se?"Automatisch gelernt":"Manuell angelegt",children:[Se&&v.jsx(Vm,{className:"h-2.5 w-2.5"}),ce.source]}),v.jsx("button",{onClick:()=>se(ce.id),title:"Eintrag löschen",className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all opacity-0 group-hover:opacity-100",children:v.jsx(OT,{className:"h-3.5 w-3.5"})})]})]},ce.id)})})]},V)})})]}),T]})}const ohe=["chat","coding","fast","heavy"];function ahe(){const{data:t,error:e}=CC(5e3),{data:n}=Bg(),{showAlert:r,dialogElement:i}=tv(),s=Rd(),o=e?String(e):"",[a,l]=R.useState(!1),c=(n==null?void 0:n.models)??[];async function d(p){try{await It("/api/agent/brain",{method:"POST",body:JSON.stringify({model:p})}),r("Erledigt",`Hermes-Hirn zeigt jetzt auf das Alias '${p}'. Der Gateway-Dienst wurde neu gestartet.`),s.invalidateQueries({queryKey:qn.agentStatus}),l(!1)}catch(y){r("Fehler",`Wechsel fehlgeschlagen: ${y.message||y}`)}}async function f(p){try{await It("/api/agent/brain/set",{method:"POST",body:JSON.stringify({model_id:p})}),r("Erledigt","Agent-Hirn gewechselt (warm gehalten). Gateway wurde neugestartet."),s.invalidateQueries({queryKey:qn.agentStatus}),s.invalidateQueries({queryKey:qn.models}),l(!1)}catch(y){r("Fehler",`Wechsel fehlgeschlagen: ${y.message||y}`)}}return v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Hermes Agenten-Cockpit"}),v.jsxs("p",{className:"text-sm text-muted-foreground",children:["Hermes ist ein autonomer Agent, der im Hintergrund der Box läuft (Port ",v.jsx("code",{children:":8642"}),") und seine eigene UI besitzt."]})]}),(t==null?void 0:t.terminal_url)&&v.jsxs("a",{href:Ng(t.terminal_url),target:"_blank",rel:"noopener",className:nt("flex h-9 px-4 items-center gap-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer shadow-md shrink-0 self-start",t.terminal_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-primary/10":"border border-border/60 text-muted-foreground bg-background/20"),children:[v.jsx(xg,{className:"h-4 w-4"}),v.jsx("span",{children:"Terminal öffnen"})]})]}),o&&v.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400 font-mono",children:["Status nicht lesbar (",o,")."]}),t&&v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10",children:[v.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[v.jsx($c,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Agent-Fluss"})]}),v.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-stretch gap-3",children:[v.jsxs("button",{onClick:()=>t.terminal_reachable&&window.open(Ng(t.terminal_url),"_blank"),title:t.terminal_reachable?"Hermes-Terminal öffnen":"Terminal offline",className:"lg:w-40 shrink-0 rounded-xl border border-border/60 bg-background/30 p-3 text-left hover:border-primary/40 transition-all cursor-pointer flex flex-col justify-center",children:[v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx(bC,{className:nt("h-3.5 w-3.5",t.terminal_reachable?"text-emerald-400":"text-amber-500")}),v.jsx("span",{className:"text-xs font-semibold text-foreground",children:"Terminal"}),v.jsx("span",{className:nt("ml-auto h-1.5 w-1.5 rounded-full animate-pulse",t.terminal_reachable?"bg-emerald-500":"bg-amber-500")})]}),v.jsx("span",{className:"text-[10px] text-muted-foreground font-mono mt-0.5",children:"hermes chat · Clients"})]}),v.jsx("div",{className:"hidden lg:flex items-center text-muted-foreground text-lg select-none",children:"→"}),v.jsxs("div",{className:"flex-1 flex flex-col gap-2.5",children:[v.jsxs("div",{className:"rounded-xl border border-primary/40 bg-primary/5 px-3.5 py-2.5 flex items-center gap-2",children:[v.jsx($c,{className:"h-3.5 w-3.5 text-primary"}),v.jsx("span",{className:"text-xs font-semibold text-primary",children:"Agent Gateway"}),v.jsx("span",{className:"text-[11px] font-mono text-muted-foreground",children:":8642"}),v.jsxs("span",{className:nt("ml-auto inline-flex items-center gap-1.5 text-[10px] font-bold uppercase font-mono px-2 py-0.5 rounded-full border",t.gateway_reachable?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-red-500/10 text-red-400 border-red-500/20"),children:[v.jsx("span",{className:nt("h-1.5 w-1.5 rounded-full",t.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-red-500")}),t.gateway_reachable?"online":"offline"]})]}),v.jsxs("div",{className:"grid gap-2.5 sm:grid-cols-3",children:[v.jsxs("button",{onClick:()=>l(!0),className:"rounded-xl border border-border/60 bg-background/30 p-3 text-left hover:border-primary/45 transition-all cursor-pointer",children:[v.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[v.jsx(Sd,{className:"h-3.5 w-3.5 text-primary"}),v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Hirn"}),v.jsx("span",{className:"ml-auto text-[9px] text-primary/70 font-bold uppercase",children:"wechseln →"})]}),v.jsx("div",{className:"text-[11px] font-mono font-medium text-foreground truncate mt-1",title:t.brain_model,children:t.brain_model||"chat"})]}),v.jsxs("div",{className:"rounded-xl border border-border/60 bg-background/30 p-3",children:[v.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[v.jsx(SC,{className:"h-3.5 w-3.5 text-primary"}),v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Verdrahtung"})]}),v.jsxs("div",{className:"text-[10px] font-mono mt-1 flex flex-wrap gap-x-2 text-muted-foreground",children:[v.jsxs("span",{children:["Config: ",t.has_config?"✓":"—"]}),v.jsxs("span",{children:["Skills: ",t.has_skills?"✓":"—"]}),v.jsxs("span",{children:["Memory: ",t.has_memories?"✓":"—"]})]})]}),v.jsxs("div",{className:"rounded-xl border border-border/60 bg-background/30 p-3",children:[v.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[v.jsx(cI,{className:"h-3.5 w-3.5 text-primary"}),v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"PC"}),v.jsx("span",{className:nt("ml-auto h-1.5 w-1.5 rounded-full",t.pc_executor_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")})]}),v.jsxs("div",{className:nt("text-[11px] font-mono mt-1",t.pc_executor_reachable?"text-emerald-400":"text-muted-foreground"),children:[":7777 ",t.pc_executor_reachable?"verbunden":"offline"]})]})]})]})]})]}),v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(cI,{className:"h-5 w-5 text-primary"}),v.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"PC Verbindung"})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("span",{className:nt("h-2 w-2 rounded-full",t.pc_executor_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),v.jsx("span",{className:"text-xs font-semibold text-foreground",children:t.pc_executor_reachable?"Erreichbar":"Nicht verbunden"})]})]}),v.jsxs("div",{className:"grid gap-6 md:grid-cols-2 text-xs text-muted-foreground leading-relaxed text-left",children:[v.jsxs("div",{className:"space-y-3",children:[v.jsxs("p",{children:["Der ",v.jsx("strong",{className:"text-foreground",children:"Hermes PC Executor"})," läuft auf ",v.jsx("code",{className:"text-foreground font-mono px-1 py-0.5 rounded bg-muted/40 border border-border/30",children:"192.168.178.98:7777"})," und ermöglicht Hermes den direkten Zugriff auf deinen Windows-PC — Shell-Befehle, Screenshots, Tastatureingaben."]}),v.jsxs("p",{children:["Hermes erreicht den PC über den MCP-Server ",v.jsx("code",{className:"text-foreground font-mono px-1 py-0.5 rounded bg-muted/40 border border-border/30",children:"hermes-pc-control"}),", der automatisch beim Gateway-Start verbunden wird."]})]}),v.jsx("div",{className:"space-y-3",children:t.pc_executor_reachable?v.jsxs("div",{className:"p-3.5 bg-emerald-500/5 border border-emerald-500/20 rounded-xl space-y-1",children:[v.jsxs("div",{className:"text-emerald-400 font-semibold text-xs flex items-center gap-1.5",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"PC Executor verbunden"]}),v.jsxs("p",{className:"text-[10px]",children:["Hermes kann jetzt per Telegram oder Terminal Befehle auf TobisNicerPC ausführen. Nutze ",v.jsx("code",{className:"text-foreground",children:"pc_shell"}),", ",v.jsx("code",{className:"text-foreground",children:"pc_screenshot"})," oder ",v.jsx("code",{className:"text-foreground",children:"pc_open"}),"."]})]}):v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs font-bold text-foreground",children:"PC Executor starten"}),v.jsxs("p",{children:["Starte ",v.jsx("code",{className:"text-foreground font-mono",children:"start.bat"})," im Ordner ",v.jsx("code",{className:"text-foreground font-mono",children:"client\\hermes-pc\\"})," auf dem Windows-PC und lasse das Fenster offen."]}),v.jsx("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[9px] text-cyan-300",children:"client\\hermes-pc\\start.bat"})]})})]})]}),!t.gateway_reachable&&v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10 text-left",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(Ym,{className:"h-5 w-5 text-amber-500"}),v.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"Hermes-Agent Diagnostics"})]}),v.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-relaxed",children:[v.jsx("p",{children:"Der Hermes-Dienst ist auf der Box derzeit offline oder kann sich nicht mit dem lokalen llama-swap verbinden."}),v.jsxs("p",{children:["Stelle sicher, dass die systemd-Dienste auf der Box laufen. Du kannst den Status im ",v.jsx("strong",{children:"OS & Updates Drawer"})," prüfen und die Dienste bei Bedarf neu starten."]}),v.jsxs("div",{className:"p-3.5 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1",children:[v.jsx("div",{className:"text-muted-foreground/60",children:"# Dienste manuell auf der Box prüfen:"}),v.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-gateway"}),v.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-terminal"})]}),v.jsxs("p",{children:["Weitere Einrichtungsdetails (Brain-Konfiguration, MCP-Kopplungen, SSH-Tunneling und Such-Engines) findest du in der Dokumentationsdatei:",v.jsx("code",{className:"ml-1 px-1.5 py-0.5 rounded bg-muted/40 text-foreground border border-border/30",children:"docs/HERMES_SETUP.md"}),"."]})]})]})]}),t&&a&&v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[v.jsx(Sd,{className:"h-4 w-4"}),v.jsx("span",{children:"Hermes-Hirn konfigurieren"})]}),v.jsx("button",{onClick:()=>l(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Md,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Lane / Gateway-Alias"}),v.jsx("div",{className:"flex flex-wrap gap-1.5",children:ohe.map(p=>{const y=t.brain_model===p;return v.jsxs("button",{onClick:()=>d(p),className:nt("px-3 py-1.5 rounded-lg text-xs font-mono font-semibold border transition-all cursor-pointer flex items-center gap-1.5",y?"border-primary/40 bg-primary/10 text-primary":"border-border/30 bg-background/20 text-foreground hover:bg-accent"),children:[p,y&&v.jsx(Xo,{className:"h-3.5 w-3.5"})]},p)})}),v.jsxs("p",{className:"text-[10px] text-muted-foreground/70",children:["Schlank & flexibel: das Hirn folgt dem Lane-Routing (z.B. ",v.jsx("code",{className:"text-primary",children:"chat"})," = fast↔heavy)."]})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Installiertes Modell (warm gehalten)"}),v.jsx("div",{className:"space-y-1.5 max-h-56 overflow-y-auto pr-1",children:c.map(p=>{var x;const y=p.role==="hermes";return v.jsxs("button",{onClick:()=>!y&&f(p.name),disabled:y||p.incomplete,className:nt("w-full text-left px-3 py-2.5 rounded-lg text-xs flex items-center justify-between font-mono border transition-all",y?"border-indigo-500/40 bg-indigo-500/10 text-indigo-300":p.incomplete?"border-border/20 bg-background/10 text-muted-foreground/50 cursor-not-allowed":"border-border/30 bg-background/20 text-foreground hover:bg-accent cursor-pointer"),children:[v.jsxs("div",{className:"flex flex-col min-w-0",children:[v.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:(x=p.name.split("/").pop())==null?void 0:x.replace(/\.gguf$/i,"")}),v.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[p.capabilities.params_b?`${p.capabilities.params_b}B`:"?"," · ",p.capabilities.tools!=="no"?"Tools ✓":"ohne Tools",p.role&&` · Rolle: ${p.role}`]})]}),y?v.jsxs("span",{className:"text-[9px] font-bold uppercase text-indigo-300 shrink-0 flex items-center gap-1",children:[v.jsx(Xo,{className:"h-3.5 w-3.5"})," Aktiv"]}):v.jsx("span",{className:"text-[9px] font-bold uppercase text-primary/70 shrink-0",children:"Warm setzen →"})]},p.name)})})]}),v.jsxs("div",{className:"text-[10px] text-amber-400/80 flex items-start gap-1.5 border-t border-border/20 pt-2.5",children:[v.jsx("span",{children:"💡"}),v.jsxs("span",{children:["Für einen ",v.jsx("strong",{children:"Agenten"}),' sind Hermes-Modelle (natives Tool-Calling) meist die robustere Wahl. Neues Modell? Erst über „Modell-Manager → Modelle finden" laden.']})]})]})}),i]})}function lhe(){const{data:t}=CC(5e3),e=t!=null&&t.terminal_url?Ng(t.terminal_url):void 0,n=t==null?void 0:t.terminal_reachable;return v.jsxs("div",{className:"flex h-full flex-col gap-4",children:[v.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text font-space text-2xl font-bold tracking-tight text-transparent",children:"Hermes Terminal"}),v.jsxs("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:["Interaktiver Agent (",v.jsx("code",{className:"rounded bg-background/40 px-1 font-mono text-[11px] text-primary",children:"hermes chat"}),') mit Tools & PC-Steuerung — „mehr als Chatten".']})]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[v.jsx("span",{className:`h-2 w-2 rounded-full ${n?"bg-emerald-500 animate-pulse":"bg-amber-500"}`}),n?"online":"offline"]}),e&&v.jsxs("a",{href:e,target:"_blank",rel:"noopener",className:"flex h-8 items-center gap-1.5 rounded-lg border border-border/60 bg-background/20 px-3 text-xs font-semibold text-muted-foreground transition-all hover:border-primary/50 hover:text-foreground",children:[v.jsx(xg,{className:"h-3.5 w-3.5"})," In neuem Tab"]})]})]}),e?v.jsxs("div",{className:"relative min-h-[68vh] flex-1 overflow-hidden rounded-2xl border border-border/60 bg-black/50 shadow-lg shadow-black/25",children:[n===!1&&v.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-3 bg-black/70 text-center",children:[v.jsx(bg,{className:"h-8 w-8 text-amber-400"}),v.jsx("div",{className:"text-sm font-semibold text-amber-300",children:"Terminal nicht erreichbar"}),v.jsxs("p",{className:"max-w-sm text-[11px] leading-normal text-muted-foreground",children:["Der ",v.jsx("code",{className:"font-mono text-primary",children:"hermes-terminal"}),"-Dienst (ttyd) läuft nicht. Auf der Box: ",v.jsx("code",{className:"font-mono",children:"systemctl --user restart hermes-terminal"}),"."]})]}),v.jsx("iframe",{src:e,title:"Hermes Terminal",className:"h-full w-full border-0",style:{minHeight:"68vh"}})]}):v.jsxs("div",{className:"flex min-h-[68vh] flex-1 items-center justify-center rounded-2xl border border-border/60 bg-background/20 text-xs text-muted-foreground",children:[v.jsx(fF,{className:"mr-2 h-4 w-4"})," Lade Terminal…"]})]})}/**
|
||
* @license
|
||
* Copyright 2010-2024 Three.js Authors
|
||
* SPDX-License-Identifier: MIT
|
||
*/const Td="169",qf={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Kf={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},mV=0,BP=1,gV=2,che=3,vV=0,zS=1,K0=2,Oa=3,Ll=0,os=1,xo=2,Vc=0,Eh=1,HP=2,VP=3,GP=4,yV=5,ld=100,xV=101,bV=102,_V=103,wV=104,SV=200,MV=201,EV=202,AV=203,Zw=204,Qw=205,TV=206,PV=207,CV=208,RV=209,NV=210,IV=211,kV=212,OV=213,LV=214,Jw=0,e1=1,t1=2,Fh=3,n1=4,r1=5,i1=6,s1=7,ax=0,DV=1,UV=2,Tl=0,jV=1,FV=2,zV=3,dR=4,BV=5,HV=6,VV=7,WP="attached",GV="detached",BS=300,Zc=301,Pd=302,Ey=303,Ay=304,nv=306,Cd=1e3,_o=1001,Ig=1002,ri=1003,HS=1004,uhe=1004,oh=1005,dhe=1005,Cr=1006,ng=1007,fhe=1007,$o=1008,hhe=1008,Ha=1009,fR=1010,hR=1011,kg=1012,VS=1013,Qc=1014,Qs=1015,rv=1016,GS=1017,WS=1018,zh=1020,pR=35902,mR=1021,gR=1022,ss=1023,vR=1024,yR=1025,Ah=1026,Bh=1027,$S=1028,lx=1029,xR=1030,XS=1031,phe=1032,qS=1033,Y0=33776,Z0=33777,Q0=33778,J0=33779,o1=35840,a1=35841,l1=35842,c1=35843,u1=36196,d1=37492,f1=37496,h1=37808,p1=37809,m1=37810,g1=37811,v1=37812,y1=37813,x1=37814,b1=37815,_1=37816,w1=37817,S1=37818,M1=37819,E1=37820,A1=37821,ey=36492,T1=36494,P1=36495,bR=36283,C1=36284,R1=36285,N1=36286,WV=2200,$V=2201,XV=2202,Og=2300,Lg=2301,W_=2302,ah=2400,lh=2401,Ty=2402,KS=2500,_R=2501,qV=0,wR=1,I1=2,KV=3200,YV=3201,mhe=3202,ghe=3203,ou=0,ZV=1,Oc="",Fi="srgb",xi="srgb-linear",YS="display-p3",cx="display-p3-linear",Py="linear",er="srgb",Cy="rec709",Ry="p3",vhe=0,Yf=7680,yhe=7681,xhe=7682,bhe=7683,_he=34055,whe=34056,She=5386,Mhe=512,Ehe=513,Ahe=514,The=515,Phe=516,Che=517,Rhe=518,$P=519,QV=512,JV=513,e6=514,SR=515,t6=516,n6=517,r6=518,i6=519,Ny=35044,s6=35048,Nhe=35040,Ihe=35045,khe=35049,Ohe=35041,Lhe=35046,Dhe=35050,Uhe=35042,jhe="100",XP="300 es",Ml=2e3,Iy=2001;let zl=class{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(n);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,o=i.length;s<o;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 V3=1234567;const Th=Math.PI/180,Dg=180/Math.PI;function So(){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 MR(t,e){return(t%e+e)%e}function Fhe(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)}function zhe(t,e,n){return t!==e?(n-t)/(e-t):0}function ty(t,e,n){return(1-n)*t+n*e}function Bhe(t,e,n,r){return ty(t,e,1-Math.exp(-n*r))}function Hhe(t,e=1){return e-Math.abs(MR(t,e*2)-e)}function Vhe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function Ghe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function Whe(t,e){return t+Math.floor(Math.random()*(e-t+1))}function $he(t,e){return t+Math.random()*(e-t)}function Xhe(t){return t*(.5-Math.random())}function qhe(t){t!==void 0&&(V3=t);let e=V3+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Khe(t){return t*Th}function Yhe(t){return t*Dg}function Zhe(t){return(t&t-1)===0&&t!==0}function Qhe(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Jhe(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function epe(t,e,n,r,i){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((e+r)/2),d=o((e+r)/2),f=s((e-r)/2),p=o((e-r)/2),y=s((r-e)/2),x=o((r-e)/2);switch(i){case"XYX":t.set(a*d,l*f,l*p,a*c);break;case"YZY":t.set(l*p,a*d,l*f,a*c);break;case"ZXZ":t.set(l*f,l*p,a*d,a*c);break;case"XZX":t.set(a*d,l*x,l*y,a*c);break;case"YXY":t.set(l*y,a*d,l*x,a*c);break;case"ZYZ":t.set(l*x,l*y,a*d,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Ss(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function cn(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}const vr={DEG2RAD:Th,RAD2DEG:Dg,generateUUID:So,clamp:Tr,euclideanModulo:MR,mapLinear:Fhe,inverseLerp:zhe,lerp:ty,damp:Bhe,pingpong:Hhe,smoothstep:Vhe,smootherstep:Ghe,randInt:Whe,randFloat:$he,randFloatSpread:Xhe,seededRandom:qhe,degToRad:Khe,radToDeg:Yhe,isPowerOfTwo:Zhe,ceilPowerOfTwo:Qhe,floorPowerOfTwo:Jhe,setQuaternionFromProperEuler:epe,normalize:cn,denormalize:Ss};class He{constructor(e=0,n=0){He.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const n=this.x,r=this.y,i=e.elements;return this.x=i[0]*n+i[3]*r+i[6],this.y=i[1]*n+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(Tr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y;return n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const r=Math.cos(n),i=Math.sin(n),s=this.x-e.x,o=this.y-e.y;return this.x=s*r-o*i+e.x,this.y=s*i+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class $t{constructor(e,n,r,i,s,o,a,l,c){$t.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,o,a,l,c)}set(e,n,r,i,s,o,a,l,c){const d=this.elements;return d[0]=e,d[1]=i,d[2]=a,d[3]=n,d[4]=s,d[5]=l,d[6]=r,d[7]=o,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],this}extractBasis(e,n,r){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,o=r[0],a=r[3],l=r[6],c=r[1],d=r[4],f=r[7],p=r[2],y=r[5],x=r[8],S=i[0],w=i[3],_=i[6],E=i[1],T=i[4],P=i[7],O=i[2],N=i[5],D=i[8];return s[0]=o*S+a*E+l*O,s[3]=o*w+a*T+l*N,s[6]=o*_+a*P+l*D,s[1]=c*S+d*E+f*O,s[4]=c*w+d*T+f*N,s[7]=c*_+d*P+f*D,s[2]=p*S+y*E+x*O,s[5]=p*w+y*T+x*N,s[8]=p*_+y*P+x*D,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8];return n*o*d-n*a*c-r*s*d+r*a*l+i*s*c-i*o*l}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8],f=d*o-a*c,p=a*l-d*s,y=c*s-o*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]=(a*r-i*o)*S,e[3]=p*S,e[4]=(d*n-i*l)*S,e[5]=(i*s-a*n)*S,e[6]=y*S,e[7]=(r*l-c*n)*S,e[8]=(o*n-r*s)*S,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,r,i,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+n,0,0,1),this}scale(e,n){return this.premultiply(qE.makeScale(e,n)),this}rotate(e){return this.premultiply(qE.makeRotation(-e)),this}translate(e,n){return this.premultiply(qE.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,r,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<9;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<9;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const qE=new $t;function o6(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const tpe={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function $m(t,e){return new tpe[t](e)}function ky(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function a6(){const t=ky("canvas");return t.style.display="block",t}const G3={};function $_(t){t in G3||(G3[t]=!0,console.warn(t))}function npe(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 rpe(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 ipe(t){const e=t.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const W3=new $t().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),$3=new $t().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),v0={[xi]:{transfer:Py,primaries:Cy,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t,fromReference:t=>t},[Fi]:{transfer:er,primaries:Cy,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[cx]:{transfer:Py,primaries:Ry,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.applyMatrix3($3),fromReference:t=>t.applyMatrix3(W3)},[YS]:{transfer:er,primaries:Ry,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.convertSRGBToLinear().applyMatrix3($3),fromReference:t=>t.applyMatrix3(W3).convertLinearToSRGB()}},spe=new Set([xi,cx]),Nn={enabled:!0,_workingColorSpace:xi,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!spe.has(t))throw new Error(`Unsupported working color space, "${t}".`);this._workingColorSpace=t},convert:function(t,e,n){if(this.enabled===!1||e===n||!e||!n)return t;const r=v0[e].toReference,i=v0[n].fromReference;return i(r(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this._workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this._workingColorSpace)},getPrimaries:function(t){return v0[t].primaries},getTransfer:function(t){return t===Oc?Py:v0[t].transfer},getLuminanceCoefficients:function(t,e=this._workingColorSpace){return t.fromArray(v0[e].luminanceCoefficients)}};function rg(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function KE(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let hm;class l6{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{hm===void 0&&(hm=ky("canvas")),hm.width=e.width,hm.height=e.height;const r=hm.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=hm}return n.width>2048||n.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),n.toDataURL("image/jpeg",.6)):n.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=ky("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o<s.length;o++)s[o]=rg(s[o]/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(rg(n[r]/255)*255):n[r]=rg(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 ope=0;class ch{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:ope++}),this.uuid=So(),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 o=0,a=i.length;o<a;o++)i[o].isDataTexture?s.push(YE(i[o].image)):s.push(YE(i[o]))}else s=YE(i);r.url=s}return n||(e.images[this.uuid]=r),r}}function YE(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?l6.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 ape=0;class fr extends zl{constructor(e=fr.DEFAULT_IMAGE,n=fr.DEFAULT_MAPPING,r=_o,i=_o,s=Cr,o=$o,a=ss,l=Ha,c=fr.DEFAULT_ANISOTROPY,d=Oc){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:ape++}),this.uuid=So(),this.name="",this.source=new ch(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,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 $t,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!==BS)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Cd:e.x=e.x-Math.floor(e.x);break;case _o:e.x=e.x<0?0:1;break;case Ig:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Cd:e.y=e.y-Math.floor(e.y);break;case _o:e.y=e.y<0?0:1;break;case Ig:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}fr.DEFAULT_IMAGE=null;fr.DEFAULT_MAPPING=BS;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,o=e.elements;return this.x=o[0]*n+o[4]*r+o[8]*i+o[12]*s,this.y=o[1]*n+o[5]*r+o[9]*i+o[13]*s,this.z=o[2]*n+o[6]*r+o[10]*i+o[14]*s,this.w=o[3]*n+o[7]*r+o[11]*i+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,r,i,s;const l=e.elements,c=l[0],d=l[4],f=l[8],p=l[1],y=l[5],x=l[9],S=l[2],w=l[6],_=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+_-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const T=(c+1)/2,P=(y+1)/2,O=(_+1)/2,N=(d+p)/4,D=(f+S)/4,z=(x+w)/4;return T>P&&T>O?T<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(T),i=N/r,s=D/r):P>O?P<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(P),r=N/i,s=z/i):O<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(O),r=D/s,i=z/s),this.set(r,i,s,n),this}let E=Math.sqrt((w-x)*(w-x)+(f-S)*(f-S)+(p-d)*(p-d));return Math.abs(E)<.001&&(E=1),this.x=(w-x)/E,this.y=(f-S)/E,this.z=(p-d)/E,this.w=Math.acos((c+y+_-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this.w=Math.max(e.w,Math.min(n.w,this.w)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this.w=Math.max(e,Math.min(n,this.w)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this.w=e.w+(n.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class c6 extends zl{constructor(e=1,n=1,r={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new On(0,0,e,n),this.scissorTest=!1,this.viewport=new On(0,0,e,n);const i={width:e,height:n,depth:1};r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Cr,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},r);const s=new fr(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace);s.flipY=!1,s.generateMipmaps=r.generateMipmaps,s.internalFormat=r.internalFormat,this.textures=[];const o=r.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].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 ch(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 Va extends c6{constructor(e=1,n=1,r={}){super(e,n,r),this.isWebGLRenderTarget=!0}}class ZS 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=_o,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class lpe extends Va{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isWebGLArrayRenderTarget=!0,this.depth=r,this.texture=new ZS(null,e,n,r),this.texture.isRenderTargetTexture=!0}}class ER 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=_o,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class cpe extends Va{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isWebGL3DRenderTarget=!0,this.depth=r,this.texture=new ER(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,o,a){let l=r[i+0],c=r[i+1],d=r[i+2],f=r[i+3];const p=s[o+0],y=s[o+1],x=s[o+2],S=s[o+3];if(a===0){e[n+0]=l,e[n+1]=c,e[n+2]=d,e[n+3]=f;return}if(a===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-a;const _=l*p+c*y+d*x+f*S,E=_>=0?1:-1,T=1-_*_;if(T>Number.EPSILON){const O=Math.sqrt(T),N=Math.atan2(O,_*E);w=Math.sin(w*N)/O,a=Math.sin(a*N)/O}const P=a*E;if(l=l*w+p*P,c=c*w+y*P,d=d*w+x*P,f=f*w+S*P,w===1-a){const O=1/Math.sqrt(l*l+c*c+d*d+f*f);l*=O,c*=O,d*=O,f*=O}}e[n]=l,e[n+1]=c,e[n+2]=d,e[n+3]=f}static multiplyQuaternionsFlat(e,n,r,i,s,o){const a=r[i],l=r[i+1],c=r[i+2],d=r[i+3],f=s[o],p=s[o+1],y=s[o+2],x=s[o+3];return e[n]=a*x+d*f+l*y-c*p,e[n+1]=l*x+d*p+c*f-a*y,e[n+2]=c*x+d*y+a*p-l*f,e[n+3]=d*x-a*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,o=e._order,a=Math.cos,l=Math.sin,c=a(r/2),d=a(i/2),f=a(s/2),p=l(r/2),y=l(i/2),x=l(s/2);switch(o){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: "+o)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const r=n/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,r=n[0],i=n[4],s=n[8],o=n[1],a=n[5],l=n[9],c=n[2],d=n[6],f=n[10],p=r+a+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=(o-i)*y}else if(r>a&&r>f){const y=2*Math.sqrt(1+r-a-f);this._w=(d-l)/y,this._x=.25*y,this._y=(i+o)/y,this._z=(s+c)/y}else if(a>f){const y=2*Math.sqrt(1+a-r-f);this._w=(s-c)/y,this._x=(i+o)/y,this._y=.25*y,this._z=(l+d)/y}else{const y=2*Math.sqrt(1+f-r-a);this._w=(o-i)/y,this._x=(s+c)/y,this._y=(l+d)/y,this._z=.25*y}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let r=e.dot(n)+1;return 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,o=e._w,a=n._x,l=n._y,c=n._z,d=n._w;return this._x=r*d+o*a+i*c-s*l,this._y=i*d+o*l+s*a-r*c,this._z=s*d+o*c+r*l-i*a,this._w=o*d-r*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,n){if(n===0)return this;if(n===1)return this.copy(e);const r=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+r*e._x+i*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=r,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const y=1-n;return this._w=y*o+n*this._w,this._x=y*r+n*this._x,this._y=y*i+n*this._y,this._z=y*s+n*this._z,this.normalize(),this}const c=Math.sqrt(l),d=Math.atan2(c,a),f=Math.sin((1-n)*d)/c,p=Math.sin(n*d)/c;return this._w=o*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 X{constructor(e=0,n=0,r=0){X.prototype.isVector3=!0,this.x=e,this.y=n,this.z=r}set(e,n,r){return r===void 0&&(r=this.z),this.x=e,this.y=n,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(X3.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(X3.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[3]*r+s[6]*i,this.y=s[1]*n+s[4]*r+s[7]*i,this.z=s[2]*n+s[5]*r+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,s=e.elements,o=1/(s[3]*n+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*n+s[4]*r+s[8]*i+s[12])*o,this.y=(s[1]*n+s[5]*r+s[9]*i+s[13])*o,this.z=(s[2]*n+s[6]*r+s[10]*i+s[14])*o,this}applyQuaternion(e){const n=this.x,r=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*i-a*r),d=2*(a*n-s*i),f=2*(s*r-o*n);return this.x=n+l*c+o*f-a*d,this.y=r+l*d+a*c-s*f,this.z=i+l*f+s*d-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[4]*r+s[8]*i,this.y=s[1]*n+s[5]*r+s[9]*i,this.z=s[2]*n+s[6]*r+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const r=e.x,i=e.y,s=e.z,o=n.x,a=n.y,l=n.z;return this.x=i*l-s*a,this.y=s*o-r*l,this.z=r*a-i*o,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const r=e.dot(this)/n;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return ZE.copy(this).projectOnVector(e),this.sub(ZE)}reflect(e){return this.sub(ZE.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(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 ZE=new X,X3=new qt;class as{constructor(e=new X(1/0,1/0,1/0),n=new X(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,r=e.length;n<r;n+=3)this.expandByPoint(Pa.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,r=e.count;n<r;n++)this.expandByPoint(Pa.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=Pa.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 o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Pa):Pa.fromBufferAttribute(s,o),Pa.applyMatrix4(e.matrixWorld),this.expandByPoint(Pa);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),jb.copy(e.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),jb.copy(r.boundingBox)),jb.applyMatrix4(e.matrixWorld),this.union(jb)}const i=e.children;for(let s=0,o=i.length;s<o;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,Pa),Pa.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,r;return e.normal.x>0?(n=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),n<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(y0),Fb.subVectors(this.max,y0),pm.subVectors(e.a,y0),mm.subVectors(e.b,y0),gm.subVectors(e.c,y0),Wu.subVectors(mm,pm),$u.subVectors(gm,mm),Pf.subVectors(pm,gm);let n=[0,-Wu.z,Wu.y,0,-$u.z,$u.y,0,-Pf.z,Pf.y,Wu.z,0,-Wu.x,$u.z,0,-$u.x,Pf.z,0,-Pf.x,-Wu.y,Wu.x,0,-$u.y,$u.x,0,-Pf.y,Pf.x,0];return!QE(n,pm,mm,gm,Fb)||(n=[1,0,0,0,1,0,0,0,1],!QE(n,pm,mm,gm,Fb))?!1:(zb.crossVectors(Wu,$u),n=[zb.x,zb.y,zb.z],QE(n,pm,mm,gm,Fb))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Pa).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Pa).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(_c[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),_c[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),_c[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),_c[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),_c[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),_c[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),_c[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),_c[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(_c),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const _c=[new X,new X,new X,new X,new X,new X,new X,new X],Pa=new X,jb=new as,pm=new X,mm=new X,gm=new X,Wu=new X,$u=new X,Pf=new X,y0=new X,Fb=new X,zb=new X,Cf=new X;function QE(t,e,n,r,i){for(let s=0,o=t.length-3;s<=o;s+=3){Cf.fromArray(t,s);const a=i.x*Math.abs(Cf.x)+i.y*Math.abs(Cf.y)+i.z*Math.abs(Cf.z),l=e.dot(Cf),c=n.dot(Cf),d=r.dot(Cf);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>a)return!1}return!0}const upe=new as,x0=new X,JE=new X;class Hi{constructor(e=new X,n=-1){this.isSphere=!0,this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const r=this.center;n!==void 0?r.copy(n):upe.setFromPoints(e).getCenter(r);let i=0;for(let s=0,o=e.length;s<o;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;x0.subVectors(e,this.center);const n=x0.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),i=(r-this.radius)*.5;this.center.addScaledVector(x0,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(JE.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(x0.copy(e.center).add(JE)),this.expandByPoint(x0.copy(e.center).sub(JE))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const wc=new X,eA=new X,Bb=new X,Xu=new X,tA=new X,Hb=new X,nA=new X;class Jh{constructor(e=new X,n=new X(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,wc)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const r=n.dot(this.direction);return r<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=wc.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(wc.copy(this.origin).addScaledVector(this.direction,n),wc.distanceToSquared(e))}distanceSqToSegment(e,n,r,i){eA.copy(e).add(n).multiplyScalar(.5),Bb.copy(n).sub(e).normalize(),Xu.copy(this.origin).sub(eA);const s=e.distanceTo(n)*.5,o=-this.direction.dot(Bb),a=Xu.dot(this.direction),l=-Xu.dot(Bb),c=Xu.lengthSq(),d=Math.abs(1-o*o);let f,p,y,x;if(d>0)if(f=o*l-a,p=o*a-l,x=s*d,f>=0)if(p>=-x)if(p<=x){const S=1/d;f*=S,p*=S,y=f*(f+o*p+2*a)+p*(o*f+p+2*l)+c}else p=s,f=Math.max(0,-(o*p+a)),y=-f*f+p*(p+2*l)+c;else p=-s,f=Math.max(0,-(o*p+a)),y=-f*f+p*(p+2*l)+c;else p<=-x?(f=Math.max(0,-(-o*s+a)),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,-(o*s+a)),p=f>0?s:Math.min(Math.max(-s,-l),s),y=-f*f+p*(p+2*l)+c);else p=o>0?-s:s,f=Math.max(0,-(o*p+a)),y=-f*f+p*(p+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,f),i&&i.copy(eA).addScaledVector(Bb,p),y}intersectSphere(e,n){wc.subVectors(e.center,this.origin);const r=wc.dot(this.direction),i=wc.dot(wc)-r*r,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=r-o,l=r+o;return l<0?null:a<0?this.at(l,n):this.at(a,n)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/n;return r>=0?r:null}intersectPlane(e,n){const r=this.distanceToPlane(e);return r===null?null:this.at(r,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let r,i,s,o,a,l;const c=1/this.direction.x,d=1/this.direction.y,f=1/this.direction.z,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,o=(e.max.y-p.y)*d):(s=(e.max.y-p.y)*d,o=(e.min.y-p.y)*d),r>o||s>i||((s>r||isNaN(r))&&(r=s),(o<i||isNaN(i))&&(i=o),f>=0?(a=(e.min.z-p.z)*f,l=(e.max.z-p.z)*f):(a=(e.max.z-p.z)*f,l=(e.min.z-p.z)*f),r>l||a>i)||((a>r||r!==r)&&(r=a),(l<i||i!==i)&&(i=l),i<0)?null:this.at(r>=0?r:i,n)}intersectsBox(e){return this.intersectBox(e,wc)!==null}intersectTriangle(e,n,r,i,s){tA.subVectors(n,e),Hb.subVectors(r,e),nA.crossVectors(tA,Hb);let o=this.direction.dot(nA),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Xu.subVectors(this.origin,e);const l=a*this.direction.dot(Hb.crossVectors(Xu,Hb));if(l<0)return null;const c=a*this.direction.dot(tA.cross(Xu));if(c<0||l+c>o)return null;const d=-a*Xu.dot(nA);return d<0?null:this.at(d/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Ct{constructor(e,n,r,i,s,o,a,l,c,d,f,p,y,x,S,w){Ct.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,o,a,l,c,d,f,p,y,x,S,w)}set(e,n,r,i,s,o,a,l,c,d,f,p,y,x,S,w){const _=this.elements;return _[0]=e,_[4]=n,_[8]=r,_[12]=i,_[1]=s,_[5]=o,_[9]=a,_[13]=l,_[2]=c,_[6]=d,_[10]=f,_[14]=p,_[3]=y,_[7]=x,_[11]=S,_[15]=w,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Ct().fromArray(this.elements)}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],this}copyPosition(e){const n=this.elements,r=e.elements;return n[12]=r[12],n[13]=r[13],n[14]=r[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,r){return e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,n,r){return this.set(e.x,n.x,r.x,0,e.y,n.y,r.y,0,e.z,n.z,r.z,0,0,0,0,1),this}extractRotation(e){const n=this.elements,r=e.elements,i=1/vm.setFromMatrixColumn(e,0).length(),s=1/vm.setFromMatrixColumn(e,1).length(),o=1/vm.setFromMatrixColumn(e,2).length();return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[3]=0,n[4]=r[4]*s,n[5]=r[5]*s,n[6]=r[6]*s,n[7]=0,n[8]=r[8]*o,n[9]=r[9]*o,n[10]=r[10]*o,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,r=e.x,i=e.y,s=e.z,o=Math.cos(r),a=Math.sin(r),l=Math.cos(i),c=Math.sin(i),d=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const p=o*d,y=o*f,x=a*d,S=a*f;n[0]=l*d,n[4]=-l*f,n[8]=c,n[1]=y+x*c,n[5]=p-S*c,n[9]=-a*l,n[2]=S-p*c,n[6]=x+y*c,n[10]=o*l}else if(e.order==="YXZ"){const p=l*d,y=l*f,x=c*d,S=c*f;n[0]=p+S*a,n[4]=x*a-y,n[8]=o*c,n[1]=o*f,n[5]=o*d,n[9]=-a,n[2]=y*a-x,n[6]=S+p*a,n[10]=o*l}else if(e.order==="ZXY"){const p=l*d,y=l*f,x=c*d,S=c*f;n[0]=p-S*a,n[4]=-o*f,n[8]=x+y*a,n[1]=y+x*a,n[5]=o*d,n[9]=S-p*a,n[2]=-o*c,n[6]=a,n[10]=o*l}else if(e.order==="ZYX"){const p=o*d,y=o*f,x=a*d,S=a*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]=a*l,n[10]=o*l}else if(e.order==="YZX"){const p=o*l,y=o*c,x=a*l,S=a*c;n[0]=l*d,n[4]=S-p*f,n[8]=x*f+y,n[1]=f,n[5]=o*d,n[9]=-a*d,n[2]=-c*d,n[6]=y*f+x,n[10]=p-S*f}else if(e.order==="XZY"){const p=o*l,y=o*c,x=a*l,S=a*c;n[0]=l*d,n[4]=-f,n[8]=c*d,n[1]=p*f+S,n[5]=o*d,n[9]=y*f-x,n[2]=x*f-y,n[6]=a*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(dpe,e,fpe)}lookAt(e,n,r){const i=this.elements;return ho.subVectors(e,n),ho.lengthSq()===0&&(ho.z=1),ho.normalize(),qu.crossVectors(r,ho),qu.lengthSq()===0&&(Math.abs(r.z)===1?ho.x+=1e-4:ho.z+=1e-4,ho.normalize(),qu.crossVectors(r,ho)),qu.normalize(),Vb.crossVectors(ho,qu),i[0]=qu.x,i[4]=Vb.x,i[8]=ho.x,i[1]=qu.y,i[5]=Vb.y,i[9]=ho.y,i[2]=qu.z,i[6]=Vb.z,i[10]=ho.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,o=r[0],a=r[4],l=r[8],c=r[12],d=r[1],f=r[5],p=r[9],y=r[13],x=r[2],S=r[6],w=r[10],_=r[14],E=r[3],T=r[7],P=r[11],O=r[15],N=i[0],D=i[4],z=i[8],G=i[12],k=i[1],j=i[5],H=i[9],ee=i[13],te=i[2],he=i[6],se=i[10],fe=i[14],B=i[3],J=i[7],Y=i[11],V=i[15];return s[0]=o*N+a*k+l*te+c*B,s[4]=o*D+a*j+l*he+c*J,s[8]=o*z+a*H+l*se+c*Y,s[12]=o*G+a*ee+l*fe+c*V,s[1]=d*N+f*k+p*te+y*B,s[5]=d*D+f*j+p*he+y*J,s[9]=d*z+f*H+p*se+y*Y,s[13]=d*G+f*ee+p*fe+y*V,s[2]=x*N+S*k+w*te+_*B,s[6]=x*D+S*j+w*he+_*J,s[10]=x*z+S*H+w*se+_*Y,s[14]=x*G+S*ee+w*fe+_*V,s[3]=E*N+T*k+P*te+O*B,s[7]=E*D+T*j+P*he+O*J,s[11]=E*z+T*H+P*se+O*Y,s[15]=E*G+T*ee+P*fe+O*V,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],d=e[2],f=e[6],p=e[10],y=e[14],x=e[3],S=e[7],w=e[11],_=e[15];return x*(+s*l*f-i*c*f-s*a*p+r*c*p+i*a*y-r*l*y)+S*(+n*l*y-n*c*p+s*o*p-i*o*y+i*c*d-s*l*d)+w*(+n*c*f-n*a*y-s*o*f+r*o*y+s*a*d-r*c*d)+_*(-i*a*d-n*l*f+n*a*p+i*o*f-r*o*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],o=e[4],a=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],_=e[15],E=f*w*c-S*p*c+S*l*y-a*w*y-f*l*_+a*p*_,T=x*p*c-d*w*c-x*l*y+o*w*y+d*l*_-o*p*_,P=d*S*c-x*f*c+x*a*y-o*S*y-d*a*_+o*f*_,O=x*f*l-d*S*l-x*a*p+o*S*p+d*a*w-o*f*w,N=n*E+r*T+i*P+s*O;if(N===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const D=1/N;return e[0]=E*D,e[1]=(S*p*s-f*w*s-S*i*y+r*w*y+f*i*_-r*p*_)*D,e[2]=(a*w*s-S*l*s+S*i*c-r*w*c-a*i*_+r*l*_)*D,e[3]=(f*l*s-a*p*s-f*i*c+r*p*c+a*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*_+n*p*_)*D,e[6]=(x*l*s-o*w*s-x*i*c+n*w*c+o*i*_-n*l*_)*D,e[7]=(o*p*s-d*l*s+d*i*c-n*p*c-o*i*y+n*l*y)*D,e[8]=P*D,e[9]=(x*f*s-d*S*s-x*r*y+n*S*y+d*r*_-n*f*_)*D,e[10]=(o*S*s-x*a*s+x*r*c-n*S*c-o*r*_+n*a*_)*D,e[11]=(d*a*s-o*f*s-d*r*c+n*f*c+o*r*y-n*a*y)*D,e[12]=O*D,e[13]=(d*S*i-x*f*i+x*r*p-n*S*p-d*r*w+n*f*w)*D,e[14]=(x*a*i-o*S*i-x*r*l+n*S*l+o*r*w-n*a*w)*D,e[15]=(o*f*i-d*a*i+d*r*l-n*f*l-o*r*p+n*a*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,o=e.x,a=e.y,l=e.z,c=s*o,d=s*a;return this.set(c*o+r,c*a-i*l,c*l+i*a,0,c*a+i*l,d*a+r,d*l-i*o,0,c*l-i*a,d*l+i*o,s*l*l+r,0,0,0,0,1),this}makeScale(e,n,r){return this.set(e,0,0,0,0,n,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,n,r,i,s,o){return this.set(1,r,s,0,e,1,o,0,n,i,1,0,0,0,0,1),this}compose(e,n,r){const i=this.elements,s=n._x,o=n._y,a=n._z,l=n._w,c=s+s,d=o+o,f=a+a,p=s*c,y=s*d,x=s*f,S=o*d,w=o*f,_=a*f,E=l*c,T=l*d,P=l*f,O=r.x,N=r.y,D=r.z;return i[0]=(1-(S+_))*O,i[1]=(y+P)*O,i[2]=(x-T)*O,i[3]=0,i[4]=(y-P)*N,i[5]=(1-(p+_))*N,i[6]=(w+E)*N,i[7]=0,i[8]=(x+T)*D,i[9]=(w-E)*D,i[10]=(1-(p+S))*D,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,n,r){const i=this.elements;let s=vm.set(i[0],i[1],i[2]).length();const o=vm.set(i[4],i[5],i[6]).length(),a=vm.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Ca.copy(this);const c=1/s,d=1/o,f=1/a;return Ca.elements[0]*=c,Ca.elements[1]*=c,Ca.elements[2]*=c,Ca.elements[4]*=d,Ca.elements[5]*=d,Ca.elements[6]*=d,Ca.elements[8]*=f,Ca.elements[9]*=f,Ca.elements[10]*=f,n.setFromRotationMatrix(Ca),r.x=s,r.y=o,r.z=a,this}makePerspective(e,n,r,i,s,o,a=Ml){const l=this.elements,c=2*s/(n-e),d=2*s/(r-i),f=(n+e)/(n-e),p=(r+i)/(r-i);let y,x;if(a===Ml)y=-(o+s)/(o-s),x=-2*o*s/(o-s);else if(a===Iy)y=-o/(o-s),x=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=d,l[9]=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,o,a=Ml){const l=this.elements,c=1/(n-e),d=1/(r-i),f=1/(o-s),p=(n+e)*c,y=(r+i)*d;let x,S;if(a===Ml)x=(o+s)*f,S=-2*f;else if(a===Iy)x=s*f,S=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-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 vm=new X,Ca=new Ct,dpe=new X(0,0,0),fpe=new X(1,1,1),qu=new X,Vb=new X,ho=new X,q3=new Ct,K3=new qt;class ls{constructor(e=0,n=0,r=0,i=ls.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,n,r,i=this._order){return this._x=e,this._y=n,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,n=this._order,r=!0){const i=e.elements,s=i[0],o=i[4],a=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(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-d,y),this._z=Math.atan2(-o,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(a,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(-o,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(-o,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(a,y));break;case"XZY":this._z=Math.asin(-Tr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-d,y),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,r){return q3.makeRotationFromQuaternion(e),this.setFromRotationMatrix(q3,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return K3.setFromEuler(this),this.setFromQuaternion(K3,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}ls.DEFAULT_ORDER="XYZ";class Ph{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 hpe=0;const Y3=new X,ym=new qt,Sc=new Ct,Gb=new X,b0=new X,ppe=new X,mpe=new qt,Z3=new X(1,0,0),Q3=new X(0,1,0),J3=new X(0,0,1),eD={type:"added"},gpe={type:"removed"},xm={type:"childadded",child:null},rA={type:"childremoved",child:null};class mn extends zl{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:hpe++}),this.uuid=So(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=mn.DEFAULT_UP.clone();const e=new X,n=new ls,r=new qt,i=new X(1,1,1);function s(){r.setFromEuler(n,!1)}function o(){n.setFromQuaternion(r,void 0,!1)}n._onChange(s),r._onChange(o),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 Ct},normalMatrix:{value:new $t}}),this.matrix=new Ct,this.matrixWorld=new Ct,this.matrixAutoUpdate=mn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=mn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ph,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 ym.setFromAxisAngle(e,n),this.quaternion.multiply(ym),this}rotateOnWorldAxis(e,n){return ym.setFromAxisAngle(e,n),this.quaternion.premultiply(ym),this}rotateX(e){return this.rotateOnAxis(Z3,e)}rotateY(e){return this.rotateOnAxis(Q3,e)}rotateZ(e){return this.rotateOnAxis(J3,e)}translateOnAxis(e,n){return Y3.copy(e).applyQuaternion(this.quaternion),this.position.add(Y3.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(Z3,e)}translateY(e){return this.translateOnAxis(Q3,e)}translateZ(e){return this.translateOnAxis(J3,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Sc.copy(this.matrixWorld).invert())}lookAt(e,n,r){e.isVector3?Gb.copy(e):Gb.set(e,n,r);const i=this.parent;this.updateWorldMatrix(!0,!1),b0.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Sc.lookAt(b0,Gb,this.up):Sc.lookAt(Gb,b0,this.up),this.quaternion.setFromRotationMatrix(Sc),i&&(Sc.extractRotation(i.matrixWorld),ym.setFromRotationMatrix(Sc),this.quaternion.premultiply(ym.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(eD),xm.child=e,this.dispatchEvent(xm),xm.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(gpe),rA.child=e,this.dispatchEvent(rA),rA.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),Sc.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Sc.multiply(e.parent.matrixWorld)),e.applyMatrix4(Sc),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(eD),xm.child=e,this.dispatchEvent(xm),xm.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 o=this.children[r].getObjectByProperty(e,n);if(o!==void 0)return o}}getObjectsByProperty(e,n,r=[]){this[e]===n&&r.push(this);const i=this.children;for(let s=0,o=i.length;s<o;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(b0,e,ppe),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(b0,mpe,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,o=i.length;s<o;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(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,d=l.length;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 a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));i.material=a}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];i.animations.push(s(e.animations,l))}}if(n){const a=o(e.geometries),l=o(e.materials),c=o(e.textures),d=o(e.images),f=o(e.shapes),p=o(e.skeletons),y=o(e.animations),x=o(e.nodes);a.length>0&&(r.geometries=a),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),d.length>0&&(r.images=d),f.length>0&&(r.shapes=f),p.length>0&&(r.skeletons=p),y.length>0&&(r.animations=y),x.length>0&&(r.nodes=x)}return r.object=i,r;function o(a){const l=[];for(const c in a){const d=a[c];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let r=0;r<e.children.length;r++){const i=e.children[r];this.add(i.clone())}return this}}mn.DEFAULT_UP=new X(0,1,0);mn.DEFAULT_MATRIX_AUTO_UPDATE=!0;mn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Ra=new X,Mc=new X,iA=new X,Ec=new X,bm=new X,_m=new X,tD=new X,sA=new X,oA=new X,aA=new X,lA=new On,cA=new On,uA=new On;class Ks{constructor(e=new X,n=new X,r=new X){this.a=e,this.b=n,this.c=r}static getNormal(e,n,r,i){i.subVectors(r,n),Ra.subVectors(e,n),i.cross(Ra);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){Ra.subVectors(i,n),Mc.subVectors(r,n),iA.subVectors(e,n);const o=Ra.dot(Ra),a=Ra.dot(Mc),l=Ra.dot(iA),c=Mc.dot(Mc),d=Mc.dot(iA),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;const p=1/f,y=(c*l-a*d)*p,x=(o*d-a*l)*p;return s.set(1-y-x,x,y)}static containsPoint(e,n,r,i){return this.getBarycoord(e,n,r,i,Ec)===null?!1:Ec.x>=0&&Ec.y>=0&&Ec.x+Ec.y<=1}static getInterpolation(e,n,r,i,s,o,a,l){return this.getBarycoord(e,n,r,i,Ec)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Ec.x),l.addScaledVector(o,Ec.y),l.addScaledVector(a,Ec.z),l)}static getInterpolatedAttribute(e,n,r,i,s,o){return lA.setScalar(0),cA.setScalar(0),uA.setScalar(0),lA.fromBufferAttribute(e,n),cA.fromBufferAttribute(e,r),uA.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(lA,s.x),o.addScaledVector(cA,s.y),o.addScaledVector(uA,s.z),o}static isFrontFacing(e,n,r,i){return Ra.subVectors(r,n),Mc.subVectors(e,n),Ra.cross(Mc).dot(i)<0}set(e,n,r){return this.a.copy(e),this.b.copy(n),this.c.copy(r),this}setFromPointsAndIndices(e,n,r,i){return this.a.copy(e[n]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,n,r,i){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Ra.subVectors(this.c,this.b),Mc.subVectors(this.a,this.b),Ra.cross(Mc).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ks.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Ks.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,r,i,s){return Ks.getInterpolation(e,this.a,this.b,this.c,n,r,i,s)}containsPoint(e){return Ks.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ks.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const r=this.a,i=this.b,s=this.c;let o,a;bm.subVectors(i,r),_m.subVectors(s,r),sA.subVectors(e,r);const l=bm.dot(sA),c=_m.dot(sA);if(l<=0&&c<=0)return n.copy(r);oA.subVectors(e,i);const d=bm.dot(oA),f=_m.dot(oA);if(d>=0&&f<=d)return n.copy(i);const p=l*f-d*c;if(p<=0&&l>=0&&d<=0)return o=l/(l-d),n.copy(r).addScaledVector(bm,o);aA.subVectors(e,s);const y=bm.dot(aA),x=_m.dot(aA);if(x>=0&&y<=x)return n.copy(s);const S=y*c-l*x;if(S<=0&&c>=0&&x<=0)return a=c/(c-x),n.copy(r).addScaledVector(_m,a);const w=d*x-y*f;if(w<=0&&f-d>=0&&y-x>=0)return tD.subVectors(s,i),a=(f-d)/(f-d+(y-x)),n.copy(i).addScaledVector(tD,a);const _=1/(w+S+p);return o=S*_,a=p*_,n.copy(r).addScaledVector(bm,o).addScaledVector(_m,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const u6={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Ku={h:0,s:0,l:0},Wb={h:0,s:0,l:0};function dA(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}class ct{constructor(e,n,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,r)}set(e,n,r){if(n===void 0&&r===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,n,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=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=MR(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,o=2*r-s;this.r=dA(o,s,e+1/3),this.g=dA(o,s,e),this.b=dA(o,s,e-1/3)}return 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 o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,n);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,n);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(o===6)return this.setHex(parseInt(s,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=Fi){const r=u6[e.toLowerCase()];return r!==void 0?this.setHex(r,n):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=rg(e.r),this.g=rg(e.g),this.b=rg(e.b),this}copyLinearToSRGB(e){return this.r=KE(e.r),this.g=KE(e.g),this.b=KE(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=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,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,c;const d=(a+o)/2;if(a===o)l=0,c=0;else{const f=o-a;switch(c=d<=.5?f/(o+a):f/(2-o-a),o){case r:l=(i-s)/f+(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(Ku),this.setHSL(Ku.h+e,Ku.s+n,Ku.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(Ku),e.getHSL(Wb);const r=ty(Ku.h,Wb.h,n),i=ty(Ku.s,Wb.s,n),s=ty(Ku.l,Wb.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 ct;ct.NAMES=u6;let vpe=0;class Gr extends zl{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:vpe++}),this.uuid=So(),this.name="",this.type="Material",this.blending=Eh,this.side=Ll,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Zw,this.blendDst=Qw,this.blendEquation=ld,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ct(0,0,0),this.blendAlpha=0,this.depthFunc=Fh,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=$P,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Yf,this.stencilZFail=Yf,this.stencilZPass=Yf,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!==Eh&&(r.blending=this.blending),this.side!==Ll&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==Zw&&(r.blendSrc=this.blendSrc),this.blendDst!==Qw&&(r.blendDst=this.blendDst),this.blendEquation!==ld&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==Fh&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==$P&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Yf&&(r.stencilFail=this.stencilFail),this.stencilZFail!==Yf&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==Yf&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(n){const s=i(e.textures),o=i(e.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const n=e.clippingPlanes;let r=null;if(n!==null){const i=n.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=n[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class As extends Gr{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ct(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ls,this.combine=ax,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Lc=ype();function ype(){const t=new ArrayBuffer(4),e=new Float32Array(t),n=new Uint32Array(t),r=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(r[l]=0,r[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(r[l]=1024>>-c-14,r[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(r[l]=c+15<<10,r[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(r[l]=31744,r[l|256]=64512,i[l]=24,i[l|256]=24):(r[l]=31744,r[l|256]=64512,i[l]=13,i[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,d=0;for(;(c&8388608)===0;)c<<=1,d-=8388608;c&=-8388609,d+=947912704,s[l]=c|d}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:a}}function $s(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=Tr(t,-65504,65504),Lc.floatView[0]=t;const e=Lc.uint32View[0],n=e>>23&511;return Lc.baseTable[n]+((e&8388607)>>Lc.shiftTable[n])}function V0(t){const e=t>>10;return Lc.uint32View[0]=Lc.mantissaTable[Lc.offsetTable[e]+(t&1023)]+Lc.exponentTable[e],Lc.floatView[0]}const xpe={toHalfFloat:$s,fromHalfFloat:V0},Hr=new X,$b=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=Ny,this.updateRanges=[],this.gpuType=Qs,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,n,r){e*=this.itemSize,r*=n.itemSize;for(let i=0,s=this.itemSize;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++)$b.fromBufferAttribute(this,n),$b.applyMatrix3(e),this.setXY(n,$b.x,$b.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=Ss(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=Ss(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=Ss(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=Ss(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=Ss(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!==Ny&&(e.usage=this.usage),e}}class bpe extends Qt{constructor(e,n,r){super(new Int8Array(e),n,r)}}class _pe extends Qt{constructor(e,n,r){super(new Uint8Array(e),n,r)}}class wpe extends Qt{constructor(e,n,r){super(new Uint8ClampedArray(e),n,r)}}class Spe extends Qt{constructor(e,n,r){super(new Int16Array(e),n,r)}}class AR extends Qt{constructor(e,n,r){super(new Uint16Array(e),n,r)}}class Mpe extends Qt{constructor(e,n,r){super(new Int32Array(e),n,r)}}class TR extends Qt{constructor(e,n,r){super(new Uint32Array(e),n,r)}}class Epe extends Qt{constructor(e,n,r){super(new Uint16Array(e),n,r),this.isFloat16BufferAttribute=!0}getX(e){let n=V0(this.array[e*this.itemSize]);return this.normalized&&(n=Ss(n,this.array)),n}setX(e,n){return this.normalized&&(n=cn(n,this.array)),this.array[e*this.itemSize]=$s(n),this}getY(e){let n=V0(this.array[e*this.itemSize+1]);return this.normalized&&(n=Ss(n,this.array)),n}setY(e,n){return this.normalized&&(n=cn(n,this.array)),this.array[e*this.itemSize+1]=$s(n),this}getZ(e){let n=V0(this.array[e*this.itemSize+2]);return this.normalized&&(n=Ss(n,this.array)),n}setZ(e,n){return this.normalized&&(n=cn(n,this.array)),this.array[e*this.itemSize+2]=$s(n),this}getW(e){let n=V0(this.array[e*this.itemSize+3]);return this.normalized&&(n=Ss(n,this.array)),n}setW(e,n){return this.normalized&&(n=cn(n,this.array)),this.array[e*this.itemSize+3]=$s(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]=$s(n),this.array[e+1]=$s(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]=$s(n),this.array[e+1]=$s(r),this.array[e+2]=$s(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]=$s(n),this.array[e+1]=$s(r),this.array[e+2]=$s(i),this.array[e+3]=$s(s),this}}class Lt extends Qt{constructor(e,n,r){super(new Float32Array(e),n,r)}}let Ape=0;const jo=new Ct,fA=new mn,wm=new X,po=new as,_0=new as,mi=new X;class Yt extends zl{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Ape++}),this.uuid=So(),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(o6(e)?TR:AR)(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 $t().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 jo.makeRotationFromQuaternion(e),this.applyMatrix4(jo),this}rotateX(e){return jo.makeRotationX(e),this.applyMatrix4(jo),this}rotateY(e){return jo.makeRotationY(e),this.applyMatrix4(jo),this}rotateZ(e){return jo.makeRotationZ(e),this.applyMatrix4(jo),this}translate(e,n,r){return jo.makeTranslation(e,n,r),this.applyMatrix4(jo),this}scale(e,n,r){return jo.makeScale(e,n,r),this.applyMatrix4(jo),this}lookAt(e){return fA.lookAt(e),fA.updateMatrix(),this.applyMatrix4(fA.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(wm).negate(),this.translate(wm.x,wm.y,wm.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 Lt(n,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new as);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 X(-1/0,-1/0,-1/0),new X(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];po.setFromBufferAttribute(s),this.morphTargetsRelative?(mi.addVectors(this.boundingBox.min,po.min),this.boundingBox.expandByPoint(mi),mi.addVectors(this.boundingBox.max,po.max),this.boundingBox.expandByPoint(mi)):(this.boundingBox.expandByPoint(po.min),this.boundingBox.expandByPoint(po.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 X,1/0);return}if(e){const r=this.boundingSphere.center;if(po.setFromBufferAttribute(e),n)for(let s=0,o=n.length;s<o;s++){const a=n[s];_0.setFromBufferAttribute(a),this.morphTargetsRelative?(mi.addVectors(po.min,_0.min),po.expandByPoint(mi),mi.addVectors(po.max,_0.max),po.expandByPoint(mi)):(po.expandByPoint(_0.min),po.expandByPoint(_0.max))}po.getCenter(r);let i=0;for(let s=0,o=e.count;s<o;s++)mi.fromBufferAttribute(e,s),i=Math.max(i,r.distanceToSquared(mi));if(n)for(let s=0,o=n.length;s<o;s++){const a=n[s],l=this.morphTargetsRelative;for(let c=0,d=a.count;c<d;c++)mi.fromBufferAttribute(a,c),l&&(wm.fromBufferAttribute(e,c),mi.add(wm)),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 o=this.getAttribute("tangent"),a=[],l=[];for(let z=0;z<r.count;z++)a[z]=new X,l[z]=new X;const c=new X,d=new X,f=new X,p=new He,y=new He,x=new He,S=new X,w=new X;function _(z,G,k){c.fromBufferAttribute(r,z),d.fromBufferAttribute(r,G),f.fromBufferAttribute(r,k),p.fromBufferAttribute(s,z),y.fromBufferAttribute(s,G),x.fromBufferAttribute(s,k),d.sub(c),f.sub(c),y.sub(p),x.sub(p);const j=1/(y.x*x.y-x.x*y.y);isFinite(j)&&(S.copy(d).multiplyScalar(x.y).addScaledVector(f,-y.y).multiplyScalar(j),w.copy(f).multiplyScalar(y.x).addScaledVector(d,-x.x).multiplyScalar(j),a[z].add(S),a[G].add(S),a[k].add(S),l[z].add(w),l[G].add(w),l[k].add(w))}let E=this.groups;E.length===0&&(E=[{start:0,count:e.count}]);for(let z=0,G=E.length;z<G;++z){const k=E[z],j=k.start,H=k.count;for(let ee=j,te=j+H;ee<te;ee+=3)_(e.getX(ee+0),e.getX(ee+1),e.getX(ee+2))}const T=new X,P=new X,O=new X,N=new X;function D(z){O.fromBufferAttribute(i,z),N.copy(O);const G=a[z];T.copy(G),T.sub(O.multiplyScalar(O.dot(G))).normalize(),P.crossVectors(N,G);const j=P.dot(l[z])<0?-1:1;o.setXYZW(z,T.x,T.y,T.z,j)}for(let z=0,G=E.length;z<G;++z){const k=E[z],j=k.start,H=k.count;for(let ee=j,te=j+H;ee<te;ee+=3)D(e.getX(ee+0)),D(e.getX(ee+1)),D(e.getX(ee+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 X,s=new X,o=new X,a=new X,l=new X,c=new X,d=new X,f=new X;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),o.fromBufferAttribute(n,w),d.subVectors(o,s),f.subVectors(i,s),d.cross(f),a.fromBufferAttribute(r,x),l.fromBufferAttribute(r,S),c.fromBufferAttribute(r,w),a.add(d),l.add(d),c.add(d),r.setXYZ(x,a.x,a.y,a.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),o.fromBufferAttribute(n,p+2),d.subVectors(o,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(a,l){const c=a.array,d=a.itemSize,f=a.normalized,p=new c.constructor(l.length*d);let y=0,x=0;for(let S=0,w=l.length;S<w;S++){a.isInterleavedBufferAttribute?y=l[S]*a.data.stride+a.offset:y=l[S]*d;for(let _=0;_<d;_++)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 a in i){const l=i[a],c=e(l,r);n.setAttribute(a,c)}const s=this.morphAttributes;for(const a in s){const l=[],c=s[a];for(let d=0,f=c.length;d<f;d++){const p=c[d],y=e(p,r);l.push(y)}n.morphAttributes[a]=l}n.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];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 o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone(n));const i=e.attributes;for(const c in i){const d=i[c];this.setAttribute(c,d.clone(n))}const s=e.morphAttributes;for(const c in s){const d=[],f=s[c];for(let p=0,y=f.length;p<y;p++)d.push(f[p].clone(n));this.morphAttributes[c]=d}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let c=0,d=o.length;c<d;c++){const f=o[c];this.addGroup(f.start,f.count,f.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.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 nD=new Ct,Rf=new Jh,Xb=new Hi,rD=new X,qb=new X,Kb=new X,Yb=new X,hA=new X,Zb=new X,iD=new X,Qb=new X;class xr extends mn{constructor(e=new Yt,n=new As){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,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,n){const r=this.geometry,i=r.attributes.position,s=r.morphAttributes.position,o=r.morphTargetsRelative;n.fromBufferAttribute(i,e);const a=this.morphTargetInfluences;if(s&&a){Zb.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const d=a[l],f=s[l];d!==0&&(hA.fromBufferAttribute(f,e),o?Zb.addScaledVector(hA,d):Zb.addScaledVector(hA.sub(n),d))}n.add(Zb)}return n}raycast(e,n){const r=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),Xb.copy(r.boundingSphere),Xb.applyMatrix4(s),Rf.copy(e.ray).recast(e.near),!(Xb.containsPoint(Rf.origin)===!1&&(Rf.intersectSphere(Xb,rD)===null||Rf.origin.distanceToSquared(rD)>(e.far-e.near)**2))&&(nD.copy(s).invert(),Rf.copy(e.ray).applyMatrix4(nD),!(r.boundingBox!==null&&Rf.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,Rf)))}_computeIntersections(e,n,r){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,f=s.attributes.normal,p=s.groups,y=s.drawRange;if(a!==null)if(Array.isArray(o))for(let x=0,S=p.length;x<S;x++){const w=p[x],_=o[w.materialIndex],E=Math.max(w.start,y.start),T=Math.min(a.count,Math.min(w.start+w.count,y.start+y.count));for(let P=E,O=T;P<O;P+=3){const N=a.getX(P),D=a.getX(P+1),z=a.getX(P+2);i=Jb(this,_,e,r,c,d,f,N,D,z),i&&(i.faceIndex=Math.floor(P/3),i.face.materialIndex=w.materialIndex,n.push(i))}}else{const x=Math.max(0,y.start),S=Math.min(a.count,y.start+y.count);for(let w=x,_=S;w<_;w+=3){const E=a.getX(w),T=a.getX(w+1),P=a.getX(w+2);i=Jb(this,o,e,r,c,d,f,E,T,P),i&&(i.faceIndex=Math.floor(w/3),n.push(i))}}else if(l!==void 0)if(Array.isArray(o))for(let x=0,S=p.length;x<S;x++){const w=p[x],_=o[w.materialIndex],E=Math.max(w.start,y.start),T=Math.min(l.count,Math.min(w.start+w.count,y.start+y.count));for(let P=E,O=T;P<O;P+=3){const N=P,D=P+1,z=P+2;i=Jb(this,_,e,r,c,d,f,N,D,z),i&&(i.faceIndex=Math.floor(P/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,_=S;w<_;w+=3){const E=w,T=w+1,P=w+2;i=Jb(this,o,e,r,c,d,f,E,T,P),i&&(i.faceIndex=Math.floor(w/3),n.push(i))}}}}function Tpe(t,e,n,r,i,s,o,a){let l;if(e.side===os?l=r.intersectTriangle(o,s,i,!0,a):l=r.intersectTriangle(i,s,o,e.side===Ll,a),l===null)return null;Qb.copy(a),Qb.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(Qb);return c<n.near||c>n.far?null:{distance:c,point:Qb.clone(),object:t}}function Jb(t,e,n,r,i,s,o,a,l,c){t.getVertexPosition(a,qb),t.getVertexPosition(l,Kb),t.getVertexPosition(c,Yb);const d=Tpe(t,e,n,r,qb,Kb,Yb,iD);if(d){const f=new X;Ks.getBarycoord(iD,qb,Kb,Yb,f),i&&(d.uv=Ks.getInterpolatedAttribute(i,a,l,c,f,new He)),s&&(d.uv1=Ks.getInterpolatedAttribute(s,a,l,c,f,new He)),o&&(d.normal=Ks.getInterpolatedAttribute(o,a,l,c,f,new X),d.normal.dot(r.direction)>0&&d.normal.multiplyScalar(-1));const p={a,b:l,c,normal:new X,materialIndex:0};Ks.getNormal(qb,Kb,Yb,p.normal),d.face=p,d.barycoord=f}return d}class ep extends Yt{constructor(e=1,n=1,r=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:r,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],d=[],f=[];let p=0,y=0;x("z","y","x",-1,-1,r,n,e,o,s,0),x("z","y","x",1,-1,r,n,-e,o,s,1),x("x","z","y",1,1,e,r,n,i,o,2),x("x","z","y",1,-1,e,r,-n,i,o,3),x("x","y","z",1,-1,e,n,r,i,s,4),x("x","y","z",-1,-1,e,n,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new Lt(c,3)),this.setAttribute("normal",new Lt(d,3)),this.setAttribute("uv",new Lt(f,2));function x(S,w,_,E,T,P,O,N,D,z,G){const k=P/D,j=O/z,H=P/2,ee=O/2,te=N/2,he=D+1,se=z+1;let fe=0,B=0;const J=new X;for(let Y=0;Y<se;Y++){const V=Y*j-ee;for(let q=0;q<he;q++){const pe=q*k-H;J[S]=pe*E,J[w]=V*T,J[_]=te,c.push(J.x,J.y,J.z),J[S]=0,J[w]=0,J[_]=N>0?1:-1,d.push(J.x,J.y,J.z),f.push(q/D),f.push(1-Y/z),fe+=1}}for(let Y=0;Y<z;Y++)for(let V=0;V<D;V++){const q=p+V+he*Y,pe=p+V+he*(Y+1),ae=p+(V+1)+he*(Y+1),ce=p+(V+1)+he*Y;l.push(q,pe,ce),l.push(pe,ae,ce),B+=6}a.addGroup(y,B,G),y+=B,p+=fe}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ep(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Ug(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=Ug(t[n]);for(const i in r)e[i]=r[i]}return e}function Ppe(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function d6(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Nn.workingColorSpace}const PR={clone:Ug,merge:_s};var Cpe=`void main() {
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
}`,Rpe=`void main() {
|
||
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
||
}`;class Zo extends Gr{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Cpe,this.fragmentShader=Rpe,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Ug(e.uniforms),this.uniformsGroups=Ppe(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const n=super.toJSON(e);n.glslVersion=this.glslVersion,n.uniforms={};for(const i in this.uniforms){const o=this.uniforms[i].value;o&&o.isTexture?n.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?n.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?n.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?n.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?n.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?n.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?n.uniforms[i]={type:"m4",value:o.toArray()}:n.uniforms[i]={value:o}}Object.keys(this.defines).length>0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const r={};for(const i in this.extensions)this.extensions[i]===!0&&(r[i]=!0);return Object.keys(r).length>0&&(n.extensions=r),n}}class ux extends mn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ct,this.projectionMatrix=new Ct,this.projectionMatrixInverse=new Ct,this.coordinateSystem=Ml}copy(e,n){return super.copy(e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Yu=new X,sD=new He,oD=new He;class Pr extends ux{constructor(e=50,n=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const n=.5*this.getFilmHeight()/e;this.fov=Dg*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Th*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Dg*2*Math.atan(Math.tan(Th*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,n,r){Yu.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Yu.x,Yu.y).multiplyScalar(-e/Yu.z),Yu.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(Yu.x,Yu.y).multiplyScalar(-e/Yu.z)}getViewSize(e,n){return this.getViewBounds(e,sD,oD),n.subVectors(oD,sD)}setViewOffset(e,n,r,i,s,o){this.aspect=e/n,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(Th*.5*this.fov)/this.zoom,r=2*n,i=this.aspect*r,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,n-=o.offsetY*r/c,i*=o.width/l,r*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,n,n-r,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}const Sm=-90,Mm=1;class f6 extends mn{constructor(e,n,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Pr(Sm,Mm,e,n);i.layers=this.layers,this.add(i);const s=new Pr(Sm,Mm,e,n);s.layers=this.layers,this.add(s);const o=new Pr(Sm,Mm,e,n);o.layers=this.layers,this.add(o);const a=new Pr(Sm,Mm,e,n);a.layers=this.layers,this.add(a);const l=new Pr(Sm,Mm,e,n);l.layers=this.layers,this.add(l);const c=new Pr(Sm,Mm,e,n);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[r,i,s,o,a,l]=n;for(const c of n)this.remove(c);if(e===Ml)r.up.set(0,1,0),r.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Iy)r.up.set(0,-1,0),r.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of n)this.add(c),c.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:r,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,d]=this.children,f=e.getRenderTarget(),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,o),e.setRenderTarget(r,2,i),e.render(n,a),e.setRenderTarget(r,3,i),e.render(n,l),e.setRenderTarget(r,4,i),e.render(n,c),r.texture.generateMipmaps=S,e.setRenderTarget(r,5,i),e.render(n,d),e.setRenderTarget(f,p,y),e.xr.enabled=x,r.texture.needsPMREMUpdate=!0}}class dx extends fr{constructor(e,n,r,i,s,o,a,l,c,d){e=e!==void 0?e:[],n=n!==void 0?n:Zc,super(e,n,r,i,s,o,a,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class h6 extends Va{constructor(e=1,n={}){super(e,e,n),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},i=[r,r,r,r,r,r];this.texture=new dx(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:Cr}fromEquirectangularTexture(e,n){this.texture.type=n.type,this.texture.colorSpace=n.colorSpace,this.texture.generateMipmaps=n.generateMipmaps,this.texture.minFilter=n.minFilter,this.texture.magFilter=n.magFilter;const r={uniforms:{tEquirect:{value:null}},vertexShader:`
|
||
|
||
varying vec3 vWorldDirection;
|
||
|
||
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 ep(5,5,5),s=new Zo({name:"CubemapFromEquirect",uniforms:Ug(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:os,blending:Vc});s.uniforms.tEquirect.value=n;const o=new xr(i,s),a=n.minFilter;return n.minFilter===$o&&(n.minFilter=Cr),new f6(1,10,this).update(e,o),n.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,n,r,i){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(n,r,i);e.setRenderTarget(s)}}const pA=new X,Npe=new X,Ipe=new $t;class Rc{constructor(e=new X(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,r,i){return this.normal.set(e,n,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,r){const i=pA.subVectors(r,n).cross(Npe.subVectors(e,n)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,n){return n.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,n){const r=e.delta(pA),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:n.copy(e.start).addScaledVector(r,s)}intersectsLine(e){const n=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return n<0&&r>0||r<0&&n>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,n){const r=n||Ipe.getNormalMatrix(e),i=this.coplanarPoint(pA).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Nf=new Hi,e_=new X;class fx{constructor(e=new Rc,n=new Rc,r=new Rc,i=new Rc,s=new Rc,o=new Rc){this.planes=[e,n,r,i,s,o]}set(e,n,r,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(n),a[2].copy(r),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const n=this.planes;for(let r=0;r<6;r++)n[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,n=Ml){const r=this.planes,i=e.elements,s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],d=i[5],f=i[6],p=i[7],y=i[8],x=i[9],S=i[10],w=i[11],_=i[12],E=i[13],T=i[14],P=i[15];if(r[0].setComponents(l-s,p-c,w-y,P-_).normalize(),r[1].setComponents(l+s,p+c,w+y,P+_).normalize(),r[2].setComponents(l+o,p+d,w+x,P+E).normalize(),r[3].setComponents(l-o,p-d,w-x,P-E).normalize(),r[4].setComponents(l-a,p-f,w-S,P-T).normalize(),n===Ml)r[5].setComponents(l+a,p+f,w+S,P+T).normalize();else if(n===Iy)r[5].setComponents(a,f,S,T).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Nf.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),Nf.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Nf)}intersectsSprite(e){return Nf.center.set(0,0,0),Nf.radius=.7071067811865476,Nf.applyMatrix4(e.matrixWorld),this.intersectsSphere(Nf)}intersectsSphere(e){const n=this.planes,r=e.center,i=-e.radius;for(let s=0;s<6;s++)if(n[s].distanceToPoint(r)<i)return!1;return!0}intersectsBox(e){const n=this.planes;for(let r=0;r<6;r++){const i=n[r];if(e_.x=i.normal.x>0?e.max.x:e.min.x,e_.y=i.normal.y>0?e.max.y:e.min.y,e_.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(e_)<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 p6(){let t=null,e=!1,n=null,r=null;function i(s,o){n(s,o),r=t.requestAnimationFrame(i)}return{start:function(){e!==!0&&n!==null&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(s){n=s},setContext:function(s){t=s}}}function kpe(t){const e=new WeakMap;function n(a,l){const c=a.array,d=a.usage,f=c.byteLength,p=t.createBuffer();t.bindBuffer(l,p),t.bufferData(l,c,d),a.onUploadCallback();let y;if(c instanceof Float32Array)y=t.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?y=t.HALF_FLOAT:y=t.UNSIGNED_SHORT;else if(c instanceof Int16Array)y=t.SHORT;else if(c instanceof Uint32Array)y=t.UNSIGNED_INT;else if(c instanceof Int32Array)y=t.INT;else if(c instanceof Int8Array)y=t.BYTE;else if(c instanceof Uint8Array)y=t.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)y=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:p,type:y,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:f}}function r(a,l,c){const d=l.array,f=l.updateRanges;if(t.bindBuffer(c,a),f.length===0)t.bufferSubData(c,0,d);else{f.sort((y,x)=>y.start-x.start);let 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(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);const l=e.get(a);l&&(t.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){const d=e.get(a);(!d||d.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}const c=e.get(a);if(c===void 0)e.set(a,n(a,l));else if(c.version<a.version){if(c.size!==a.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,a,l),c.version=a.version}}return{get:i,remove:s,update:o}}class iv 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,o=n/2,a=Math.floor(r),l=Math.floor(i),c=a+1,d=l+1,f=e/a,p=n/l,y=[],x=[],S=[],w=[];for(let _=0;_<d;_++){const E=_*p-o;for(let T=0;T<c;T++){const P=T*f-s;x.push(P,-E,0),S.push(0,0,1),w.push(T/a),w.push(1-_/l)}}for(let _=0;_<l;_++)for(let E=0;E<a;E++){const T=E+c*_,P=E+c*(_+1),O=E+1+c*(_+1),N=E+1+c*_;y.push(T,P,N),y.push(P,O,N)}this.setIndex(y),this.setAttribute("position",new Lt(x,3)),this.setAttribute("normal",new Lt(S,3)),this.setAttribute("uv",new Lt(w,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new iv(e.width,e.height,e.widthSegments,e.heightSegments)}}var Ope=`#ifdef USE_ALPHAHASH
|
||
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
||
#endif`,Lpe=`#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`,Dpe=`#ifdef USE_ALPHAMAP
|
||
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
|
||
#endif`,Upe=`#ifdef USE_ALPHAMAP
|
||
uniform sampler2D alphaMap;
|
||
#endif`,jpe=`#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`,Fpe=`#ifdef USE_ALPHATEST
|
||
uniform float alphaTest;
|
||
#endif`,zpe=`#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`,Bpe=`#ifdef USE_AOMAP
|
||
uniform sampler2D aoMap;
|
||
uniform float aoMapIntensity;
|
||
#endif`,Hpe=`#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`,Vpe=`#ifdef USE_BATCHING
|
||
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
|
||
#endif`,Gpe=`vec3 transformed = vec3( position );
|
||
#ifdef USE_ALPHAHASH
|
||
vPosition = vec3( position );
|
||
#endif`,Wpe=`vec3 objectNormal = vec3( normal );
|
||
#ifdef USE_TANGENT
|
||
vec3 objectTangent = vec3( tangent.xyz );
|
||
#endif`,$pe=`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`,Xpe=`#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`,qpe=`#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`,Kpe=`#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`,Ype=`#if NUM_CLIPPING_PLANES > 0
|
||
varying vec3 vClipPosition;
|
||
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
||
#endif`,Zpe=`#if NUM_CLIPPING_PLANES > 0
|
||
varying vec3 vClipPosition;
|
||
#endif`,Qpe=`#if NUM_CLIPPING_PLANES > 0
|
||
vClipPosition = - mvPosition.xyz;
|
||
#endif`,Jpe=`#if defined( USE_COLOR_ALPHA )
|
||
diffuseColor *= vColor;
|
||
#elif defined( USE_COLOR )
|
||
diffuseColor.rgb *= vColor;
|
||
#endif`,eme=`#if defined( USE_COLOR_ALPHA )
|
||
varying vec4 vColor;
|
||
#elif defined( USE_COLOR )
|
||
varying vec3 vColor;
|
||
#endif`,tme=`#if defined( USE_COLOR_ALPHA )
|
||
varying vec4 vColor;
|
||
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
||
varying vec3 vColor;
|
||
#endif`,nme=`#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`,rme=`#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`,ime=`#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`,sme=`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`,ome=`#ifdef USE_DISPLACEMENTMAP
|
||
uniform sampler2D displacementMap;
|
||
uniform float displacementScale;
|
||
uniform float displacementBias;
|
||
#endif`,ame=`#ifdef USE_DISPLACEMENTMAP
|
||
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
|
||
#endif`,lme=`#ifdef USE_EMISSIVEMAP
|
||
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
|
||
totalEmissiveRadiance *= emissiveColor.rgb;
|
||
#endif`,cme=`#ifdef USE_EMISSIVEMAP
|
||
uniform sampler2D emissiveMap;
|
||
#endif`,ume="gl_FragColor = linearToOutputTexel( gl_FragColor );",dme=`
|
||
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 );
|
||
}`,fme=`#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`,hme=`#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`,pme=`#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`,mme=`#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`,gme=`#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`,vme=`#ifdef USE_FOG
|
||
vFogDepth = - mvPosition.z;
|
||
#endif`,yme=`#ifdef USE_FOG
|
||
varying float vFogDepth;
|
||
#endif`,xme=`#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`,bme=`#ifdef USE_FOG
|
||
uniform vec3 fogColor;
|
||
varying float vFogDepth;
|
||
#ifdef FOG_EXP2
|
||
uniform float fogDensity;
|
||
#else
|
||
uniform float fogNear;
|
||
uniform float fogFar;
|
||
#endif
|
||
#endif`,_me=`#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
|
||
}`,wme=`#ifdef USE_LIGHTMAP
|
||
uniform sampler2D lightMap;
|
||
uniform float lightMapIntensity;
|
||
#endif`,Sme=`LambertMaterial material;
|
||
material.diffuseColor = diffuseColor.rgb;
|
||
material.specularStrength = specularStrength;`,Mme=`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`,Eme=`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`,Ame=`#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`,Tme=`ToonMaterial material;
|
||
material.diffuseColor = diffuseColor.rgb;`,Pme=`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`,Cme=`BlinnPhongMaterial material;
|
||
material.diffuseColor = diffuseColor.rgb;
|
||
material.specularColor = specular;
|
||
material.specularShininess = shininess;
|
||
material.specularStrength = specularStrength;`,Rme=`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`,Nme=`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`,Ime=`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 );
|
||
}`,kme=`
|
||
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`,Ome=`#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`,Lme=`#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`,Dme=`#if defined( USE_LOGDEPTHBUF )
|
||
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
||
#endif`,Ume=`#if defined( USE_LOGDEPTHBUF )
|
||
uniform float logDepthBufFC;
|
||
varying float vFragDepth;
|
||
varying float vIsPerspective;
|
||
#endif`,jme=`#ifdef USE_LOGDEPTHBUF
|
||
varying float vFragDepth;
|
||
varying float vIsPerspective;
|
||
#endif`,Fme=`#ifdef USE_LOGDEPTHBUF
|
||
vFragDepth = 1.0 + gl_Position.w;
|
||
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
||
#endif`,zme=`#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`,Bme=`#ifdef USE_MAP
|
||
uniform sampler2D map;
|
||
#endif`,Hme=`#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`,Vme=`#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`,Gme=`float metalnessFactor = metalness;
|
||
#ifdef USE_METALNESSMAP
|
||
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
|
||
metalnessFactor *= texelMetalness.b;
|
||
#endif`,Wme=`#ifdef USE_METALNESSMAP
|
||
uniform sampler2D metalnessMap;
|
||
#endif`,$me=`#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`,Xme=`#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`,qme=`#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`,Kme=`#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`,Yme=`#ifdef USE_MORPHTARGETS
|
||
transformed *= morphTargetBaseInfluence;
|
||
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
||
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
|
||
}
|
||
#endif`,Zme=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
|
||
#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;`,Qme=`#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`,Jme=`#ifndef FLAT_SHADED
|
||
varying vec3 vNormal;
|
||
#ifdef USE_TANGENT
|
||
varying vec3 vTangent;
|
||
varying vec3 vBitangent;
|
||
#endif
|
||
#endif`,ege=`#ifndef FLAT_SHADED
|
||
varying vec3 vNormal;
|
||
#ifdef USE_TANGENT
|
||
varying vec3 vTangent;
|
||
varying vec3 vBitangent;
|
||
#endif
|
||
#endif`,tge=`#ifndef FLAT_SHADED
|
||
vNormal = normalize( transformedNormal );
|
||
#ifdef USE_TANGENT
|
||
vTangent = normalize( transformedTangent );
|
||
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
||
#endif
|
||
#endif`,nge=`#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`,rge=`#ifdef USE_CLEARCOAT
|
||
vec3 clearcoatNormal = nonPerturbedNormal;
|
||
#endif`,ige=`#ifdef USE_CLEARCOAT_NORMALMAP
|
||
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
|
||
clearcoatMapN.xy *= clearcoatNormalScale;
|
||
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
|
||
#endif`,sge=`#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`,oge=`#ifdef USE_IRIDESCENCEMAP
|
||
uniform sampler2D iridescenceMap;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
||
uniform sampler2D iridescenceThicknessMap;
|
||
#endif`,age=`#ifdef OPAQUE
|
||
diffuseColor.a = 1.0;
|
||
#endif
|
||
#ifdef USE_TRANSMISSION
|
||
diffuseColor.a *= material.transmissionAlpha;
|
||
#endif
|
||
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,lge=`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 );
|
||
}`,cge=`#ifdef PREMULTIPLIED_ALPHA
|
||
gl_FragColor.rgb *= gl_FragColor.a;
|
||
#endif`,uge=`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;`,dge=`#ifdef DITHERING
|
||
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
||
#endif`,fge=`#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`,hge=`float roughnessFactor = roughness;
|
||
#ifdef USE_ROUGHNESSMAP
|
||
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
|
||
roughnessFactor *= texelRoughness.g;
|
||
#endif`,pge=`#ifdef USE_ROUGHNESSMAP
|
||
uniform sampler2D roughnessMap;
|
||
#endif`,mge=`#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`,gge=`#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`,vge=`#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`,yge=`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;
|
||
}`,xge=`#ifdef USE_SKINNING
|
||
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
||
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
||
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
||
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
||
#endif`,bge=`#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`,_ge=`#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`,wge=`#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`,Sge=`float specularStrength;
|
||
#ifdef USE_SPECULARMAP
|
||
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
|
||
specularStrength = texelSpecular.r;
|
||
#else
|
||
specularStrength = 1.0;
|
||
#endif`,Mge=`#ifdef USE_SPECULARMAP
|
||
uniform sampler2D specularMap;
|
||
#endif`,Ege=`#if defined( TONE_MAPPING )
|
||
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
||
#endif`,Age=`#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; }`,Tge=`#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`,Pge=`#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`,Cge=`#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`,Rge=`#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`,Nge=`#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`,Ige=`#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 kge=`varying vec2 vUv;
|
||
uniform mat3 uvTransform;
|
||
void main() {
|
||
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
||
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
||
}`,Oge=`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>
|
||
}`,Lge=`varying vec3 vWorldDirection;
|
||
#include <common>
|
||
void main() {
|
||
vWorldDirection = transformDirection( position, modelMatrix );
|
||
#include <begin_vertex>
|
||
#include <project_vertex>
|
||
gl_Position.z = gl_Position.w;
|
||
}`,Dge=`#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>
|
||
}`,Uge=`varying vec3 vWorldDirection;
|
||
#include <common>
|
||
void main() {
|
||
vWorldDirection = transformDirection( position, modelMatrix );
|
||
#include <begin_vertex>
|
||
#include <project_vertex>
|
||
gl_Position.z = gl_Position.w;
|
||
}`,jge=`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>
|
||
}`,Fge=`#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;
|
||
}`,zge=`#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
|
||
}`,Bge=`#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;
|
||
}`,Hge=`#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 );
|
||
}`,Vge=`varying vec3 vWorldDirection;
|
||
#include <common>
|
||
void main() {
|
||
vWorldDirection = transformDirection( position, modelMatrix );
|
||
#include <begin_vertex>
|
||
#include <project_vertex>
|
||
}`,Gge=`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>
|
||
}`,Wge=`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>
|
||
}`,$ge=`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>
|
||
}`,Xge=`#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>
|
||
}`,qge=`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>
|
||
}`,Kge=`#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>
|
||
}`,Yge=`#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>
|
||
}`,Zge=`#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;
|
||
}`,Qge=`#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>
|
||
}`,Jge=`#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
|
||
}`,eve=`#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
|
||
}`,tve=`#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>
|
||
}`,nve=`#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>
|
||
}`,rve=`#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
|
||
}`,ive=`#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>
|
||
}`,sve=`#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>
|
||
}`,ove=`#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>
|
||
}`,ave=`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>
|
||
}`,lve=`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>
|
||
}`,cve=`#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>
|
||
}`,uve=`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>
|
||
}`,dve=`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>
|
||
}`,fve=`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:Ope,alphahash_pars_fragment:Lpe,alphamap_fragment:Dpe,alphamap_pars_fragment:Upe,alphatest_fragment:jpe,alphatest_pars_fragment:Fpe,aomap_fragment:zpe,aomap_pars_fragment:Bpe,batching_pars_vertex:Hpe,batching_vertex:Vpe,begin_vertex:Gpe,beginnormal_vertex:Wpe,bsdfs:$pe,iridescence_fragment:Xpe,bumpmap_pars_fragment:qpe,clipping_planes_fragment:Kpe,clipping_planes_pars_fragment:Ype,clipping_planes_pars_vertex:Zpe,clipping_planes_vertex:Qpe,color_fragment:Jpe,color_pars_fragment:eme,color_pars_vertex:tme,color_vertex:nme,common:rme,cube_uv_reflection_fragment:ime,defaultnormal_vertex:sme,displacementmap_pars_vertex:ome,displacementmap_vertex:ame,emissivemap_fragment:lme,emissivemap_pars_fragment:cme,colorspace_fragment:ume,colorspace_pars_fragment:dme,envmap_fragment:fme,envmap_common_pars_fragment:hme,envmap_pars_fragment:pme,envmap_pars_vertex:mme,envmap_physical_pars_fragment:Ame,envmap_vertex:gme,fog_vertex:vme,fog_pars_vertex:yme,fog_fragment:xme,fog_pars_fragment:bme,gradientmap_pars_fragment:_me,lightmap_pars_fragment:wme,lights_lambert_fragment:Sme,lights_lambert_pars_fragment:Mme,lights_pars_begin:Eme,lights_toon_fragment:Tme,lights_toon_pars_fragment:Pme,lights_phong_fragment:Cme,lights_phong_pars_fragment:Rme,lights_physical_fragment:Nme,lights_physical_pars_fragment:Ime,lights_fragment_begin:kme,lights_fragment_maps:Ome,lights_fragment_end:Lme,logdepthbuf_fragment:Dme,logdepthbuf_pars_fragment:Ume,logdepthbuf_pars_vertex:jme,logdepthbuf_vertex:Fme,map_fragment:zme,map_pars_fragment:Bme,map_particle_fragment:Hme,map_particle_pars_fragment:Vme,metalnessmap_fragment:Gme,metalnessmap_pars_fragment:Wme,morphinstance_vertex:$me,morphcolor_vertex:Xme,morphnormal_vertex:qme,morphtarget_pars_vertex:Kme,morphtarget_vertex:Yme,normal_fragment_begin:Zme,normal_fragment_maps:Qme,normal_pars_fragment:Jme,normal_pars_vertex:ege,normal_vertex:tge,normalmap_pars_fragment:nge,clearcoat_normal_fragment_begin:rge,clearcoat_normal_fragment_maps:ige,clearcoat_pars_fragment:sge,iridescence_pars_fragment:oge,opaque_fragment:age,packing:lge,premultiplied_alpha_fragment:cge,project_vertex:uge,dithering_fragment:dge,dithering_pars_fragment:fge,roughnessmap_fragment:hge,roughnessmap_pars_fragment:pge,shadowmap_pars_fragment:mge,shadowmap_pars_vertex:gge,shadowmap_vertex:vge,shadowmask_pars_fragment:yge,skinbase_vertex:xge,skinning_pars_vertex:bge,skinning_vertex:_ge,skinnormal_vertex:wge,specularmap_fragment:Sge,specularmap_pars_fragment:Mge,tonemapping_fragment:Ege,tonemapping_pars_fragment:Age,transmission_fragment:Tge,transmission_pars_fragment:Pge,uv_pars_fragment:Cge,uv_pars_vertex:Rge,uv_vertex:Nge,worldpos_vertex:Ige,background_vert:kge,background_frag:Oge,backgroundCube_vert:Lge,backgroundCube_frag:Dge,cube_vert:Uge,cube_frag:jge,depth_vert:Fge,depth_frag:zge,distanceRGBA_vert:Bge,distanceRGBA_frag:Hge,equirect_vert:Vge,equirect_frag:Gge,linedashed_vert:Wge,linedashed_frag:$ge,meshbasic_vert:Xge,meshbasic_frag:qge,meshlambert_vert:Kge,meshlambert_frag:Yge,meshmatcap_vert:Zge,meshmatcap_frag:Qge,meshnormal_vert:Jge,meshnormal_frag:eve,meshphong_vert:tve,meshphong_frag:nve,meshphysical_vert:rve,meshphysical_frag:ive,meshtoon_vert:sve,meshtoon_frag:ove,points_vert:ave,points_frag:lve,shadow_vert:cve,shadow_frag:uve,sprite_vert:dve,sprite_frag:fve},dt={common:{diffuse:{value:new ct(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new $t},alphaMap:{value:null},alphaMapTransform:{value:new $t},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new $t}},envmap:{envMap:{value:null},envMapRotation:{value:new $t},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new $t}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new $t}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new $t},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new $t},normalScale:{value:new He(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new $t},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new $t}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new $t}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new $t}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ct(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ct(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new $t},alphaTest:{value:0},uvTransform:{value:new $t}},sprite:{diffuse:{value:new ct(16777215)},opacity:{value:1},center:{value:new He(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new $t},alphaMap:{value:null},alphaMapTransform:{value:new $t},alphaTest:{value:0}}},Da={basic:{uniforms:_s([dt.common,dt.specularmap,dt.envmap,dt.aomap,dt.lightmap,dt.fog]),vertexShader:fn.meshbasic_vert,fragmentShader:fn.meshbasic_frag},lambert:{uniforms:_s([dt.common,dt.specularmap,dt.envmap,dt.aomap,dt.lightmap,dt.emissivemap,dt.bumpmap,dt.normalmap,dt.displacementmap,dt.fog,dt.lights,{emissive:{value:new ct(0)}}]),vertexShader:fn.meshlambert_vert,fragmentShader:fn.meshlambert_frag},phong:{uniforms:_s([dt.common,dt.specularmap,dt.envmap,dt.aomap,dt.lightmap,dt.emissivemap,dt.bumpmap,dt.normalmap,dt.displacementmap,dt.fog,dt.lights,{emissive:{value:new ct(0)},specular:{value:new ct(1118481)},shininess:{value:30}}]),vertexShader:fn.meshphong_vert,fragmentShader:fn.meshphong_frag},standard:{uniforms:_s([dt.common,dt.envmap,dt.aomap,dt.lightmap,dt.emissivemap,dt.bumpmap,dt.normalmap,dt.displacementmap,dt.roughnessmap,dt.metalnessmap,dt.fog,dt.lights,{emissive:{value:new ct(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:fn.meshphysical_vert,fragmentShader:fn.meshphysical_frag},toon:{uniforms:_s([dt.common,dt.aomap,dt.lightmap,dt.emissivemap,dt.bumpmap,dt.normalmap,dt.displacementmap,dt.gradientmap,dt.fog,dt.lights,{emissive:{value:new ct(0)}}]),vertexShader:fn.meshtoon_vert,fragmentShader:fn.meshtoon_frag},matcap:{uniforms:_s([dt.common,dt.bumpmap,dt.normalmap,dt.displacementmap,dt.fog,{matcap:{value:null}}]),vertexShader:fn.meshmatcap_vert,fragmentShader:fn.meshmatcap_frag},points:{uniforms:_s([dt.points,dt.fog]),vertexShader:fn.points_vert,fragmentShader:fn.points_frag},dashed:{uniforms:_s([dt.common,dt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:fn.linedashed_vert,fragmentShader:fn.linedashed_frag},depth:{uniforms:_s([dt.common,dt.displacementmap]),vertexShader:fn.depth_vert,fragmentShader:fn.depth_frag},normal:{uniforms:_s([dt.common,dt.bumpmap,dt.normalmap,dt.displacementmap,{opacity:{value:1}}]),vertexShader:fn.meshnormal_vert,fragmentShader:fn.meshnormal_frag},sprite:{uniforms:_s([dt.sprite,dt.fog]),vertexShader:fn.sprite_vert,fragmentShader:fn.sprite_frag},background:{uniforms:{uvTransform:{value:new $t},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:fn.background_vert,fragmentShader:fn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new $t}},vertexShader:fn.backgroundCube_vert,fragmentShader:fn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:fn.cube_vert,fragmentShader:fn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:fn.equirect_vert,fragmentShader:fn.equirect_frag},distanceRGBA:{uniforms:_s([dt.common,dt.displacementmap,{referencePosition:{value:new X},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:fn.distanceRGBA_vert,fragmentShader:fn.distanceRGBA_frag},shadow:{uniforms:_s([dt.lights,dt.fog,{color:{value:new ct(0)},opacity:{value:1}}]),vertexShader:fn.shadow_vert,fragmentShader:fn.shadow_frag}};Da.physical={uniforms:_s([Da.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new $t},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new $t},clearcoatNormalScale:{value:new He(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new $t},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new $t},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new $t},sheen:{value:0},sheenColor:{value:new ct(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new $t},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new $t},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new $t},transmissionSamplerSize:{value:new He},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new $t},attenuationDistance:{value:0},attenuationColor:{value:new ct(0)},specularColor:{value:new ct(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new $t},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new $t},anisotropyVector:{value:new He},anisotropyMap:{value:null},anisotropyMapTransform:{value:new $t}}]),vertexShader:fn.meshphysical_vert,fragmentShader:fn.meshphysical_frag};const t_={r:0,b:0,g:0},If=new ls,hve=new Ct;function pve(t,e,n,r,i,s,o){const a=new ct(0);let l=s===!0?0:1,c,d,f=null,p=0,y=null;function x(E){let T=E.isScene===!0?E.background:null;return T&&T.isTexture&&(T=(E.backgroundBlurriness>0?n:e).get(T)),T}function S(E){let T=!1;const P=x(E);P===null?_(a,l):P&&P.isColor&&(_(P,1),T=!0);const O=t.xr.getEnvironmentBlendMode();O==="additive"?r.buffers.color.setClear(0,0,0,1,o):O==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,o),(t.autoClear||T)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function w(E,T){const P=x(T);P&&(P.isCubeTexture||P.mapping===nv)?(d===void 0&&(d=new xr(new ep(1,1,1),new Zo({name:"BackgroundCubeMaterial",uniforms:Ug(Da.backgroundCube.uniforms),vertexShader:Da.backgroundCube.vertexShader,fragmentShader:Da.backgroundCube.fragmentShader,side:os,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(O,N,D){this.matrixWorld.copyPosition(D.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(d)),If.copy(T.backgroundRotation),If.x*=-1,If.y*=-1,If.z*=-1,P.isCubeTexture&&P.isRenderTargetTexture===!1&&(If.y*=-1,If.z*=-1),d.material.uniforms.envMap.value=P,d.material.uniforms.flipEnvMap.value=P.isCubeTexture&&P.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(hve.makeRotationFromEuler(If)),d.material.toneMapped=Nn.getTransfer(P.colorSpace)!==er,(f!==P||p!==P.version||y!==t.toneMapping)&&(d.material.needsUpdate=!0,f=P,p=P.version,y=t.toneMapping),d.layers.enableAll(),E.unshift(d,d.geometry,d.material,0,0,null)):P&&P.isTexture&&(c===void 0&&(c=new xr(new iv(2,2),new Zo({name:"BackgroundMaterial",uniforms:Ug(Da.background.uniforms),vertexShader:Da.background.vertexShader,fragmentShader:Da.background.fragmentShader,side:Ll,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=P,c.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,c.material.toneMapped=Nn.getTransfer(P.colorSpace)!==er,P.matrixAutoUpdate===!0&&P.updateMatrix(),c.material.uniforms.uvTransform.value.copy(P.matrix),(f!==P||p!==P.version||y!==t.toneMapping)&&(c.material.needsUpdate=!0,f=P,p=P.version,y=t.toneMapping),c.layers.enableAll(),E.unshift(c,c.geometry,c.material,0,0,null))}function _(E,T){E.getRGB(t_,d6(t)),r.buffers.color.setClear(t_.r,t_.g,t_.b,T,o)}return{getClearColor:function(){return a},setClearColor:function(E,T=1){a.set(E),l=T,_(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(E){l=E,_(a,l)},render:S,addToRenderList:w}}function mve(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),r={},i=p(null);let s=i,o=!1;function a(k,j,H,ee,te){let he=!1;const se=f(ee,H,j);s!==se&&(s=se,c(s.object)),he=y(k,ee,H,te),he&&x(k,ee,H,te),te!==null&&e.update(te,t.ELEMENT_ARRAY_BUFFER),(he||o)&&(o=!1,P(k,j,H,ee),te!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(te).buffer))}function l(){return t.createVertexArray()}function c(k){return t.bindVertexArray(k)}function d(k){return t.deleteVertexArray(k)}function f(k,j,H){const ee=H.wireframe===!0;let te=r[k.id];te===void 0&&(te={},r[k.id]=te);let he=te[j.id];he===void 0&&(he={},te[j.id]=he);let se=he[ee];return se===void 0&&(se=p(l()),he[ee]=se),se}function p(k){const j=[],H=[],ee=[];for(let te=0;te<n;te++)j[te]=0,H[te]=0,ee[te]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:j,enabledAttributes:H,attributeDivisors:ee,object:k,attributes:{},index:null}}function y(k,j,H,ee){const te=s.attributes,he=j.attributes;let se=0;const fe=H.getAttributes();for(const B in fe)if(fe[B].location>=0){const Y=te[B];let V=he[B];if(V===void 0&&(B==="instanceMatrix"&&k.instanceMatrix&&(V=k.instanceMatrix),B==="instanceColor"&&k.instanceColor&&(V=k.instanceColor)),Y===void 0||Y.attribute!==V||V&&Y.data!==V.data)return!0;se++}return s.attributesNum!==se||s.index!==ee}function x(k,j,H,ee){const te={},he=j.attributes;let se=0;const fe=H.getAttributes();for(const B in fe)if(fe[B].location>=0){let Y=he[B];Y===void 0&&(B==="instanceMatrix"&&k.instanceMatrix&&(Y=k.instanceMatrix),B==="instanceColor"&&k.instanceColor&&(Y=k.instanceColor));const V={};V.attribute=Y,Y&&Y.data&&(V.data=Y.data),te[B]=V,se++}s.attributes=te,s.attributesNum=se,s.index=ee}function S(){const k=s.newAttributes;for(let j=0,H=k.length;j<H;j++)k[j]=0}function w(k){_(k,0)}function _(k,j){const H=s.newAttributes,ee=s.enabledAttributes,te=s.attributeDivisors;H[k]=1,ee[k]===0&&(t.enableVertexAttribArray(k),ee[k]=1),te[k]!==j&&(t.vertexAttribDivisor(k,j),te[k]=j)}function E(){const k=s.newAttributes,j=s.enabledAttributes;for(let H=0,ee=j.length;H<ee;H++)j[H]!==k[H]&&(t.disableVertexAttribArray(H),j[H]=0)}function T(k,j,H,ee,te,he,se){se===!0?t.vertexAttribIPointer(k,j,H,te,he):t.vertexAttribPointer(k,j,H,ee,te,he)}function P(k,j,H,ee){S();const te=ee.attributes,he=H.getAttributes(),se=j.defaultAttributeValues;for(const fe in he){const B=he[fe];if(B.location>=0){let J=te[fe];if(J===void 0&&(fe==="instanceMatrix"&&k.instanceMatrix&&(J=k.instanceMatrix),fe==="instanceColor"&&k.instanceColor&&(J=k.instanceColor)),J!==void 0){const Y=J.normalized,V=J.itemSize,q=e.get(J);if(q===void 0)continue;const pe=q.buffer,ae=q.type,ce=q.bytesPerElement,Se=ae===t.INT||ae===t.UNSIGNED_INT||J.gpuType===VS;if(J.isInterleavedBufferAttribute){const Ee=J.data,$e=Ee.stride,Me=J.offset;if(Ee.isInstancedInterleavedBuffer){for(let Ge=0;Ge<B.locationSize;Ge++)_(B.location+Ge,Ee.meshPerAttribute);k.isInstancedMesh!==!0&&ee._maxInstanceCount===void 0&&(ee._maxInstanceCount=Ee.meshPerAttribute*Ee.count)}else for(let Ge=0;Ge<B.locationSize;Ge++)w(B.location+Ge);t.bindBuffer(t.ARRAY_BUFFER,pe);for(let Ge=0;Ge<B.locationSize;Ge++)T(B.location+Ge,V/B.locationSize,ae,Y,$e*ce,(Me+V/B.locationSize*Ge)*ce,Se)}else{if(J.isInstancedBufferAttribute){for(let Ee=0;Ee<B.locationSize;Ee++)_(B.location+Ee,J.meshPerAttribute);k.isInstancedMesh!==!0&&ee._maxInstanceCount===void 0&&(ee._maxInstanceCount=J.meshPerAttribute*J.count)}else for(let Ee=0;Ee<B.locationSize;Ee++)w(B.location+Ee);t.bindBuffer(t.ARRAY_BUFFER,pe);for(let Ee=0;Ee<B.locationSize;Ee++)T(B.location+Ee,V/B.locationSize,ae,Y,V*ce,V/B.locationSize*Ee*ce,Se)}}else if(se!==void 0){const Y=se[fe];if(Y!==void 0)switch(Y.length){case 2:t.vertexAttrib2fv(B.location,Y);break;case 3:t.vertexAttrib3fv(B.location,Y);break;case 4:t.vertexAttrib4fv(B.location,Y);break;default:t.vertexAttrib1fv(B.location,Y)}}}}E()}function O(){z();for(const k in r){const j=r[k];for(const H in j){const ee=j[H];for(const te in ee)d(ee[te].object),delete ee[te];delete j[H]}delete r[k]}}function N(k){if(r[k.id]===void 0)return;const j=r[k.id];for(const H in j){const ee=j[H];for(const te in ee)d(ee[te].object),delete ee[te];delete j[H]}delete r[k.id]}function D(k){for(const j in r){const H=r[j];if(H[k.id]===void 0)continue;const ee=H[k.id];for(const te in ee)d(ee[te].object),delete ee[te];delete H[k.id]}}function z(){G(),o=!0,s!==i&&(s=i,c(s.object))}function G(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:a,reset:z,resetDefaultState:G,dispose:O,releaseStatesOfGeometry:N,releaseStatesOfProgram:D,initAttributes:S,enableAttribute:w,disableUnusedAttributes:E}}function gve(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 o(c,d,f){f!==0&&(t.drawArraysInstanced(r,c,d,f),n.update(d,r,f))}function a(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++)o(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=o,this.renderMultiDraw=a,this.renderMultiDrawInstances=l}function vve(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 o(D){return!(D!==ss&&r.convert(D)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(D){const z=D===rv&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(D!==Ha&&r.convert(D)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&D!==Qs&&!z)}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),_=t.getParameter(t.MAX_VERTEX_ATTRIBS),E=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),T=t.getParameter(t.MAX_VARYING_VECTORS),P=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),O=x>0,N=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reverseDepthBuffer:p,maxTextures:y,maxVertexTextures:x,maxTextureSize:S,maxCubemapSize:w,maxAttributes:_,maxVertexUniforms:E,maxVaryings:T,maxFragmentUniforms:P,vertexTextures:O,maxSamples:N}}function yve(t){const e=this;let n=null,r=0,i=!1,s=!1;const o=new Rc,a=new $t,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,p){const y=f.length!==0||p||r!==0||i;return i=p,r=f.length,y},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,p){n=d(f,p,0)},this.setState=function(f,p,y){const x=f.clippingPlanes,S=f.clipIntersection,w=f.clipShadows,_=t.get(f);if(!i||x===null||x.length===0||s&&!w)s?d(null):c();else{const E=s?0:r,T=E*4;let P=_.clippingState||null;l.value=P,P=d(x,p,T,y);for(let O=0;O!==T;++O)P[O]=n[O];_.clippingState=P,this.numIntersection=S?this.numPlanes:0,this.numPlanes+=E}};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function d(f,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 _=y+S*4,E=p.matrixWorldInverse;a.getNormalMatrix(E),(w===null||w.length<_)&&(w=new Float32Array(_));for(let T=0,P=y;T!==S;++T,P+=4)o.copy(f[T]).applyMatrix4(E,a),o.normal.toArray(w,P),w[P+3]=o.constant}l.value=w,l.needsUpdate=!0}return e.numPlanes=S,e.numIntersection=0,w}}function xve(t){let e=new WeakMap;function n(o,a){return a===Ey?o.mapping=Zc:a===Ay&&(o.mapping=Pd),o}function r(o){if(o&&o.isTexture){const a=o.mapping;if(a===Ey||a===Ay)if(e.has(o)){const l=e.get(o).texture;return n(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const c=new h6(l.height);return c.fromEquirectangularTexture(t,o),e.set(o,c),o.addEventListener("dispose",i),n(c.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}class Gc extends ux{constructor(e=-1,n=1,r=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=r,this.bottom=i,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,n,r,i,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=r-e,o=r+e,a=i+n,l=i-n;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=d*this.view.offsetY,l=a-d*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}const Xm=4,aD=[.125,.215,.35,.446,.526,.582],Jf=20,mA=new Gc,lD=new ct;let gA=null,vA=0,yA=0,xA=!1;const Zf=(1+Math.sqrt(5))/2,Em=1/Zf,cD=[new X(-Zf,Em,0),new X(Zf,Em,0),new X(-Em,0,Zf),new X(Em,0,Zf),new X(0,Zf,-Em),new X(0,Zf,Em),new X(-1,1,-1),new X(1,1,-1),new X(-1,1,1),new X(1,1,1)];class qP{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,n=0,r=.1,i=100){gA=this._renderer.getRenderTarget(),vA=this._renderer.getActiveCubeFace(),yA=this._renderer.getActiveMipmapLevel(),xA=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,r,i,s),n>0&&this._blur(s,0,0,n),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=fD(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=dD(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(gA,vA,yA),this._renderer.xr.enabled=xA,e.scissorTest=!1,n_(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===Zc||e.mapping===Pd?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),gA=this._renderer.getRenderTarget(),vA=this._renderer.getActiveCubeFace(),yA=this._renderer.getActiveMipmapLevel(),xA=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:Cr,minFilter:Cr,generateMipmaps:!1,type:rv,format:ss,colorSpace:xi,depthBuffer:!1},i=uD(e,n,r);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=uD(e,n,r);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=bve(s)),this._blurMaterial=_ve(s,e,n)}return i}_compileMaterial(e){const n=new xr(this._lodPlanes[0],e);this._renderer.compile(n,mA)}_sceneToCubeUV(e,n,r,i){const a=new Pr(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(lD),d.toneMapping=Tl,d.autoClear=!1;const y=new As({name:"PMREM.Background",side:os,depthWrite:!1,depthTest:!1}),x=new xr(new ep,y);let S=!1;const w=e.background;w?w.isColor&&(y.color.copy(w),e.background=null,S=!0):(y.color.copy(lD),S=!0);for(let _=0;_<6;_++){const E=_%3;E===0?(a.up.set(0,l[_],0),a.lookAt(c[_],0,0)):E===1?(a.up.set(0,0,l[_]),a.lookAt(0,c[_],0)):(a.up.set(0,l[_],0),a.lookAt(0,0,c[_]));const T=this._cubeSize;n_(i,E*T,_>2?T:0,T,T),d.setRenderTarget(i),S&&d.render(x,a),d.render(e,a)}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===Zc||e.mapping===Pd;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=fD()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=dD());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new xr(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;n_(n,0,0,3*l,2*l),r.setRenderTarget(n),r.render(o,mA)}_applyPMREM(e){const n=this._renderer,r=n.autoClear;n.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;s<i;s++){const o=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),a=cD[(i-s-1)%cD.length];this._blur(e,s-1,s,o,a)}n.autoClear=r}_blur(e,n,r,i,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,n,r,i,"latitudinal",s),this._halfBlur(o,e,r,r,i,"longitudinal",s)}_halfBlur(e,n,r,i,s,o,a){const l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="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*Jf-1),S=s/x,w=isFinite(s)?1+Math.floor(d*S):Jf;w>Jf&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${w} samples when the maximum is set to ${Jf}`);const _=[];let E=0;for(let D=0;D<Jf;++D){const z=D/S,G=Math.exp(-z*z/2);_.push(G),D===0?E+=G:D<w&&(E+=2*G)}for(let D=0;D<_.length;D++)_[D]=_[D]/E;p.envMap.value=e.texture,p.samples.value=w,p.weights.value=_,p.latitudinal.value=o==="latitudinal",a&&(p.poleAxis.value=a);const{_lodMax:T}=this;p.dTheta.value=x,p.mipInt.value=T-r;const P=this._sizeLods[i],O=3*P*(i>T-Xm?i-T+Xm:0),N=4*(this._cubeSize-P);n_(n,O,N,3*P,2*P),l.setRenderTarget(n),l.render(f,mA)}}function bve(t){const e=[],n=[],r=[];let i=t;const s=t-Xm+1+aD.length;for(let o=0;o<s;o++){const a=Math.pow(2,i);n.push(a);let l=1/a;o>t-Xm?l=aD[o-t+Xm-1]:o===0&&(l=0),r.push(l);const c=1/(a-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,_=1,E=new Float32Array(S*x*y),T=new Float32Array(w*x*y),P=new Float32Array(_*x*y);for(let N=0;N<y;N++){const D=N%3*2/3-1,z=N>2?0:-1,G=[D,z,0,D+2/3,z,0,D+2/3,z+1,0,D,z,0,D+2/3,z+1,0,D,z+1,0];E.set(G,S*x*N),T.set(p,w*x*N);const k=[N,N,N,N,N,N];P.set(k,_*x*N)}const O=new Yt;O.setAttribute("position",new Qt(E,S)),O.setAttribute("uv",new Qt(T,w)),O.setAttribute("faceIndex",new Qt(P,_)),e.push(O),i>Xm&&i--}return{lodPlanes:e,sizeLods:n,sigmas:r}}function uD(t,e,n){const r=new Va(t,e,n);return r.texture.mapping=nv,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function n_(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function _ve(t,e,n){const r=new Float32Array(Jf),i=new X(0,1,0);return new Zo({name:"SphericalGaussianBlur",defines:{n:Jf,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:CR(),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:Vc,depthTest:!1,depthWrite:!1})}function dD(){return new Zo({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:CR(),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:Vc,depthTest:!1,depthWrite:!1})}function fD(){return new Zo({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:CR(),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:Vc,depthTest:!1,depthWrite:!1})}function CR(){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 wve(t){let e=new WeakMap,n=null;function r(a){if(a&&a.isTexture){const l=a.mapping,c=l===Ey||l===Ay,d=l===Zc||l===Pd;if(c||d){let f=e.get(a);const p=f!==void 0?f.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==p)return n===null&&(n=new qP(t)),f=c?n.fromEquirectangular(a,f):n.fromCubemap(a,f),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),f.texture;if(f!==void 0)return f.texture;{const y=a.image;return c&&y&&y.height>0||d&&y&&i(y)?(n===null&&(n=new qP(t)),f=c?n.fromEquirectangular(a):n.fromCubemap(a),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),a.addEventListener("dispose",s),f.texture):null}}}return a}function i(a){let l=0;const c=6;for(let d=0;d<c;d++)a[d]!==void 0&&l++;return l===c}function s(a){const l=a.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function o(){e=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:o}}function Sve(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&&$_("THREE.WebGLRenderer: "+r+" extension not supported."),i}}}function Mve(t,e,n,r){const i={},s=new WeakMap;function o(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,_=S.length;w<_;w++)e.remove(S[w])}p.removeEventListener("dispose",o),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 a(f,p){return i[p.id]===!0||(p.addEventListener("dispose",o),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,_=S.length;w<_;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 E=y.array;S=y.version;for(let T=0,P=E.length;T<P;T+=3){const O=E[T+0],N=E[T+1],D=E[T+2];p.push(O,N,N,D,D,O)}}else if(x!==void 0){const E=x.array;S=x.version;for(let T=0,P=E.length/3-1;T<P;T+=3){const O=T+0,N=T+1,D=T+2;p.push(O,N,N,D,D,O)}}else return;const w=new(o6(p)?TR:AR)(p,1);w.version=S;const _=s.get(f);_&&e.remove(_),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:a,update:l,getWireframeAttribute:d}}function Eve(t,e,n){let r;function i(p){r=p}let s,o;function a(p){s=p.type,o=p.bytesPerElement}function l(p,y){t.drawElements(r,y,s,p*o),n.update(y,r,1)}function c(p,y,x){x!==0&&(t.drawElementsInstanced(r,y,s,p*o,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 _=0;_<x;_++)w+=y[_];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 _=0;_<p.length;_++)c(p[_]/o,y[_],S[_]);else{w.multiDrawElementsInstancedWEBGL(r,y,0,s,p,0,S,0,x);let _=0;for(let E=0;E<x;E++)_+=y[E];for(let E=0;E<S.length;E++)n.update(_,r,S[E])}}this.setMode=i,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=d,this.renderMultiDrawInstances=f}function Ave(t){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function r(s,o,a){switch(n.calls++,o){case t.TRIANGLES:n.triangles+=a*(s/3);break;case t.LINES:n.lines+=a*(s/2);break;case t.LINE_STRIP:n.lines+=a*(s-1);break;case t.LINE_LOOP:n.lines+=a*s;break;case t.POINTS:n.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);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 Tve(t,e,n){const r=new WeakMap,i=new On;function s(o,a,l){const c=o.morphTargetInfluences,d=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,f=d!==void 0?d.length:0;let p=r.get(a);if(p===void 0||p.count!==f){let G=function(){D.dispose(),r.delete(a),a.removeEventListener("dispose",G)};p!==void 0&&p.texture.dispose();const y=a.morphAttributes.position!==void 0,x=a.morphAttributes.normal!==void 0,S=a.morphAttributes.color!==void 0,w=a.morphAttributes.position||[],_=a.morphAttributes.normal||[],E=a.morphAttributes.color||[];let T=0;y===!0&&(T=1),x===!0&&(T=2),S===!0&&(T=3);let P=a.attributes.position.count*T,O=1;P>e.maxTextureSize&&(O=Math.ceil(P/e.maxTextureSize),P=e.maxTextureSize);const N=new Float32Array(P*O*4*f),D=new ZS(N,P,O,f);D.type=Qs,D.needsUpdate=!0;const z=T*4;for(let k=0;k<f;k++){const j=w[k],H=_[k],ee=E[k],te=P*O*4*k;for(let he=0;he<j.count;he++){const se=he*z;y===!0&&(i.fromBufferAttribute(j,he),N[te+se+0]=i.x,N[te+se+1]=i.y,N[te+se+2]=i.z,N[te+se+3]=0),x===!0&&(i.fromBufferAttribute(H,he),N[te+se+4]=i.x,N[te+se+5]=i.y,N[te+se+6]=i.z,N[te+se+7]=0),S===!0&&(i.fromBufferAttribute(ee,he),N[te+se+8]=i.x,N[te+se+9]=i.y,N[te+se+10]=i.z,N[te+se+11]=ee.itemSize===4?i.w:1)}}p={count:f,texture:D,size:new He(P,O)},r.set(a,p),a.addEventListener("dispose",G)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(t,"morphTexture",o.morphTexture,n);else{let y=0;for(let S=0;S<c.length;S++)y+=c[S];const x=a.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 Pve(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",a)===!1&&l.addEventListener("dispose",a),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 o(){i=new WeakMap}function a(l){const c=l.target;c.removeEventListener("dispose",a),n.remove(c.instanceMatrix),c.instanceColor!==null&&n.remove(c.instanceColor)}return{update:s,dispose:o}}class RR extends fr{constructor(e,n,r,i,s,o,a,l,c,d=Ah){if(d!==Ah&&d!==Bh)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&d===Ah&&(r=Qc),r===void 0&&d===Bh&&(r=zh),super(null,i,s,o,a,l,d,r,c),this.isDepthTexture=!0,this.image={width:e,height:n},this.magFilter=a!==void 0?a: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 m6=new fr,hD=new RR(1,1),g6=new ZS,v6=new ER,y6=new dx,pD=[],mD=[],gD=new Float32Array(16),vD=new Float32Array(9),yD=new Float32Array(4);function sv(t,e,n){const r=t[0];if(r<=0||r>0)return t;const i=e*n;let s=pD[i];if(s===void 0&&(s=new Float32Array(i),pD[i]=s),e!==0){r.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=n,t[o].toArray(s,a)}return s}function ii(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n<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 QS(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 Cve(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function Rve(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 Nve(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 Ive(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 kve(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;yD.set(r),t.uniformMatrix2fv(this.addr,!1,yD),si(n,r)}}function Ove(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;vD.set(r),t.uniformMatrix3fv(this.addr,!1,vD),si(n,r)}}function Lve(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;gD.set(r),t.uniformMatrix4fv(this.addr,!1,gD),si(n,r)}}function Dve(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function Uve(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 jve(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 Fve(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 zve(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function Bve(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 Hve(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 Vve(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 Gve(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?(hD.compareFunction=SR,s=hD):s=m6,n.setTexture2D(e||s,i)}function Wve(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(e||v6,i)}function $ve(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(e||y6,i)}function Xve(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(e||g6,i)}function qve(t){switch(t){case 5126:return Cve;case 35664:return Rve;case 35665:return Nve;case 35666:return Ive;case 35674:return kve;case 35675:return Ove;case 35676:return Lve;case 5124:case 35670:return Dve;case 35667:case 35671:return Uve;case 35668:case 35672:return jve;case 35669:case 35673:return Fve;case 5125:return zve;case 36294:return Bve;case 36295:return Hve;case 36296:return Vve;case 35678:case 36198:case 36298:case 36306:case 35682:return Gve;case 35679:case 36299:case 36307:return Wve;case 35680:case 36300:case 36308:case 36293:return $ve;case 36289:case 36303:case 36311:case 36292:return Xve}}function Kve(t,e){t.uniform1fv(this.addr,e)}function Yve(t,e){const n=sv(e,this.size,2);t.uniform2fv(this.addr,n)}function Zve(t,e){const n=sv(e,this.size,3);t.uniform3fv(this.addr,n)}function Qve(t,e){const n=sv(e,this.size,4);t.uniform4fv(this.addr,n)}function Jve(t,e){const n=sv(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function e0e(t,e){const n=sv(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function t0e(t,e){const n=sv(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function n0e(t,e){t.uniform1iv(this.addr,e)}function r0e(t,e){t.uniform2iv(this.addr,e)}function i0e(t,e){t.uniform3iv(this.addr,e)}function s0e(t,e){t.uniform4iv(this.addr,e)}function o0e(t,e){t.uniform1uiv(this.addr,e)}function a0e(t,e){t.uniform2uiv(this.addr,e)}function l0e(t,e){t.uniform3uiv(this.addr,e)}function c0e(t,e){t.uniform4uiv(this.addr,e)}function u0e(t,e,n){const r=this.cache,i=e.length,s=QS(n,i);ii(r,s)||(t.uniform1iv(this.addr,s),si(r,s));for(let o=0;o!==i;++o)n.setTexture2D(e[o]||m6,s[o])}function d0e(t,e,n){const r=this.cache,i=e.length,s=QS(n,i);ii(r,s)||(t.uniform1iv(this.addr,s),si(r,s));for(let o=0;o!==i;++o)n.setTexture3D(e[o]||v6,s[o])}function f0e(t,e,n){const r=this.cache,i=e.length,s=QS(n,i);ii(r,s)||(t.uniform1iv(this.addr,s),si(r,s));for(let o=0;o!==i;++o)n.setTextureCube(e[o]||y6,s[o])}function h0e(t,e,n){const r=this.cache,i=e.length,s=QS(n,i);ii(r,s)||(t.uniform1iv(this.addr,s),si(r,s));for(let o=0;o!==i;++o)n.setTexture2DArray(e[o]||g6,s[o])}function p0e(t){switch(t){case 5126:return Kve;case 35664:return Yve;case 35665:return Zve;case 35666:return Qve;case 35674:return Jve;case 35675:return e0e;case 35676:return t0e;case 5124:case 35670:return n0e;case 35667:case 35671:return r0e;case 35668:case 35672:return i0e;case 35669:case 35673:return s0e;case 5125:return o0e;case 36294:return a0e;case 36295:return l0e;case 36296:return c0e;case 35678:case 36198:case 36298:case 36306:case 35682:return u0e;case 35679:case 36299:case 36307:return d0e;case 35680:case 36300:case 36308:case 36293:return f0e;case 36289:case 36303:case 36311:case 36292:return h0e}}class m0e{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.setValue=qve(n.type)}}class g0e{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=p0e(n.type)}}class v0e{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,n,r){const i=this.seq;for(let s=0,o=i.length;s!==o;++s){const a=i[s];a.setValue(e,n[a.id],r)}}}const bA=/(\w+)(\])?(\[|\.)?/g;function xD(t,e){t.seq.push(e),t.map[e.id]=e}function y0e(t,e,n){const r=t.name,i=r.length;for(bA.lastIndex=0;;){const s=bA.exec(r),o=bA.lastIndex;let a=s[1];const l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===i){xD(n,c===void 0?new m0e(a,t,e):new g0e(a,t,e));break}else{let f=n.map[a];f===void 0&&(f=new v0e(a),xD(n,f)),n=f}}}class X_{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),o=e.getUniformLocation(n,s.name);y0e(s,o,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,o=n.length;s!==o;++s){const a=n[s],l=r[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,i)}}static seqWithValue(e,n){const r=[];for(let i=0,s=e.length;i!==s;++i){const o=e[i];o.id in n&&r.push(o)}return r}}function bD(t,e,n){const r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}const x0e=37297;let b0e=0;function _0e(t,e){const n=t.split(`
|
||
`),r=[],i=Math.max(e-6,0),s=Math.min(e+6,n.length);for(let o=i;o<s;o++){const a=o+1;r.push(`${a===e?">":" "} ${a}: ${n[o]}`)}return r.join(`
|
||
`)}function w0e(t){const e=Nn.getPrimaries(Nn.workingColorSpace),n=Nn.getPrimaries(t);let r;switch(e===n?r="":e===Ry&&n===Cy?r="LinearDisplayP3ToLinearSRGB":e===Cy&&n===Ry&&(r="LinearSRGBToLinearDisplayP3"),t){case xi:case cx:return[r,"LinearTransferOETF"];case Fi:case YS:return[r,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[r,"LinearTransferOETF"]}}function _D(t,e,n){const r=t.getShaderParameter(e,t.COMPILE_STATUS),i=t.getShaderInfoLog(e).trim();if(r&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return n.toUpperCase()+`
|
||
|
||
`+i+`
|
||
|
||
`+_0e(t.getShaderSource(e),o)}else return i}function S0e(t,e){const n=w0e(e);return`vec4 ${t}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function M0e(t,e){let n;switch(e){case jV:n="Linear";break;case FV:n="Reinhard";break;case zV:n="Cineon";break;case dR:n="ACESFilmic";break;case HV:n="AgX";break;case VV:n="Neutral";break;case BV:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const r_=new X;function E0e(){Nn.getLuminanceCoefficients(r_);const t=r_.x.toFixed(4),e=r_.y.toFixed(4),n=r_.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${t}, ${e}, ${n} );`," return dot( weights, rgb );","}"].join(`
|
||
`)}function A0e(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(G0).join(`
|
||
`)}function T0e(t){const e=[];for(const n in t){const r=t[n];r!==!1&&e.push("#define "+n+" "+r)}return e.join(`
|
||
`)}function P0e(t,e){const n={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let i=0;i<r;i++){const s=t.getActiveAttrib(e,i),o=s.name;let a=1;s.type===t.FLOAT_MAT2&&(a=2),s.type===t.FLOAT_MAT3&&(a=3),s.type===t.FLOAT_MAT4&&(a=4),n[o]={type:s.type,location:t.getAttribLocation(e,o),locationSize:a}}return n}function G0(t){return t!==""}function wD(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 SD(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const C0e=/^[ \t]*#include +<([\w\d./]+)>/gm;function KP(t){return t.replace(C0e,N0e)}const R0e=new Map;function N0e(t,e){let n=fn[e];if(n===void 0){const r=R0e.get(e);if(r!==void 0)n=fn[r],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return KP(n)}const I0e=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function MD(t){return t.replace(I0e,k0e)}function k0e(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 ED(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 O0e(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===zS?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===K0?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===Oa&&(e="SHADOWMAP_TYPE_VSM"),e}function L0e(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case Zc:case Pd:e="ENVMAP_TYPE_CUBE";break;case nv:e="ENVMAP_TYPE_CUBE_UV";break}return e}function D0e(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case Pd:e="ENVMAP_MODE_REFRACTION";break}return e}function U0e(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case ax:e="ENVMAP_BLENDING_MULTIPLY";break;case DV:e="ENVMAP_BLENDING_MIX";break;case UV:e="ENVMAP_BLENDING_ADD";break}return e}function j0e(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 F0e(t,e,n,r){const i=t.getContext(),s=n.defines;let o=n.vertexShader,a=n.fragmentShader;const l=O0e(n),c=L0e(n),d=D0e(n),f=U0e(n),p=j0e(n),y=A0e(n),x=T0e(s),S=i.createProgram();let w,_,E=n.glslVersion?"#version "+n.glslVersion+`
|
||
`:"";n.isRawShaderMaterial?(w=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(G0).join(`
|
||
`),w.length>0&&(w+=`
|
||
`),_=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(G0).join(`
|
||
`),_.length>0&&(_+=`
|
||
`)):(w=[ED(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
|
||
`].filter(G0).join(`
|
||
`),_=[ED(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!==Tl?"#define TONE_MAPPING":"",n.toneMapping!==Tl?fn.tonemapping_pars_fragment:"",n.toneMapping!==Tl?M0e("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",fn.colorspace_pars_fragment,S0e("linearToOutputTexel",n.outputColorSpace),E0e(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
|
||
`].filter(G0).join(`
|
||
`)),o=KP(o),o=wD(o,n),o=SD(o,n),a=KP(a),a=wD(a,n),a=SD(a,n),o=MD(o),a=MD(a),n.isRawShaderMaterial!==!0&&(E=`#version 300 es
|
||
`,w=[y,"#define attribute in","#define varying out","#define texture2D texture"].join(`
|
||
`)+`
|
||
`+w,_=["#define varying in",n.glslVersion===XP?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===XP?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
|
||
`)+`
|
||
`+_);const T=E+w+o,P=E+_+a,O=bD(i,i.VERTEX_SHADER,T),N=bD(i,i.FRAGMENT_SHADER,P);i.attachShader(S,O),i.attachShader(S,N),n.index0AttributeName!==void 0?i.bindAttribLocation(S,0,n.index0AttributeName):n.morphTargets===!0&&i.bindAttribLocation(S,0,"position"),i.linkProgram(S);function D(j){if(t.debug.checkShaderErrors){const H=i.getProgramInfoLog(S).trim(),ee=i.getShaderInfoLog(O).trim(),te=i.getShaderInfoLog(N).trim();let he=!0,se=!0;if(i.getProgramParameter(S,i.LINK_STATUS)===!1)if(he=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(i,S,O,N);else{const fe=_D(i,O,"vertex"),B=_D(i,N,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(S,i.VALIDATE_STATUS)+`
|
||
|
||
Material Name: `+j.name+`
|
||
Material Type: `+j.type+`
|
||
|
||
Program Info Log: `+H+`
|
||
`+fe+`
|
||
`+B)}else H!==""?console.warn("THREE.WebGLProgram: Program Info Log:",H):(ee===""||te==="")&&(se=!1);se&&(j.diagnostics={runnable:he,programLog:H,vertexShader:{log:ee,prefix:w},fragmentShader:{log:te,prefix:_}})}i.deleteShader(O),i.deleteShader(N),z=new X_(i,S),G=P0e(i,S)}let z;this.getUniforms=function(){return z===void 0&&D(this),z};let G;this.getAttributes=function(){return G===void 0&&D(this),G};let k=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return k===!1&&(k=i.getProgramParameter(S,x0e)),k},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(S),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=b0e++,this.cacheKey=e,this.usedTimes=1,this.program=S,this.vertexShader=O,this.fragmentShader=N,this}let z0e=0;class B0e{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(n),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const r of n)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let r=n.get(e);return r===void 0&&(r=new Set,n.set(e,r)),r}_getShaderStage(e){const n=this.shaderCache;let r=n.get(e);return r===void 0&&(r=new H0e(e),n.set(e,r)),r}}class H0e{constructor(e){this.id=z0e++,this.code=e,this.usedTimes=0}}function V0e(t,e,n,r,i,s,o){const a=new Ph,l=new B0e,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(k){return c.add(k),k===0?"uv":`uv${k}`}function _(k,j,H,ee,te){const he=ee.fog,se=te.geometry,fe=k.isMeshStandardMaterial?ee.environment:null,B=(k.isMeshStandardMaterial?n:e).get(k.envMap||fe),J=B&&B.mapping===nv?B.image.height:null,Y=S[k.type];k.precision!==null&&(x=i.getMaxPrecision(k.precision),x!==k.precision&&console.warn("THREE.WebGLProgram.getParameters:",k.precision,"not supported, using",x,"instead."));const V=se.morphAttributes.position||se.morphAttributes.normal||se.morphAttributes.color,q=V!==void 0?V.length:0;let pe=0;se.morphAttributes.position!==void 0&&(pe=1),se.morphAttributes.normal!==void 0&&(pe=2),se.morphAttributes.color!==void 0&&(pe=3);let ae,ce,Se,Ee;if(Y){const Hn=Da[Y];ae=Hn.vertexShader,ce=Hn.fragmentShader}else ae=k.vertexShader,ce=k.fragmentShader,l.update(k),Se=l.getVertexShaderID(k),Ee=l.getFragmentShaderID(k);const $e=t.getRenderTarget(),Me=te.isInstancedMesh===!0,Ge=te.isBatchedMesh===!0,We=!!k.map,ue=!!k.matcap,Z=!!B,Ve=!!k.aoMap,Le=!!k.lightMap,re=!!k.bumpMap,Ce=!!k.normalMap,qe=!!k.displacementMap,Ze=!!k.emissiveMap,Q=!!k.metalnessMap,W=!!k.roughnessMap,be=k.anisotropy>0,Ue=k.clearcoat>0,ze=k.dispersion>0,Fe=k.iridescence>0,bt=k.sheen>0,rt=k.transmission>0,ft=be&&!!k.anisotropyMap,Xt=Ue&&!!k.clearcoatMap,Ke=Ue&&!!k.clearcoatNormalMap,ne=Ue&&!!k.clearcoatRoughnessMap,et=Fe&&!!k.iridescenceMap,Mt=Fe&&!!k.iridescenceThicknessMap,vt=bt&&!!k.sheenColorMap,Zt=bt&&!!k.sheenRoughnessMap,de=!!k.specularMap,Xe=!!k.specularColorMap,le=!!k.specularIntensityMap,Ye=rt&&!!k.transmissionMap,Re=rt&&!!k.thicknessMap,Be=!!k.gradientMap,ot=!!k.alphaMap,pt=k.alphaTest>0,Jt=!!k.alphaHash,pn=!!k.extensions;let jn=Tl;k.toneMapped&&($e===null||$e.isXRRenderTarget===!0)&&(jn=t.toneMapping);const en={shaderID:Y,shaderType:k.type,shaderName:k.name,vertexShader:ae,fragmentShader:ce,defines:k.defines,customVertexShaderID:Se,customFragmentShaderID:Ee,isRawShaderMaterial:k.isRawShaderMaterial===!0,glslVersion:k.glslVersion,precision:x,batching:Ge,batchingColor:Ge&&te._colorsTexture!==null,instancing:Me,instancingColor:Me&&te.instanceColor!==null,instancingMorph:Me&&te.morphTexture!==null,supportsVertexTextures:y,outputColorSpace:$e===null?t.outputColorSpace:$e.isXRRenderTarget===!0?$e.texture.colorSpace:xi,alphaToCoverage:!!k.alphaToCoverage,map:We,matcap:ue,envMap:Z,envMapMode:Z&&B.mapping,envMapCubeUVHeight:J,aoMap:Ve,lightMap:Le,bumpMap:re,normalMap:Ce,displacementMap:y&&qe,emissiveMap:Ze,normalMapObjectSpace:Ce&&k.normalMapType===ZV,normalMapTangentSpace:Ce&&k.normalMapType===ou,metalnessMap:Q,roughnessMap:W,anisotropy:be,anisotropyMap:ft,clearcoat:Ue,clearcoatMap:Xt,clearcoatNormalMap:Ke,clearcoatRoughnessMap:ne,dispersion:ze,iridescence:Fe,iridescenceMap:et,iridescenceThicknessMap:Mt,sheen:bt,sheenColorMap:vt,sheenRoughnessMap:Zt,specularMap:de,specularColorMap:Xe,specularIntensityMap:le,transmission:rt,transmissionMap:Ye,thicknessMap:Re,gradientMap:Be,opaque:k.transparent===!1&&k.blending===Eh&&k.alphaToCoverage===!1,alphaMap:ot,alphaTest:pt,alphaHash:Jt,combine:k.combine,mapUv:We&&w(k.map.channel),aoMapUv:Ve&&w(k.aoMap.channel),lightMapUv:Le&&w(k.lightMap.channel),bumpMapUv:re&&w(k.bumpMap.channel),normalMapUv:Ce&&w(k.normalMap.channel),displacementMapUv:qe&&w(k.displacementMap.channel),emissiveMapUv:Ze&&w(k.emissiveMap.channel),metalnessMapUv:Q&&w(k.metalnessMap.channel),roughnessMapUv:W&&w(k.roughnessMap.channel),anisotropyMapUv:ft&&w(k.anisotropyMap.channel),clearcoatMapUv:Xt&&w(k.clearcoatMap.channel),clearcoatNormalMapUv:Ke&&w(k.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ne&&w(k.clearcoatRoughnessMap.channel),iridescenceMapUv:et&&w(k.iridescenceMap.channel),iridescenceThicknessMapUv:Mt&&w(k.iridescenceThicknessMap.channel),sheenColorMapUv:vt&&w(k.sheenColorMap.channel),sheenRoughnessMapUv:Zt&&w(k.sheenRoughnessMap.channel),specularMapUv:de&&w(k.specularMap.channel),specularColorMapUv:Xe&&w(k.specularColorMap.channel),specularIntensityMapUv:le&&w(k.specularIntensityMap.channel),transmissionMapUv:Ye&&w(k.transmissionMap.channel),thicknessMapUv:Re&&w(k.thicknessMap.channel),alphaMapUv:ot&&w(k.alphaMap.channel),vertexTangents:!!se.attributes.tangent&&(Ce||be),vertexColors:k.vertexColors,vertexAlphas:k.vertexColors===!0&&!!se.attributes.color&&se.attributes.color.itemSize===4,pointsUvs:te.isPoints===!0&&!!se.attributes.uv&&(We||ot),fog:!!he,useFog:k.fog===!0,fogExp2:!!he&&he.isFogExp2,flatShading:k.flatShading===!0,sizeAttenuation:k.sizeAttenuation===!0,logarithmicDepthBuffer:f,reverseDepthBuffer:p,skinning:te.isSkinnedMesh===!0,morphTargets:se.morphAttributes.position!==void 0,morphNormals:se.morphAttributes.normal!==void 0,morphColors:se.morphAttributes.color!==void 0,morphTargetsCount:q,morphTextureStride:pe,numDirLights:j.directional.length,numPointLights:j.point.length,numSpotLights:j.spot.length,numSpotLightMaps:j.spotLightMap.length,numRectAreaLights:j.rectArea.length,numHemiLights:j.hemi.length,numDirLightShadows:j.directionalShadowMap.length,numPointLightShadows:j.pointShadowMap.length,numSpotLightShadows:j.spotShadowMap.length,numSpotLightShadowsWithMaps:j.numSpotLightShadowsWithMaps,numLightProbes:j.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:k.dithering,shadowMapEnabled:t.shadowMap.enabled&&H.length>0,shadowMapType:t.shadowMap.type,toneMapping:jn,decodeVideoTexture:We&&k.map.isVideoTexture===!0&&Nn.getTransfer(k.map.colorSpace)===er,premultipliedAlpha:k.premultipliedAlpha,doubleSided:k.side===xo,flipSided:k.side===os,useDepthPacking:k.depthPacking>=0,depthPacking:k.depthPacking||0,index0AttributeName:k.index0AttributeName,extensionClipCullDistance:pn&&k.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(pn&&k.extensions.multiDraw===!0||Ge)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:k.customProgramCacheKey()};return en.vertexUv1s=c.has(1),en.vertexUv2s=c.has(2),en.vertexUv3s=c.has(3),c.clear(),en}function E(k){const j=[];if(k.shaderID?j.push(k.shaderID):(j.push(k.customVertexShaderID),j.push(k.customFragmentShaderID)),k.defines!==void 0)for(const H in k.defines)j.push(H),j.push(k.defines[H]);return k.isRawShaderMaterial===!1&&(T(j,k),P(j,k),j.push(t.outputColorSpace)),j.push(k.customProgramCacheKey),j.join()}function T(k,j){k.push(j.precision),k.push(j.outputColorSpace),k.push(j.envMapMode),k.push(j.envMapCubeUVHeight),k.push(j.mapUv),k.push(j.alphaMapUv),k.push(j.lightMapUv),k.push(j.aoMapUv),k.push(j.bumpMapUv),k.push(j.normalMapUv),k.push(j.displacementMapUv),k.push(j.emissiveMapUv),k.push(j.metalnessMapUv),k.push(j.roughnessMapUv),k.push(j.anisotropyMapUv),k.push(j.clearcoatMapUv),k.push(j.clearcoatNormalMapUv),k.push(j.clearcoatRoughnessMapUv),k.push(j.iridescenceMapUv),k.push(j.iridescenceThicknessMapUv),k.push(j.sheenColorMapUv),k.push(j.sheenRoughnessMapUv),k.push(j.specularMapUv),k.push(j.specularColorMapUv),k.push(j.specularIntensityMapUv),k.push(j.transmissionMapUv),k.push(j.thicknessMapUv),k.push(j.combine),k.push(j.fogExp2),k.push(j.sizeAttenuation),k.push(j.morphTargetsCount),k.push(j.morphAttributeCount),k.push(j.numDirLights),k.push(j.numPointLights),k.push(j.numSpotLights),k.push(j.numSpotLightMaps),k.push(j.numHemiLights),k.push(j.numRectAreaLights),k.push(j.numDirLightShadows),k.push(j.numPointLightShadows),k.push(j.numSpotLightShadows),k.push(j.numSpotLightShadowsWithMaps),k.push(j.numLightProbes),k.push(j.shadowMapType),k.push(j.toneMapping),k.push(j.numClippingPlanes),k.push(j.numClipIntersection),k.push(j.depthPacking)}function P(k,j){a.disableAll(),j.supportsVertexTextures&&a.enable(0),j.instancing&&a.enable(1),j.instancingColor&&a.enable(2),j.instancingMorph&&a.enable(3),j.matcap&&a.enable(4),j.envMap&&a.enable(5),j.normalMapObjectSpace&&a.enable(6),j.normalMapTangentSpace&&a.enable(7),j.clearcoat&&a.enable(8),j.iridescence&&a.enable(9),j.alphaTest&&a.enable(10),j.vertexColors&&a.enable(11),j.vertexAlphas&&a.enable(12),j.vertexUv1s&&a.enable(13),j.vertexUv2s&&a.enable(14),j.vertexUv3s&&a.enable(15),j.vertexTangents&&a.enable(16),j.anisotropy&&a.enable(17),j.alphaHash&&a.enable(18),j.batching&&a.enable(19),j.dispersion&&a.enable(20),j.batchingColor&&a.enable(21),k.push(a.mask),a.disableAll(),j.fog&&a.enable(0),j.useFog&&a.enable(1),j.flatShading&&a.enable(2),j.logarithmicDepthBuffer&&a.enable(3),j.reverseDepthBuffer&&a.enable(4),j.skinning&&a.enable(5),j.morphTargets&&a.enable(6),j.morphNormals&&a.enable(7),j.morphColors&&a.enable(8),j.premultipliedAlpha&&a.enable(9),j.shadowMapEnabled&&a.enable(10),j.doubleSided&&a.enable(11),j.flipSided&&a.enable(12),j.useDepthPacking&&a.enable(13),j.dithering&&a.enable(14),j.transmission&&a.enable(15),j.sheen&&a.enable(16),j.opaque&&a.enable(17),j.pointsUvs&&a.enable(18),j.decodeVideoTexture&&a.enable(19),j.alphaToCoverage&&a.enable(20),k.push(a.mask)}function O(k){const j=S[k.type];let H;if(j){const ee=Da[j];H=PR.clone(ee.uniforms)}else H=k.uniforms;return H}function N(k,j){let H;for(let ee=0,te=d.length;ee<te;ee++){const he=d[ee];if(he.cacheKey===j){H=he,++H.usedTimes;break}}return H===void 0&&(H=new F0e(t,j,k,s),d.push(H)),H}function D(k){if(--k.usedTimes===0){const j=d.indexOf(k);d[j]=d[d.length-1],d.pop(),k.destroy()}}function z(k){l.remove(k)}function G(){l.dispose()}return{getParameters:_,getProgramCacheKey:E,getUniforms:O,acquireProgram:N,releaseProgram:D,releaseShaderCache:z,programs:d,dispose:G}}function G0e(){let t=new WeakMap;function e(o){return t.has(o)}function n(o){let a=t.get(o);return a===void 0&&(a={},t.set(o,a)),a}function r(o){t.delete(o)}function i(o,a,l){t.get(o)[a]=l}function s(){t=new WeakMap}return{has:e,get:n,remove:r,update:i,dispose:s}}function W0e(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 AD(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 TD(){const t=[];let e=0;const n=[],r=[],i=[];function s(){e=0,n.length=0,r.length=0,i.length=0}function o(f,p,y,x,S,w){let _=t[e];return _===void 0?(_={id:f.id,object:f,geometry:p,material:y,groupOrder:x,renderOrder:f.renderOrder,z:S,group:w},t[e]=_):(_.id=f.id,_.object=f,_.geometry=p,_.material=y,_.groupOrder=x,_.renderOrder=f.renderOrder,_.z=S,_.group=w),e++,_}function a(f,p,y,x,S,w){const _=o(f,p,y,x,S,w);y.transmission>0?r.push(_):y.transparent===!0?i.push(_):n.push(_)}function l(f,p,y,x,S,w){const _=o(f,p,y,x,S,w);y.transmission>0?r.unshift(_):y.transparent===!0?i.unshift(_):n.unshift(_)}function c(f,p){n.length>1&&n.sort(f||W0e),r.length>1&&r.sort(p||AD),i.length>1&&i.sort(p||AD)}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:a,unshift:l,finish:d,sort:c}}function $0e(){let t=new WeakMap;function e(r,i){const s=t.get(r);let o;return s===void 0?(o=new TD,t.set(r,[o])):i>=s.length?(o=new TD,s.push(o)):o=s[i],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function X0e(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new X,color:new ct};break;case"SpotLight":n={position:new X,direction:new X,color:new ct,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new X,color:new ct,distance:0,decay:0};break;case"HemisphereLight":n={direction:new X,skyColor:new ct,groundColor:new ct};break;case"RectAreaLight":n={color:new ct,position:new X,halfWidth:new X,halfHeight:new X};break}return t[e.id]=n,n}}}function q0e(){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 K0e=0;function Y0e(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function Z0e(t){const e=new X0e,n=q0e(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)r.probe.push(new X);const i=new X,s=new Ct,o=new Ct;function a(c){let d=0,f=0,p=0;for(let G=0;G<9;G++)r.probe[G].set(0,0,0);let y=0,x=0,S=0,w=0,_=0,E=0,T=0,P=0,O=0,N=0,D=0;c.sort(Y0e);for(let G=0,k=c.length;G<k;G++){const j=c[G],H=j.color,ee=j.intensity,te=j.distance,he=j.shadow&&j.shadow.map?j.shadow.map.texture:null;if(j.isAmbientLight)d+=H.r*ee,f+=H.g*ee,p+=H.b*ee;else if(j.isLightProbe){for(let se=0;se<9;se++)r.probe[se].addScaledVector(j.sh.coefficients[se],ee);D++}else if(j.isDirectionalLight){const se=e.get(j);if(se.color.copy(j.color).multiplyScalar(j.intensity),j.castShadow){const fe=j.shadow,B=n.get(j);B.shadowIntensity=fe.intensity,B.shadowBias=fe.bias,B.shadowNormalBias=fe.normalBias,B.shadowRadius=fe.radius,B.shadowMapSize=fe.mapSize,r.directionalShadow[y]=B,r.directionalShadowMap[y]=he,r.directionalShadowMatrix[y]=j.shadow.matrix,E++}r.directional[y]=se,y++}else if(j.isSpotLight){const se=e.get(j);se.position.setFromMatrixPosition(j.matrixWorld),se.color.copy(H).multiplyScalar(ee),se.distance=te,se.coneCos=Math.cos(j.angle),se.penumbraCos=Math.cos(j.angle*(1-j.penumbra)),se.decay=j.decay,r.spot[S]=se;const fe=j.shadow;if(j.map&&(r.spotLightMap[O]=j.map,O++,fe.updateMatrices(j),j.castShadow&&N++),r.spotLightMatrix[S]=fe.matrix,j.castShadow){const B=n.get(j);B.shadowIntensity=fe.intensity,B.shadowBias=fe.bias,B.shadowNormalBias=fe.normalBias,B.shadowRadius=fe.radius,B.shadowMapSize=fe.mapSize,r.spotShadow[S]=B,r.spotShadowMap[S]=he,P++}S++}else if(j.isRectAreaLight){const se=e.get(j);se.color.copy(H).multiplyScalar(ee),se.halfWidth.set(j.width*.5,0,0),se.halfHeight.set(0,j.height*.5,0),r.rectArea[w]=se,w++}else if(j.isPointLight){const se=e.get(j);if(se.color.copy(j.color).multiplyScalar(j.intensity),se.distance=j.distance,se.decay=j.decay,j.castShadow){const fe=j.shadow,B=n.get(j);B.shadowIntensity=fe.intensity,B.shadowBias=fe.bias,B.shadowNormalBias=fe.normalBias,B.shadowRadius=fe.radius,B.shadowMapSize=fe.mapSize,B.shadowCameraNear=fe.camera.near,B.shadowCameraFar=fe.camera.far,r.pointShadow[x]=B,r.pointShadowMap[x]=he,r.pointShadowMatrix[x]=j.shadow.matrix,T++}r.point[x]=se,x++}else if(j.isHemisphereLight){const se=e.get(j);se.skyColor.copy(j.color).multiplyScalar(ee),se.groundColor.copy(j.groundColor).multiplyScalar(ee),r.hemi[_]=se,_++}}w>0&&(t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=dt.LTC_FLOAT_1,r.rectAreaLTC2=dt.LTC_FLOAT_2):(r.rectAreaLTC1=dt.LTC_HALF_1,r.rectAreaLTC2=dt.LTC_HALF_2)),r.ambient[0]=d,r.ambient[1]=f,r.ambient[2]=p;const z=r.hash;(z.directionalLength!==y||z.pointLength!==x||z.spotLength!==S||z.rectAreaLength!==w||z.hemiLength!==_||z.numDirectionalShadows!==E||z.numPointShadows!==T||z.numSpotShadows!==P||z.numSpotMaps!==O||z.numLightProbes!==D)&&(r.directional.length=y,r.spot.length=S,r.rectArea.length=w,r.point.length=x,r.hemi.length=_,r.directionalShadow.length=E,r.directionalShadowMap.length=E,r.pointShadow.length=T,r.pointShadowMap.length=T,r.spotShadow.length=P,r.spotShadowMap.length=P,r.directionalShadowMatrix.length=E,r.pointShadowMatrix.length=T,r.spotLightMatrix.length=P+O-N,r.spotLightMap.length=O,r.numSpotLightShadowsWithMaps=N,r.numLightProbes=D,z.directionalLength=y,z.pointLength=x,z.spotLength=S,z.rectAreaLength=w,z.hemiLength=_,z.numDirectionalShadows=E,z.numPointShadows=T,z.numSpotShadows=P,z.numSpotMaps=O,z.numLightProbes=D,r.version=K0e++)}function l(c,d){let f=0,p=0,y=0,x=0,S=0;const w=d.matrixWorldInverse;for(let _=0,E=c.length;_<E;_++){const T=c[_];if(T.isDirectionalLight){const P=r.directional[f];P.direction.setFromMatrixPosition(T.matrixWorld),i.setFromMatrixPosition(T.target.matrixWorld),P.direction.sub(i),P.direction.transformDirection(w),f++}else if(T.isSpotLight){const P=r.spot[y];P.position.setFromMatrixPosition(T.matrixWorld),P.position.applyMatrix4(w),P.direction.setFromMatrixPosition(T.matrixWorld),i.setFromMatrixPosition(T.target.matrixWorld),P.direction.sub(i),P.direction.transformDirection(w),y++}else if(T.isRectAreaLight){const P=r.rectArea[x];P.position.setFromMatrixPosition(T.matrixWorld),P.position.applyMatrix4(w),o.identity(),s.copy(T.matrixWorld),s.premultiply(w),o.extractRotation(s),P.halfWidth.set(T.width*.5,0,0),P.halfHeight.set(0,T.height*.5,0),P.halfWidth.applyMatrix4(o),P.halfHeight.applyMatrix4(o),x++}else if(T.isPointLight){const P=r.point[p];P.position.setFromMatrixPosition(T.matrixWorld),P.position.applyMatrix4(w),p++}else if(T.isHemisphereLight){const P=r.hemi[S];P.direction.setFromMatrixPosition(T.matrixWorld),P.direction.transformDirection(w),S++}}}return{setup:a,setupView:l,state:r}}function PD(t){const e=new Z0e(t),n=[],r=[];function i(d){c.camera=d,n.length=0,r.length=0}function s(d){n.push(d)}function o(d){r.push(d)}function a(){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:a,setupLightsView:l,pushLight:s,pushShadow:o}}function Q0e(t){let e=new WeakMap;function n(i,s=0){const o=e.get(i);let a;return o===void 0?(a=new PD(t),e.set(i,[a])):s>=o.length?(a=new PD(t),o.push(a)):a=o[s],a}function r(){e=new WeakMap}return{get:n,dispose:r}}class NR extends Gr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=KV,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class IR extends Gr{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const J0e=`void main() {
|
||
gl_Position = vec4( position, 1.0 );
|
||
}`,eye=`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 tye(t,e,n){let r=new fx;const i=new He,s=new He,o=new On,a=new NR({depthPacking:YV}),l=new IR,c={},d=n.maxTextureSize,f={[Ll]:os,[os]:Ll,[xo]:xo},p=new Zo({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new He},radius:{value:4}},vertexShader:J0e,fragmentShader:eye}),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=zS;let _=this.type;this.render=function(N,D,z){if(w.enabled===!1||w.autoUpdate===!1&&w.needsUpdate===!1||N.length===0)return;const G=t.getRenderTarget(),k=t.getActiveCubeFace(),j=t.getActiveMipmapLevel(),H=t.state;H.setBlending(Vc),H.buffers.color.setClear(1,1,1,1),H.buffers.depth.setTest(!0),H.setScissorTest(!1);const ee=_!==Oa&&this.type===Oa,te=_===Oa&&this.type!==Oa;for(let he=0,se=N.length;he<se;he++){const fe=N[he],B=fe.shadow;if(B===void 0){console.warn("THREE.WebGLShadowMap:",fe,"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||ee===!0||te===!0){const V=this.type!==Oa?{minFilter:ri,magFilter:ri}:{};B.map!==null&&B.map.dispose(),B.map=new Va(i.x,i.y,V),B.map.texture.name=fe.name+".shadowMap",B.camera.updateProjectionMatrix()}t.setRenderTarget(B.map),t.clear();const Y=B.getViewportCount();for(let V=0;V<Y;V++){const q=B.getViewport(V);o.set(s.x*q.x,s.y*q.y,s.x*q.z,s.y*q.w),H.viewport(o),B.updateMatrices(fe,V),r=B.getFrustum(),P(D,z,B.camera,fe,this.type)}B.isPointLightShadow!==!0&&this.type===Oa&&E(B,z),B.needsUpdate=!1}_=this.type,w.needsUpdate=!1,t.setRenderTarget(G,k,j)};function E(N,D){const z=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 Va(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,z,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,z,y,S,null)}function T(N,D,z,G){let k=null;const j=z.isPointLight===!0?N.customDistanceMaterial:N.customDepthMaterial;if(j!==void 0)k=j;else if(k=z.isPointLight===!0?l:a,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 H=k.uuid,ee=D.uuid;let te=c[H];te===void 0&&(te={},c[H]=te);let he=te[ee];he===void 0&&(he=k.clone(),te[ee]=he,D.addEventListener("dispose",O)),k=he}if(k.visible=D.visible,k.wireframe=D.wireframe,G===Oa?k.side=D.shadowSide!==null?D.shadowSide:D.side:k.side=D.shadowSide!==null?D.shadowSide:f[D.side],k.alphaMap=D.alphaMap,k.alphaTest=D.alphaTest,k.map=D.map,k.clipShadows=D.clipShadows,k.clippingPlanes=D.clippingPlanes,k.clipIntersection=D.clipIntersection,k.displacementMap=D.displacementMap,k.displacementScale=D.displacementScale,k.displacementBias=D.displacementBias,k.wireframeLinewidth=D.wireframeLinewidth,k.linewidth=D.linewidth,z.isPointLight===!0&&k.isMeshDistanceMaterial===!0){const H=t.properties.get(k);H.light=z}return k}function P(N,D,z,G,k){if(N.visible===!1)return;if(N.layers.test(D.layers)&&(N.isMesh||N.isLine||N.isPoints)&&(N.castShadow||N.receiveShadow&&k===Oa)&&(!N.frustumCulled||r.intersectsObject(N))){N.modelViewMatrix.multiplyMatrices(z.matrixWorldInverse,N.matrixWorld);const ee=e.update(N),te=N.material;if(Array.isArray(te)){const he=ee.groups;for(let se=0,fe=he.length;se<fe;se++){const B=he[se],J=te[B.materialIndex];if(J&&J.visible){const Y=T(N,J,G,k);N.onBeforeShadow(t,N,D,z,ee,Y,B),t.renderBufferDirect(z,null,ee,Y,N,B),N.onAfterShadow(t,N,D,z,ee,Y,B)}}}else if(te.visible){const he=T(N,te,G,k);N.onBeforeShadow(t,N,D,z,ee,he,null),t.renderBufferDirect(z,null,ee,he,N,null),N.onAfterShadow(t,N,D,z,ee,he,null)}}const H=N.children;for(let ee=0,te=H.length;ee<te;ee++)P(H[ee],D,z,G,k)}function O(N){N.target.removeEventListener("dispose",O);for(const z in c){const G=c[z],k=N.target.uuid;k in G&&(G[k].dispose(),delete G[k])}}}const nye={[Jw]:e1,[t1]:i1,[n1]:s1,[Fh]:r1,[e1]:Jw,[i1]:t1,[s1]:n1,[r1]:Fh};function rye(t){function e(){let le=!1;const Ye=new On;let Re=null;const Be=new On(0,0,0,0);return{setMask:function(ot){Re!==ot&&!le&&(t.colorMask(ot,ot,ot,ot),Re=ot)},setLocked:function(ot){le=ot},setClear:function(ot,pt,Jt,pn,jn){jn===!0&&(ot*=pn,pt*=pn,Jt*=pn),Ye.set(ot,pt,Jt,pn),Be.equals(Ye)===!1&&(t.clearColor(ot,pt,Jt,pn),Be.copy(Ye))},reset:function(){le=!1,Re=null,Be.set(-1,0,0,0)}}}function n(){let le=!1,Ye=!1,Re=null,Be=null,ot=null;return{setReversed:function(pt){Ye=pt},setTest:function(pt){pt?Se(t.DEPTH_TEST):Ee(t.DEPTH_TEST)},setMask:function(pt){Re!==pt&&!le&&(t.depthMask(pt),Re=pt)},setFunc:function(pt){if(Ye&&(pt=nye[pt]),Be!==pt){switch(pt){case Jw:t.depthFunc(t.NEVER);break;case e1:t.depthFunc(t.ALWAYS);break;case t1:t.depthFunc(t.LESS);break;case Fh:t.depthFunc(t.LEQUAL);break;case n1:t.depthFunc(t.EQUAL);break;case r1:t.depthFunc(t.GEQUAL);break;case i1:t.depthFunc(t.GREATER);break;case s1:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}Be=pt}},setLocked:function(pt){le=pt},setClear:function(pt){ot!==pt&&(t.clearDepth(pt),ot=pt)},reset:function(){le=!1,Re=null,Be=null,ot=null}}}function r(){let le=!1,Ye=null,Re=null,Be=null,ot=null,pt=null,Jt=null,pn=null,jn=null;return{setTest:function(en){le||(en?Se(t.STENCIL_TEST):Ee(t.STENCIL_TEST))},setMask:function(en){Ye!==en&&!le&&(t.stencilMask(en),Ye=en)},setFunc:function(en,Hn,pr){(Re!==en||Be!==Hn||ot!==pr)&&(t.stencilFunc(en,Hn,pr),Re=en,Be=Hn,ot=pr)},setOp:function(en,Hn,pr){(pt!==en||Jt!==Hn||pn!==pr)&&(t.stencilOp(en,Hn,pr),pt=en,Jt=Hn,pn=pr)},setLocked:function(en){le=en},setClear:function(en){jn!==en&&(t.clearStencil(en),jn=en)},reset:function(){le=!1,Ye=null,Re=null,Be=null,ot=null,pt=null,Jt=null,pn=null,jn=null}}}const i=new e,s=new n,o=new r,a=new WeakMap,l=new WeakMap;let c={},d={},f=new WeakMap,p=[],y=null,x=!1,S=null,w=null,_=null,E=null,T=null,P=null,O=null,N=new ct(0,0,0),D=0,z=!1,G=null,k=null,j=null,H=null,ee=null;const te=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let he=!1,se=0;const fe=t.getParameter(t.VERSION);fe.indexOf("WebGL")!==-1?(se=parseFloat(/^WebGL (\d)/.exec(fe)[1]),he=se>=1):fe.indexOf("OpenGL ES")!==-1&&(se=parseFloat(/^OpenGL ES (\d)/.exec(fe)[1]),he=se>=2);let B=null,J={};const Y=t.getParameter(t.SCISSOR_BOX),V=t.getParameter(t.VIEWPORT),q=new On().fromArray(Y),pe=new On().fromArray(V);function ae(le,Ye,Re,Be){const ot=new Uint8Array(4),pt=t.createTexture();t.bindTexture(le,pt),t.texParameteri(le,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(le,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Jt=0;Jt<Re;Jt++)le===t.TEXTURE_3D||le===t.TEXTURE_2D_ARRAY?t.texImage3D(Ye,0,t.RGBA,1,1,Be,0,t.RGBA,t.UNSIGNED_BYTE,ot):t.texImage2D(Ye+Jt,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,ot);return pt}const ce={};ce[t.TEXTURE_2D]=ae(t.TEXTURE_2D,t.TEXTURE_2D,1),ce[t.TEXTURE_CUBE_MAP]=ae(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),ce[t.TEXTURE_2D_ARRAY]=ae(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),ce[t.TEXTURE_3D]=ae(t.TEXTURE_3D,t.TEXTURE_3D,1,1),i.setClear(0,0,0,1),s.setClear(1),o.setClear(0),Se(t.DEPTH_TEST),s.setFunc(Fh),Le(!1),re(BP),Se(t.CULL_FACE),Z(Vc);function Se(le){c[le]!==!0&&(t.enable(le),c[le]=!0)}function Ee(le){c[le]!==!1&&(t.disable(le),c[le]=!1)}function $e(le,Ye){return d[le]!==Ye?(t.bindFramebuffer(le,Ye),d[le]=Ye,le===t.DRAW_FRAMEBUFFER&&(d[t.FRAMEBUFFER]=Ye),le===t.FRAMEBUFFER&&(d[t.DRAW_FRAMEBUFFER]=Ye),!0):!1}function Me(le,Ye){let Re=p,Be=!1;if(le){Re=f.get(Ye),Re===void 0&&(Re=[],f.set(Ye,Re));const ot=le.textures;if(Re.length!==ot.length||Re[0]!==t.COLOR_ATTACHMENT0){for(let pt=0,Jt=ot.length;pt<Jt;pt++)Re[pt]=t.COLOR_ATTACHMENT0+pt;Re.length=ot.length,Be=!0}}else Re[0]!==t.BACK&&(Re[0]=t.BACK,Be=!0);Be&&t.drawBuffers(Re)}function Ge(le){return y!==le?(t.useProgram(le),y=le,!0):!1}const We={[ld]:t.FUNC_ADD,[xV]:t.FUNC_SUBTRACT,[bV]:t.FUNC_REVERSE_SUBTRACT};We[_V]=t.MIN,We[wV]=t.MAX;const ue={[SV]:t.ZERO,[MV]:t.ONE,[EV]:t.SRC_COLOR,[Zw]:t.SRC_ALPHA,[NV]:t.SRC_ALPHA_SATURATE,[CV]:t.DST_COLOR,[TV]:t.DST_ALPHA,[AV]:t.ONE_MINUS_SRC_COLOR,[Qw]:t.ONE_MINUS_SRC_ALPHA,[RV]:t.ONE_MINUS_DST_COLOR,[PV]:t.ONE_MINUS_DST_ALPHA,[IV]:t.CONSTANT_COLOR,[kV]:t.ONE_MINUS_CONSTANT_COLOR,[OV]:t.CONSTANT_ALPHA,[LV]:t.ONE_MINUS_CONSTANT_ALPHA};function Z(le,Ye,Re,Be,ot,pt,Jt,pn,jn,en){if(le===Vc){x===!0&&(Ee(t.BLEND),x=!1);return}if(x===!1&&(Se(t.BLEND),x=!0),le!==yV){if(le!==S||en!==z){if((w!==ld||T!==ld)&&(t.blendEquation(t.FUNC_ADD),w=ld,T=ld),en)switch(le){case Eh:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case HP:t.blendFunc(t.ONE,t.ONE);break;case VP:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case GP:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",le);break}else switch(le){case Eh:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case HP:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case VP:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case GP:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",le);break}_=null,E=null,P=null,O=null,N.set(0,0,0),D=0,S=le,z=en}return}ot=ot||Ye,pt=pt||Re,Jt=Jt||Be,(Ye!==w||ot!==T)&&(t.blendEquationSeparate(We[Ye],We[ot]),w=Ye,T=ot),(Re!==_||Be!==E||pt!==P||Jt!==O)&&(t.blendFuncSeparate(ue[Re],ue[Be],ue[pt],ue[Jt]),_=Re,E=Be,P=pt,O=Jt),(pn.equals(N)===!1||jn!==D)&&(t.blendColor(pn.r,pn.g,pn.b,jn),N.copy(pn),D=jn),S=le,z=!1}function Ve(le,Ye){le.side===xo?Ee(t.CULL_FACE):Se(t.CULL_FACE);let Re=le.side===os;Ye&&(Re=!Re),Le(Re),le.blending===Eh&&le.transparent===!1?Z(Vc):Z(le.blending,le.blendEquation,le.blendSrc,le.blendDst,le.blendEquationAlpha,le.blendSrcAlpha,le.blendDstAlpha,le.blendColor,le.blendAlpha,le.premultipliedAlpha),s.setFunc(le.depthFunc),s.setTest(le.depthTest),s.setMask(le.depthWrite),i.setMask(le.colorWrite);const Be=le.stencilWrite;o.setTest(Be),Be&&(o.setMask(le.stencilWriteMask),o.setFunc(le.stencilFunc,le.stencilRef,le.stencilFuncMask),o.setOp(le.stencilFail,le.stencilZFail,le.stencilZPass)),qe(le.polygonOffset,le.polygonOffsetFactor,le.polygonOffsetUnits),le.alphaToCoverage===!0?Se(t.SAMPLE_ALPHA_TO_COVERAGE):Ee(t.SAMPLE_ALPHA_TO_COVERAGE)}function Le(le){G!==le&&(le?t.frontFace(t.CW):t.frontFace(t.CCW),G=le)}function re(le){le!==mV?(Se(t.CULL_FACE),le!==k&&(le===BP?t.cullFace(t.BACK):le===gV?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):Ee(t.CULL_FACE),k=le}function Ce(le){le!==j&&(he&&t.lineWidth(le),j=le)}function qe(le,Ye,Re){le?(Se(t.POLYGON_OFFSET_FILL),(H!==Ye||ee!==Re)&&(t.polygonOffset(Ye,Re),H=Ye,ee=Re)):Ee(t.POLYGON_OFFSET_FILL)}function Ze(le){le?Se(t.SCISSOR_TEST):Ee(t.SCISSOR_TEST)}function Q(le){le===void 0&&(le=t.TEXTURE0+te-1),B!==le&&(t.activeTexture(le),B=le)}function W(le,Ye,Re){Re===void 0&&(B===null?Re=t.TEXTURE0+te-1:Re=B);let Be=J[Re];Be===void 0&&(Be={type:void 0,texture:void 0},J[Re]=Be),(Be.type!==le||Be.texture!==Ye)&&(B!==Re&&(t.activeTexture(Re),B=Re),t.bindTexture(le,Ye||ce[le]),Be.type=le,Be.texture=Ye)}function be(){const le=J[B];le!==void 0&&le.type!==void 0&&(t.bindTexture(le.type,null),le.type=void 0,le.texture=void 0)}function Ue(){try{t.compressedTexImage2D.apply(t,arguments)}catch(le){console.error("THREE.WebGLState:",le)}}function ze(){try{t.compressedTexImage3D.apply(t,arguments)}catch(le){console.error("THREE.WebGLState:",le)}}function Fe(){try{t.texSubImage2D.apply(t,arguments)}catch(le){console.error("THREE.WebGLState:",le)}}function bt(){try{t.texSubImage3D.apply(t,arguments)}catch(le){console.error("THREE.WebGLState:",le)}}function rt(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(le){console.error("THREE.WebGLState:",le)}}function ft(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(le){console.error("THREE.WebGLState:",le)}}function Xt(){try{t.texStorage2D.apply(t,arguments)}catch(le){console.error("THREE.WebGLState:",le)}}function Ke(){try{t.texStorage3D.apply(t,arguments)}catch(le){console.error("THREE.WebGLState:",le)}}function ne(){try{t.texImage2D.apply(t,arguments)}catch(le){console.error("THREE.WebGLState:",le)}}function et(){try{t.texImage3D.apply(t,arguments)}catch(le){console.error("THREE.WebGLState:",le)}}function Mt(le){q.equals(le)===!1&&(t.scissor(le.x,le.y,le.z,le.w),q.copy(le))}function vt(le){pe.equals(le)===!1&&(t.viewport(le.x,le.y,le.z,le.w),pe.copy(le))}function Zt(le,Ye){let Re=l.get(Ye);Re===void 0&&(Re=new WeakMap,l.set(Ye,Re));let Be=Re.get(le);Be===void 0&&(Be=t.getUniformBlockIndex(Ye,le.name),Re.set(le,Be))}function de(le,Ye){const Be=l.get(Ye).get(le);a.get(Ye)!==Be&&(t.uniformBlockBinding(Ye,Be,le.__bindingPointIndex),a.set(Ye,Be))}function Xe(){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,_=null,E=null,T=null,P=null,O=null,N=new ct(0,0,0),D=0,z=!1,G=null,k=null,j=null,H=null,ee=null,q.set(0,0,t.canvas.width,t.canvas.height),pe.set(0,0,t.canvas.width,t.canvas.height),i.reset(),s.reset(),o.reset()}return{buffers:{color:i,depth:s,stencil:o},enable:Se,disable:Ee,bindFramebuffer:$e,drawBuffers:Me,useProgram:Ge,setBlending:Z,setMaterial:Ve,setFlipSided:Le,setCullFace:re,setLineWidth:Ce,setPolygonOffset:qe,setScissorTest:Ze,activeTexture:Q,bindTexture:W,unbindTexture:be,compressedTexImage2D:Ue,compressedTexImage3D:ze,texImage2D:ne,texImage3D:et,updateUBOMapping:Zt,uniformBlockBinding:de,texStorage2D:Xt,texStorage3D:Ke,texSubImage2D:Fe,texSubImage3D:bt,compressedTexSubImage2D:rt,compressedTexSubImage3D:ft,scissor:Mt,viewport:vt,reset:Xe}}function iye(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 sye(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 oye(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}function YP(t,e,n,r){const i=aye(r);switch(n){case mR:return t*e;case vR:return t*e;case yR:return t*e*2;case $S:return t*e/i.components*i.byteLength;case lx:return t*e/i.components*i.byteLength;case xR:return t*e*2/i.components*i.byteLength;case XS:return t*e*2/i.components*i.byteLength;case gR:return t*e*3/i.components*i.byteLength;case ss:return t*e*4/i.components*i.byteLength;case qS:return t*e*4/i.components*i.byteLength;case Y0:case Z0:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Q0:case J0:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case a1:case c1:return Math.max(t,16)*Math.max(e,8)/4;case o1:case l1:return Math.max(t,8)*Math.max(e,8)/2;case u1:case d1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case f1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case h1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case p1:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case m1:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case g1:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case v1:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case y1:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case x1:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case b1:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case _1:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case w1:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case S1:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case M1:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case E1:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case A1:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case ey:case T1:case P1:return Math.ceil(t/4)*Math.ceil(e/4)*16;case bR:case C1:return Math.ceil(t/4)*Math.ceil(e/4)*8;case R1:case N1:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function aye(t){switch(t){case Ha:case fR:return{byteLength:1,components:1};case kg:case hR:case rv:return{byteLength:2,components:1};case GS:case WS:return{byteLength:2,components:4};case Qc:case VS:case Qs:return{byteLength:4,components:1};case pR:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}const lye={contain:iye,cover:sye,fill:oye,getByteLength:YP};function cye(t,e,n,r,i,s,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new He,d=new WeakMap;let f;const p=new WeakMap;let y=!1;try{y=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(Q,W){return y?new OffscreenCanvas(Q,W):ky("canvas")}function S(Q,W,be){let Ue=1;const ze=Ze(Q);if((ze.width>be||ze.height>be)&&(Ue=be/Math.max(ze.width,ze.height)),Ue<1)if(typeof HTMLImageElement<"u"&&Q instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&Q instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&Q instanceof ImageBitmap||typeof VideoFrame<"u"&&Q instanceof VideoFrame){const Fe=Math.floor(Ue*ze.width),bt=Math.floor(Ue*ze.height);f===void 0&&(f=x(Fe,bt));const rt=W?x(Fe,bt):f;return rt.width=Fe,rt.height=bt,rt.getContext("2d").drawImage(Q,0,0,Fe,bt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+ze.width+"x"+ze.height+") to ("+Fe+"x"+bt+")."),rt}else return"data"in Q&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+ze.width+"x"+ze.height+")."),Q;return Q}function w(Q){return Q.generateMipmaps&&Q.minFilter!==ri&&Q.minFilter!==Cr}function _(Q){t.generateMipmap(Q)}function E(Q,W,be,Ue,ze=!1){if(Q!==null){if(t[Q]!==void 0)return t[Q];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+Q+"'")}let Fe=W;if(W===t.RED&&(be===t.FLOAT&&(Fe=t.R32F),be===t.HALF_FLOAT&&(Fe=t.R16F),be===t.UNSIGNED_BYTE&&(Fe=t.R8)),W===t.RED_INTEGER&&(be===t.UNSIGNED_BYTE&&(Fe=t.R8UI),be===t.UNSIGNED_SHORT&&(Fe=t.R16UI),be===t.UNSIGNED_INT&&(Fe=t.R32UI),be===t.BYTE&&(Fe=t.R8I),be===t.SHORT&&(Fe=t.R16I),be===t.INT&&(Fe=t.R32I)),W===t.RG&&(be===t.FLOAT&&(Fe=t.RG32F),be===t.HALF_FLOAT&&(Fe=t.RG16F),be===t.UNSIGNED_BYTE&&(Fe=t.RG8)),W===t.RG_INTEGER&&(be===t.UNSIGNED_BYTE&&(Fe=t.RG8UI),be===t.UNSIGNED_SHORT&&(Fe=t.RG16UI),be===t.UNSIGNED_INT&&(Fe=t.RG32UI),be===t.BYTE&&(Fe=t.RG8I),be===t.SHORT&&(Fe=t.RG16I),be===t.INT&&(Fe=t.RG32I)),W===t.RGB_INTEGER&&(be===t.UNSIGNED_BYTE&&(Fe=t.RGB8UI),be===t.UNSIGNED_SHORT&&(Fe=t.RGB16UI),be===t.UNSIGNED_INT&&(Fe=t.RGB32UI),be===t.BYTE&&(Fe=t.RGB8I),be===t.SHORT&&(Fe=t.RGB16I),be===t.INT&&(Fe=t.RGB32I)),W===t.RGBA_INTEGER&&(be===t.UNSIGNED_BYTE&&(Fe=t.RGBA8UI),be===t.UNSIGNED_SHORT&&(Fe=t.RGBA16UI),be===t.UNSIGNED_INT&&(Fe=t.RGBA32UI),be===t.BYTE&&(Fe=t.RGBA8I),be===t.SHORT&&(Fe=t.RGBA16I),be===t.INT&&(Fe=t.RGBA32I)),W===t.RGB&&be===t.UNSIGNED_INT_5_9_9_9_REV&&(Fe=t.RGB9_E5),W===t.RGBA){const bt=ze?Py:Nn.getTransfer(Ue);be===t.FLOAT&&(Fe=t.RGBA32F),be===t.HALF_FLOAT&&(Fe=t.RGBA16F),be===t.UNSIGNED_BYTE&&(Fe=bt===er?t.SRGB8_ALPHA8:t.RGBA8),be===t.UNSIGNED_SHORT_4_4_4_4&&(Fe=t.RGBA4),be===t.UNSIGNED_SHORT_5_5_5_1&&(Fe=t.RGB5_A1)}return(Fe===t.R16F||Fe===t.R32F||Fe===t.RG16F||Fe===t.RG32F||Fe===t.RGBA16F||Fe===t.RGBA32F)&&e.get("EXT_color_buffer_float"),Fe}function T(Q,W){let be;return Q?W===null||W===Qc||W===zh?be=t.DEPTH24_STENCIL8:W===Qs?be=t.DEPTH32F_STENCIL8:W===kg&&(be=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):W===null||W===Qc||W===zh?be=t.DEPTH_COMPONENT24:W===Qs?be=t.DEPTH_COMPONENT32F:W===kg&&(be=t.DEPTH_COMPONENT16),be}function P(Q,W){return w(Q)===!0||Q.isFramebufferTexture&&Q.minFilter!==ri&&Q.minFilter!==Cr?Math.log2(Math.max(W.width,W.height))+1:Q.mipmaps!==void 0&&Q.mipmaps.length>0?Q.mipmaps.length:Q.isCompressedTexture&&Array.isArray(Q.image)?W.mipmaps.length:1}function O(Q){const W=Q.target;W.removeEventListener("dispose",O),D(W),W.isVideoTexture&&d.delete(W)}function N(Q){const W=Q.target;W.removeEventListener("dispose",N),G(W)}function D(Q){const W=r.get(Q);if(W.__webglInit===void 0)return;const be=Q.source,Ue=p.get(be);if(Ue){const ze=Ue[W.__cacheKey];ze.usedTimes--,ze.usedTimes===0&&z(Q),Object.keys(Ue).length===0&&p.delete(be)}r.remove(Q)}function z(Q){const W=r.get(Q);t.deleteTexture(W.__webglTexture);const be=Q.source,Ue=p.get(be);delete Ue[W.__cacheKey],o.memory.textures--}function G(Q){const W=r.get(Q);if(Q.depthTexture&&Q.depthTexture.dispose(),Q.isWebGLCubeRenderTarget)for(let Ue=0;Ue<6;Ue++){if(Array.isArray(W.__webglFramebuffer[Ue]))for(let ze=0;ze<W.__webglFramebuffer[Ue].length;ze++)t.deleteFramebuffer(W.__webglFramebuffer[Ue][ze]);else t.deleteFramebuffer(W.__webglFramebuffer[Ue]);W.__webglDepthbuffer&&t.deleteRenderbuffer(W.__webglDepthbuffer[Ue])}else{if(Array.isArray(W.__webglFramebuffer))for(let Ue=0;Ue<W.__webglFramebuffer.length;Ue++)t.deleteFramebuffer(W.__webglFramebuffer[Ue]);else t.deleteFramebuffer(W.__webglFramebuffer);if(W.__webglDepthbuffer&&t.deleteRenderbuffer(W.__webglDepthbuffer),W.__webglMultisampledFramebuffer&&t.deleteFramebuffer(W.__webglMultisampledFramebuffer),W.__webglColorRenderbuffer)for(let Ue=0;Ue<W.__webglColorRenderbuffer.length;Ue++)W.__webglColorRenderbuffer[Ue]&&t.deleteRenderbuffer(W.__webglColorRenderbuffer[Ue]);W.__webglDepthRenderbuffer&&t.deleteRenderbuffer(W.__webglDepthRenderbuffer)}const be=Q.textures;for(let Ue=0,ze=be.length;Ue<ze;Ue++){const Fe=r.get(be[Ue]);Fe.__webglTexture&&(t.deleteTexture(Fe.__webglTexture),o.memory.textures--),r.remove(be[Ue])}r.remove(Q)}let k=0;function j(){k=0}function H(){const Q=k;return Q>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+Q+" texture units while this GPU supports only "+i.maxTextures),k+=1,Q}function ee(Q){const W=[];return W.push(Q.wrapS),W.push(Q.wrapT),W.push(Q.wrapR||0),W.push(Q.magFilter),W.push(Q.minFilter),W.push(Q.anisotropy),W.push(Q.internalFormat),W.push(Q.format),W.push(Q.type),W.push(Q.generateMipmaps),W.push(Q.premultiplyAlpha),W.push(Q.flipY),W.push(Q.unpackAlignment),W.push(Q.colorSpace),W.join()}function te(Q,W){const be=r.get(Q);if(Q.isVideoTexture&&Ce(Q),Q.isRenderTargetTexture===!1&&Q.version>0&&be.__version!==Q.version){const Ue=Q.image;if(Ue===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Ue.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{pe(be,Q,W);return}}n.bindTexture(t.TEXTURE_2D,be.__webglTexture,t.TEXTURE0+W)}function he(Q,W){const be=r.get(Q);if(Q.version>0&&be.__version!==Q.version){pe(be,Q,W);return}n.bindTexture(t.TEXTURE_2D_ARRAY,be.__webglTexture,t.TEXTURE0+W)}function se(Q,W){const be=r.get(Q);if(Q.version>0&&be.__version!==Q.version){pe(be,Q,W);return}n.bindTexture(t.TEXTURE_3D,be.__webglTexture,t.TEXTURE0+W)}function fe(Q,W){const be=r.get(Q);if(Q.version>0&&be.__version!==Q.version){ae(be,Q,W);return}n.bindTexture(t.TEXTURE_CUBE_MAP,be.__webglTexture,t.TEXTURE0+W)}const B={[Cd]:t.REPEAT,[_o]:t.CLAMP_TO_EDGE,[Ig]:t.MIRRORED_REPEAT},J={[ri]:t.NEAREST,[HS]:t.NEAREST_MIPMAP_NEAREST,[oh]:t.NEAREST_MIPMAP_LINEAR,[Cr]:t.LINEAR,[ng]:t.LINEAR_MIPMAP_NEAREST,[$o]:t.LINEAR_MIPMAP_LINEAR},Y={[QV]:t.NEVER,[i6]:t.ALWAYS,[JV]:t.LESS,[SR]:t.LEQUAL,[e6]:t.EQUAL,[r6]:t.GEQUAL,[t6]:t.GREATER,[n6]:t.NOTEQUAL};function V(Q,W){if(W.type===Qs&&e.has("OES_texture_float_linear")===!1&&(W.magFilter===Cr||W.magFilter===ng||W.magFilter===oh||W.magFilter===$o||W.minFilter===Cr||W.minFilter===ng||W.minFilter===oh||W.minFilter===$o)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(Q,t.TEXTURE_WRAP_S,B[W.wrapS]),t.texParameteri(Q,t.TEXTURE_WRAP_T,B[W.wrapT]),(Q===t.TEXTURE_3D||Q===t.TEXTURE_2D_ARRAY)&&t.texParameteri(Q,t.TEXTURE_WRAP_R,B[W.wrapR]),t.texParameteri(Q,t.TEXTURE_MAG_FILTER,J[W.magFilter]),t.texParameteri(Q,t.TEXTURE_MIN_FILTER,J[W.minFilter]),W.compareFunction&&(t.texParameteri(Q,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(Q,t.TEXTURE_COMPARE_FUNC,Y[W.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(W.magFilter===ri||W.minFilter!==oh&&W.minFilter!==$o||W.type===Qs&&e.has("OES_texture_float_linear")===!1)return;if(W.anisotropy>1||r.get(W).__currentAnisotropy){const be=e.get("EXT_texture_filter_anisotropic");t.texParameterf(Q,be.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(W.anisotropy,i.getMaxAnisotropy())),r.get(W).__currentAnisotropy=W.anisotropy}}}function q(Q,W){let be=!1;Q.__webglInit===void 0&&(Q.__webglInit=!0,W.addEventListener("dispose",O));const Ue=W.source;let ze=p.get(Ue);ze===void 0&&(ze={},p.set(Ue,ze));const Fe=ee(W);if(Fe!==Q.__cacheKey){ze[Fe]===void 0&&(ze[Fe]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,be=!0),ze[Fe].usedTimes++;const bt=ze[Q.__cacheKey];bt!==void 0&&(ze[Q.__cacheKey].usedTimes--,bt.usedTimes===0&&z(W)),Q.__cacheKey=Fe,Q.__webglTexture=ze[Fe].texture}return be}function pe(Q,W,be){let Ue=t.TEXTURE_2D;(W.isDataArrayTexture||W.isCompressedArrayTexture)&&(Ue=t.TEXTURE_2D_ARRAY),W.isData3DTexture&&(Ue=t.TEXTURE_3D);const ze=q(Q,W),Fe=W.source;n.bindTexture(Ue,Q.__webglTexture,t.TEXTURE0+be);const bt=r.get(Fe);if(Fe.version!==bt.__version||ze===!0){n.activeTexture(t.TEXTURE0+be);const rt=Nn.getPrimaries(Nn.workingColorSpace),ft=W.colorSpace===Oc?null:Nn.getPrimaries(W.colorSpace),Xt=W.colorSpace===Oc||rt===ft?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,W.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,W.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,W.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Xt);let Ke=S(W.image,!1,i.maxTextureSize);Ke=qe(W,Ke);const ne=s.convert(W.format,W.colorSpace),et=s.convert(W.type);let Mt=E(W.internalFormat,ne,et,W.colorSpace,W.isVideoTexture);V(Ue,W);let vt;const Zt=W.mipmaps,de=W.isVideoTexture!==!0,Xe=bt.__version===void 0||ze===!0,le=Fe.dataReady,Ye=P(W,Ke);if(W.isDepthTexture)Mt=T(W.format===Bh,W.type),Xe&&(de?n.texStorage2D(t.TEXTURE_2D,1,Mt,Ke.width,Ke.height):n.texImage2D(t.TEXTURE_2D,0,Mt,Ke.width,Ke.height,0,ne,et,null));else if(W.isDataTexture)if(Zt.length>0){de&&Xe&&n.texStorage2D(t.TEXTURE_2D,Ye,Mt,Zt[0].width,Zt[0].height);for(let Re=0,Be=Zt.length;Re<Be;Re++)vt=Zt[Re],de?le&&n.texSubImage2D(t.TEXTURE_2D,Re,0,0,vt.width,vt.height,ne,et,vt.data):n.texImage2D(t.TEXTURE_2D,Re,Mt,vt.width,vt.height,0,ne,et,vt.data);W.generateMipmaps=!1}else de?(Xe&&n.texStorage2D(t.TEXTURE_2D,Ye,Mt,Ke.width,Ke.height),le&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,Ke.width,Ke.height,ne,et,Ke.data)):n.texImage2D(t.TEXTURE_2D,0,Mt,Ke.width,Ke.height,0,ne,et,Ke.data);else if(W.isCompressedTexture)if(W.isCompressedArrayTexture){de&&Xe&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Ye,Mt,Zt[0].width,Zt[0].height,Ke.depth);for(let Re=0,Be=Zt.length;Re<Be;Re++)if(vt=Zt[Re],W.format!==ss)if(ne!==null)if(de){if(le)if(W.layerUpdates.size>0){const ot=YP(vt.width,vt.height,W.format,W.type);for(const pt of W.layerUpdates){const Jt=vt.data.subarray(pt*ot/vt.data.BYTES_PER_ELEMENT,(pt+1)*ot/vt.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Re,0,0,pt,vt.width,vt.height,1,ne,Jt,0,0)}W.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Re,0,0,0,vt.width,vt.height,Ke.depth,ne,vt.data,0,0)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,Re,Mt,vt.width,vt.height,Ke.depth,0,vt.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else de?le&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,Re,0,0,0,vt.width,vt.height,Ke.depth,ne,et,vt.data):n.texImage3D(t.TEXTURE_2D_ARRAY,Re,Mt,vt.width,vt.height,Ke.depth,0,ne,et,vt.data)}else{de&&Xe&&n.texStorage2D(t.TEXTURE_2D,Ye,Mt,Zt[0].width,Zt[0].height);for(let Re=0,Be=Zt.length;Re<Be;Re++)vt=Zt[Re],W.format!==ss?ne!==null?de?le&&n.compressedTexSubImage2D(t.TEXTURE_2D,Re,0,0,vt.width,vt.height,ne,vt.data):n.compressedTexImage2D(t.TEXTURE_2D,Re,Mt,vt.width,vt.height,0,vt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):de?le&&n.texSubImage2D(t.TEXTURE_2D,Re,0,0,vt.width,vt.height,ne,et,vt.data):n.texImage2D(t.TEXTURE_2D,Re,Mt,vt.width,vt.height,0,ne,et,vt.data)}else if(W.isDataArrayTexture)if(de){if(Xe&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Ye,Mt,Ke.width,Ke.height,Ke.depth),le)if(W.layerUpdates.size>0){const Re=YP(Ke.width,Ke.height,W.format,W.type);for(const Be of W.layerUpdates){const ot=Ke.data.subarray(Be*Re/Ke.data.BYTES_PER_ELEMENT,(Be+1)*Re/Ke.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,Be,Ke.width,Ke.height,1,ne,et,ot)}W.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,Ke.width,Ke.height,Ke.depth,ne,et,Ke.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,Mt,Ke.width,Ke.height,Ke.depth,0,ne,et,Ke.data);else if(W.isData3DTexture)de?(Xe&&n.texStorage3D(t.TEXTURE_3D,Ye,Mt,Ke.width,Ke.height,Ke.depth),le&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,Ke.width,Ke.height,Ke.depth,ne,et,Ke.data)):n.texImage3D(t.TEXTURE_3D,0,Mt,Ke.width,Ke.height,Ke.depth,0,ne,et,Ke.data);else if(W.isFramebufferTexture){if(Xe)if(de)n.texStorage2D(t.TEXTURE_2D,Ye,Mt,Ke.width,Ke.height);else{let Re=Ke.width,Be=Ke.height;for(let ot=0;ot<Ye;ot++)n.texImage2D(t.TEXTURE_2D,ot,Mt,Re,Be,0,ne,et,null),Re>>=1,Be>>=1}}else if(Zt.length>0){if(de&&Xe){const Re=Ze(Zt[0]);n.texStorage2D(t.TEXTURE_2D,Ye,Mt,Re.width,Re.height)}for(let Re=0,Be=Zt.length;Re<Be;Re++)vt=Zt[Re],de?le&&n.texSubImage2D(t.TEXTURE_2D,Re,0,0,ne,et,vt):n.texImage2D(t.TEXTURE_2D,Re,Mt,ne,et,vt);W.generateMipmaps=!1}else if(de){if(Xe){const Re=Ze(Ke);n.texStorage2D(t.TEXTURE_2D,Ye,Mt,Re.width,Re.height)}le&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,ne,et,Ke)}else n.texImage2D(t.TEXTURE_2D,0,Mt,ne,et,Ke);w(W)&&_(Ue),bt.__version=Fe.version,W.onUpdate&&W.onUpdate(W)}Q.__version=W.version}function ae(Q,W,be){if(W.image.length!==6)return;const Ue=q(Q,W),ze=W.source;n.bindTexture(t.TEXTURE_CUBE_MAP,Q.__webglTexture,t.TEXTURE0+be);const Fe=r.get(ze);if(ze.version!==Fe.__version||Ue===!0){n.activeTexture(t.TEXTURE0+be);const bt=Nn.getPrimaries(Nn.workingColorSpace),rt=W.colorSpace===Oc?null:Nn.getPrimaries(W.colorSpace),ft=W.colorSpace===Oc||bt===rt?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,W.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,W.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,W.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,ft);const Xt=W.isCompressedTexture||W.image[0].isCompressedTexture,Ke=W.image[0]&&W.image[0].isDataTexture,ne=[];for(let Be=0;Be<6;Be++)!Xt&&!Ke?ne[Be]=S(W.image[Be],!0,i.maxCubemapSize):ne[Be]=Ke?W.image[Be].image:W.image[Be],ne[Be]=qe(W,ne[Be]);const et=ne[0],Mt=s.convert(W.format,W.colorSpace),vt=s.convert(W.type),Zt=E(W.internalFormat,Mt,vt,W.colorSpace),de=W.isVideoTexture!==!0,Xe=Fe.__version===void 0||Ue===!0,le=ze.dataReady;let Ye=P(W,et);V(t.TEXTURE_CUBE_MAP,W);let Re;if(Xt){de&&Xe&&n.texStorage2D(t.TEXTURE_CUBE_MAP,Ye,Zt,et.width,et.height);for(let Be=0;Be<6;Be++){Re=ne[Be].mipmaps;for(let ot=0;ot<Re.length;ot++){const pt=Re[ot];W.format!==ss?Mt!==null?de?le&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Be,ot,0,0,pt.width,pt.height,Mt,pt.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Be,ot,Zt,pt.width,pt.height,0,pt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):de?le&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Be,ot,0,0,pt.width,pt.height,Mt,vt,pt.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Be,ot,Zt,pt.width,pt.height,0,Mt,vt,pt.data)}}}else{if(Re=W.mipmaps,de&&Xe){Re.length>0&&Ye++;const Be=Ze(ne[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,Ye,Zt,Be.width,Be.height)}for(let Be=0;Be<6;Be++)if(Ke){de?le&&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 ot=0;ot<Re.length;ot++){const Jt=Re[ot].image[Be].image;de?le&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Be,ot+1,0,0,Jt.width,Jt.height,Mt,vt,Jt.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Be,ot+1,Zt,Jt.width,Jt.height,0,Mt,vt,Jt.data)}}else{de?le&&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 ot=0;ot<Re.length;ot++){const pt=Re[ot];de?le&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Be,ot+1,0,0,Mt,vt,pt.image[Be]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Be,ot+1,Zt,Mt,vt,pt.image[Be])}}}w(W)&&_(t.TEXTURE_CUBE_MAP),Fe.__version=ze.version,W.onUpdate&&W.onUpdate(W)}Q.__version=W.version}function ce(Q,W,be,Ue,ze,Fe){const bt=s.convert(be.format,be.colorSpace),rt=s.convert(be.type),ft=E(be.internalFormat,bt,rt,be.colorSpace);if(!r.get(W).__hasExternalTextures){const Ke=Math.max(1,W.width>>Fe),ne=Math.max(1,W.height>>Fe);ze===t.TEXTURE_3D||ze===t.TEXTURE_2D_ARRAY?n.texImage3D(ze,Fe,ft,Ke,ne,W.depth,0,bt,rt,null):n.texImage2D(ze,Fe,ft,Ke,ne,0,bt,rt,null)}n.bindFramebuffer(t.FRAMEBUFFER,Q),re(W)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,Ue,ze,r.get(be).__webglTexture,0,Le(W)):(ze===t.TEXTURE_2D||ze>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&ze<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,Ue,ze,r.get(be).__webglTexture,Fe),n.bindFramebuffer(t.FRAMEBUFFER,null)}function Se(Q,W,be){if(t.bindRenderbuffer(t.RENDERBUFFER,Q),W.depthBuffer){const Ue=W.depthTexture,ze=Ue&&Ue.isDepthTexture?Ue.type:null,Fe=T(W.stencilBuffer,ze),bt=W.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,rt=Le(W);re(W)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,rt,Fe,W.width,W.height):be?t.renderbufferStorageMultisample(t.RENDERBUFFER,rt,Fe,W.width,W.height):t.renderbufferStorage(t.RENDERBUFFER,Fe,W.width,W.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,bt,t.RENDERBUFFER,Q)}else{const Ue=W.textures;for(let ze=0;ze<Ue.length;ze++){const Fe=Ue[ze],bt=s.convert(Fe.format,Fe.colorSpace),rt=s.convert(Fe.type),ft=E(Fe.internalFormat,bt,rt,Fe.colorSpace),Xt=Le(W);be&&re(W)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,Xt,ft,W.width,W.height):re(W)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,Xt,ft,W.width,W.height):t.renderbufferStorage(t.RENDERBUFFER,ft,W.width,W.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function Ee(Q,W){if(W&&W.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,Q),!(W.depthTexture&&W.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!r.get(W.depthTexture).__webglTexture||W.depthTexture.image.width!==W.width||W.depthTexture.image.height!==W.height)&&(W.depthTexture.image.width=W.width,W.depthTexture.image.height=W.height,W.depthTexture.needsUpdate=!0),te(W.depthTexture,0);const Ue=r.get(W.depthTexture).__webglTexture,ze=Le(W);if(W.depthTexture.format===Ah)re(W)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,Ue,0,ze):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,Ue,0);else if(W.depthTexture.format===Bh)re(W)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,Ue,0,ze):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,Ue,0);else throw new Error("Unknown depthTexture format")}function $e(Q){const W=r.get(Q),be=Q.isWebGLCubeRenderTarget===!0;if(W.__boundDepthTexture!==Q.depthTexture){const Ue=Q.depthTexture;if(W.__depthDisposeCallback&&W.__depthDisposeCallback(),Ue){const ze=()=>{delete W.__boundDepthTexture,delete W.__depthDisposeCallback,Ue.removeEventListener("dispose",ze)};Ue.addEventListener("dispose",ze),W.__depthDisposeCallback=ze}W.__boundDepthTexture=Ue}if(Q.depthTexture&&!W.__autoAllocateDepthBuffer){if(be)throw new Error("target.depthTexture not supported in Cube render targets");Ee(W.__webglFramebuffer,Q)}else if(be){W.__webglDepthbuffer=[];for(let Ue=0;Ue<6;Ue++)if(n.bindFramebuffer(t.FRAMEBUFFER,W.__webglFramebuffer[Ue]),W.__webglDepthbuffer[Ue]===void 0)W.__webglDepthbuffer[Ue]=t.createRenderbuffer(),Se(W.__webglDepthbuffer[Ue],Q,!1);else{const ze=Q.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Fe=W.__webglDepthbuffer[Ue];t.bindRenderbuffer(t.RENDERBUFFER,Fe),t.framebufferRenderbuffer(t.FRAMEBUFFER,ze,t.RENDERBUFFER,Fe)}}else if(n.bindFramebuffer(t.FRAMEBUFFER,W.__webglFramebuffer),W.__webglDepthbuffer===void 0)W.__webglDepthbuffer=t.createRenderbuffer(),Se(W.__webglDepthbuffer,Q,!1);else{const Ue=Q.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ze=W.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,ze),t.framebufferRenderbuffer(t.FRAMEBUFFER,Ue,t.RENDERBUFFER,ze)}n.bindFramebuffer(t.FRAMEBUFFER,null)}function Me(Q,W,be){const Ue=r.get(Q);W!==void 0&&ce(Ue.__webglFramebuffer,Q,Q.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),be!==void 0&&$e(Q)}function Ge(Q){const W=Q.texture,be=r.get(Q),Ue=r.get(W);Q.addEventListener("dispose",N);const ze=Q.textures,Fe=Q.isWebGLCubeRenderTarget===!0,bt=ze.length>1;if(bt||(Ue.__webglTexture===void 0&&(Ue.__webglTexture=t.createTexture()),Ue.__version=W.version,o.memory.textures++),Fe){be.__webglFramebuffer=[];for(let rt=0;rt<6;rt++)if(W.mipmaps&&W.mipmaps.length>0){be.__webglFramebuffer[rt]=[];for(let ft=0;ft<W.mipmaps.length;ft++)be.__webglFramebuffer[rt][ft]=t.createFramebuffer()}else be.__webglFramebuffer[rt]=t.createFramebuffer()}else{if(W.mipmaps&&W.mipmaps.length>0){be.__webglFramebuffer=[];for(let rt=0;rt<W.mipmaps.length;rt++)be.__webglFramebuffer[rt]=t.createFramebuffer()}else be.__webglFramebuffer=t.createFramebuffer();if(bt)for(let rt=0,ft=ze.length;rt<ft;rt++){const Xt=r.get(ze[rt]);Xt.__webglTexture===void 0&&(Xt.__webglTexture=t.createTexture(),o.memory.textures++)}if(Q.samples>0&&re(Q)===!1){be.__webglMultisampledFramebuffer=t.createFramebuffer(),be.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,be.__webglMultisampledFramebuffer);for(let rt=0;rt<ze.length;rt++){const ft=ze[rt];be.__webglColorRenderbuffer[rt]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,be.__webglColorRenderbuffer[rt]);const Xt=s.convert(ft.format,ft.colorSpace),Ke=s.convert(ft.type),ne=E(ft.internalFormat,Xt,Ke,ft.colorSpace,Q.isXRRenderTarget===!0),et=Le(Q);t.renderbufferStorageMultisample(t.RENDERBUFFER,et,ne,Q.width,Q.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+rt,t.RENDERBUFFER,be.__webglColorRenderbuffer[rt])}t.bindRenderbuffer(t.RENDERBUFFER,null),Q.depthBuffer&&(be.__webglDepthRenderbuffer=t.createRenderbuffer(),Se(be.__webglDepthRenderbuffer,Q,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(Fe){n.bindTexture(t.TEXTURE_CUBE_MAP,Ue.__webglTexture),V(t.TEXTURE_CUBE_MAP,W);for(let rt=0;rt<6;rt++)if(W.mipmaps&&W.mipmaps.length>0)for(let ft=0;ft<W.mipmaps.length;ft++)ce(be.__webglFramebuffer[rt][ft],Q,W,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+rt,ft);else ce(be.__webglFramebuffer[rt],Q,W,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+rt,0);w(W)&&_(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(bt){for(let rt=0,ft=ze.length;rt<ft;rt++){const Xt=ze[rt],Ke=r.get(Xt);n.bindTexture(t.TEXTURE_2D,Ke.__webglTexture),V(t.TEXTURE_2D,Xt),ce(be.__webglFramebuffer,Q,Xt,t.COLOR_ATTACHMENT0+rt,t.TEXTURE_2D,0),w(Xt)&&_(t.TEXTURE_2D)}n.unbindTexture()}else{let rt=t.TEXTURE_2D;if((Q.isWebGL3DRenderTarget||Q.isWebGLArrayRenderTarget)&&(rt=Q.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(rt,Ue.__webglTexture),V(rt,W),W.mipmaps&&W.mipmaps.length>0)for(let ft=0;ft<W.mipmaps.length;ft++)ce(be.__webglFramebuffer[ft],Q,W,t.COLOR_ATTACHMENT0,rt,ft);else ce(be.__webglFramebuffer,Q,W,t.COLOR_ATTACHMENT0,rt,0);w(W)&&_(rt),n.unbindTexture()}Q.depthBuffer&&$e(Q)}function We(Q){const W=Q.textures;for(let be=0,Ue=W.length;be<Ue;be++){const ze=W[be];if(w(ze)){const Fe=Q.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,bt=r.get(ze).__webglTexture;n.bindTexture(Fe,bt),_(Fe),n.unbindTexture()}}}const ue=[],Z=[];function Ve(Q){if(Q.samples>0){if(re(Q)===!1){const W=Q.textures,be=Q.width,Ue=Q.height;let ze=t.COLOR_BUFFER_BIT;const Fe=Q.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,bt=r.get(Q),rt=W.length>1;if(rt)for(let ft=0;ft<W.length;ft++)n.bindFramebuffer(t.FRAMEBUFFER,bt.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+ft,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,bt.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+ft,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,bt.__webglMultisampledFramebuffer),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,bt.__webglFramebuffer);for(let ft=0;ft<W.length;ft++){if(Q.resolveDepthBuffer&&(Q.depthBuffer&&(ze|=t.DEPTH_BUFFER_BIT),Q.stencilBuffer&&Q.resolveStencilBuffer&&(ze|=t.STENCIL_BUFFER_BIT)),rt){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,bt.__webglColorRenderbuffer[ft]);const Xt=r.get(W[ft]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,Xt,0)}t.blitFramebuffer(0,0,be,Ue,0,0,be,Ue,ze,t.NEAREST),l===!0&&(ue.length=0,Z.length=0,ue.push(t.COLOR_ATTACHMENT0+ft),Q.depthBuffer&&Q.resolveDepthBuffer===!1&&(ue.push(Fe),Z.push(Fe),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,Z)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,ue))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),rt)for(let ft=0;ft<W.length;ft++){n.bindFramebuffer(t.FRAMEBUFFER,bt.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+ft,t.RENDERBUFFER,bt.__webglColorRenderbuffer[ft]);const Xt=r.get(W[ft]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,bt.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+ft,t.TEXTURE_2D,Xt,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,bt.__webglMultisampledFramebuffer)}else if(Q.depthBuffer&&Q.resolveDepthBuffer===!1&&l){const W=Q.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[W])}}}function Le(Q){return Math.min(i.maxSamples,Q.samples)}function re(Q){const W=r.get(Q);return Q.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&W.__useRenderToTexture!==!1}function Ce(Q){const W=o.render.frame;d.get(Q)!==W&&(d.set(Q,W),Q.update())}function qe(Q,W){const be=Q.colorSpace,Ue=Q.format,ze=Q.type;return Q.isCompressedTexture===!0||Q.isVideoTexture===!0||be!==xi&&be!==Oc&&(Nn.getTransfer(be)===er?(Ue!==ss||ze!==Ha)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",be)),W}function Ze(Q){return typeof HTMLImageElement<"u"&&Q instanceof HTMLImageElement?(c.width=Q.naturalWidth||Q.width,c.height=Q.naturalHeight||Q.height):typeof VideoFrame<"u"&&Q instanceof VideoFrame?(c.width=Q.displayWidth,c.height=Q.displayHeight):(c.width=Q.width,c.height=Q.height),c}this.allocateTextureUnit=H,this.resetTextureUnits=j,this.setTexture2D=te,this.setTexture2DArray=he,this.setTexture3D=se,this.setTextureCube=fe,this.rebindTextures=Me,this.setupRenderTarget=Ge,this.updateRenderTargetMipmap=We,this.updateMultisampleRenderTarget=Ve,this.setupDepthRenderbuffer=$e,this.setupFrameBufferTexture=ce,this.useMultisampledRTT=re}function x6(t,e){function n(r,i=Oc){let s;const o=Nn.getTransfer(i);if(r===Ha)return t.UNSIGNED_BYTE;if(r===GS)return t.UNSIGNED_SHORT_4_4_4_4;if(r===WS)return t.UNSIGNED_SHORT_5_5_5_1;if(r===pR)return t.UNSIGNED_INT_5_9_9_9_REV;if(r===fR)return t.BYTE;if(r===hR)return t.SHORT;if(r===kg)return t.UNSIGNED_SHORT;if(r===VS)return t.INT;if(r===Qc)return t.UNSIGNED_INT;if(r===Qs)return t.FLOAT;if(r===rv)return t.HALF_FLOAT;if(r===mR)return t.ALPHA;if(r===gR)return t.RGB;if(r===ss)return t.RGBA;if(r===vR)return t.LUMINANCE;if(r===yR)return t.LUMINANCE_ALPHA;if(r===Ah)return t.DEPTH_COMPONENT;if(r===Bh)return t.DEPTH_STENCIL;if(r===$S)return t.RED;if(r===lx)return t.RED_INTEGER;if(r===xR)return t.RG;if(r===XS)return t.RG_INTEGER;if(r===qS)return t.RGBA_INTEGER;if(r===Y0||r===Z0||r===Q0||r===J0)if(o===er)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===Y0)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===Z0)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===Q0)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===J0)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===Y0)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===Z0)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===Q0)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===J0)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===o1||r===a1||r===l1||r===c1)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===o1)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===a1)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===l1)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===c1)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===u1||r===d1||r===f1)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===u1||r===d1)return o===er?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===f1)return o===er?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===h1||r===p1||r===m1||r===g1||r===v1||r===y1||r===x1||r===b1||r===_1||r===w1||r===S1||r===M1||r===E1||r===A1)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===h1)return o===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===p1)return o===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===m1)return o===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===g1)return o===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===v1)return o===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===y1)return o===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===x1)return o===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===b1)return o===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===_1)return o===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===w1)return o===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===S1)return o===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===M1)return o===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===E1)return o===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===A1)return o===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===ey||r===T1||r===P1)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===ey)return o===er?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===T1)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===P1)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===bR||r===C1||r===R1||r===N1)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===ey)return s.COMPRESSED_RED_RGTC1_EXT;if(r===C1)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===R1)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===N1)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===zh?t.UNSIGNED_INT_24_8:t[r]!==void 0?t[r]:null}return{convert:n}}class b6 extends Pr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Ts extends mn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const uye={type:"move"};class _A{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ts,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Ts,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new X,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new X),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ts,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new X,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new X),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const r of e.hand.values())this._getHandJoint(n,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,r){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const S of e.hand.values()){const w=n.getJointPose(S,r),_=this._getHandJoint(c,S);w!==null&&(_.matrix.fromArray(w.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),_.matrixWorldNeedsUpdate=!0,_.jointRadius=w.radius),_.visible=w!==null}const d=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],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));a!==null&&(i=n.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(uye)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const r=new Ts;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}}const dye=`
|
||
void main() {
|
||
|
||
gl_Position = vec4( position, 1.0 );
|
||
|
||
}`,fye=`
|
||
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 hye{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 Zo({vertexShader:dye,fragmentShader:fye,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new xr(new iv(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class pye extends zl{constructor(e,n){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,d=null,f=null,p=null,y=null,x=null;const S=new hye,w=n.getContextAttributes();let _=null,E=null;const T=[],P=[],O=new He;let N=null;const D=new Pr;D.layers.enable(1),D.viewport=new On;const z=new Pr;z.layers.enable(2),z.viewport=new On;const G=[D,z],k=new b6;k.layers.enable(1),k.layers.enable(2);let j=null,H=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ae){let ce=T[ae];return ce===void 0&&(ce=new _A,T[ae]=ce),ce.getTargetRaySpace()},this.getControllerGrip=function(ae){let ce=T[ae];return ce===void 0&&(ce=new _A,T[ae]=ce),ce.getGripSpace()},this.getHand=function(ae){let ce=T[ae];return ce===void 0&&(ce=new _A,T[ae]=ce),ce.getHandSpace()};function ee(ae){const ce=P.indexOf(ae.inputSource);if(ce===-1)return;const Se=T[ce];Se!==void 0&&(Se.update(ae.inputSource,ae.frame,c||o),Se.dispatchEvent({type:ae.type,data:ae.inputSource}))}function te(){i.removeEventListener("select",ee),i.removeEventListener("selectstart",ee),i.removeEventListener("selectend",ee),i.removeEventListener("squeeze",ee),i.removeEventListener("squeezestart",ee),i.removeEventListener("squeezeend",ee),i.removeEventListener("end",te),i.removeEventListener("inputsourceschange",he);for(let ae=0;ae<T.length;ae++){const ce=P[ae];ce!==null&&(P[ae]=null,T[ae].disconnect(ce))}j=null,H=null,S.reset(),e.setRenderTarget(_),y=null,p=null,f=null,i=null,E=null,pe.stop(),r.isPresenting=!1,e.setPixelRatio(N),e.setSize(O.width,O.height,!1),r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ae){s=ae,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ae){a=ae,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(ae){c=ae},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(ae){if(i=ae,i!==null){if(_=e.getRenderTarget(),i.addEventListener("select",ee),i.addEventListener("selectstart",ee),i.addEventListener("selectend",ee),i.addEventListener("squeeze",ee),i.addEventListener("squeezestart",ee),i.addEventListener("squeezeend",ee),i.addEventListener("end",te),i.addEventListener("inputsourceschange",he),w.xrCompatible!==!0&&await n.makeXRCompatible(),N=e.getPixelRatio(),e.getSize(O),i.renderState.layers===void 0){const ce={antialias:w.antialias,alpha:!0,depth:w.depth,stencil:w.stencil,framebufferScaleFactor:s};y=new XRWebGLLayer(i,n,ce),i.updateRenderState({baseLayer:y}),e.setPixelRatio(1),e.setSize(y.framebufferWidth,y.framebufferHeight,!1),E=new Va(y.framebufferWidth,y.framebufferHeight,{format:ss,type:Ha,colorSpace:e.outputColorSpace,stencilBuffer:w.stencil})}else{let ce=null,Se=null,Ee=null;w.depth&&(Ee=w.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,ce=w.stencil?Bh:Ah,Se=w.stencil?zh:Qc);const $e={colorFormat:n.RGBA8,depthFormat:Ee,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),E=new Va(p.textureWidth,p.textureHeight,{format:ss,type:Ha,depthTexture:new RR(p.textureWidth,p.textureHeight,Se,void 0,void 0,void 0,void 0,void 0,void 0,ce),stencilBuffer:w.stencil,colorSpace:e.outputColorSpace,samples:w.antialias?4:0,resolveDepthBuffer:p.ignoreDepthValues===!1})}E.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await i.requestReferenceSpace(a),pe.setContext(i),pe.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return S.getDepthTexture()};function he(ae){for(let ce=0;ce<ae.removed.length;ce++){const Se=ae.removed[ce],Ee=P.indexOf(Se);Ee>=0&&(P[Ee]=null,T[Ee].disconnect(Se))}for(let ce=0;ce<ae.added.length;ce++){const Se=ae.added[ce];let Ee=P.indexOf(Se);if(Ee===-1){for(let Me=0;Me<T.length;Me++)if(Me>=P.length){P.push(Se),Ee=Me;break}else if(P[Me]===null){P[Me]=Se,Ee=Me;break}if(Ee===-1)break}const $e=T[Ee];$e&&$e.connect(Se)}}const se=new X,fe=new X;function B(ae,ce,Se){se.setFromMatrixPosition(ce.matrixWorld),fe.setFromMatrixPosition(Se.matrixWorld);const Ee=se.distanceTo(fe),$e=ce.projectionMatrix.elements,Me=Se.projectionMatrix.elements,Ge=$e[14]/($e[10]-1),We=$e[14]/($e[10]+1),ue=($e[9]+1)/$e[5],Z=($e[9]-1)/$e[5],Ve=($e[8]-1)/$e[0],Le=(Me[8]+1)/Me[0],re=Ge*Ve,Ce=Ge*Le,qe=Ee/(-Ve+Le),Ze=qe*-Ve;if(ce.matrixWorld.decompose(ae.position,ae.quaternion,ae.scale),ae.translateX(Ze),ae.translateZ(qe),ae.matrixWorld.compose(ae.position,ae.quaternion,ae.scale),ae.matrixWorldInverse.copy(ae.matrixWorld).invert(),$e[10]===-1)ae.projectionMatrix.copy(ce.projectionMatrix),ae.projectionMatrixInverse.copy(ce.projectionMatrixInverse);else{const Q=Ge+qe,W=We+qe,be=re-Ze,Ue=Ce+(Ee-Ze),ze=ue*We/W*Q,Fe=Z*We/W*Q;ae.projectionMatrix.makePerspective(be,Ue,ze,Fe,Q,W),ae.projectionMatrixInverse.copy(ae.projectionMatrix).invert()}}function J(ae,ce){ce===null?ae.matrixWorld.copy(ae.matrix):ae.matrixWorld.multiplyMatrices(ce.matrixWorld,ae.matrix),ae.matrixWorldInverse.copy(ae.matrixWorld).invert()}this.updateCamera=function(ae){if(i===null)return;let ce=ae.near,Se=ae.far;S.texture!==null&&(S.depthNear>0&&(ce=S.depthNear),S.depthFar>0&&(Se=S.depthFar)),k.near=z.near=D.near=ce,k.far=z.far=D.far=Se,(j!==k.near||H!==k.far)&&(i.updateRenderState({depthNear:k.near,depthFar:k.far}),j=k.near,H=k.far);const Ee=ae.parent,$e=k.cameras;J(k,Ee);for(let Me=0;Me<$e.length;Me++)J($e[Me],Ee);$e.length===2?B(k,D,z):k.projectionMatrix.copy(D.projectionMatrix),Y(ae,k,Ee)};function Y(ae,ce,Se){Se===null?ae.matrix.copy(ce.matrixWorld):(ae.matrix.copy(Se.matrixWorld),ae.matrix.invert(),ae.matrix.multiply(ce.matrixWorld)),ae.matrix.decompose(ae.position,ae.quaternion,ae.scale),ae.updateMatrixWorld(!0),ae.projectionMatrix.copy(ce.projectionMatrix),ae.projectionMatrixInverse.copy(ce.projectionMatrixInverse),ae.isPerspectiveCamera&&(ae.fov=Dg*2*Math.atan(1/ae.projectionMatrix.elements[5]),ae.zoom=1)}this.getCamera=function(){return k},this.getFoveation=function(){if(!(p===null&&y===null))return l},this.setFoveation=function(ae){l=ae,p!==null&&(p.fixedFoveation=ae),y!==null&&y.fixedFoveation!==void 0&&(y.fixedFoveation=ae)},this.hasDepthSensing=function(){return S.texture!==null},this.getDepthSensingMesh=function(){return S.getMesh(k)};let V=null;function q(ae,ce){if(d=ce.getViewerPose(c||o),x=ce,d!==null){const Se=d.views;y!==null&&(e.setRenderTargetFramebuffer(E,y.framebuffer),e.setRenderTarget(E));let Ee=!1;Se.length!==k.cameras.length&&(k.cameras.length=0,Ee=!0);for(let Me=0;Me<Se.length;Me++){const Ge=Se[Me];let We=null;if(y!==null)We=y.getViewport(Ge);else{const Z=f.getViewSubImage(p,Ge);We=Z.viewport,Me===0&&(e.setRenderTargetTextures(E,Z.colorTexture,p.ignoreDepthValues?void 0:Z.depthStencilTexture),e.setRenderTarget(E))}let ue=G[Me];ue===void 0&&(ue=new Pr,ue.layers.enable(Me),ue.viewport=new On,G[Me]=ue),ue.matrix.fromArray(Ge.transform.matrix),ue.matrix.decompose(ue.position,ue.quaternion,ue.scale),ue.projectionMatrix.fromArray(Ge.projectionMatrix),ue.projectionMatrixInverse.copy(ue.projectionMatrix).invert(),ue.viewport.set(We.x,We.y,We.width,We.height),Me===0&&(k.matrix.copy(ue.matrix),k.matrix.decompose(k.position,k.quaternion,k.scale)),Ee===!0&&k.cameras.push(ue)}const $e=i.enabledFeatures;if($e&&$e.includes("depth-sensing")){const Me=f.getDepthInformation(Se[0]);Me&&Me.isValid&&Me.texture&&S.init(e,Me,i.renderState)}}for(let Se=0;Se<T.length;Se++){const Ee=P[Se],$e=T[Se];Ee!==null&&$e!==void 0&&$e.update(Ee,ce,c||o)}V&&V(ae,ce),ce.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:ce}),x=null}const pe=new p6;pe.setAnimationLoop(q),this.setAnimationLoop=function(ae){V=ae},this.dispose=function(){}}}const kf=new ls,mye=new Ct;function gye(t,e){function n(w,_){w.matrixAutoUpdate===!0&&w.updateMatrix(),_.value.copy(w.matrix)}function r(w,_){_.color.getRGB(w.fogColor.value,d6(t)),_.isFog?(w.fogNear.value=_.near,w.fogFar.value=_.far):_.isFogExp2&&(w.fogDensity.value=_.density)}function i(w,_,E,T,P){_.isMeshBasicMaterial||_.isMeshLambertMaterial?s(w,_):_.isMeshToonMaterial?(s(w,_),f(w,_)):_.isMeshPhongMaterial?(s(w,_),d(w,_)):_.isMeshStandardMaterial?(s(w,_),p(w,_),_.isMeshPhysicalMaterial&&y(w,_,P)):_.isMeshMatcapMaterial?(s(w,_),x(w,_)):_.isMeshDepthMaterial?s(w,_):_.isMeshDistanceMaterial?(s(w,_),S(w,_)):_.isMeshNormalMaterial?s(w,_):_.isLineBasicMaterial?(o(w,_),_.isLineDashedMaterial&&a(w,_)):_.isPointsMaterial?l(w,_,E,T):_.isSpriteMaterial?c(w,_):_.isShadowMaterial?(w.color.value.copy(_.color),w.opacity.value=_.opacity):_.isShaderMaterial&&(_.uniformsNeedUpdate=!1)}function s(w,_){w.opacity.value=_.opacity,_.color&&w.diffuse.value.copy(_.color),_.emissive&&w.emissive.value.copy(_.emissive).multiplyScalar(_.emissiveIntensity),_.map&&(w.map.value=_.map,n(_.map,w.mapTransform)),_.alphaMap&&(w.alphaMap.value=_.alphaMap,n(_.alphaMap,w.alphaMapTransform)),_.bumpMap&&(w.bumpMap.value=_.bumpMap,n(_.bumpMap,w.bumpMapTransform),w.bumpScale.value=_.bumpScale,_.side===os&&(w.bumpScale.value*=-1)),_.normalMap&&(w.normalMap.value=_.normalMap,n(_.normalMap,w.normalMapTransform),w.normalScale.value.copy(_.normalScale),_.side===os&&w.normalScale.value.negate()),_.displacementMap&&(w.displacementMap.value=_.displacementMap,n(_.displacementMap,w.displacementMapTransform),w.displacementScale.value=_.displacementScale,w.displacementBias.value=_.displacementBias),_.emissiveMap&&(w.emissiveMap.value=_.emissiveMap,n(_.emissiveMap,w.emissiveMapTransform)),_.specularMap&&(w.specularMap.value=_.specularMap,n(_.specularMap,w.specularMapTransform)),_.alphaTest>0&&(w.alphaTest.value=_.alphaTest);const E=e.get(_),T=E.envMap,P=E.envMapRotation;T&&(w.envMap.value=T,kf.copy(P),kf.x*=-1,kf.y*=-1,kf.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(kf.y*=-1,kf.z*=-1),w.envMapRotation.value.setFromMatrix4(mye.makeRotationFromEuler(kf)),w.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,w.reflectivity.value=_.reflectivity,w.ior.value=_.ior,w.refractionRatio.value=_.refractionRatio),_.lightMap&&(w.lightMap.value=_.lightMap,w.lightMapIntensity.value=_.lightMapIntensity,n(_.lightMap,w.lightMapTransform)),_.aoMap&&(w.aoMap.value=_.aoMap,w.aoMapIntensity.value=_.aoMapIntensity,n(_.aoMap,w.aoMapTransform))}function o(w,_){w.diffuse.value.copy(_.color),w.opacity.value=_.opacity,_.map&&(w.map.value=_.map,n(_.map,w.mapTransform))}function a(w,_){w.dashSize.value=_.dashSize,w.totalSize.value=_.dashSize+_.gapSize,w.scale.value=_.scale}function l(w,_,E,T){w.diffuse.value.copy(_.color),w.opacity.value=_.opacity,w.size.value=_.size*E,w.scale.value=T*.5,_.map&&(w.map.value=_.map,n(_.map,w.uvTransform)),_.alphaMap&&(w.alphaMap.value=_.alphaMap,n(_.alphaMap,w.alphaMapTransform)),_.alphaTest>0&&(w.alphaTest.value=_.alphaTest)}function c(w,_){w.diffuse.value.copy(_.color),w.opacity.value=_.opacity,w.rotation.value=_.rotation,_.map&&(w.map.value=_.map,n(_.map,w.mapTransform)),_.alphaMap&&(w.alphaMap.value=_.alphaMap,n(_.alphaMap,w.alphaMapTransform)),_.alphaTest>0&&(w.alphaTest.value=_.alphaTest)}function d(w,_){w.specular.value.copy(_.specular),w.shininess.value=Math.max(_.shininess,1e-4)}function f(w,_){_.gradientMap&&(w.gradientMap.value=_.gradientMap)}function p(w,_){w.metalness.value=_.metalness,_.metalnessMap&&(w.metalnessMap.value=_.metalnessMap,n(_.metalnessMap,w.metalnessMapTransform)),w.roughness.value=_.roughness,_.roughnessMap&&(w.roughnessMap.value=_.roughnessMap,n(_.roughnessMap,w.roughnessMapTransform)),_.envMap&&(w.envMapIntensity.value=_.envMapIntensity)}function y(w,_,E){w.ior.value=_.ior,_.sheen>0&&(w.sheenColor.value.copy(_.sheenColor).multiplyScalar(_.sheen),w.sheenRoughness.value=_.sheenRoughness,_.sheenColorMap&&(w.sheenColorMap.value=_.sheenColorMap,n(_.sheenColorMap,w.sheenColorMapTransform)),_.sheenRoughnessMap&&(w.sheenRoughnessMap.value=_.sheenRoughnessMap,n(_.sheenRoughnessMap,w.sheenRoughnessMapTransform))),_.clearcoat>0&&(w.clearcoat.value=_.clearcoat,w.clearcoatRoughness.value=_.clearcoatRoughness,_.clearcoatMap&&(w.clearcoatMap.value=_.clearcoatMap,n(_.clearcoatMap,w.clearcoatMapTransform)),_.clearcoatRoughnessMap&&(w.clearcoatRoughnessMap.value=_.clearcoatRoughnessMap,n(_.clearcoatRoughnessMap,w.clearcoatRoughnessMapTransform)),_.clearcoatNormalMap&&(w.clearcoatNormalMap.value=_.clearcoatNormalMap,n(_.clearcoatNormalMap,w.clearcoatNormalMapTransform),w.clearcoatNormalScale.value.copy(_.clearcoatNormalScale),_.side===os&&w.clearcoatNormalScale.value.negate())),_.dispersion>0&&(w.dispersion.value=_.dispersion),_.iridescence>0&&(w.iridescence.value=_.iridescence,w.iridescenceIOR.value=_.iridescenceIOR,w.iridescenceThicknessMinimum.value=_.iridescenceThicknessRange[0],w.iridescenceThicknessMaximum.value=_.iridescenceThicknessRange[1],_.iridescenceMap&&(w.iridescenceMap.value=_.iridescenceMap,n(_.iridescenceMap,w.iridescenceMapTransform)),_.iridescenceThicknessMap&&(w.iridescenceThicknessMap.value=_.iridescenceThicknessMap,n(_.iridescenceThicknessMap,w.iridescenceThicknessMapTransform))),_.transmission>0&&(w.transmission.value=_.transmission,w.transmissionSamplerMap.value=E.texture,w.transmissionSamplerSize.value.set(E.width,E.height),_.transmissionMap&&(w.transmissionMap.value=_.transmissionMap,n(_.transmissionMap,w.transmissionMapTransform)),w.thickness.value=_.thickness,_.thicknessMap&&(w.thicknessMap.value=_.thicknessMap,n(_.thicknessMap,w.thicknessMapTransform)),w.attenuationDistance.value=_.attenuationDistance,w.attenuationColor.value.copy(_.attenuationColor)),_.anisotropy>0&&(w.anisotropyVector.value.set(_.anisotropy*Math.cos(_.anisotropyRotation),_.anisotropy*Math.sin(_.anisotropyRotation)),_.anisotropyMap&&(w.anisotropyMap.value=_.anisotropyMap,n(_.anisotropyMap,w.anisotropyMapTransform))),w.specularIntensity.value=_.specularIntensity,w.specularColor.value.copy(_.specularColor),_.specularColorMap&&(w.specularColorMap.value=_.specularColorMap,n(_.specularColorMap,w.specularColorMapTransform)),_.specularIntensityMap&&(w.specularIntensityMap.value=_.specularIntensityMap,n(_.specularIntensityMap,w.specularIntensityMapTransform))}function x(w,_){_.matcap&&(w.matcap.value=_.matcap)}function S(w,_){const E=e.get(_).light;w.referencePosition.value.setFromMatrixPosition(E.matrixWorld),w.nearDistance.value=E.shadow.camera.near,w.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function vye(t,e,n,r){let i={},s={},o=[];const a=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(E,T){const P=T.program;r.uniformBlockBinding(E,P)}function c(E,T){let P=i[E.id];P===void 0&&(x(E),P=d(E),i[E.id]=P,E.addEventListener("dispose",w));const O=T.program;r.updateUBOMapping(E,O);const N=e.render.frame;s[E.id]!==N&&(p(E),s[E.id]=N)}function d(E){const T=f();E.__bindingPointIndex=T;const P=t.createBuffer(),O=E.__size,N=E.usage;return t.bindBuffer(t.UNIFORM_BUFFER,P),t.bufferData(t.UNIFORM_BUFFER,O,N),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,T,P),P}function f(){for(let E=0;E<a;E++)if(o.indexOf(E)===-1)return o.push(E),E;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function p(E){const T=i[E.id],P=E.uniforms,O=E.__cache;t.bindBuffer(t.UNIFORM_BUFFER,T);for(let N=0,D=P.length;N<D;N++){const z=Array.isArray(P[N])?P[N]:[P[N]];for(let G=0,k=z.length;G<k;G++){const j=z[G];if(y(j,N,G,O)===!0){const H=j.__offset,ee=Array.isArray(j.value)?j.value:[j.value];let te=0;for(let he=0;he<ee.length;he++){const se=ee[he],fe=S(se);typeof se=="number"||typeof se=="boolean"?(j.__data[0]=se,t.bufferSubData(t.UNIFORM_BUFFER,H+te,j.__data)):se.isMatrix3?(j.__data[0]=se.elements[0],j.__data[1]=se.elements[1],j.__data[2]=se.elements[2],j.__data[3]=0,j.__data[4]=se.elements[3],j.__data[5]=se.elements[4],j.__data[6]=se.elements[5],j.__data[7]=0,j.__data[8]=se.elements[6],j.__data[9]=se.elements[7],j.__data[10]=se.elements[8],j.__data[11]=0):(se.toArray(j.__data,te),te+=fe.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,H,j.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function y(E,T,P,O){const N=E.value,D=T+"_"+P;if(O[D]===void 0)return typeof N=="number"||typeof N=="boolean"?O[D]=N:O[D]=N.clone(),!0;{const z=O[D];if(typeof N=="number"||typeof N=="boolean"){if(z!==N)return O[D]=N,!0}else if(z.equals(N)===!1)return z.copy(N),!0}return!1}function x(E){const T=E.uniforms;let P=0;const O=16;for(let D=0,z=T.length;D<z;D++){const G=Array.isArray(T[D])?T[D]:[T[D]];for(let k=0,j=G.length;k<j;k++){const H=G[k],ee=Array.isArray(H.value)?H.value:[H.value];for(let te=0,he=ee.length;te<he;te++){const se=ee[te],fe=S(se),B=P%O,J=B%fe.boundary,Y=B+J;P+=J,Y!==0&&O-Y<fe.storage&&(P+=O-Y),H.__data=new Float32Array(fe.storage/Float32Array.BYTES_PER_ELEMENT),H.__offset=P,P+=fe.storage}}}const N=P%O;return N>0&&(P+=O-N),E.__size=P,E.__cache={},this}function S(E){const T={boundary:0,storage:0};return typeof E=="number"||typeof E=="boolean"?(T.boundary=4,T.storage=4):E.isVector2?(T.boundary=8,T.storage=8):E.isVector3||E.isColor?(T.boundary=16,T.storage=12):E.isVector4?(T.boundary=16,T.storage=16):E.isMatrix3?(T.boundary=48,T.storage=48):E.isMatrix4?(T.boundary=64,T.storage=64):E.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",E),T}function w(E){const T=E.target;T.removeEventListener("dispose",w);const P=o.indexOf(T.__bindingPointIndex);o.splice(P,1),t.deleteBuffer(i[T.id]),delete i[T.id],delete s[T.id]}function _(){for(const E in i)t.deleteBuffer(i[E]);o=[],i={},s={}}return{bind:l,update:c,dispose:_}}class _6{constructor(e={}){const{canvas:n=a6(),context:r=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let 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=o;const y=new Uint32Array(4),x=new Int32Array(4);let S=null,w=null;const _=[],E=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Fi,this.toneMapping=Tl,this.toneMappingExposure=1;const T=this;let P=!1,O=0,N=0,D=null,z=-1,G=null;const k=new On,j=new On;let H=null;const ee=new ct(0);let te=0,he=n.width,se=n.height,fe=1,B=null,J=null;const Y=new On(0,0,he,se),V=new On(0,0,he,se);let q=!1;const pe=new fx;let ae=!1,ce=!1;const Se=new Ct,Ee=new Ct,$e=new X,Me=new On,Ge={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let We=!1;function ue(){return D===null?fe:1}let Z=r;function Ve(K,xe){return n.getContext(K,xe)}try{const K={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:f};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${Td}`),n.addEventListener("webglcontextlost",Be,!1),n.addEventListener("webglcontextrestored",ot,!1),n.addEventListener("webglcontextcreationerror",pt,!1),Z===null){const xe="webgl2";if(Z=Ve(xe,K),Z===null)throw Ve(xe)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(K){throw console.error("THREE.WebGLRenderer: "+K.message),K}let Le,re,Ce,qe,Ze,Q,W,be,Ue,ze,Fe,bt,rt,ft,Xt,Ke,ne,et,Mt,vt,Zt,de,Xe,le;function Ye(){Le=new Sve(Z),Le.init(),de=new x6(Z,Le),re=new vve(Z,Le,e,de),Ce=new rye(Z),re.reverseDepthBuffer&&Ce.buffers.depth.setReversed(!0),qe=new Ave(Z),Ze=new G0e,Q=new cye(Z,Le,Ce,Ze,re,de,qe),W=new xve(T),be=new wve(T),Ue=new kpe(Z),Xe=new mve(Z,Ue),ze=new Mve(Z,Ue,qe,Xe),Fe=new Pve(Z,ze,Ue,qe),Mt=new Tve(Z,re,Q),Ke=new yve(Ze),bt=new V0e(T,W,be,Le,re,Xe,Ke),rt=new gye(T,Ze),ft=new $0e,Xt=new Q0e(Le),et=new pve(T,W,be,Ce,Fe,p,l),ne=new tye(T,Fe,re),le=new vye(Z,qe,re,Ce),vt=new gve(Z,Le,qe),Zt=new Eve(Z,Le,qe),qe.programs=bt.programs,T.capabilities=re,T.extensions=Le,T.properties=Ze,T.renderLists=ft,T.shadowMap=ne,T.state=Ce,T.info=qe}Ye();const Re=new pye(T,Z);this.xr=Re,this.getContext=function(){return Z},this.getContextAttributes=function(){return Z.getContextAttributes()},this.forceContextLoss=function(){const K=Le.get("WEBGL_lose_context");K&&K.loseContext()},this.forceContextRestore=function(){const K=Le.get("WEBGL_lose_context");K&&K.restoreContext()},this.getPixelRatio=function(){return fe},this.setPixelRatio=function(K){K!==void 0&&(fe=K,this.setSize(he,se,!1))},this.getSize=function(K){return K.set(he,se)},this.setSize=function(K,xe,Te=!0){if(Re.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}he=K,se=xe,n.width=Math.floor(K*fe),n.height=Math.floor(xe*fe),Te===!0&&(n.style.width=K+"px",n.style.height=xe+"px"),this.setViewport(0,0,K,xe)},this.getDrawingBufferSize=function(K){return K.set(he*fe,se*fe).floor()},this.setDrawingBufferSize=function(K,xe,Te){he=K,se=xe,fe=Te,n.width=Math.floor(K*Te),n.height=Math.floor(xe*Te),this.setViewport(0,0,K,xe)},this.getCurrentViewport=function(K){return K.copy(k)},this.getViewport=function(K){return K.copy(Y)},this.setViewport=function(K,xe,Te,Ie){K.isVector4?Y.set(K.x,K.y,K.z,K.w):Y.set(K,xe,Te,Ie),Ce.viewport(k.copy(Y).multiplyScalar(fe).round())},this.getScissor=function(K){return K.copy(V)},this.setScissor=function(K,xe,Te,Ie){K.isVector4?V.set(K.x,K.y,K.z,K.w):V.set(K,xe,Te,Ie),Ce.scissor(j.copy(V).multiplyScalar(fe).round())},this.getScissorTest=function(){return q},this.setScissorTest=function(K){Ce.setScissorTest(q=K)},this.setOpaqueSort=function(K){B=K},this.setTransparentSort=function(K){J=K},this.getClearColor=function(K){return K.copy(et.getClearColor())},this.setClearColor=function(){et.setClearColor.apply(et,arguments)},this.getClearAlpha=function(){return et.getClearAlpha()},this.setClearAlpha=function(){et.setClearAlpha.apply(et,arguments)},this.clear=function(K=!0,xe=!0,Te=!0){let Ie=0;if(K){let we=!1;if(D!==null){const it=D.texture.format;we=it===qS||it===XS||it===lx}if(we){const it=D.texture.type,yt=it===Ha||it===Qc||it===kg||it===zh||it===GS||it===WS,lt=et.getClearColor(),Et=et.getClearAlpha(),jt=lt.r,Bt=lt.g,Rt=lt.b;yt?(y[0]=jt,y[1]=Bt,y[2]=Rt,y[3]=Et,Z.clearBufferuiv(Z.COLOR,0,y)):(x[0]=jt,x[1]=Bt,x[2]=Rt,x[3]=Et,Z.clearBufferiv(Z.COLOR,0,x))}else Ie|=Z.COLOR_BUFFER_BIT}xe&&(Ie|=Z.DEPTH_BUFFER_BIT,Z.clearDepth(this.capabilities.reverseDepthBuffer?0:1)),Te&&(Ie|=Z.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Z.clear(Ie)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",Be,!1),n.removeEventListener("webglcontextrestored",ot,!1),n.removeEventListener("webglcontextcreationerror",pt,!1),ft.dispose(),Xt.dispose(),Ze.dispose(),W.dispose(),be.dispose(),Fe.dispose(),Xe.dispose(),le.dispose(),bt.dispose(),Re.dispose(),Re.removeEventListener("sessionstart",Mi),Re.removeEventListener("sessionend",na),Ei.stop()};function Be(K){K.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),P=!0}function ot(){console.log("THREE.WebGLRenderer: Context Restored."),P=!1;const K=qe.autoReset,xe=ne.enabled,Te=ne.autoUpdate,Ie=ne.needsUpdate,we=ne.type;Ye(),qe.autoReset=K,ne.enabled=xe,ne.autoUpdate=Te,ne.needsUpdate=Ie,ne.type=we}function pt(K){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",K.statusMessage)}function Jt(K){const xe=K.target;xe.removeEventListener("dispose",Jt),pn(xe)}function pn(K){jn(K),Ze.remove(K)}function jn(K){const xe=Ze.get(K).programs;xe!==void 0&&(xe.forEach(function(Te){bt.releaseProgram(Te)}),K.isShaderMaterial&&bt.releaseShaderCache(K))}this.renderBufferDirect=function(K,xe,Te,Ie,we,it){xe===null&&(xe=Ge);const yt=we.isMesh&&we.matrixWorld.determinant()<0,lt=To(K,xe,Te,Ie,we);Ce.setMaterial(Ie,yt);let Et=Te.index,jt=1;if(Ie.wireframe===!0){if(Et=ze.getWireframeAttribute(Te),Et===void 0)return;jt=2}const Bt=Te.drawRange,Rt=Te.attributes.position;let Sn=Bt.start*jt,Mn=(Bt.start+Bt.count)*jt;it!==null&&(Sn=Math.max(Sn,it.start*jt),Mn=Math.min(Mn,(it.start+it.count)*jt)),Et!==null?(Sn=Math.max(Sn,0),Mn=Math.min(Mn,Et.count)):Rt!=null&&(Sn=Math.max(Sn,0),Mn=Math.min(Mn,Rt.count));const yn=Mn-Sn;if(yn<0||yn===1/0)return;Xe.setup(we,Ie,lt,Te,Et);let Kt,Ut=vt;if(Et!==null&&(Kt=Ue.get(Et),Ut=Zt,Ut.setIndex(Kt)),we.isMesh)Ie.wireframe===!0?(Ce.setLineWidth(Ie.wireframeLinewidth*ue()),Ut.setMode(Z.LINES)):Ut.setMode(Z.TRIANGLES);else if(we.isLine){let mt=Ie.linewidth;mt===void 0&&(mt=1),Ce.setLineWidth(mt*ue()),we.isLineSegments?Ut.setMode(Z.LINES):we.isLineLoop?Ut.setMode(Z.LINE_LOOP):Ut.setMode(Z.LINE_STRIP)}else we.isPoints?Ut.setMode(Z.POINTS):we.isSprite&&Ut.setMode(Z.TRIANGLES);if(we.isBatchedMesh)if(we._multiDrawInstances!==null)Ut.renderMultiDrawInstances(we._multiDrawStarts,we._multiDrawCounts,we._multiDrawCount,we._multiDrawInstances);else if(Le.get("WEBGL_multi_draw"))Ut.renderMultiDraw(we._multiDrawStarts,we._multiDrawCounts,we._multiDrawCount);else{const mt=we._multiDrawStarts,xn=we._multiDrawCounts,tn=we._multiDrawCount,Rr=Et?Ue.get(Et).bytesPerElement:1,li=Ze.get(Ie).currentProgram.getUniforms();for(let In=0;In<tn;In++)li.setValue(Z,"_gl_DrawID",In),Ut.render(mt[In]/Rr,xn[In])}else if(we.isInstancedMesh)Ut.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);Ut.renderInstances(Sn,yn,xn)}else Ut.render(Sn,yn)};function en(K,xe,Te){K.transparent===!0&&K.side===xo&&K.forceSinglePass===!1?(K.side=os,K.needsUpdate=!0,ia(K,xe,Te),K.side=Ll,K.needsUpdate=!0,ia(K,xe,Te),K.side=xo):ia(K,xe,Te)}this.compile=function(K,xe,Te=null){Te===null&&(Te=K),w=Xt.get(Te),w.init(xe),E.push(w),Te.traverseVisible(function(we){we.isLight&&we.layers.test(xe.layers)&&(w.pushLight(we),we.castShadow&&w.pushShadow(we))}),K!==Te&&K.traverseVisible(function(we){we.isLight&&we.layers.test(xe.layers)&&(w.pushLight(we),we.castShadow&&w.pushShadow(we))}),w.setupLights();const Ie=new Set;return K.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 lt=it[yt];en(lt,Te,we),Ie.add(lt)}else en(it,Te,we),Ie.add(it)}),E.pop(),w=null,Ie},this.compileAsync=function(K,xe,Te=null){const Ie=this.compile(K,xe,Te);return new Promise(we=>{function it(){if(Ie.forEach(function(yt){Ze.get(yt).currentProgram.isReady()&&Ie.delete(yt)}),Ie.size===0){we(K);return}setTimeout(it,10)}Le.get("KHR_parallel_shader_compile")!==null?it():setTimeout(it,10)})};let Hn=null;function pr(K){Hn&&Hn(K)}function Mi(){Ei.stop()}function na(){Ei.start()}const Ei=new p6;Ei.setAnimationLoop(pr),typeof self<"u"&&Ei.setContext(self),this.setAnimationLoop=function(K){Hn=K,Re.setAnimationLoop(K),K===null?Ei.stop():Ei.start()},Re.addEventListener("sessionstart",Mi),Re.addEventListener("sessionend",na),this.render=function(K,xe){if(xe!==void 0&&xe.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(P===!0)return;if(K.matrixWorldAutoUpdate===!0&&K.updateMatrixWorld(),xe.parent===null&&xe.matrixWorldAutoUpdate===!0&&xe.updateMatrixWorld(),Re.enabled===!0&&Re.isPresenting===!0&&(Re.cameraAutoUpdate===!0&&Re.updateCamera(xe),xe=Re.getCamera()),K.isScene===!0&&K.onBeforeRender(T,K,xe,D),w=Xt.get(K,E.length),w.init(xe),E.push(w),Ee.multiplyMatrices(xe.projectionMatrix,xe.matrixWorldInverse),pe.setFromProjectionMatrix(Ee),ce=this.localClippingEnabled,ae=Ke.init(this.clippingPlanes,ce),S=ft.get(K,_.length),S.init(),_.push(S),Re.enabled===!0&&Re.isPresenting===!0){const it=T.xr.getDepthSensingMesh();it!==null&&Ka(it,xe,-1/0,T.sortObjects)}Ka(K,xe,0,T.sortObjects),S.finish(),T.sortObjects===!0&&S.sort(B,J),We=Re.enabled===!1||Re.isPresenting===!1||Re.hasDepthSensing()===!1,We&&et.addToRenderList(S,K),this.info.render.frame++,ae===!0&&Ke.beginShadows();const Te=w.state.shadowsArray;ne.render(Te,K,xe),ae===!0&&Ke.endShadows(),this.info.autoReset===!0&&this.info.reset();const Ie=S.opaque,we=S.transmissive;if(w.setupLights(),xe.isArrayCamera){const it=xe.cameras;if(we.length>0)for(let yt=0,lt=it.length;yt<lt;yt++){const Et=it[yt];ra(Ie,we,K,Et)}We&&et.render(K);for(let yt=0,lt=it.length;yt<lt;yt++){const Et=it[yt];Ns(S,K,Et,Et.viewport)}}else we.length>0&&ra(Ie,we,K,xe),We&&et.render(K),Ns(S,K,xe);D!==null&&(Q.updateMultisampleRenderTarget(D),Q.updateRenderTargetMipmap(D)),K.isScene===!0&&K.onAfterRender(T,K,xe),Xe.resetDefaultState(),z=-1,G=null,E.pop(),E.length>0?(w=E[E.length-1],ae===!0&&Ke.setGlobalState(T.clippingPlanes,w.state.camera)):w=null,_.pop(),_.length>0?S=_[_.length-1]:S=null};function Ka(K,xe,Te,Ie){if(K.visible===!1)return;if(K.layers.test(xe.layers)){if(K.isGroup)Te=K.renderOrder;else if(K.isLOD)K.autoUpdate===!0&&K.update(xe);else if(K.isLight)w.pushLight(K),K.castShadow&&w.pushShadow(K);else if(K.isSprite){if(!K.frustumCulled||pe.intersectsSprite(K)){Ie&&Me.setFromMatrixPosition(K.matrixWorld).applyMatrix4(Ee);const yt=Fe.update(K),lt=K.material;lt.visible&&S.push(K,yt,lt,Te,Me.z,null)}}else if((K.isMesh||K.isLine||K.isPoints)&&(!K.frustumCulled||pe.intersectsObject(K))){const yt=Fe.update(K),lt=K.material;if(Ie&&(K.boundingSphere!==void 0?(K.boundingSphere===null&&K.computeBoundingSphere(),Me.copy(K.boundingSphere.center)):(yt.boundingSphere===null&&yt.computeBoundingSphere(),Me.copy(yt.boundingSphere.center)),Me.applyMatrix4(K.matrixWorld).applyMatrix4(Ee)),Array.isArray(lt)){const Et=yt.groups;for(let jt=0,Bt=Et.length;jt<Bt;jt++){const Rt=Et[jt],Sn=lt[Rt.materialIndex];Sn&&Sn.visible&&S.push(K,yt,Sn,Te,Me.z,Rt)}}else lt.visible&&S.push(K,yt,lt,Te,Me.z,null)}}const it=K.children;for(let yt=0,lt=it.length;yt<lt;yt++)Ka(it[yt],xe,Te,Ie)}function Ns(K,xe,Te,Ie){const we=K.opaque,it=K.transmissive,yt=K.transparent;w.setupLightsView(Te),ae===!0&&Ke.setGlobalState(T.clippingPlanes,Te),Ie&&Ce.viewport(k.copy(Ie)),we.length>0&&Ai(we,xe,Te),it.length>0&&Ai(it,xe,Te),yt.length>0&&Ai(yt,xe,Te),Ce.buffers.depth.setTest(!0),Ce.buffers.depth.setMask(!0),Ce.buffers.color.setMask(!0),Ce.setPolygonOffset(!1)}function ra(K,xe,Te,Ie){if((Te.isScene===!0?Te.overrideMaterial:null)!==null)return;w.state.transmissionRenderTarget[Ie.id]===void 0&&(w.state.transmissionRenderTarget[Ie.id]=new Va(1,1,{generateMipmaps:!0,type:Le.has("EXT_color_buffer_half_float")||Le.has("EXT_color_buffer_float")?rv:Ha,minFilter:$o,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Nn.workingColorSpace}));const it=w.state.transmissionRenderTarget[Ie.id],yt=Ie.viewport||k;it.setSize(yt.z,yt.w);const lt=T.getRenderTarget();T.setRenderTarget(it),T.getClearColor(ee),te=T.getClearAlpha(),te<1&&T.setClearColor(16777215,.5),T.clear(),We&&et.render(Te);const Et=T.toneMapping;T.toneMapping=Tl;const jt=Ie.viewport;if(Ie.viewport!==void 0&&(Ie.viewport=void 0),w.setupLightsView(Ie),ae===!0&&Ke.setGlobalState(T.clippingPlanes,Ie),Ai(K,Te,Ie),Q.updateMultisampleRenderTarget(it),Q.updateRenderTargetMipmap(it),Le.has("WEBGL_multisampled_render_to_texture")===!1){let Bt=!1;for(let Rt=0,Sn=xe.length;Rt<Sn;Rt++){const Mn=xe[Rt],yn=Mn.object,Kt=Mn.geometry,Ut=Mn.material,mt=Mn.group;if(Ut.side===xo&&yn.layers.test(Ie.layers)){const xn=Ut.side;Ut.side=os,Ut.needsUpdate=!0,Ao(yn,Te,Ie,Kt,Ut,mt),Ut.side=xn,Ut.needsUpdate=!0,Bt=!0}}Bt===!0&&(Q.updateMultisampleRenderTarget(it),Q.updateRenderTargetMipmap(it))}T.setRenderTarget(lt),T.setClearColor(ee,te),jt!==void 0&&(Ie.viewport=jt),T.toneMapping=Et}function Ai(K,xe,Te){const Ie=xe.isScene===!0?xe.overrideMaterial:null;for(let we=0,it=K.length;we<it;we++){const yt=K[we],lt=yt.object,Et=yt.geometry,jt=Ie===null?yt.material:Ie,Bt=yt.group;lt.layers.test(Te.layers)&&Ao(lt,xe,Te,Et,jt,Bt)}}function Ao(K,xe,Te,Ie,we,it){K.onBeforeRender(T,xe,Te,Ie,we,it),K.modelViewMatrix.multiplyMatrices(Te.matrixWorldInverse,K.matrixWorld),K.normalMatrix.getNormalMatrix(K.modelViewMatrix),we.onBeforeRender(T,xe,Te,Ie,K,it),we.transparent===!0&&we.side===xo&&we.forceSinglePass===!1?(we.side=os,we.needsUpdate=!0,T.renderBufferDirect(Te,xe,Ie,we,K,it),we.side=Ll,we.needsUpdate=!0,T.renderBufferDirect(Te,xe,Ie,we,K,it),we.side=xo):T.renderBufferDirect(Te,xe,Ie,we,K,it),K.onAfterRender(T,xe,Te,Ie,we,it)}function ia(K,xe,Te){xe.isScene!==!0&&(xe=Ge);const Ie=Ze.get(K),we=w.state.lights,it=w.state.shadowsArray,yt=we.state.version,lt=bt.getParameters(K,we.state,it,xe,Te),Et=bt.getProgramCacheKey(lt);let jt=Ie.programs;Ie.environment=K.isMeshStandardMaterial?xe.environment:null,Ie.fog=xe.fog,Ie.envMap=(K.isMeshStandardMaterial?be:W).get(K.envMap||Ie.environment),Ie.envMapRotation=Ie.environment!==null&&K.envMap===null?xe.environmentRotation:K.envMapRotation,jt===void 0&&(K.addEventListener("dispose",Jt),jt=new Map,Ie.programs=jt);let Bt=jt.get(Et);if(Bt!==void 0){if(Ie.currentProgram===Bt&&Ie.lightsStateVersion===yt)return lu(K,lt),Bt}else lt.uniforms=bt.getUniforms(K),K.onBeforeCompile(lt,T),Bt=bt.acquireProgram(lt,Et),jt.set(Et,Bt),Ie.uniforms=lt.uniforms;const Rt=Ie.uniforms;return(!K.isShaderMaterial&&!K.isRawShaderMaterial||K.clipping===!0)&&(Rt.clippingPlanes=Ke.uniform),lu(K,lt),Ie.needsLights=Bl(K),Ie.lightsStateVersion=yt,Ie.needsLights&&(Rt.ambientLightColor.value=we.state.ambient,Rt.lightProbe.value=we.state.probe,Rt.directionalLights.value=we.state.directional,Rt.directionalLightShadows.value=we.state.directionalShadow,Rt.spotLights.value=we.state.spot,Rt.spotLightShadows.value=we.state.spotShadow,Rt.rectAreaLights.value=we.state.rectArea,Rt.ltc_1.value=we.state.rectAreaLTC1,Rt.ltc_2.value=we.state.rectAreaLTC2,Rt.pointLights.value=we.state.point,Rt.pointLightShadows.value=we.state.pointShadow,Rt.hemisphereLights.value=we.state.hemi,Rt.directionalShadowMap.value=we.state.directionalShadowMap,Rt.directionalShadowMatrix.value=we.state.directionalShadowMatrix,Rt.spotShadowMap.value=we.state.spotShadowMap,Rt.spotLightMatrix.value=we.state.spotLightMatrix,Rt.spotLightMap.value=we.state.spotLightMap,Rt.pointShadowMap.value=we.state.pointShadowMap,Rt.pointShadowMatrix.value=we.state.pointShadowMatrix),Ie.currentProgram=Bt,Ie.uniformsList=null,Bt}function au(K){if(K.uniformsList===null){const xe=K.currentProgram.getUniforms();K.uniformsList=X_.seqWithValue(xe.seq,K.uniforms)}return K.uniformsList}function lu(K,xe){const Te=Ze.get(K);Te.outputColorSpace=xe.outputColorSpace,Te.batching=xe.batching,Te.batchingColor=xe.batchingColor,Te.instancing=xe.instancing,Te.instancingColor=xe.instancingColor,Te.instancingMorph=xe.instancingMorph,Te.skinning=xe.skinning,Te.morphTargets=xe.morphTargets,Te.morphNormals=xe.morphNormals,Te.morphColors=xe.morphColors,Te.morphTargetsCount=xe.morphTargetsCount,Te.numClippingPlanes=xe.numClippingPlanes,Te.numIntersection=xe.numClipIntersection,Te.vertexAlphas=xe.vertexAlphas,Te.vertexTangents=xe.vertexTangents,Te.toneMapping=xe.toneMapping}function To(K,xe,Te,Ie,we){xe.isScene!==!0&&(xe=Ge),Q.resetTextureUnits();const it=xe.fog,yt=Ie.isMeshStandardMaterial?xe.environment:null,lt=D===null?T.outputColorSpace:D.isXRRenderTarget===!0?D.texture.colorSpace:xi,Et=(Ie.isMeshStandardMaterial?be:W).get(Ie.envMap||yt),jt=Ie.vertexColors===!0&&!!Te.attributes.color&&Te.attributes.color.itemSize===4,Bt=!!Te.attributes.tangent&&(!!Ie.normalMap||Ie.anisotropy>0),Rt=!!Te.morphAttributes.position,Sn=!!Te.morphAttributes.normal,Mn=!!Te.morphAttributes.color;let yn=Tl;Ie.toneMapped&&(D===null||D.isXRRenderTarget===!0)&&(yn=T.toneMapping);const Kt=Te.morphAttributes.position||Te.morphAttributes.normal||Te.morphAttributes.color,Ut=Kt!==void 0?Kt.length:0,mt=Ze.get(Ie),xn=w.state.lights;if(ae===!0&&(ce===!0||K!==G)){const Xr=K===G&&Ie.id===z;Ke.setState(Ie,K,Xr)}let tn=!1;Ie.version===mt.__version?(mt.needsLights&&mt.lightsStateVersion!==xn.state.version||mt.outputColorSpace!==lt||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||Ie.fog===!0&&mt.fog!==it||mt.numClippingPlanes!==void 0&&(mt.numClippingPlanes!==Ke.numPlanes||mt.numIntersection!==Ke.numIntersection)||mt.vertexAlphas!==jt||mt.vertexTangents!==Bt||mt.morphTargets!==Rt||mt.morphNormals!==Sn||mt.morphColors!==Mn||mt.toneMapping!==yn||mt.morphTargetsCount!==Ut)&&(tn=!0):(tn=!0,mt.__version=Ie.version);let Rr=mt.currentProgram;tn===!0&&(Rr=ia(Ie,xe,we));let li=!1,In=!1,Is=!1;const Vn=Rr.getUniforms(),to=mt.uniforms;if(Ce.useProgram(Rr.program)&&(li=!0,In=!0,Is=!0),Ie.id!==z&&(z=Ie.id,In=!0),li||G!==K){re.reverseDepthBuffer?(Se.copy(K.projectionMatrix),rpe(Se),ipe(Se),Vn.setValue(Z,"projectionMatrix",Se)):Vn.setValue(Z,"projectionMatrix",K.projectionMatrix),Vn.setValue(Z,"viewMatrix",K.matrixWorldInverse);const Xr=Vn.map.cameraPosition;Xr!==void 0&&Xr.setValue(Z,$e.setFromMatrixPosition(K.matrixWorld)),re.logarithmicDepthBuffer&&Vn.setValue(Z,"logDepthBufFC",2/(Math.log(K.far+1)/Math.LN2)),(Ie.isMeshPhongMaterial||Ie.isMeshToonMaterial||Ie.isMeshLambertMaterial||Ie.isMeshBasicMaterial||Ie.isMeshStandardMaterial||Ie.isShaderMaterial)&&Vn.setValue(Z,"isOrthographic",K.isOrthographicCamera===!0),G!==K&&(G=K,In=!0,Is=!0)}if(we.isSkinnedMesh){Vn.setOptional(Z,we,"bindMatrix"),Vn.setOptional(Z,we,"bindMatrixInverse");const Xr=we.skeleton;Xr&&(Xr.boneTexture===null&&Xr.computeBoneTexture(),Vn.setValue(Z,"boneTexture",Xr.boneTexture,Q))}we.isBatchedMesh&&(Vn.setOptional(Z,we,"batchingTexture"),Vn.setValue(Z,"batchingTexture",we._matricesTexture,Q),Vn.setOptional(Z,we,"batchingIdTexture"),Vn.setValue(Z,"batchingIdTexture",we._indirectTexture,Q),Vn.setOptional(Z,we,"batchingColorTexture"),we._colorsTexture!==null&&Vn.setValue(Z,"batchingColorTexture",we._colorsTexture,Q));const Ya=Te.morphAttributes;if((Ya.position!==void 0||Ya.normal!==void 0||Ya.color!==void 0)&&Mt.update(we,Te,Rr),(In||mt.receiveShadow!==we.receiveShadow)&&(mt.receiveShadow=we.receiveShadow,Vn.setValue(Z,"receiveShadow",we.receiveShadow)),Ie.isMeshGouraudMaterial&&Ie.envMap!==null&&(to.envMap.value=Et,to.flipEnvMap.value=Et.isCubeTexture&&Et.isRenderTargetTexture===!1?-1:1),Ie.isMeshStandardMaterial&&Ie.envMap===null&&xe.environment!==null&&(to.envMapIntensity.value=xe.environmentIntensity),In&&(Vn.setValue(Z,"toneMappingExposure",T.toneMappingExposure),mt.needsLights&&cu(to,Is),it&&Ie.fog===!0&&rt.refreshFogUniforms(to,it),rt.refreshMaterialUniforms(to,Ie,fe,se,w.state.transmissionRenderTarget[K.id]),X_.upload(Z,au(mt),to,Q)),Ie.isShaderMaterial&&Ie.uniformsNeedUpdate===!0&&(X_.upload(Z,au(mt),to,Q),Ie.uniformsNeedUpdate=!1),Ie.isSpriteMaterial&&Vn.setValue(Z,"center",we.center),Vn.setValue(Z,"modelViewMatrix",we.modelViewMatrix),Vn.setValue(Z,"normalMatrix",we.normalMatrix),Vn.setValue(Z,"modelMatrix",we.matrixWorld),Ie.isShaderMaterial||Ie.isRawShaderMaterial){const Xr=Ie.uniformsGroups;for(let ci=0,Dd=Xr.length;ci<Dd;ci++){const Za=Xr[ci];le.update(Za,Rr),le.bind(Za,Rr)}}return Rr}function cu(K,xe){K.ambientLightColor.needsUpdate=xe,K.lightProbe.needsUpdate=xe,K.directionalLights.needsUpdate=xe,K.directionalLightShadows.needsUpdate=xe,K.pointLights.needsUpdate=xe,K.pointLightShadows.needsUpdate=xe,K.spotLights.needsUpdate=xe,K.spotLightShadows.needsUpdate=xe,K.rectAreaLights.needsUpdate=xe,K.hemisphereLights.needsUpdate=xe}function Bl(K){return K.isMeshLambertMaterial||K.isMeshToonMaterial||K.isMeshPhongMaterial||K.isMeshStandardMaterial||K.isShadowMaterial||K.isShaderMaterial&&K.lights===!0}this.getActiveCubeFace=function(){return O},this.getActiveMipmapLevel=function(){return N},this.getRenderTarget=function(){return D},this.setRenderTargetTextures=function(K,xe,Te){Ze.get(K.texture).__webglTexture=xe,Ze.get(K.depthTexture).__webglTexture=Te;const Ie=Ze.get(K);Ie.__hasExternalTextures=!0,Ie.__autoAllocateDepthBuffer=Te===void 0,Ie.__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"),Ie.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(K,xe){const Te=Ze.get(K);Te.__webglFramebuffer=xe,Te.__useDefaultFramebuffer=xe===void 0},this.setRenderTarget=function(K,xe=0,Te=0){D=K,O=xe,N=Te;let Ie=!0,we=null,it=!1,yt=!1;if(K){const Et=Ze.get(K);if(Et.__useDefaultFramebuffer!==void 0)Ce.bindFramebuffer(Z.FRAMEBUFFER,null),Ie=!1;else if(Et.__webglFramebuffer===void 0)Q.setupRenderTarget(K);else if(Et.__hasExternalTextures)Q.rebindTextures(K,Ze.get(K.texture).__webglTexture,Ze.get(K.depthTexture).__webglTexture);else if(K.depthBuffer){const Rt=K.depthTexture;if(Et.__boundDepthTexture!==Rt){if(Rt!==null&&Ze.has(Rt)&&(K.width!==Rt.image.width||K.height!==Rt.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");Q.setupDepthRenderbuffer(K)}}const jt=K.texture;(jt.isData3DTexture||jt.isDataArrayTexture||jt.isCompressedArrayTexture)&&(yt=!0);const Bt=Ze.get(K).__webglFramebuffer;K.isWebGLCubeRenderTarget?(Array.isArray(Bt[xe])?we=Bt[xe][Te]:we=Bt[xe],it=!0):K.samples>0&&Q.useMultisampledRTT(K)===!1?we=Ze.get(K).__webglMultisampledFramebuffer:Array.isArray(Bt)?we=Bt[Te]:we=Bt,k.copy(K.viewport),j.copy(K.scissor),H=K.scissorTest}else k.copy(Y).multiplyScalar(fe).floor(),j.copy(V).multiplyScalar(fe).floor(),H=q;if(Ce.bindFramebuffer(Z.FRAMEBUFFER,we)&&Ie&&Ce.drawBuffers(K,we),Ce.viewport(k),Ce.scissor(j),Ce.setScissorTest(H),it){const Et=Ze.get(K.texture);Z.framebufferTexture2D(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,Z.TEXTURE_CUBE_MAP_POSITIVE_X+xe,Et.__webglTexture,Te)}else if(yt){const Et=Ze.get(K.texture),jt=xe||0;Z.framebufferTextureLayer(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,Et.__webglTexture,Te||0,jt)}z=-1},this.readRenderTargetPixels=function(K,xe,Te,Ie,we,it,yt){if(!(K&&K.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let lt=Ze.get(K).__webglFramebuffer;if(K.isWebGLCubeRenderTarget&&yt!==void 0&&(lt=lt[yt]),lt){Ce.bindFramebuffer(Z.FRAMEBUFFER,lt);try{const Et=K.texture,jt=Et.format,Bt=Et.type;if(!re.textureFormatReadable(jt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!re.textureTypeReadable(Bt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}xe>=0&&xe<=K.width-Ie&&Te>=0&&Te<=K.height-we&&Z.readPixels(xe,Te,Ie,we,de.convert(jt),de.convert(Bt),it)}finally{const Et=D!==null?Ze.get(D).__webglFramebuffer:null;Ce.bindFramebuffer(Z.FRAMEBUFFER,Et)}}},this.readRenderTargetPixelsAsync=async function(K,xe,Te,Ie,we,it,yt){if(!(K&&K.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let lt=Ze.get(K).__webglFramebuffer;if(K.isWebGLCubeRenderTarget&&yt!==void 0&&(lt=lt[yt]),lt){const Et=K.texture,jt=Et.format,Bt=Et.type;if(!re.textureFormatReadable(jt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!re.textureTypeReadable(Bt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(xe>=0&&xe<=K.width-Ie&&Te>=0&&Te<=K.height-we){Ce.bindFramebuffer(Z.FRAMEBUFFER,lt);const Rt=Z.createBuffer();Z.bindBuffer(Z.PIXEL_PACK_BUFFER,Rt),Z.bufferData(Z.PIXEL_PACK_BUFFER,it.byteLength,Z.STREAM_READ),Z.readPixels(xe,Te,Ie,we,de.convert(jt),de.convert(Bt),0);const Sn=D!==null?Ze.get(D).__webglFramebuffer:null;Ce.bindFramebuffer(Z.FRAMEBUFFER,Sn);const Mn=Z.fenceSync(Z.SYNC_GPU_COMMANDS_COMPLETE,0);return Z.flush(),await npe(Z,Mn,4),Z.bindBuffer(Z.PIXEL_PACK_BUFFER,Rt),Z.getBufferSubData(Z.PIXEL_PACK_BUFFER,0,it),Z.deleteBuffer(Rt),Z.deleteSync(Mn),it}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(K,xe=null,Te=0){K.isTexture!==!0&&($_("WebGLRenderer: copyFramebufferToTexture function signature has changed."),xe=arguments[0]||null,K=arguments[1]);const Ie=Math.pow(2,-Te),we=Math.floor(K.image.width*Ie),it=Math.floor(K.image.height*Ie),yt=xe!==null?xe.x:0,lt=xe!==null?xe.y:0;Q.setTexture2D(K,0),Z.copyTexSubImage2D(Z.TEXTURE_2D,Te,0,0,yt,lt,we,it),Ce.unbindTexture()},this.copyTextureToTexture=function(K,xe,Te=null,Ie=null,we=0){K.isTexture!==!0&&($_("WebGLRenderer: copyTextureToTexture function signature has changed."),Ie=arguments[0]||null,K=arguments[1],xe=arguments[2],we=arguments[3]||0,Te=null);let it,yt,lt,Et,jt,Bt;Te!==null?(it=Te.max.x-Te.min.x,yt=Te.max.y-Te.min.y,lt=Te.min.x,Et=Te.min.y):(it=K.image.width,yt=K.image.height,lt=0,Et=0),Ie!==null?(jt=Ie.x,Bt=Ie.y):(jt=0,Bt=0);const Rt=de.convert(xe.format),Sn=de.convert(xe.type);Q.setTexture2D(xe,0),Z.pixelStorei(Z.UNPACK_FLIP_Y_WEBGL,xe.flipY),Z.pixelStorei(Z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,xe.premultiplyAlpha),Z.pixelStorei(Z.UNPACK_ALIGNMENT,xe.unpackAlignment);const Mn=Z.getParameter(Z.UNPACK_ROW_LENGTH),yn=Z.getParameter(Z.UNPACK_IMAGE_HEIGHT),Kt=Z.getParameter(Z.UNPACK_SKIP_PIXELS),Ut=Z.getParameter(Z.UNPACK_SKIP_ROWS),mt=Z.getParameter(Z.UNPACK_SKIP_IMAGES),xn=K.isCompressedTexture?K.mipmaps[we]:K.image;Z.pixelStorei(Z.UNPACK_ROW_LENGTH,xn.width),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,xn.height),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,lt),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,Et),K.isDataTexture?Z.texSubImage2D(Z.TEXTURE_2D,we,jt,Bt,it,yt,Rt,Sn,xn.data):K.isCompressedTexture?Z.compressedTexSubImage2D(Z.TEXTURE_2D,we,jt,Bt,xn.width,xn.height,Rt,xn.data):Z.texSubImage2D(Z.TEXTURE_2D,we,jt,Bt,it,yt,Rt,Sn,xn),Z.pixelStorei(Z.UNPACK_ROW_LENGTH,Mn),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,yn),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,Kt),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,Ut),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,mt),we===0&&xe.generateMipmaps&&Z.generateMipmap(Z.TEXTURE_2D),Ce.unbindTexture()},this.copyTextureToTexture3D=function(K,xe,Te=null,Ie=null,we=0){K.isTexture!==!0&&($_("WebGLRenderer: copyTextureToTexture3D function signature has changed."),Te=arguments[0]||null,Ie=arguments[1]||null,K=arguments[2],xe=arguments[3],we=arguments[4]||0);let it,yt,lt,Et,jt,Bt,Rt,Sn,Mn;const yn=K.isCompressedTexture?K.mipmaps[we]:K.image;Te!==null?(it=Te.max.x-Te.min.x,yt=Te.max.y-Te.min.y,lt=Te.max.z-Te.min.z,Et=Te.min.x,jt=Te.min.y,Bt=Te.min.z):(it=yn.width,yt=yn.height,lt=yn.depth,Et=0,jt=0,Bt=0),Ie!==null?(Rt=Ie.x,Sn=Ie.y,Mn=Ie.z):(Rt=0,Sn=0,Mn=0);const Kt=de.convert(xe.format),Ut=de.convert(xe.type);let mt;if(xe.isData3DTexture)Q.setTexture3D(xe,0),mt=Z.TEXTURE_3D;else if(xe.isDataArrayTexture||xe.isCompressedArrayTexture)Q.setTexture2DArray(xe,0),mt=Z.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Z.pixelStorei(Z.UNPACK_FLIP_Y_WEBGL,xe.flipY),Z.pixelStorei(Z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,xe.premultiplyAlpha),Z.pixelStorei(Z.UNPACK_ALIGNMENT,xe.unpackAlignment);const xn=Z.getParameter(Z.UNPACK_ROW_LENGTH),tn=Z.getParameter(Z.UNPACK_IMAGE_HEIGHT),Rr=Z.getParameter(Z.UNPACK_SKIP_PIXELS),li=Z.getParameter(Z.UNPACK_SKIP_ROWS),In=Z.getParameter(Z.UNPACK_SKIP_IMAGES);Z.pixelStorei(Z.UNPACK_ROW_LENGTH,yn.width),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,yn.height),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,Et),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,jt),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,Bt),K.isDataTexture||K.isData3DTexture?Z.texSubImage3D(mt,we,Rt,Sn,Mn,it,yt,lt,Kt,Ut,yn.data):xe.isCompressedArrayTexture?Z.compressedTexSubImage3D(mt,we,Rt,Sn,Mn,it,yt,lt,Kt,yn.data):Z.texSubImage3D(mt,we,Rt,Sn,Mn,it,yt,lt,Kt,Ut,yn),Z.pixelStorei(Z.UNPACK_ROW_LENGTH,xn),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,tn),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,Rr),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,li),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,In),we===0&&xe.generateMipmaps&&Z.generateMipmap(mt),Ce.unbindTexture()},this.initRenderTarget=function(K){Ze.get(K).__webglFramebuffer===void 0&&Q.setupRenderTarget(K)},this.initTexture=function(K){K.isCubeTexture?Q.setTextureCube(K,0):K.isData3DTexture?Q.setTexture3D(K,0):K.isDataArrayTexture||K.isCompressedArrayTexture?Q.setTexture2DArray(K,0):Q.setTexture2D(K,0),Ce.unbindTexture()},this.resetState=function(){O=0,N=0,D=null,Ce.reset(),Xe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ml}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=e===YS?"display-p3":"srgb",n.unpackColorSpace=Nn.workingColorSpace===cx?"display-p3":"srgb"}}class JS{constructor(e,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new ct(e),this.density=n}clone(){return new JS(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class eM{constructor(e,n=1,r=1e3){this.isFog=!0,this.name="",this.color=new ct(e),this.near=n,this.far=r}clone(){return new eM(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class kR extends mn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new 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 tp{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=Ny,this.updateRanges=[],this.version=0,this.uuid=So()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,n,r){e*=this.stride,r*=n.stride;for(let i=0,s=this.stride;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=So()),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=So()),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 X;class Dl{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=Ss(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=Ss(n,this.array)),n}getY(e){let n=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(n=Ss(n,this.array)),n}getZ(e){let n=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(n=Ss(n,this.array)),n}getW(e){let n=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(n=Ss(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 Dl(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 OR extends Gr{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new ct(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 Am;const w0=new X,Tm=new X,Pm=new X,Cm=new He,S0=new He,w6=new Ct,i_=new X,M0=new X,s_=new X,CD=new He,wA=new He,RD=new He;class S6 extends mn{constructor(e=new OR){if(super(),this.isSprite=!0,this.type="Sprite",Am===void 0){Am=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 tp(n,5);Am.setIndex([0,1,2,0,2,3]),Am.setAttribute("position",new Dl(r,3,0,!1)),Am.setAttribute("uv",new Dl(r,2,3,!1))}this.geometry=Am,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.'),Tm.setFromMatrixScale(this.matrixWorld),w6.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Pm.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Tm.multiplyScalar(-Pm.z);const r=this.material.rotation;let i,s;r!==0&&(s=Math.cos(r),i=Math.sin(r));const o=this.center;o_(i_.set(-.5,-.5,0),Pm,o,Tm,i,s),o_(M0.set(.5,-.5,0),Pm,o,Tm,i,s),o_(s_.set(.5,.5,0),Pm,o,Tm,i,s),CD.set(0,0),wA.set(1,0),RD.set(1,1);let a=e.ray.intersectTriangle(i_,M0,s_,!1,w0);if(a===null&&(o_(M0.set(-.5,.5,0),Pm,o,Tm,i,s),wA.set(0,1),a=e.ray.intersectTriangle(i_,s_,M0,!1,w0),a===null))return;const l=e.ray.origin.distanceTo(w0);l<e.near||l>e.far||n.push({distance:l,point:w0.clone(),uv:Ks.getInterpolation(w0,i_,M0,s_,CD,wA,RD,new He),face:null,object:this})}copy(e,n){return super.copy(e,n),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function o_(t,e,n,r,i,s){Cm.subVectors(t,n).addScalar(.5).multiply(r),i!==void 0?(S0.x=s*Cm.x-i*Cm.y,S0.y=i*Cm.x+s*Cm.y):S0.copy(Cm),t.copy(e),t.x+=S0.x,t.y+=S0.y,t.applyMatrix4(w6)}const a_=new X,ND=new X;class M6 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){a_.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(a_);this.getObjectForDistance(i).raycast(e,n)}}update(e){const n=this.levels;if(n.length>1){a_.setFromMatrixPosition(e.matrixWorld),ND.setFromMatrixPosition(this.matrixWorld);const r=a_.distanceTo(ND)/e.zoom;n[0].object.visible=!0;let i,s;for(i=1,s=n.length;i<s;i++){let o=n[i].distance;if(n[i].object.visible&&(o-=o*n[i].hysteresis),r>=o)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 o=r[i];n.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return n}}const ID=new X,kD=new On,OD=new On,yye=new X,LD=new Ct,l_=new X,SA=new Hi,DD=new Ct,MA=new Jh;class tM extends xr{constructor(e,n){super(e,n),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=WP,this.bindMatrix=new Ct,this.bindMatrixInverse=new Ct,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new as),this.boundingBox.makeEmpty();const n=e.getAttribute("position");for(let r=0;r<n.count;r++)this.getVertexPosition(r,l_),this.boundingBox.expandByPoint(l_)}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,l_),this.boundingSphere.expandByPoint(l_)}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(),SA.copy(this.boundingSphere),SA.applyMatrix4(i),e.ray.intersectsSphere(SA)!==!1&&(DD.copy(i).invert(),MA.copy(e.ray).applyMatrix4(DD),!(this.boundingBox!==null&&MA.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,n,MA)))}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===WP?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===GV?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,n){const r=this.skeleton,i=this.geometry;kD.fromBufferAttribute(i.attributes.skinIndex,e),OD.fromBufferAttribute(i.attributes.skinWeight,e),ID.copy(n).applyMatrix4(this.bindMatrix),n.set(0,0,0);for(let s=0;s<4;s++){const o=OD.getComponent(s);if(o!==0){const a=kD.getComponent(s);LD.multiplyMatrices(r.bones[a].matrixWorld,r.boneInverses[a]),n.addScaledVector(yye.copy(ID).applyMatrix4(LD),o)}}return n.applyMatrix4(this.bindMatrixInverse)}}class nM extends mn{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Pl extends fr{constructor(e=null,n=1,r=1,i,s,o,a,l,c=ri,d=ri,f,p){super(null,o,a,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 UD=new Ct,xye=new Ct;class kd{constructor(e=[],n=[]){this.uuid=So(),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 Ct)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,n=this.bones.length;e<n;e++){const r=new Ct;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,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:xye;UD.multiplyMatrices(a,n[s]),UD.toArray(r,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new kd(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,Qs);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 o=n[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),o=new nM),this.bones.push(o),this.boneInverses.push(new Ct().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 o=n[i];e.bones.push(o.uuid);const a=r[i];e.boneInverses.push(a.toArray())}return e}}class Hh 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 Rm=new Ct,jD=new Ct,c_=[],FD=new as,bye=new Ct,E0=new xr,A0=new Hi;class LR extends xr{constructor(e,n,r){super(e,n),this.isInstancedMesh=!0,this.instanceMatrix=new Hh(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,bye)}computeBoundingBox(){const e=this.geometry,n=this.count;this.boundingBox===null&&(this.boundingBox=new as),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let r=0;r<n;r++)this.getMatrixAt(r,Rm),FD.copy(e.boundingBox).applyMatrix4(Rm),this.boundingBox.union(FD)}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,Rm),A0.copy(e.boundingSphere).applyMatrix4(Rm),this.boundingSphere.union(A0)}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,o=e*s+1;for(let a=0;a<r.length;a++)r[a]=i[o+a]}raycast(e,n){const r=this.matrixWorld,i=this.count;if(E0.geometry=this.geometry,E0.material=this.material,E0.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),A0.copy(this.boundingSphere),A0.applyMatrix4(r),e.ray.intersectsSphere(A0)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,Rm),jD.multiplyMatrices(r,Rm),E0.matrixWorld=jD,E0.raycast(e,c_);for(let o=0,a=c_.length;o<a;o++){const l=c_[o];l.instanceId=s,l.object=this,n.push(l)}c_.length=0}}setColorAt(e,n){this.instanceColor===null&&(this.instanceColor=new Hh(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,$S,Qs));const s=this.morphTexture.source.data.data;let o=0;for(let c=0;c<r.length;c++)o+=r[c];const a=this.geometry.morphTargetsRelative?1:1-o,l=i*e;s[l]=a,s.set(r,l+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}function _ye(t,e){return t.z-e.z}function wye(t,e){return e.z-t.z}class Sye{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 o=i[this.index];s.push(o),this.index++,o.start=e.start,o.count=e.count,o.z=n,o.index=r}reset(){this.list.length=0,this.index=0}}const Zu=new Ct,EA=new Ct,Mye=new Ct,Eye=new ct(1,1,1),zD=new Ct,AA=new fx,u_=new as,Of=new Hi,T0=new X,BD=new X,Aye=new X,TA=new Sye,ts=new xr,d_=[];function Tye(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 o=0;o<r;o++)e.setComponent(s+n,o,t.getComponent(s,o))}else e.array.set(t.array,n*r);e.needsUpdate=!0}class E6 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,Qs);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,lx,Qc);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,Qs);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 o=e.getAttribute(s),{array:a,itemSize:l,normalized:c}=o,d=new a.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 as);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,Zu),this.getBoundingBoxAt(s,u_).applyMatrix4(Zu),e.union(u_)}}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,Zu),this.getBoundingSphereAt(s,Of).applyMatrix4(Zu),e.union(Of)}}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,o=s.image.data;Mye.toArray(o,i*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(Eye.toArray(a.image.data,i*4),a.needsUpdate=!0),i}addGeometry(e,n=-1,r=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const o=this._reservedRanges,a=this._drawRanges,l=this._bounds;this._geometryCount!==0&&(s=o[o.length-1]),n===-1?i.vertexCount=e.getAttribute("position").count:i.vertexCount=n,s===null?i.vertexStart=0:i.vertexStart=s.vertexStart+s.vertexCount;const c=e.getIndex(),d=c!==null;if(d&&(r===-1?i.indexCount=c.count:i.indexCount=r,s===null?i.indexStart=0:i.indexStart=s.indexStart+s.indexCount),i.indexStart!==-1&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const f=this._geometryCount;return this._geometryCount++,o.push(i),a.push({start:d?i.indexStart:i.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new as,sphereInitialized:!1,sphere:new Hi}),this.setGeometryAt(f,e),f}setGeometryAt(e,n){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(n);const r=this.geometry,i=r.getIndex()!==null,s=r.getIndex(),o=n.getIndex(),a=this._reservedRanges[e];if(i&&o.count>a.indexCount||n.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,c=a.vertexCount;for(const y in r.attributes){const x=n.getAttribute(y),S=r.getAttribute(y);Tye(x,S,l);const w=x.itemSize;for(let _=x.count,E=c;_<E;_++){const T=l+_;for(let P=0;P<w;P++)S.setComponent(T,P,0)}S.needsUpdate=!0,S.addUpdateRange(l*w,c*w)}if(i){const y=a.indexStart;for(let x=0;x<o.count;x++)s.setX(y+x,l+o.getX(x));for(let x=o.count,S=a.indexCount;x<S;x++)s.setX(y+x,l);s.needsUpdate=!0,s.addUpdateRange(y,a.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?o.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 o=s.index,a=s.attributes.position,l=this._drawRanges[e];for(let c=l.start,d=l.start+l.count;c<d;c++){let f=c;o&&(f=o.getX(f)),i.expandByPoint(T0.fromBufferAttribute(a,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,u_),u_.getCenter(i.center);const o=s.index,a=s.attributes.position,l=this._drawRanges[e];let c=0;for(let d=l.start,f=l.start+l.count;d<f;d++){let p=d;o&&(p=o.getX(p)),T0.fromBufferAttribute(a,p),c=Math.max(c,i.center.distanceToSquared(T0))}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,o=this.geometry;ts.material=this.material,ts.geometry.index=o.index,ts.geometry.attributes=o.attributes,ts.geometry.boundingBox===null&&(ts.geometry.boundingBox=new as),ts.geometry.boundingSphere===null&&(ts.geometry.boundingSphere=new Hi);for(let a=0,l=r.length;a<l;a++){if(!r[a].visible||!r[a].active)continue;const c=r[a].geometryIndex,d=i[c];ts.geometry.setDrawRange(d.start,d.count),this.getMatrixAt(a,ts.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,ts.geometry.boundingBox),this.getBoundingSphereAt(c,ts.geometry.boundingSphere),ts.raycast(e,d_);for(let f=0,p=d_.length;f<p;f++){const y=d_[f];y.object=this,y.batchId=a,n.push(y)}d_.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 o=i.getIndex(),a=o===null?1:o.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&&(zD.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),AA.setFromProjectionMatrix(zD,e.coordinateSystem));let S=0;if(this.sortObjects){EA.copy(this.matrixWorld).invert(),T0.setFromMatrixPosition(r.matrixWorld).applyMatrix4(EA),BD.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(EA);for(let E=0,T=l.length;E<T;E++)if(l[E].visible&&l[E].active){const P=l[E].geometryIndex;this.getMatrixAt(E,Zu),this.getBoundingSphereAt(P,Of).applyMatrix4(Zu);let O=!1;if(p&&(O=!AA.intersectsSphere(Of)),!O){const N=Aye.subVectors(Of.center,T0).dot(BD);TA.push(f[P],N,E)}}const w=TA.list,_=this.customSort;_===null?w.sort(s.transparent?wye:_ye):_.call(this,w,r);for(let E=0,T=w.length;E<T;E++){const P=w[E];c[S]=P.start*a,d[S]=P.count,x[S]=P.index,S++}TA.reset()}else for(let w=0,_=l.length;w<_;w++)if(l[w].visible&&l[w].active){const E=l[w].geometryIndex;let T=!1;if(p&&(this.getMatrixAt(w,Zu),this.getBoundingSphereAt(E,Of).applyMatrix4(Zu),T=!AA.intersectsSphere(Of)),!T){const P=f[E];c[S]=P.start*a,d[S]=P.count,x[S]=w,S++}}y.needsUpdate=!0,this._multiDrawCount=S,this._visibilityChanged=!1}onBeforeShadow(e,n,r,i,s,o){this.onBeforeRender(e,null,i,s,o)}}class $r extends Gr{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new ct(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 k1=new X,O1=new X,HD=new Ct,P0=new Jh,f_=new Hi,PA=new X,VD=new X;class Ul 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++)k1.fromBufferAttribute(n,i-1),O1.fromBufferAttribute(n,i),r[i]=r[i-1],r[i]+=k1.distanceTo(O1);e.setAttribute("lineDistance",new Lt(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,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),f_.copy(r.boundingSphere),f_.applyMatrix4(i),f_.radius+=s,e.ray.intersectsSphere(f_)===!1)return;HD.copy(i).invert(),P0.copy(e.ray).applyMatrix4(HD);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,d=r.index,p=r.attributes.position;if(d!==null){const y=Math.max(0,o.start),x=Math.min(d.count,o.start+o.count);for(let S=y,w=x-1;S<w;S+=c){const _=d.getX(S),E=d.getX(S+1),T=h_(this,e,P0,l,_,E);T&&n.push(T)}if(this.isLineLoop){const S=d.getX(x-1),w=d.getX(y),_=h_(this,e,P0,l,S,w);_&&n.push(_)}}else{const y=Math.max(0,o.start),x=Math.min(p.count,o.start+o.count);for(let S=y,w=x-1;S<w;S+=c){const _=h_(this,e,P0,l,S,S+1);_&&n.push(_)}if(this.isLineLoop){const S=h_(this,e,P0,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,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function h_(t,e,n,r,i,s){const o=t.geometry.attributes.position;if(k1.fromBufferAttribute(o,i),O1.fromBufferAttribute(o,s),n.distanceSqToSegment(k1,O1,PA,VD)>r)return;PA.applyMatrix4(t.matrixWorld);const l=e.ray.origin.distanceTo(PA);if(!(l<e.near||l>e.far))return{distance:l,point:VD.clone().applyMatrix4(t.matrixWorld),index:i,face:null,faceIndex:null,barycoord:null,object:t}}const GD=new X,WD=new X;class eo extends Ul{constructor(e,n){super(e,n),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,r=[];for(let i=0,s=n.count;i<s;i+=2)GD.fromBufferAttribute(n,i),WD.fromBufferAttribute(n,i+1),r[i]=i===0?0:r[i-1],r[i+1]=r[i]+GD.distanceTo(WD);e.setAttribute("lineDistance",new Lt(r,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class DR extends Ul{constructor(e,n){super(e,n),this.isLineLoop=!0,this.type="LineLoop"}}class rM extends Gr{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new ct(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 $D=new Ct,ZP=new Jh,p_=new Hi,m_=new X;class UR extends mn{constructor(e=new Yt,n=new rM){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,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),p_.copy(r.boundingSphere),p_.applyMatrix4(i),p_.radius+=s,e.ray.intersectsSphere(p_)===!1)return;$D.copy(i).invert(),ZP.copy(e.ray).applyMatrix4($D);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=r.index,f=r.attributes.position;if(c!==null){const p=Math.max(0,o.start),y=Math.min(c.count,o.start+o.count);for(let x=p,S=y;x<S;x++){const w=c.getX(x);m_.fromBufferAttribute(f,w),XD(m_,w,l,i,e,n,this)}}else{const p=Math.max(0,o.start),y=Math.min(f.count,o.start+o.count);for(let x=p,S=y;x<S;x++)m_.fromBufferAttribute(f,x),XD(m_,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,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function XD(t,e,n,r,i,s,o){const a=ZP.distanceSqToPoint(t);if(a<n){const l=new X;ZP.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(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class Pye extends fr{constructor(e,n,r,i,s,o,a,l,c){super(e,n,r,i,s,o,a,l,c),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Cr,this.magFilter=s!==void 0?s:Cr,this.generateMipmaps=!1;const d=this;function f(){d.needsUpdate=!0,e.requestVideoFrameCallback(f)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(f)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class Cye 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 iM extends fr{constructor(e,n,r,i,s,o,a,l,c,d,f,p){super(null,o,a,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 Rye extends iM{constructor(e,n,r,i,s,o){super(e,n,r,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=_o,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Nye extends iM{constructor(e,n,r){super(void 0,e[0].width,e[0].height,n,r,Zc),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class Iye extends fr{constructor(e,n,r,i,s,o,a,l,c){super(e,n,r,i,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Xa{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,n){const r=this.getUtoTmapping(e);return this.getPoint(r,n)}getPoints(e=5){const n=[];for(let r=0;r<=e;r++)n.push(this.getPoint(r/e));return n}getSpacedPoints(e=5){const n=[];for(let r=0;r<=e;r++)n.push(this.getPointAt(r/e));return n}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const n=[];let r,i=this.getPoint(0),s=0;n.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(i),n.push(s),i=r;return this.cacheArcLengths=n,n}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,n){const r=this.getLengths();let i=0;const s=r.length;let o;n?o=n:o=e*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=r[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const d=r[i],p=r[i+1]-d,y=(o-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 o=this.getPoint(i),a=this.getPoint(s),l=n||(o.isVector2?new He:new X);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,n){const r=this.getUtoTmapping(e);return this.getTangent(r,n)}computeFrenetFrames(e,n){const r=new X,i=[],s=[],o=[],a=new X,l=new Ct;for(let y=0;y<=e;y++){const x=y/e;i[y]=this.getTangentAt(x,new X)}s[0]=new X,o[0]=new X;let c=Number.MAX_VALUE;const d=Math.abs(i[0].x),f=Math.abs(i[0].y),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),a.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let y=1;y<=e;y++){if(s[y]=s[y-1].clone(),o[y]=o[y-1].clone(),a.crossVectors(i[y-1],i[y]),a.length()>Number.EPSILON){a.normalize();const x=Math.acos(Tr(i[y-1].dot(i[y]),-1,1));s[y].applyMatrix4(l.makeRotationAxis(a,x))}o[y].crossVectors(i[y],s[y])}if(n===!0){let y=Math.acos(Tr(s[0].dot(s[e]),-1,1));y/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(y=-y);for(let x=1;x<=e;x++)s[x].applyMatrix4(l.makeRotationAxis(i[x],y*x)),o[x].crossVectors(i[x],s[x])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class sM extends Xa{constructor(e=0,n=0,r=1,i=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=n,this.xRadius=r,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,n=new He){const r=n,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(o?s=0:s=i),this.aClockwise===!0&&!o&&(s===i?s=-i:s=s-i);const a=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);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 A6 extends sM{constructor(e,n,r,i,s,o){super(e,n,r,r,i,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function jR(){let t=0,e=0,n=0,r=0;function i(s,o,a,l){t=s,e=a,n=-3*s+3*o-2*a-l,r=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){i(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,d,f){let p=(o-s)/c-(a-s)/(c+d)+(a-o)/d,y=(a-o)/d-(l-o)/(d+f)+(l-a)/f;p*=d,y*=d,i(o,a,p,y)},calc:function(s){const o=s*s,a=o*s;return t+e*s+n*o+r*a}}}const g_=new X,CA=new jR,RA=new jR,NA=new jR;class T6 extends Xa{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 X){const r=n,i=this.points,s=i.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,d;this.closed||a>0?c=i[(a-1)%s]:(g_.subVectors(i[0],i[1]).add(i[0]),c=g_);const f=i[a%s],p=i[(a+1)%s];if(this.closed||a+2<s?d=i[(a+2)%s]:(g_.subVectors(i[s-1],i[s-2]).add(i[s-1]),d=g_),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),CA.initNonuniformCatmullRom(c.x,f.x,p.x,d.x,x,S,w),RA.initNonuniformCatmullRom(c.y,f.y,p.y,d.y,x,S,w),NA.initNonuniformCatmullRom(c.z,f.z,p.z,d.z,x,S,w)}else this.curveType==="catmullrom"&&(CA.initCatmullRom(c.x,f.x,p.x,d.x,this.tension),RA.initCatmullRom(c.y,f.y,p.y,d.y,this.tension),NA.initCatmullRom(c.z,f.z,p.z,d.z,this.tension));return r.set(CA.calc(l),RA.calc(l),NA.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 X().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function qD(t,e,n,r,i){const s=(r-e)*.5,o=(i-n)*.5,a=t*t,l=t*a;return(2*n-2*r+s+o)*l+(-3*n+3*r-2*s-o)*a+s*t+n}function kye(t,e){const n=1-t;return n*n*e}function Oye(t,e){return 2*(1-t)*t*e}function Lye(t,e){return t*t*e}function ny(t,e,n,r){return kye(t,e)+Oye(t,n)+Lye(t,r)}function Dye(t,e){const n=1-t;return n*n*n*e}function Uye(t,e){const n=1-t;return 3*n*n*t*e}function jye(t,e){return 3*(1-t)*t*t*e}function Fye(t,e){return t*t*t*e}function ry(t,e,n,r,i){return Dye(t,e)+Uye(t,n)+jye(t,r)+Fye(t,i)}class FR extends Xa{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,o=this.v2,a=this.v3;return r.set(ry(e,i.x,s.x,o.x,a.x),ry(e,i.y,s.y,o.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.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 P6 extends Xa{constructor(e=new X,n=new X,r=new X,i=new X){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=n,this.v2=r,this.v3=i}getPoint(e,n=new X){const r=n,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(ry(e,i.x,s.x,o.x,a.x),ry(e,i.y,s.y,o.y,a.y),ry(e,i.z,s.z,o.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.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 zR extends Xa{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 C6 extends Xa{constructor(e=new X,n=new X){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=n}getPoint(e,n=new X){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 X){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 BR extends Xa{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,o=this.v2;return r.set(ny(e,i.x,s.x,o.x),ny(e,i.y,s.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}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 HR extends Xa{constructor(e=new X,n=new X,r=new X){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=n,this.v2=r}getPoint(e,n=new X){const r=n,i=this.v0,s=this.v1,o=this.v2;return r.set(ny(e,i.x,s.x,o.x),ny(e,i.y,s.y,o.y),ny(e,i.z,s.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}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 VR extends Xa{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,o=Math.floor(s),a=s-o,l=i[o===0?o:o-1],c=i[o],d=i[o>i.length-2?i.length-1:o+1],f=i[o>i.length-3?i.length-1:o+2];return r.set(qD(a,l.x,c.x,d.x,f.x),qD(a,l.y,c.y,d.y,f.y)),r}copy(e){super.copy(e),this.points=[];for(let n=0,r=e.points.length;n<r;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 L1=Object.freeze({__proto__:null,ArcCurve:A6,CatmullRomCurve3:T6,CubicBezierCurve:FR,CubicBezierCurve3:P6,EllipseCurve:sM,LineCurve:zR,LineCurve3:C6,QuadraticBezierCurve:BR,QuadraticBezierCurve3:HR,SplineCurve:VR});class R6 extends Xa{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 L1[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 o=i[s]-r,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,n)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let n=0;for(let r=0,i=this.curves.length;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 o=s[i],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);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 L1[i.type]().fromJSON(i))}return this}}class Oy extends R6{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 zR(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 BR(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,o){const a=new FR(this.currentPoint.clone(),new He(e,n),new He(r,i),new He(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const n=[this.currentPoint.clone()].concat(e),r=new VR(n);return this.curves.push(r),this.currentPoint.copy(e[e.length-1]),this}arc(e,n,r,i,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,n+l,r,i,s,o),this}absarc(e,n,r,i,s,o){return this.absellipse(e,n,r,r,i,s,o),this}ellipse(e,n,r,i,s,o,a,l){const c=this.currentPoint.x,d=this.currentPoint.y;return this.absellipse(e+c,n+d,r,i,s,o,a,l),this}absellipse(e,n,r,i,s,o,a,l){const c=new sM(e,n,r,i,s,o,a,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 hx 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=[],o=[],a=[],l=[],c=[],d=1/n,f=new X,p=new He,y=new X,x=new X,S=new X;let w=0,_=0;for(let E=0;E<=e.length-1;E++)switch(E){case 0:w=e[E+1].x-e[E].x,_=e[E+1].y-e[E].y,y.x=_*1,y.y=-w,y.z=_*0,S.copy(y),y.normalize(),l.push(y.x,y.y,y.z);break;case e.length-1:l.push(S.x,S.y,S.z);break;default:w=e[E+1].x-e[E].x,_=e[E+1].y-e[E].y,y.x=_*1,y.y=-w,y.z=_*0,x.copy(y),y.x+=S.x,y.y+=S.y,y.z+=S.z,y.normalize(),l.push(y.x,y.y,y.z),S.copy(x)}for(let E=0;E<=n;E++){const T=r+E*d*i,P=Math.sin(T),O=Math.cos(T);for(let N=0;N<=e.length-1;N++){f.x=e[N].x*P,f.y=e[N].y,f.z=e[N].x*O,o.push(f.x,f.y,f.z),p.x=E/n,p.y=N/(e.length-1),a.push(p.x,p.y);const D=l[3*N+0]*P,z=l[3*N+1],G=l[3*N+0]*O;c.push(D,z,G)}}for(let E=0;E<n;E++)for(let T=0;T<e.length-1;T++){const P=T+E*e.length,O=P,N=P+e.length,D=P+e.length+1,z=P+1;s.push(O,N,z),s.push(D,z,N)}this.setIndex(s),this.setAttribute("position",new Lt(o,3)),this.setAttribute("uv",new Lt(a,2)),this.setAttribute("normal",new Lt(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new hx(e.points,e.segments,e.phiStart,e.phiLength)}}class oM extends hx{constructor(e=1,n=1,r=4,i=8){const s=new Oy;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 oM(e.radius,e.length,e.capSegments,e.radialSegments)}}class aM 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=[],o=[],a=[],l=[],c=new X,d=new He;o.push(0,0,0),a.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),o.push(c.x,c.y,c.z),a.push(0,0,1),d.x=(o[p]/e+1)/2,d.y=(o[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 Lt(o,3)),this.setAttribute("normal",new Lt(a,3)),this.setAttribute("uv",new Lt(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new aM(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class ov extends Yt{constructor(e=1,n=1,r=1,i=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:n,height:r,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:a,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 _=0;E(),o===!1&&(e>0&&T(!0),n>0&&T(!1)),this.setIndex(d),this.setAttribute("position",new Lt(f,3)),this.setAttribute("normal",new Lt(p,3)),this.setAttribute("uv",new Lt(y,2));function E(){const P=new X,O=new X;let N=0;const D=(n-e)/r;for(let z=0;z<=s;z++){const G=[],k=z/s,j=k*(n-e)+e;for(let H=0;H<=i;H++){const ee=H/i,te=ee*l+a,he=Math.sin(te),se=Math.cos(te);O.x=j*he,O.y=-k*r+w,O.z=j*se,f.push(O.x,O.y,O.z),P.set(he,D,se).normalize(),p.push(P.x,P.y,P.z),y.push(ee,1-k),G.push(x++)}S.push(G)}for(let z=0;z<i;z++)for(let G=0;G<s;G++){const k=S[G][z],j=S[G+1][z],H=S[G+1][z+1],ee=S[G][z+1];e>0&&(d.push(k,j,ee),N+=3),n>0&&(d.push(j,H,ee),N+=3)}c.addGroup(_,N,0),_+=N}function T(P){const O=x,N=new He,D=new X;let z=0;const G=P===!0?e:n,k=P===!0?1:-1;for(let H=1;H<=i;H++)f.push(0,w*k,0),p.push(0,k,0),y.push(.5,.5),x++;const j=x;for(let H=0;H<=i;H++){const te=H/i*l+a,he=Math.cos(te),se=Math.sin(te);D.x=G*se,D.y=w*k,D.z=G*he,f.push(D.x,D.y,D.z),p.push(0,k,0),N.x=he*.5+.5,N.y=se*.5*k+.5,y.push(N.x,N.y),x++}for(let H=0;H<i;H++){const ee=O+H,te=j+H;P===!0?d.push(te,te+1,ee):d.push(te+1,te,ee),z+=3}c.addGroup(_,z,P===!0?1:2),_+=z}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ov(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class lM extends ov{constructor(e=1,n=1,r=32,i=1,s=!1,o=0,a=Math.PI*2){super(0,e,n,r,i,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:n,radialSegments:r,heightSegments:i,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new lM(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Od 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=[],o=[];a(i),c(r),d(),this.setAttribute("position",new Lt(s,3)),this.setAttribute("normal",new Lt(s.slice(),3)),this.setAttribute("uv",new Lt(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(E){const T=new X,P=new X,O=new X;for(let N=0;N<n.length;N+=3)y(n[N+0],T),y(n[N+1],P),y(n[N+2],O),l(T,P,O,E)}function l(E,T,P,O){const N=O+1,D=[];for(let z=0;z<=N;z++){D[z]=[];const G=E.clone().lerp(P,z/N),k=T.clone().lerp(P,z/N),j=N-z;for(let H=0;H<=j;H++)H===0&&z===N?D[z][H]=G:D[z][H]=G.clone().lerp(k,H/j)}for(let z=0;z<N;z++)for(let G=0;G<2*(N-z)-1;G++){const k=Math.floor(G/2);G%2===0?(p(D[z][k+1]),p(D[z+1][k]),p(D[z][k])):(p(D[z][k+1]),p(D[z+1][k+1]),p(D[z+1][k]))}}function c(E){const T=new X;for(let P=0;P<s.length;P+=3)T.x=s[P+0],T.y=s[P+1],T.z=s[P+2],T.normalize().multiplyScalar(E),s[P+0]=T.x,s[P+1]=T.y,s[P+2]=T.z}function d(){const E=new X;for(let T=0;T<s.length;T+=3){E.x=s[T+0],E.y=s[T+1],E.z=s[T+2];const P=w(E)/2/Math.PI+.5,O=_(E)/Math.PI+.5;o.push(P,1-O)}x(),f()}function f(){for(let E=0;E<o.length;E+=6){const T=o[E+0],P=o[E+2],O=o[E+4],N=Math.max(T,P,O),D=Math.min(T,P,O);N>.9&&D<.1&&(T<.2&&(o[E+0]+=1),P<.2&&(o[E+2]+=1),O<.2&&(o[E+4]+=1))}}function p(E){s.push(E.x,E.y,E.z)}function y(E,T){const P=E*3;T.x=e[P+0],T.y=e[P+1],T.z=e[P+2]}function x(){const E=new X,T=new X,P=new X,O=new X,N=new He,D=new He,z=new He;for(let G=0,k=0;G<s.length;G+=9,k+=6){E.set(s[G+0],s[G+1],s[G+2]),T.set(s[G+3],s[G+4],s[G+5]),P.set(s[G+6],s[G+7],s[G+8]),N.set(o[k+0],o[k+1]),D.set(o[k+2],o[k+3]),z.set(o[k+4],o[k+5]),O.copy(E).add(T).add(P).divideScalar(3);const j=w(O);S(N,k+0,E,j),S(D,k+2,T,j),S(z,k+4,P,j)}}function S(E,T,P,O){O<0&&E.x===1&&(o[T]=E.x-1),P.x===0&&P.z===0&&(o[T]=O/2/Math.PI+.5)}function w(E){return Math.atan2(E.z,-E.x)}function _(E){return Math.atan2(-E.y,Math.sqrt(E.x*E.x+E.z*E.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Od(e.vertices,e.indices,e.radius,e.details)}}class cM extends Od{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],o=[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,o,e,n),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:n}}static fromJSON(e){return new cM(e.radius,e.detail)}}const v_=new X,y_=new X,IA=new X,x_=new Ks;class N6 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(Th*n),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,c=[0,0,0],d=["a","b","c"],f=new Array(3),p={},y=[];for(let x=0;x<l;x+=3){o?(c[0]=o.getX(x),c[1]=o.getX(x+1),c[2]=o.getX(x+2)):(c[0]=x,c[1]=x+1,c[2]=x+2);const{a:S,b:w,c:_}=x_;if(S.fromBufferAttribute(a,c[0]),w.fromBufferAttribute(a,c[1]),_.fromBufferAttribute(a,c[2]),x_.getNormal(IA),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(_.x*i)},${Math.round(_.y*i)},${Math.round(_.z*i)}`,!(f[0]===f[1]||f[1]===f[2]||f[2]===f[0]))for(let E=0;E<3;E++){const T=(E+1)%3,P=f[E],O=f[T],N=x_[d[E]],D=x_[d[T]],z=`${P}_${O}`,G=`${O}_${P}`;G in p&&p[G]?(IA.dot(p[G].normal)<=s&&(y.push(N.x,N.y,N.z),y.push(D.x,D.y,D.z)),p[G]=null):z in p||(p[z]={index0:c[E],index1:c[T],normal:IA.clone()})}}for(const x in p)if(p[x]){const{index0:S,index1:w}=p[x];v_.fromBufferAttribute(a,S),y_.fromBufferAttribute(a,w),y.push(v_.x,v_.y,v_.z),y.push(y_.x,y_.y,y_.z)}this.setAttribute("position",new Lt(y,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Ch extends Oy{constructor(e){super(e),this.uuid=So(),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 Oy().fromJSON(i))}return this}}const zye={triangulate:function(t,e,n=2){const r=e&&e.length,i=r?e[0]*n:t.length;let s=I6(t,0,i,n,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c,d,f,p,y;if(r&&(s=Wye(t,e,s,n)),t.length>80*n){a=c=t[0],l=d=t[1];for(let x=n;x<i;x+=n)f=t[x],p=t[x+1],f<a&&(a=f),p<l&&(l=p),f>c&&(c=f),p>d&&(d=p);y=Math.max(c-a,d-l),y=y!==0?32767/y:0}return Ly(s,o,n,a,l,y,0),o}};function I6(t,e,n,r,i){let s,o;if(i===nxe(t,e,n,r)>0)for(s=e;s<n;s+=r)o=KD(s,t[s],t[s+1],o);else for(s=n-r;s>=e;s-=r)o=KD(s,t[s],t[s+1],o);return o&&uM(o,o.next)&&(Uy(o),o=o.next),o}function Vh(t,e){if(!t)return t;e||(e=t);let n=t,r;do if(r=!1,!n.steiner&&(uM(n,n.next)||yr(n.prev,n,n.next)===0)){if(Uy(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function Ly(t,e,n,r,i,s,o){if(!t)return;!o&&s&&Yye(t,r,i,s);let a=t,l,c;for(;t.prev!==t.next;){if(l=t.prev,c=t.next,s?Hye(t,r,i,s):Bye(t)){e.push(l.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),Uy(t),t=c.next,a=c.next;continue}if(t=c,t===a){o?o===1?(t=Vye(Vh(t),e,n),Ly(t,e,n,r,i,s,2)):o===2&&Gye(t,e,n,r,i,s):Ly(Vh(t),e,n,r,i,s,1);break}}}function Bye(t){const e=t.prev,n=t,r=t.next;if(yr(e,n,r)>=0)return!1;const i=e.x,s=n.x,o=r.x,a=e.y,l=n.y,c=r.y,d=i<s?i<o?i:o:s<o?s:o,f=a<l?a<c?a:c:l<c?l:c,p=i>s?i>o?i:o:s>o?s:o,y=a>l?a>c?a:c:l>c?l:c;let x=r.next;for(;x!==e;){if(x.x>=d&&x.x<=p&&x.y>=f&&x.y<=y&&qm(i,a,s,l,o,c,x.x,x.y)&&yr(x.prev,x,x.next)>=0)return!1;x=x.next}return!0}function Hye(t,e,n,r){const i=t.prev,s=t,o=t.next;if(yr(i,s,o)>=0)return!1;const a=i.x,l=s.x,c=o.x,d=i.y,f=s.y,p=o.y,y=a<l?a<c?a:c:l<c?l:c,x=d<f?d<p?d:p:f<p?f:p,S=a>l?a>c?a:c:l>c?l:c,w=d>f?d>p?d:p:f>p?f:p,_=QP(y,x,e,n,r),E=QP(S,w,e,n,r);let T=t.prevZ,P=t.nextZ;for(;T&&T.z>=_&&P&&P.z<=E;){if(T.x>=y&&T.x<=S&&T.y>=x&&T.y<=w&&T!==i&&T!==o&&qm(a,d,l,f,c,p,T.x,T.y)&&yr(T.prev,T,T.next)>=0||(T=T.prevZ,P.x>=y&&P.x<=S&&P.y>=x&&P.y<=w&&P!==i&&P!==o&&qm(a,d,l,f,c,p,P.x,P.y)&&yr(P.prev,P,P.next)>=0))return!1;P=P.nextZ}for(;T&&T.z>=_;){if(T.x>=y&&T.x<=S&&T.y>=x&&T.y<=w&&T!==i&&T!==o&&qm(a,d,l,f,c,p,T.x,T.y)&&yr(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;P&&P.z<=E;){if(P.x>=y&&P.x<=S&&P.y>=x&&P.y<=w&&P!==i&&P!==o&&qm(a,d,l,f,c,p,P.x,P.y)&&yr(P.prev,P,P.next)>=0)return!1;P=P.nextZ}return!0}function Vye(t,e,n){let r=t;do{const i=r.prev,s=r.next.next;!uM(i,s)&&k6(i,r,r.next,s)&&Dy(i,s)&&Dy(s,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(s.i/n|0),Uy(r),Uy(r.next),r=t=s),r=r.next}while(r!==t);return Vh(r)}function Gye(t,e,n,r,i,s){let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Jye(o,a)){let l=O6(o,a);o=Vh(o,o.next),l=Vh(l,l.next),Ly(o,e,n,r,i,s,0),Ly(l,e,n,r,i,s,0);return}a=a.next}o=o.next}while(o!==t)}function Wye(t,e,n,r){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*r,l=s<o-1?e[s+1]*r:t.length,c=I6(t,a,l,r,!1),c===c.next&&(c.steiner=!0),i.push(Qye(c));for(i.sort($ye),s=0;s<i.length;s++)n=Xye(i[s],n);return n}function $ye(t,e){return t.x-e.x}function Xye(t,e){const n=qye(t,e);if(!n)return e;const r=O6(n,t);return Vh(r,r.next),Vh(n,n.next)}function qye(t,e){let n=e,r=-1/0,i;const s=t.x,o=t.y;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){const p=n.x+(o-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 a=i,l=i.x,c=i.y;let d=1/0,f;n=i;do s>=n.x&&n.x>=l&&s!==n.x&&qm(o<c?s:r,o,l,c,o<c?r:s,o,n.x,n.y)&&(f=Math.abs(o-n.y)/(s-n.x),Dy(n,t)&&(f<d||f===d&&(n.x>i.x||n.x===i.x&&Kye(i,n)))&&(i=n,d=f)),n=n.next;while(n!==a);return i}function Kye(t,e){return yr(t.prev,t,e.prev)<0&&yr(e.next,t,t.next)<0}function Yye(t,e,n,r){let i=t;do i.z===0&&(i.z=QP(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,Zye(i)}function Zye(t){let e,n,r,i,s,o,a,l,c=1;do{for(n=t,t=null,s=null,o=0;n;){for(o++,r=n,a=0,e=0;e<c&&(a++,r=r.nextZ,!!r);e++);for(l=c;a>0||l>0&&r;)a!==0&&(l===0||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;n=r}s.nextZ=null,c*=2}while(o>1);return t}function QP(t,e,n,r,i){return t=(t-n)*i|0,e=(e-r)*i|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function Qye(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 qm(t,e,n,r,i,s,o,a){return(i-o)*(e-a)>=(t-o)*(s-a)&&(t-o)*(r-a)>=(n-o)*(e-a)&&(n-o)*(s-a)>=(i-o)*(r-a)}function Jye(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!exe(t,e)&&(Dy(t,e)&&Dy(e,t)&&txe(t,e)&&(yr(t.prev,t,e.prev)||yr(t,e.prev,e))||uM(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 uM(t,e){return t.x===e.x&&t.y===e.y}function k6(t,e,n,r){const i=__(yr(t,e,n)),s=__(yr(t,e,r)),o=__(yr(n,r,t)),a=__(yr(n,r,e));return!!(i!==s&&o!==a||i===0&&b_(t,n,e)||s===0&&b_(t,r,e)||o===0&&b_(n,t,r)||a===0&&b_(n,e,r))}function b_(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 __(t){return t>0?1:t<0?-1:0}function exe(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&&k6(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function Dy(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 txe(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 O6(t,e){const n=new JP(t.i,t.x,t.y),r=new JP(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,s.next=r,r.prev=s,r}function KD(t,e,n,r){const i=new JP(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Uy(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function JP(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function nxe(t,e,n,r){let i=0;for(let s=e,o=n-r;s<n;s+=r)i+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return i}class Cl{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 Cl.area(e)<0}static triangulateShape(e,n){const r=[],i=[],s=[];YD(e),ZD(r,e);let o=e.length;n.forEach(YD);for(let l=0;l<n.length;l++)i.push(o),o+=n[l].length,ZD(r,n[l]);const a=zye.triangulate(r,i);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function YD(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function ZD(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class dM extends Yt{constructor(e=new Ch([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 a=0,l=e.length;a<l;a++){const c=e[a];o(c)}this.setAttribute("position",new Lt(i,3)),this.setAttribute("uv",new Lt(s,2)),this.computeVertexNormals();function o(a){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 _=n.extrudePath,E=n.UVGenerator!==void 0?n.UVGenerator:rxe;let T,P=!1,O,N,D,z;_&&(T=_.getSpacedPoints(d),P=!0,p=!1,O=_.computeFrenetFrames(d,!1),N=new X,D=new X,z=new X),p||(w=0,y=0,x=0,S=0);const G=a.extractPoints(c);let k=G.shape;const j=G.holes;if(!Cl.isClockWise(k)){k=k.reverse();for(let ue=0,Z=j.length;ue<Z;ue++){const Ve=j[ue];Cl.isClockWise(Ve)&&(j[ue]=Ve.reverse())}}const ee=Cl.triangulateShape(k,j),te=k;for(let ue=0,Z=j.length;ue<Z;ue++){const Ve=j[ue];k=k.concat(Ve)}function he(ue,Z,Ve){return Z||console.error("THREE.ExtrudeGeometry: vec does not exist"),ue.clone().addScaledVector(Z,Ve)}const se=k.length,fe=ee.length;function B(ue,Z,Ve){let Le,re,Ce;const qe=ue.x-Z.x,Ze=ue.y-Z.y,Q=Ve.x-ue.x,W=Ve.y-ue.y,be=qe*qe+Ze*Ze,Ue=qe*W-Ze*Q;if(Math.abs(Ue)>Number.EPSILON){const ze=Math.sqrt(be),Fe=Math.sqrt(Q*Q+W*W),bt=Z.x-Ze/ze,rt=Z.y+qe/ze,ft=Ve.x-W/Fe,Xt=Ve.y+Q/Fe,Ke=((ft-bt)*W-(Xt-rt)*Q)/(qe*W-Ze*Q);Le=bt+qe*Ke-ue.x,re=rt+Ze*Ke-ue.y;const ne=Le*Le+re*re;if(ne<=2)return new He(Le,re);Ce=Math.sqrt(ne/2)}else{let ze=!1;qe>Number.EPSILON?Q>Number.EPSILON&&(ze=!0):qe<-Number.EPSILON?Q<-Number.EPSILON&&(ze=!0):Math.sign(Ze)===Math.sign(W)&&(ze=!0),ze?(Le=-Ze,re=qe,Ce=Math.sqrt(be)):(Le=qe,re=Ze,Ce=Math.sqrt(be/2))}return new He(Le/Ce,re/Ce)}const J=[];for(let ue=0,Z=te.length,Ve=Z-1,Le=ue+1;ue<Z;ue++,Ve++,Le++)Ve===Z&&(Ve=0),Le===Z&&(Le=0),J[ue]=B(te[ue],te[Ve],te[Le]);const Y=[];let V,q=J.concat();for(let ue=0,Z=j.length;ue<Z;ue++){const Ve=j[ue];V=[];for(let Le=0,re=Ve.length,Ce=re-1,qe=Le+1;Le<re;Le++,Ce++,qe++)Ce===re&&(Ce=0),qe===re&&(qe=0),V[Le]=B(Ve[Le],Ve[Ce],Ve[qe]);Y.push(V),q=q.concat(V)}for(let ue=0;ue<w;ue++){const Z=ue/w,Ve=y*Math.cos(Z*Math.PI/2),Le=x*Math.sin(Z*Math.PI/2)+S;for(let re=0,Ce=te.length;re<Ce;re++){const qe=he(te[re],J[re],Le);Ee(qe.x,qe.y,-Ve)}for(let re=0,Ce=j.length;re<Ce;re++){const qe=j[re];V=Y[re];for(let Ze=0,Q=qe.length;Ze<Q;Ze++){const W=he(qe[Ze],V[Ze],Le);Ee(W.x,W.y,-Ve)}}}const pe=x+S;for(let ue=0;ue<se;ue++){const Z=p?he(k[ue],q[ue],pe):k[ue];P?(D.copy(O.normals[0]).multiplyScalar(Z.x),N.copy(O.binormals[0]).multiplyScalar(Z.y),z.copy(T[0]).add(D).add(N),Ee(z.x,z.y,z.z)):Ee(Z.x,Z.y,0)}for(let ue=1;ue<=d;ue++)for(let Z=0;Z<se;Z++){const Ve=p?he(k[Z],q[Z],pe):k[Z];P?(D.copy(O.normals[ue]).multiplyScalar(Ve.x),N.copy(O.binormals[ue]).multiplyScalar(Ve.y),z.copy(T[ue]).add(D).add(N),Ee(z.x,z.y,z.z)):Ee(Ve.x,Ve.y,f/d*ue)}for(let ue=w-1;ue>=0;ue--){const Z=ue/w,Ve=y*Math.cos(Z*Math.PI/2),Le=x*Math.sin(Z*Math.PI/2)+S;for(let re=0,Ce=te.length;re<Ce;re++){const qe=he(te[re],J[re],Le);Ee(qe.x,qe.y,f+Ve)}for(let re=0,Ce=j.length;re<Ce;re++){const qe=j[re];V=Y[re];for(let Ze=0,Q=qe.length;Ze<Q;Ze++){const W=he(qe[Ze],V[Ze],Le);P?Ee(W.x,W.y+T[d-1].y,T[d-1].x+Ve):Ee(W.x,W.y,f+Ve)}}}ae(),ce();function ae(){const ue=i.length/3;if(p){let Z=0,Ve=se*Z;for(let Le=0;Le<fe;Le++){const re=ee[Le];$e(re[2]+Ve,re[1]+Ve,re[0]+Ve)}Z=d+w*2,Ve=se*Z;for(let Le=0;Le<fe;Le++){const re=ee[Le];$e(re[0]+Ve,re[1]+Ve,re[2]+Ve)}}else{for(let Z=0;Z<fe;Z++){const Ve=ee[Z];$e(Ve[2],Ve[1],Ve[0])}for(let Z=0;Z<fe;Z++){const Ve=ee[Z];$e(Ve[0]+se*d,Ve[1]+se*d,Ve[2]+se*d)}}r.addGroup(ue,i.length/3-ue,0)}function ce(){const ue=i.length/3;let Z=0;Se(te,Z),Z+=te.length;for(let Ve=0,Le=j.length;Ve<Le;Ve++){const re=j[Ve];Se(re,Z),Z+=re.length}r.addGroup(ue,i.length/3-ue,1)}function Se(ue,Z){let Ve=ue.length;for(;--Ve>=0;){const Le=Ve;let re=Ve-1;re<0&&(re=ue.length-1);for(let Ce=0,qe=d+w*2;Ce<qe;Ce++){const Ze=se*Ce,Q=se*(Ce+1),W=Z+Le+Ze,be=Z+re+Ze,Ue=Z+re+Q,ze=Z+Le+Q;Me(W,be,Ue,ze)}}}function Ee(ue,Z,Ve){l.push(ue),l.push(Z),l.push(Ve)}function $e(ue,Z,Ve){Ge(ue),Ge(Z),Ge(Ve);const Le=i.length/3,re=E.generateTopUV(r,i,Le-3,Le-2,Le-1);We(re[0]),We(re[1]),We(re[2])}function Me(ue,Z,Ve,Le){Ge(ue),Ge(Z),Ge(Le),Ge(Z),Ge(Ve),Ge(Le);const re=i.length/3,Ce=E.generateSideWallUV(r,i,re-6,re-3,re-2,re-1);We(Ce[0]),We(Ce[1]),We(Ce[3]),We(Ce[1]),We(Ce[2]),We(Ce[3])}function Ge(ue){i.push(l[ue*3+0]),i.push(l[ue*3+1]),i.push(l[ue*3+2])}function We(ue){s.push(ue.x),s.push(ue.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 ixe(n,r,e)}static fromJSON(e,n){const r=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=n[e.shapes[s]];r.push(a)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new L1[i.type]().fromJSON(i)),new dM(r,e.options)}}const rxe={generateTopUV:function(t,e,n,r,i){const s=e[n*3],o=e[n*3+1],a=e[r*3],l=e[r*3+1],c=e[i*3],d=e[i*3+1];return[new He(s,o),new He(a,l),new He(c,d)]},generateSideWallUV:function(t,e,n,r,i,s){const o=e[n*3],a=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],_=e[s*3+2];return Math.abs(a-d)<Math.abs(o-c)?[new He(o,1-l),new He(c,1-f),new He(p,1-x),new He(S,1-_)]:[new He(a,1-l),new He(d,1-f),new He(y,1-x),new He(w,1-_)]}};function ixe(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 fM extends Od{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 fM(e.radius,e.detail)}}class px extends Od{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 px(e.radius,e.detail)}}class hM extends Yt{constructor(e=.5,n=1,r=32,i=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:n,thetaSegments:r,phiSegments:i,thetaStart:s,thetaLength:o},r=Math.max(3,r),i=Math.max(1,i);const a=[],l=[],c=[],d=[];let f=e;const p=(n-e)/i,y=new X,x=new He;for(let S=0;S<=i;S++){for(let w=0;w<=r;w++){const _=s+w/r*o;y.x=f*Math.cos(_),y.y=f*Math.sin(_),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 _=0;_<r;_++){const E=_+w,T=E,P=E+r+1,O=E+r+2,N=E+1;a.push(T,P,N),a.push(P,O,N)}}this.setIndex(a),this.setAttribute("position",new Lt(l,3)),this.setAttribute("normal",new Lt(c,3)),this.setAttribute("uv",new Lt(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new hM(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class pM extends Yt{constructor(e=new Ch([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=[],o=[];let a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let d=0;d<e.length;d++)c(e[d]),this.addGroup(a,l,d),a+=l,l=0;this.setIndex(r),this.setAttribute("position",new Lt(i,3)),this.setAttribute("normal",new Lt(s,3)),this.setAttribute("uv",new Lt(o,2));function c(d){const f=i.length/3,p=d.extractPoints(n);let y=p.shape;const x=p.holes;Cl.isClockWise(y)===!1&&(y=y.reverse());for(let w=0,_=x.length;w<_;w++){const E=x[w];Cl.isClockWise(E)===!0&&(x[w]=E.reverse())}const S=Cl.triangulateShape(y,x);for(let w=0,_=x.length;w<_;w++){const E=x[w];y=y.concat(E)}for(let w=0,_=y.length;w<_;w++){const E=y[w];i.push(E.x,E.y,0),s.push(0,0,1),o.push(E.x,E.y)}for(let w=0,_=S.length;w<_;w++){const E=S[w],T=E[0]+f,P=E[1]+f,O=E[2]+f;r.push(T,P,O),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 sxe(n,e)}static fromJSON(e,n){const r=[];for(let i=0,s=e.shapes.length;i<s;i++){const o=n[e.shapes[i]];r.push(o)}return new pM(r,e.curveSegments)}}function sxe(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 mx extends Yt{constructor(e=1,n=32,r=16,i=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:n,heightSegments:r,phiStart:i,phiLength:s,thetaStart:o,thetaLength:a},n=Math.max(3,Math.floor(n)),r=Math.max(2,Math.floor(r));const l=Math.min(o+a,Math.PI);let c=0;const d=[],f=new X,p=new X,y=[],x=[],S=[],w=[];for(let _=0;_<=r;_++){const E=[],T=_/r;let P=0;_===0&&o===0?P=.5/n:_===r&&l===Math.PI&&(P=-.5/n);for(let O=0;O<=n;O++){const N=O/n;f.x=-e*Math.cos(i+N*s)*Math.sin(o+T*a),f.y=e*Math.cos(o+T*a),f.z=e*Math.sin(i+N*s)*Math.sin(o+T*a),x.push(f.x,f.y,f.z),p.copy(f).normalize(),S.push(p.x,p.y,p.z),w.push(N+P,1-T),E.push(c++)}d.push(E)}for(let _=0;_<r;_++)for(let E=0;E<n;E++){const T=d[_][E+1],P=d[_][E],O=d[_+1][E],N=d[_+1][E+1];(_!==0||o>0)&&y.push(T,P,N),(_!==r-1||l<Math.PI)&&y.push(P,O,N)}this.setIndex(y),this.setAttribute("position",new Lt(x,3)),this.setAttribute("normal",new Lt(S,3)),this.setAttribute("uv",new Lt(w,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new mx(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class mM extends Od{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 gM 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 o=[],a=[],l=[],c=[],d=new X,f=new X,p=new X;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),a.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,_=(i+1)*(y-1)+x,E=(i+1)*y+x;o.push(S,w,E),o.push(w,_,E)}this.setIndex(o),this.setAttribute("position",new Lt(a,3)),this.setAttribute("normal",new Lt(l,3)),this.setAttribute("uv",new Lt(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new gM(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class vM extends Yt{constructor(e=1,n=.4,r=64,i=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:n,tubularSegments:r,radialSegments:i,p:s,q:o},r=Math.floor(r),i=Math.floor(i);const a=[],l=[],c=[],d=[],f=new X,p=new X,y=new X,x=new X,S=new X,w=new X,_=new X;for(let T=0;T<=r;++T){const P=T/r*s*Math.PI*2;E(P,s,o,e,y),E(P+.01,s,o,e,x),w.subVectors(x,y),_.addVectors(x,y),S.crossVectors(w,_),_.crossVectors(S,w),S.normalize(),_.normalize();for(let O=0;O<=i;++O){const N=O/i*Math.PI*2,D=-n*Math.cos(N),z=n*Math.sin(N);f.x=y.x+(D*_.x+z*S.x),f.y=y.y+(D*_.y+z*S.y),f.z=y.z+(D*_.z+z*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(O/i)}}for(let T=1;T<=r;T++)for(let P=1;P<=i;P++){const O=(i+1)*(T-1)+(P-1),N=(i+1)*T+(P-1),D=(i+1)*T+P,z=(i+1)*(T-1)+P;a.push(O,N,z),a.push(N,D,z)}this.setIndex(a),this.setAttribute("position",new Lt(l,3)),this.setAttribute("normal",new Lt(c,3)),this.setAttribute("uv",new Lt(d,2));function E(T,P,O,N,D){const z=Math.cos(T),G=Math.sin(T),k=O/P*T,j=Math.cos(k);D.x=N*(2+j)*.5*z,D.y=N*(2+j)*G*.5,D.z=N*Math.sin(k)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new vM(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class yM extends Yt{constructor(e=new HR(new X(-1,-1,0),new X(-1,1,0),new X(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 o=e.computeFrenetFrames(n,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new X,l=new X,c=new He;let d=new X;const f=[],p=[],y=[],x=[];S(),this.setIndex(x),this.setAttribute("position",new Lt(f,3)),this.setAttribute("normal",new Lt(p,3)),this.setAttribute("uv",new Lt(y,2));function S(){for(let T=0;T<n;T++)w(T);w(s===!1?n:0),E(),_()}function w(T){d=e.getPointAt(T/n,d);const P=o.normals[T],O=o.binormals[T];for(let N=0;N<=i;N++){const D=N/i*Math.PI*2,z=Math.sin(D),G=-Math.cos(D);l.x=G*P.x+z*O.x,l.y=G*P.y+z*O.y,l.z=G*P.z+z*O.z,l.normalize(),p.push(l.x,l.y,l.z),a.x=d.x+r*l.x,a.y=d.y+r*l.y,a.z=d.z+r*l.z,f.push(a.x,a.y,a.z)}}function _(){for(let T=1;T<=n;T++)for(let P=1;P<=i;P++){const O=(i+1)*(T-1)+(P-1),N=(i+1)*T+(P-1),D=(i+1)*T+P,z=(i+1)*(T-1)+P;x.push(O,N,z),x.push(N,D,z)}}function E(){for(let T=0;T<=n;T++)for(let P=0;P<=i;P++)c.x=T/n,c.y=P/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 yM(new L1[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class L6 extends Yt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const n=[],r=new Set,i=new X,s=new X;if(e.index!==null){const o=e.attributes.position,a=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:a.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 _=a.getX(x+w),E=a.getX(x+(w+1)%3);i.fromBufferAttribute(o,_),s.fromBufferAttribute(o,E),QD(i,s,r)===!0&&(n.push(i.x,i.y,i.z),n.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){const d=3*a+c,f=3*a+(c+1)%3;i.fromBufferAttribute(o,d),s.fromBufferAttribute(o,f),QD(i,s,r)===!0&&(n.push(i.x,i.y,i.z),n.push(s.x,s.y,s.z))}}this.setAttribute("position",new Lt(n,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function QD(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 JD=Object.freeze({__proto__:null,BoxGeometry:ep,CapsuleGeometry:oM,CircleGeometry:aM,ConeGeometry:lM,CylinderGeometry:ov,DodecahedronGeometry:cM,EdgesGeometry:N6,ExtrudeGeometry:dM,IcosahedronGeometry:fM,LatheGeometry:hx,OctahedronGeometry:px,PlaneGeometry:iv,PolyhedronGeometry:Od,RingGeometry:hM,ShapeGeometry:pM,SphereGeometry:mx,TetrahedronGeometry:mM,TorusGeometry:gM,TorusKnotGeometry:vM,TubeGeometry:yM,WireframeGeometry:L6});class D6 extends Gr{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new ct(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 U6 extends Zo{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class gx extends Gr{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new ct(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 ct(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ou,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 ta extends gx{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 ct(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 ct(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new ct(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 j6 extends Gr{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ct(16777215),this.specular=new ct(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ct(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ou,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=ax,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 F6 extends Gr{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ct(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ct(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ou,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 z6 extends Gr{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ou,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 B6 extends Gr{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ct(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ct(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ou,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=ax,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 H6 extends Gr{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ct(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ou,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 V6 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 uh(t,e,n){return!t||!n&&t.constructor===e?t:typeof e.BYTES_PER_ELEMENT=="number"?new e(t):Array.prototype.slice.call(t)}function G6(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function W6(t){function e(i,s){return t[i]-t[s]}const n=t.length,r=new Array(n);for(let i=0;i!==n;++i)r[i]=i;return r.sort(e),r}function eC(t,e,n){const r=t.length,i=new t.constructor(r);for(let s=0,o=0;o!==r;++s){const a=n[s]*e;for(let l=0;l!==e;++l)i[o++]=t[a+l]}return i}function GR(t,e,n,r){let i=1,s=t[0];for(;s!==void 0&&s[r]===void 0;)s=t[i++];if(s===void 0)return;let o=s[r];if(o!==void 0)if(Array.isArray(o))do o=s[r],o!==void 0&&(e.push(s.time),n.push.apply(n,o)),s=t[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(n,n.length)),s=t[i++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),n.push(o)),s=t[i++];while(s!==void 0)}function oxe(t,e,n,r,i=30){const s=t.clone();s.name=e;const o=[];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=uh(f,c.times.constructor),c.values=uh(p,c.values.constructor),o.push(c))}s.tracks=o;let a=1/0;for(let l=0;l<s.tracks.length;++l)a>s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*a);return s.resetDuration(),s}function axe(t,e=0,n=t,r=30){r<=0&&(r=30);const i=n.tracks.length,s=e/r;for(let o=0;o<i;++o){const a=n.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;const c=t.tracks.find(function(_){return _.name===a.name&&_.ValueTypeName===l});if(c===void 0)continue;let d=0;const f=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=f/3);let p=0;const y=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(p=y/3);const x=a.times.length-1;let S;if(s<=a.times[0]){const _=d,E=f-d;S=a.values.slice(_,E)}else if(s>=a.times[x]){const _=x*f+d,E=_+f-d;S=a.values.slice(_,E)}else{const _=a.createInterpolant(),E=d,T=f-d;_.evaluate(s),S=_.resultBuffer.slice(E,T)}l==="quaternion"&&new qt().fromArray(S).normalize().conjugate().toArray(S);const w=c.times.length;for(let _=0;_<w;++_){const E=_*y+p;if(l==="quaternion")qt.multiplyQuaternionsFlat(c.values,E,S,0,c.values,E);else{const T=y-p*2;for(let P=0;P<T;++P)c.values[E+P]-=S[P]}}}return t.blendMode=_R,t}const lxe={convertArray:uh,isTypedArray:G6,getKeyframeOrder:W6,sortedArray:eC,flattenJSON:GR,subclip:oxe,makeClipAdditive:axe};class av{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 o;n:{r:if(!(e<i)){for(let a=r+2;;){if(i===void 0){if(e<s)break r;return r=n.length,this._cachedIndex=r,this.copySampleValue_(r-1)}if(r===a)break;if(s=i,i=n[++r],e<i)break t}o=n.length;break n}if(!(e>=s)){const a=n[1];e<a&&(r=2,s=a);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}o=r,r=0;break n}break e}for(;r<o;){const a=r+o>>>1;e<n[a]?o=a:r=a+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 o=0;o!==i;++o)n[o]=r[s+o];return n}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class $6 extends av{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:ah,endingEnd:ah}}intervalChanged_(e,n,r){const i=this.parameterPositions;let s=e-2,o=e+1,a=i[s],l=i[o];if(a===void 0)switch(this.getSettings_().endingStart){case lh:s=e,a=2*n-r;break;case Ty:s=i.length-2,a=n+i[s]-i[s+1];break;default:s=e,a=r}if(l===void 0)switch(this.getSettings_().endingEnd){case lh:o=e,l=2*r-n;break;case Ty:o=1,l=r+i[1]-i[0];break;default:o=e-1,l=n}const c=(r-n)*.5,d=this.valueSize;this._weightPrev=c/(n-a),this._weightNext=c/(l-r),this._offsetPrev=s*d,this._offsetNext=o*d}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,d=this._offsetPrev,f=this._offsetNext,p=this._weightPrev,y=this._weightNext,x=(r-n)/(i-n),S=x*x,w=S*x,_=-p*w+2*p*S-p*x,E=(1+p)*w+(-1.5-2*p)*S+(-.5+p)*x+1,T=(-1-y)*w+(1.5+y)*S+.5*x,P=y*w-y*S;for(let O=0;O!==a;++O)s[O]=_*o[d+O]+E*o[c+O]+T*o[l+O]+P*o[f+O];return s}}class WR extends av{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,d=(r-n)/(i-n),f=1-d;for(let p=0;p!==a;++p)s[p]=o[c+p]*f+o[l+p]*d;return s}}class X6 extends av{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class qa{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=uh(n,this.TimeBufferType),this.values=uh(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:uh(e.times,Array),values:uh(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(r.interpolation=i)}return r.type=e.ValueTypeName,r}InterpolantFactoryMethodDiscrete(e){return new X6(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new WR(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new $6(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let n;switch(e){case Og:n=this.InterpolantFactoryMethodDiscrete;break;case Lg:n=this.InterpolantFactoryMethodLinear;break;case W_: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 Og;case this.InterpolantFactoryMethodLinear:return Lg;case this.InterpolantFactoryMethodSmooth:return W_}}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,o=i-1;for(;s!==i&&r[s]<e;)++s;for(;o!==-1&&r[o]>n;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=r.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const n=this.getValueSize();n-Math.floor(n)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,i=this.values,s=r.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=r[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&G6(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),n=this.values.slice(),r=this.getValueSize(),i=this.getInterpolation()===W_,s=e.length-1;let o=1;for(let a=1;a<s;++a){let l=!1;const c=e[a],d=e[a+1];if(c!==d&&(a!==1||c!==e[0]))if(i)l=!0;else{const f=a*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(a!==o){e[o]=e[a];const f=a*r,p=o*r;for(let y=0;y!==r;++y)n[p+y]=n[f+y]}++o}}if(s>0){e[o]=e[s];for(let a=s*r,l=o*r,c=0;c!==r;++c)n[l+c]=n[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=n.slice(0,o*r)):(this.times=e,this.values=n),this}clone(){const e=this.times.slice(),n=this.values.slice(),r=this.constructor,i=new r(this.name,e,n);return i.createInterpolant=this.createInterpolant,i}}qa.prototype.TimeBufferType=Float32Array;qa.prototype.ValueBufferType=Float32Array;qa.prototype.DefaultInterpolation=Lg;class np extends qa{constructor(e,n,r){super(e,n,r)}}np.prototype.ValueTypeName="bool";np.prototype.ValueBufferType=Array;np.prototype.DefaultInterpolation=Og;np.prototype.InterpolantFactoryMethodLinear=void 0;np.prototype.InterpolantFactoryMethodSmooth=void 0;class $R extends qa{}$R.prototype.ValueTypeName="color";class Gh extends qa{}Gh.prototype.ValueTypeName="number";class q6 extends av{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-n)/(i-n);let c=e*a;for(let d=c+a;c!==d;c+=4)qt.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Wh extends qa{InterpolantFactoryMethodLinear(e){return new q6(this.times,this.values,this.getValueSize(),e)}}Wh.prototype.ValueTypeName="quaternion";Wh.prototype.InterpolantFactoryMethodSmooth=void 0;class rp extends qa{constructor(e,n,r){super(e,n,r)}}rp.prototype.ValueTypeName="string";rp.prototype.ValueBufferType=Array;rp.prototype.DefaultInterpolation=Og;rp.prototype.InterpolantFactoryMethodLinear=void 0;rp.prototype.InterpolantFactoryMethodSmooth=void 0;class $h extends qa{}$h.prototype.ValueTypeName="vector";class jg{constructor(e="",n=-1,r=[],i=KS){this.name=e,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=So(),this.duration<0&&this.resetDuration()}static parse(e){const n=[],r=e.tracks,i=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)n.push(uxe(r[o]).scale(i));const s=new this(e.name,e.duration,n,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const n=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:n,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=r.length;s!==o;++s)n.push(qa.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,n,r,i){const s=n.length,o=[];for(let a=0;a<s;a++){let l=[],c=[];l.push((a+s-1)%s,a,(a+1)%s),c.push(0,1,0);const d=W6(l);l=eC(l,1,d),c=eC(c,1,d),!i&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new Gh(".morphTargetInfluences["+n[a].name+"]",l,c).scale(1/r))}return new this(e,-1,o)}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 a=0,l=e.length;a<l;a++){const c=e[a],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 o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],n,r));return o}static parseAnimation(e,n){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const r=function(f,p,y,x,S){if(y.length!==0){const w=[],_=[];GR(y,w,_,x),w.length!==0&&S.push(new f(p,w,_))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let f=0;f<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=[],_=[];for(let E=0;E!==p[x].morphTargets.length;++E){const T=p[x];w.push(T.time),_.push(T.morphTarget===S?1:0)}i.push(new Gh(".morphTargetInfluence["+S+"]",w,_))}l=y.length*o}else{const y=".bones["+n[f].name+"]";r($h,y+".position",p,"pos",i),r(Wh,y+".quaternion",p,"rot",i),r($h,y+".scale",p,"scl",i)}}return i.length===0?null:new this(s,l,i,a)}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 cxe(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Gh;case"vector":case"vector2":case"vector3":case"vector4":return $h;case"color":return $R;case"quaternion":return Wh;case"bool":case"boolean":return np;case"string":return rp}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}function uxe(t){if(t.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=cxe(t.type);if(t.times===void 0){const n=[],r=[];GR(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 Fc={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 XR{constructor(e,n,r){const i=this;let s=!1,o=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=n,this.onError=r,this.itemStart=function(d){a++,s===!1&&i.onStart!==void 0&&i.onStart(d,o,a),s=!0},this.itemEnd=function(d){o++,i.onProgress!==void 0&&i.onProgress(d,o,a),o===a&&(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 K6=new XR;class Rs{constructor(e){this.manager=e!==void 0?e:K6,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}}Rs.DEFAULT_MATERIAL_NAME="__DEFAULT";const Ac={};class dxe extends Error{constructor(e,n){super(e),this.response=n}}class Ga extends Rs{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=Fc.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{n&&n(s),this.manager.itemEnd(e)},0),s;if(Ac[e]!==void 0){Ac[e].push({onLoad:n,onProgress:r,onError:i});return}Ac[e]=[],Ac[e].push({onLoad:n,onProgress:r,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const d=Ac[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(_){E();function E(){f.read().then(({done:T,value:P})=>{if(T)_.close();else{S+=P.byteLength;const O=new ProgressEvent("progress",{lengthComputable:x,loaded:S,total:y});for(let N=0,D=d.length;N<D;N++){const z=d[N];z.onProgress&&z.onProgress(O)}_.enqueue(P),E()}},T=>{_.error(T)})}}});return new Response(w)}else throw new dxe(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(d=>new DOMParser().parseFromString(d,a));case"json":return c.json();default:if(a===void 0)return c.text();{const f=/charset="?([^;"\s]*)"?/i.exec(a),p=f&&f[1]?f[1].toLowerCase():void 0,y=new TextDecoder(p);return c.arrayBuffer().then(x=>y.decode(x))}}}).then(c=>{Fc.add(e,c);const d=Ac[e];delete Ac[e];for(let f=0,p=d.length;f<p;f++){const y=d[f];y.onLoad&&y.onLoad(c)}}).catch(c=>{const d=Ac[e];if(d===void 0)throw this.manager.itemError(e),c;delete Ac[e];for(let f=0,p=d.length;f<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 fxe extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Ga(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{n(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},r,i)}parse(e){const n=[];for(let r=0;r<e.length;r++){const i=jg.parse(e[r]);n.push(i)}return n}}class hxe extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=this,o=[],a=new iM,l=new Ga(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);o[f]={width:y.width,height:y.height,format:y.format,mipmaps:y.mipmaps},c+=1,c===6&&(y.mipmapCount===1&&(a.minFilter=Cr),a.image=o,a.format=y.format,a.needsUpdate=!0,n&&n(a))},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++){o[x]={mipmaps:[]};for(let S=0;S<p.mipmapCount;S++)o[x].mipmaps.push(p.mipmaps[x*p.mipmapCount+S]),o[x].format=p.format,o[x].width=p.width,o[x].height=p.height}a.image=o}else a.image.width=p.width,a.image.height=p.height,a.mipmaps=p.mipmaps;p.mipmapCount===1&&(a.minFilter=Cr),a.format=p.format,a.needsUpdate=!0,n&&n(a)},r,i);return a}}class Fg extends Rs{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,o=Fc.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){n&&n(o),s.manager.itemEnd(e)},0),o;const a=ky("img");function l(){d(),Fc.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(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class pxe extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=new dx;s.colorSpace=Fi;const o=new Fg(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(d){s.images[c]=d,a++,a===6&&(s.needsUpdate=!0,n&&n(s))},void 0,i)}for(let c=0;c<e.length;++c)l(c);return s}}class mxe extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Pl,a=new Ga(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.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?o.image=c.image:c.data!==void 0&&(o.image.width=c.width,o.image.height=c.height,o.image.data=c.data),o.wrapS=c.wrapS!==void 0?c.wrapS:_o,o.wrapT=c.wrapT!==void 0?c.wrapT:_o,o.magFilter=c.magFilter!==void 0?c.magFilter:Cr,o.minFilter=c.minFilter!==void 0?c.minFilter:Cr,o.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(o.colorSpace=c.colorSpace),c.flipY!==void 0&&(o.flipY=c.flipY),c.format!==void 0&&(o.format=c.format),c.type!==void 0&&(o.type=c.type),c.mipmaps!==void 0&&(o.mipmaps=c.mipmaps,o.minFilter=$o),c.mipmapCount===1&&(o.minFilter=Cr),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,n&&n(o,c)},r,i),o}}class Y6 extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=new fr,o=new Fg(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,n!==void 0&&n(s)},r,i),s}}class Ld extends mn{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new ct(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 Z6 extends Ld{constructor(e,n,r){super(e,r),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(mn.DEFAULT_UP),this.updateMatrix(),this.groundColor=new ct(n)}copy(e,n){return super.copy(e,n),this.groundColor.copy(e.groundColor),this}}const kA=new Ct,eU=new X,tU=new X;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 Ct,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new fx,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;eU.setFromMatrixPosition(e.matrixWorld),n.position.copy(eU),tU.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(tU),n.updateMatrixWorld(),kA.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(kA),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(kA)}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 gxe extends qR{constructor(){super(new Pr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const n=this.camera,r=Dg*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 KR extends Ld{constructor(e,n,r=0,i=Math.PI/3,s=0,o=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=o,this.map=null,this.shadow=new gxe}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 nU=new Ct,C0=new X,OA=new X;class vxe extends qR{constructor(){super(new Pr(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 X(1,0,0),new X(-1,0,0),new X(0,0,1),new X(0,0,-1),new X(0,1,0),new X(0,-1,0)],this._cubeUps=[new X(0,1,0),new X(0,1,0),new X(0,1,0),new X(0,1,0),new X(0,0,1),new X(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()),C0.setFromMatrixPosition(e.matrixWorld),r.position.copy(C0),OA.copy(r.position),OA.add(this._cubeDirections[n]),r.up.copy(this._cubeUps[n]),r.lookAt(OA),r.updateMatrixWorld(),i.makeTranslation(-C0.x,-C0.y,-C0.z),nU.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(nU)}}class YR extends Ld{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 vxe}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 yxe extends qR{constructor(){super(new Gc(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class ZR extends Ld{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 yxe}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Q6 extends Ld{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}class J6 extends Ld{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 eG{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new X)}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,o=this.coefficients;return n.copy(o[0]).multiplyScalar(.282095),n.addScaledVector(o[1],.488603*i),n.addScaledVector(o[2],.488603*s),n.addScaledVector(o[3],.488603*r),n.addScaledVector(o[4],1.092548*(r*i)),n.addScaledVector(o[5],1.092548*(i*s)),n.addScaledVector(o[6],.315392*(3*s*s-1)),n.addScaledVector(o[7],1.092548*(r*s)),n.addScaledVector(o[8],.546274*(r*r-i*i)),n}getIrradianceAt(e,n){const r=e.x,i=e.y,s=e.z,o=this.coefficients;return n.copy(o[0]).multiplyScalar(.886227),n.addScaledVector(o[1],2*.511664*i),n.addScaledVector(o[2],2*.511664*s),n.addScaledVector(o[3],2*.511664*r),n.addScaledVector(o[4],2*.429043*r*i),n.addScaledVector(o[5],2*.429043*i*s),n.addScaledVector(o[6],.743125*s*s-.247708),n.addScaledVector(o[7],2*.429043*r*s),n.addScaledVector(o[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 tG extends Ld{constructor(e=new eG,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 xM extends Rs{constructor(e){super(e),this.textures={}}load(e,n,r,i){const s=this,o=new Ga(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{n(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},r,i)}parse(e){const n=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 ct().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 o=e.uniforms[s];switch(i.uniforms[s]={},o.type){case"t":i.uniforms[s].value=r(o.value);break;case"c":i.uniforms[s].value=new ct().setHex(o.value);break;case"v2":i.uniforms[s].value=new He().fromArray(o.value);break;case"v3":i.uniforms[s].value=new X().fromArray(o.value);break;case"v4":i.uniforms[s].value=new On().fromArray(o.value);break;case"m3":i.uniforms[s].value=new $t().fromArray(o.value);break;case"m4":i.uniforms[s].value=new Ct().fromArray(o.value);break;default:i.uniforms[s].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=r(e.map)),e.matcap!==void 0&&(i.matcap=r(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=r(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=r(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=r(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new He().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=r(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=r(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=r(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=r(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=r(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=r(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=r(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=r(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=r(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=r(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=r(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=r(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=r(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=r(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new He().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=r(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=r(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=r(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=r(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=r(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=r(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=r(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return xM.createMaterialFromType(e)}static createMaterialFromType(e){const n={ShadowMaterial:D6,SpriteMaterial:OR,RawShaderMaterial:U6,ShaderMaterial:Zo,PointsMaterial:rM,MeshPhysicalMaterial:ta,MeshStandardMaterial:gx,MeshPhongMaterial:j6,MeshToonMaterial:F6,MeshNormalMaterial:z6,MeshLambertMaterial:B6,MeshDepthMaterial:NR,MeshDistanceMaterial:IR,MeshBasicMaterial:As,MeshMatcapMaterial:H6,LineDashedMaterial:V6,LineBasicMaterial:$r,Material:Gr};return new n[e]}}class wd{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 nG 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 rG extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Ga(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{n(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},r,i)}parse(e){const n={},r={};function i(y,x){if(n[x]!==void 0)return n[x];const w=y.interleavedBuffers[x],_=s(y,w.buffer),E=$m(w.type,_),T=new tp(E,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],_=new Uint32Array(w).buffer;return r[x]=_,_}const o=e.isInstancedBufferGeometry?new nG:new Yt,a=e.data.index;if(a!==void 0){const y=$m(a.type,a.array);o.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 Dl(w,x.itemSize,x.offset,x.normalized)}else{const w=$m(x.type,x.array),_=x.isInstancedBufferAttribute?Hh:Qt;S=new _(w,x.itemSize,x.normalized)}x.name!==void 0&&(S.name=x.name),x.usage!==void 0&&S.setUsage(x.usage),o.setAttribute(y,S)}const c=e.data.morphAttributes;if(c)for(const y in c){const x=c[y],S=[];for(let w=0,_=x.length;w<_;w++){const E=x[w];let T;if(E.isInterleavedBufferAttribute){const P=i(e.data,E.data);T=new Dl(P,E.itemSize,E.offset,E.normalized)}else{const P=$m(E.type,E.array);T=new Qt(P,E.itemSize,E.normalized)}E.name!==void 0&&(T.name=E.name),S.push(T)}o.morphAttributes[y]=S}e.data.morphTargetsRelative&&(o.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];o.addGroup(S.start,S.count,S.materialIndex)}const p=e.data.boundingSphere;if(p!==void 0){const y=new X;p.center!==void 0&&y.fromArray(p.center),o.boundingSphere=new Hi(y,p.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class xxe extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=this,o=this.path===""?wd.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new Ga(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.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===""?wd.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new Ga(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const o=await s.loadAsync(e,n),a=JSON.parse(o),l=a.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(a)}parse(e,n){const r=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),o=this.parseImages(e.images,function(){n!==void 0&&n(c)}),a=this.parseTextures(e.textures,o),l=this.parseMaterials(e.materials,a),c=this.parseObject(e.object,s,l,a,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 o)if(o[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),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,i,a,o,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 Ch().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,o=e.length;s<o;s++){const a=new kd().fromJSON(e[s],i);r[a.uuid]=a}return r}parseGeometries(e,n){const r={};if(e!==void 0){const i=new rG;for(let s=0,o=e.length;s<o;s++){let a;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(l);break;default:l.type in JD?a=JD[l.type].fromJSON(l,n):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}a.uuid=l.uuid,l.name!==void 0&&(a.name=l.name),l.userData!==void 0&&(a.userData=l.userData),r[l.uuid]=a}}return r}parseMaterials(e,n){const r={},i={};if(e!==void 0){const s=new xM;s.setTextures(n);for(let o=0,a=e.length;o<a;o++){const l=e[o];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=jg.parse(i);n[s.uuid]=s}return n}parseImages(e,n){const r=this,i={};let s;function o(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 a(l){if(typeof l=="string"){const c=l,d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:r.resourcePath+c;return o(d)}else return l.data?{data:$m(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new XR(n);s=new Fg(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],_=a(w);_!==null&&(_ instanceof HTMLImageElement?y.push(_):y.push(new Pl(_.data,_.width,_.height)))}i[f.uuid]=new ch(y)}else{const y=a(f.url);i[f.uuid]=new ch(y)}}}return i}async parseImagesAsync(e){const n=this,r={};let i;async function s(o){if(typeof o=="string"){const a=o,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:n.resourcePath+a;return await i.loadAsync(l)}else return o.data?{data:$m(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){i=new Fg(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const l=e[o],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 ch(d)}else{const d=await s(l.url);r[l.uuid]=new ch(d)}}}return r}parseTextures(e,n){function r(s,o){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const i={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=e[s];a.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),n[a.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",a.image);const l=n[a.image],c=l.data;let d;Array.isArray(c)?(d=new dx,c.length===6&&(d.needsUpdate=!0)):(c&&c.data?d=new Pl:d=new fr,c&&(d.needsUpdate=!0)),d.source=l,d.uuid=a.uuid,a.name!==void 0&&(d.name=a.name),a.mapping!==void 0&&(d.mapping=r(a.mapping,bxe)),a.channel!==void 0&&(d.channel=a.channel),a.offset!==void 0&&d.offset.fromArray(a.offset),a.repeat!==void 0&&d.repeat.fromArray(a.repeat),a.center!==void 0&&d.center.fromArray(a.center),a.rotation!==void 0&&(d.rotation=a.rotation),a.wrap!==void 0&&(d.wrapS=r(a.wrap[0],rU),d.wrapT=r(a.wrap[1],rU)),a.format!==void 0&&(d.format=a.format),a.internalFormat!==void 0&&(d.internalFormat=a.internalFormat),a.type!==void 0&&(d.type=a.type),a.colorSpace!==void 0&&(d.colorSpace=a.colorSpace),a.minFilter!==void 0&&(d.minFilter=r(a.minFilter,iU)),a.magFilter!==void 0&&(d.magFilter=r(a.magFilter,iU)),a.anisotropy!==void 0&&(d.anisotropy=a.anisotropy),a.flipY!==void 0&&(d.flipY=a.flipY),a.generateMipmaps!==void 0&&(d.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(d.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(d.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(d.compareFunction=a.compareFunction),a.userData!==void 0&&(d.userData=a.userData),i[a.uuid]=d}return i}parseObject(e,n,r,i,s){let o;function a(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":o=new kR,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new ct(e.background):o.background=c(e.background)),e.environment!==void 0&&(o.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new eM(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new JS(e.fog.color,e.fog.density)),e.fog.name!==""&&(o.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(o.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&o.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(o.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&o.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":o=new Pr(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new Gc(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new Q6(e.color,e.intensity);break;case"DirectionalLight":o=new ZR(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new YR(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new J6(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new KR(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new Z6(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new tG().fromJSON(e);break;case"SkinnedMesh":d=a(e.geometry),f=l(e.material),o=new tM(d,f),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":d=a(e.geometry),f=l(e.material),o=new xr(d,f);break;case"InstancedMesh":d=a(e.geometry),f=l(e.material);const p=e.count,y=e.instanceMatrix,x=e.instanceColor;o=new LR(d,f,p),o.instanceMatrix=new Hh(new Float32Array(y.array),16),x!==void 0&&(o.instanceColor=new Hh(new Float32Array(x.array),x.itemSize));break;case"BatchedMesh":d=a(e.geometry),f=l(e.material),o=new E6(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,f),o.geometry=d,o.perObjectFrustumCulled=e.perObjectFrustumCulled,o.sortObjects=e.sortObjects,o._drawRanges=e.drawRanges,o._reservedRanges=e.reservedRanges,o._visibility=e.visibility,o._active=e.active,o._bounds=e.bounds.map(S=>{const w=new as;w.min.fromArray(S.boxMin),w.max.fromArray(S.boxMax);const _=new Hi;return _.radius=S.sphereRadius,_.center.fromArray(S.sphereCenter),{boxInitialized:S.boxInitialized,box:w,sphereInitialized:S.sphereInitialized,sphere:_}}),o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=c(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=c(e.colorsTexture.uuid));break;case"LOD":o=new M6;break;case"Line":o=new Ul(a(e.geometry),l(e.material));break;case"LineLoop":o=new DR(a(e.geometry),l(e.material));break;case"LineSegments":o=new eo(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new UR(a(e.geometry),l(e.material));break;case"Sprite":o=new S6(l(e.material));break;case"Group":o=new Ts;break;case"Bone":o=new nM;break;default:o=new mn}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const p=e.children;for(let y=0;y<p.length;y++)o.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];o.animations.push(s[x])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const p=e.levels;for(let y=0;y<p.length;y++){const x=p[y],S=o.getObjectByProperty("uuid",x.object);S!==void 0&&o.addLevel(S,x.distance,x.hysteresis)}}return o}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 bxe={UVMapping:BS,CubeReflectionMapping:Zc,CubeRefractionMapping:Pd,EquirectangularReflectionMapping:Ey,EquirectangularRefractionMapping:Ay,CubeUVReflectionMapping:nv},rU={RepeatWrapping:Cd,ClampToEdgeWrapping:_o,MirroredRepeatWrapping:Ig},iU={NearestFilter:ri,NearestMipmapNearestFilter:HS,NearestMipmapLinearFilter:oh,LinearFilter:Cr,LinearMipmapNearestFilter:ng,LinearMipmapLinearFilter:$o};class iG extends Rs{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,o=Fc.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{n&&n(c),s.manager.itemEnd(e)}).catch(c=>{i&&i(c)});return}return setTimeout(function(){n&&n(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Fc.add(e,c),n&&n(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),Fc.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Fc.add(e,l),s.manager.itemStart(e)}}let w_;class QR{static getContext(){return w_===void 0&&(w_=new(window.AudioContext||window.webkitAudioContext)),w_}static setContext(e){w_=e}}class _xe extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Ga(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);QR.getContext().decodeAudioData(c,function(f){n(f)}).catch(a)}catch(c){a(c)}},r,i);function a(l){i?i(l):console.error(l),s.manager.itemError(e)}}}const sU=new Ct,oU=new Ct,Lf=new Ct;class wxe{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Pr,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Pr,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const n=this._cache;if(n.focus!==e.focus||n.fov!==e.fov||n.aspect!==e.aspect*this.aspect||n.near!==e.near||n.far!==e.far||n.zoom!==e.zoom||n.eyeSep!==this.eyeSep){n.focus=e.focus,n.fov=e.fov,n.aspect=e.aspect*this.aspect,n.near=e.near,n.far=e.far,n.zoom=e.zoom,n.eyeSep=this.eyeSep,Lf.copy(e.projectionMatrix);const i=n.eyeSep/2,s=i*n.near/n.focus,o=n.near*Math.tan(Th*n.fov*.5)/n.zoom;let a,l;oU.elements[12]=-i,sU.elements[12]=i,a=-o*n.aspect+s,l=o*n.aspect+s,Lf.elements[0]=2*n.near/(l-a),Lf.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Lf),a=-o*n.aspect-s,l=o*n.aspect-s,Lf.elements[0]=2*n.near/(l-a),Lf.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Lf)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(oU),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(sU)}}class JR{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=aU(),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=aU();e=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=e}return e}}function aU(){return performance.now()}const Df=new X,lU=new qt,Sxe=new X,Uf=new X;class Mxe extends mn{constructor(){super(),this.type="AudioListener",this.context=QR.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new JR}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const n=this.context.listener,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Df,lU,Sxe),Uf.set(0,0,-1).applyQuaternion(lU),n.positionX){const i=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(Df.x,i),n.positionY.linearRampToValueAtTime(Df.y,i),n.positionZ.linearRampToValueAtTime(Df.z,i),n.forwardX.linearRampToValueAtTime(Uf.x,i),n.forwardY.linearRampToValueAtTime(Uf.y,i),n.forwardZ.linearRampToValueAtTime(Uf.z,i),n.upX.linearRampToValueAtTime(r.x,i),n.upY.linearRampToValueAtTime(r.y,i),n.upZ.linearRampToValueAtTime(r.z,i)}else n.setPosition(Df.x,Df.y,Df.z),n.setOrientation(Uf.x,Uf.y,Uf.z,r.x,r.y,r.z)}}let sG=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 jf=new X,cU=new qt,Exe=new X,Ff=new X;class Axe extends sG{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(jf,cU,Exe),Ff.set(0,0,1).applyQuaternion(cU);const n=this.panner;if(n.positionX){const r=this.context.currentTime+this.listener.timeDelta;n.positionX.linearRampToValueAtTime(jf.x,r),n.positionY.linearRampToValueAtTime(jf.y,r),n.positionZ.linearRampToValueAtTime(jf.z,r),n.orientationX.linearRampToValueAtTime(Ff.x,r),n.orientationY.linearRampToValueAtTime(Ff.y,r),n.orientationZ.linearRampToValueAtTime(Ff.z,r)}else n.setPosition(jf.x,jf.y,jf.z),n.setOrientation(Ff.x,Ff.y,Ff.z)}}class Txe{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 oG{constructor(e,n,r){this.binding=e,this.valueSize=r;let i,s,o;switch(n){case"quaternion":i=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(r*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(r*5);break;default:i=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(r*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=o,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 o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)r[s+a]=r[a];o=n}else{o+=n;const a=n/o;this._mixBufferRegion(r,s,0,a,i)}this.cumulativeWeight=o}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,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=n*this._origIndex;this._mixBufferRegion(r,i,l,1-s,n)}o>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]){a.setValue(r,i);break}}saveOriginalState(){const e=this.binding,n=this.buffer,r=this.valueSize,i=r*this._origIndex;e.getValue(n,i);for(let s=r,o=i;s!==o;++s)n[s]=n[i+s%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,n=e+this.valueSize;for(let r=e;r<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 o=0;o!==s;++o)e[n+o]=e[r+o]}_slerp(e,n,r,i){qt.slerpFlat(e,n,e,n,e,r,i)}_slerpAdditive(e,n,r,i,s){const o=this._workIndex*s;qt.multiplyQuaternionsFlat(e,o,e,n,e,r),qt.slerpFlat(e,n,e,n,e,o,i)}_lerp(e,n,r,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=n+a;e[l]=e[l]*o+e[r+a]*i}}_lerpAdditive(e,n,r,i,s){for(let o=0;o!==s;++o){const a=n+o;e[a]=e[a]+e[r+o]*i}}}const eN="\\[\\]\\.:\\/",Pxe=new RegExp("["+eN+"]","g"),tN="[^"+eN+"]",Cxe="[^"+eN.replace("\\.","")+"]",Rxe=/((?:WC+[\/:])*)/.source.replace("WC",tN),Nxe=/(WCOD+)?/.source.replace("WCOD",Cxe),Ixe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",tN),kxe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",tN),Oxe=new RegExp("^"+Rxe+Nxe+Ixe+kxe+"$"),Lxe=["material","materials","bones","map"];class Dxe{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(Pxe,"")}static parseTrackName(e){const n=Oxe.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);Lxe.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,n){if(n===void 0||n===""||n==="."||n===-1||n===e.name||n===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(n);if(r!==void 0)return r}if(e.children){const r=function(s){for(let o=0;o<s.length;o++){const a=s[o];if(a.name===n||a.uuid===n)return a;const l=r(a.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 o=e[i];if(o===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 a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=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=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Rn.Composite=Dxe;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 Uxe{constructor(){this.isAnimationObjectGroup=!0,this.uuid=So(),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,o=s.length;let a,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=o;S!==w;++S)s[S].push(new Rn(p,r[S],i[S]))}else if(x<c){a=e[x];const S=--c,w=e[S];n[w.uuid]=x,e[x]=w,n[y]=S,e[S]=p;for(let _=0,E=o;_!==E;++_){const T=s[_],P=T[S];let O=T[x];T[x]=P,O===void 0&&(O=new Rn(p,r[_],i[_])),T[S]=O}}else e[x]!==a&&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 o=0,a=arguments.length;o!==a;++o){const l=arguments[o],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],_=S[d];S[d]=w,S[f]=_}}}this.nCachedObjects_=s}uncache(){const e=this._objects,n=this._indicesByUUID,r=this._bindings,i=r.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],d=c.uuid,f=n[d];if(f!==void 0)if(delete n[d],f<s){const p=--s,y=e[p],x=--o,S=e[x];n[y.uuid]=f,e[f]=y,n[S.uuid]=p,e[p]=S,e.pop();for(let w=0,_=i;w!==_;++w){const E=r[w],T=E[p],P=E[x];E[f]=T,E[p]=P,E.pop()}}else{const p=--o,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 o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,d=this.nCachedObjects_,f=new Array(c);i=s.length,r[e]=i,o.push(e),a.push(n),s.push(f);for(let 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,o=this._bindings,a=o.length-1,l=o[a],c=e[a];n[c]=r,o[r]=l,o.pop(),s[r]=s[a],s.pop(),i[r]=i[a],i.pop()}}}class 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,o=s.length,a=new Array(o),l={endingStart:ah,endingEnd:ah};for(let c=0;c!==o;++c){const d=s[c].createInterpolant(null);a[c]=d,d.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=$V,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,n){return this.loop=e,this.repetitions=n,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,n,r){if(e.fadeOut(n),this.fadeIn(n),r){const i=this._clip.duration,s=e._clip.duration,o=s/i,a=i/s;e.warp(1,o,n),this.warp(a,1,n)}return this}crossFadeTo(e,n,r){return e.crossFadeFrom(this,n,r)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,n,r){const i=this._mixer,s=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+r,c[0]=e/o,c[1]=n/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,n,r,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*r;l<0||r===0?n=0:(this._startTime=null,n=r*l)}n*=this._updateTimeScale(e);const o=this._updateTime(n),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case _R:for(let d=0,f=l.length;d!==f;++d)l[d].evaluate(o),c[d].accumulateAdditive(a);break;case KS:default:for(let d=0,f=l.length;d!==f;++d)l[d].evaluate(o),c[d].accumulate(i,a)}}}_updateWeight(e){let n=0;if(this.enabled){n=this.weight;const r=this._weightInterpolant;if(r!==null){const i=r.evaluate(e)[0];n*=i,e>r.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=n,n}_updateTimeScale(e){let n=0;if(!this.paused){n=this.timeScale;const r=this._timeScaleInterpolant;if(r!==null){const i=r.evaluate(e)[0];n*=i,e>r.parameterPositions[1]&&(this.stopWarping(),n===0?this.paused=!0:this.timeScale=n)}}return this._effectiveTimeScale=n,n}_updateTime(e){const n=this._clip.duration,r=this.loop;let i=this.time+e,s=this._loopCount;const o=r===XV;if(e===0)return s===-1?i:o&&(s&1)===1?n-i:i;if(r===WV){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=n)i=n;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=n||i<0){const a=Math.floor(i/n);i-=n*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?n:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return n-i}return i}_setEndings(e,n,r){const i=this._interpolantSettings;r?(i.endingStart=lh,i.endingEnd=lh):(e?i.endingStart=this.zeroSlopeAtStart?lh:ah:i.endingStart=Ty,n?i.endingEnd=this.zeroSlopeAtEnd?lh:ah:i.endingEnd=Ty)}_scheduleFading(e,n,r){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=n,a[1]=s+e,l[1]=r,this}}const jxe=new Float32Array(1);class Fxe extends zl{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,n){const r=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,l=r.uuid,c=this._bindingsByRootAndName;let d=c[l];d===void 0&&(d={},c[l]=d);for(let f=0;f!==s;++f){const p=i[f],y=p.name;let x=d[y];if(x!==void 0)++x.referenceCount,o[f]=x;else{if(x=o[f],x!==void 0){x._cacheIndex===null&&(++x.referenceCount,this._addInactiveBinding(x,l,y));continue}const S=n&&n._propertyBindings[f].binding.parsedPath;x=new oG(Rn.create(r,y,S),p.ValueTypeName,p.getValueSize()),++x.referenceCount,this._addInactiveBinding(x,l,y),o[f]=x}a[f].resultBuffer=x.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const r=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,r)}const n=e._propertyBindings;for(let r=0,i=n.length;r!==i;++r){const s=n[r];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const n=e._propertyBindings;for(let r=0,i=n.length;r!==i;++r){const s=n[r];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const n=e._cacheIndex;return n!==null&&n<this._nActiveActions}_addInactiveAction(e,n,r){const i=this._actions,s=this._actionsByClip;let o=s[n];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[n]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=i.length,i.push(e),o.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,o=this._actionsByClip,a=o[s],l=a.knownActions,c=l[l.length-1],d=e._byClipCacheIndex;c._byClipCacheIndex=d,l[d]=c,l.pop(),e._byClipCacheIndex=null;const f=a.actionByRoot,p=(e._localRoot||this._root).uuid;delete f[p],l.length===0&&delete o[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 o=i[n];o===void 0&&(o={},i[n]=o),o[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,o=this._bindingsByRootAndName,a=o[i],l=n[n.length-1],c=e._cacheIndex;l._cacheIndex=c,n[c]=l,n.pop(),delete a[s],Object.keys(a).length===0&&delete o[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 WR(new Float32Array(2),new Float32Array(2),1,jxe),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 o=typeof e=="string"?jg.findByName(i,e):e;const a=o!==null?o.uuid:e,l=this._actionsByClip[a];let c=null;if(r===void 0&&(o!==null?r=o.blendMode:r=KS),l!==void 0){const f=l.actionByRoot[s];if(f!==void 0&&f.blendMode===r)return f;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;const d=new aG(this,o,n,r);return this._bindAction(d,c),this._addInactiveAction(d,a,s),d}existingAction(e,n){const r=n||this._root,i=r.uuid,s=typeof e=="string"?jg.findByName(r,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.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),o=this._accuIndex^=1;for(let c=0;c!==r;++c)n[c]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let n=0;n<this._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 o=s.knownActions;for(let a=0,l=o.length;a!==l;++a){const c=o[a];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 o in r){const a=r[o].actionByRoot,l=a[n];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const i=this._bindingsByRootAndName,s=i[n];if(s!==void 0)for(const o in s){const a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,n){const r=this.existingAction(e,n);r!==null&&(this._deactivateAction(r),this._removeInactiveAction(r))}}class nN{constructor(e){this.value=e}clone(){return new nN(this.value.clone===void 0?this.value:this.value.clone())}}let zxe=0;class Bxe extends zl{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:zxe++}),this.name="",this.usage=Ny,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 o=0;o<s.length;o++)this.uniforms.push(s[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class Hxe extends tp{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 tC{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 uU=new Ct;class lG{constructor(e,n,r=0,i=1/0){this.ray=new Jh(e,n),this.near=r,this.far=i,this.camera=null,this.layers=new Ph,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 uU.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(uU),this}intersectObject(e,n=!0,r=[]){return nC(e,this,r,n),r.sort(dU),r}intersectObjects(e,n=!0,r=[]){for(let i=0,s=e.length;i<s;i++)nC(e[i],this,r,n);return r.sort(dU),r}}function dU(t,e){return t.distance-e.distance}function nC(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 o=0,a=s.length;o<a;o++)nC(s[o],e,n,!0)}}class rC{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 Vxe{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 rN{constructor(e,n,r,i){rN.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 fU=new He;class Gxe{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=fU.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,fU).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const hU=new X,S_=new X;class Wxe{constructor(e=new X,n=new X){this.start=e,this.end=n}set(e,n){return this.start.copy(e),this.end.copy(n),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,n){return this.delta(n).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,n){hU.subVectors(e,this.start),S_.subVectors(this.end,this.start);const r=S_.dot(S_);let s=S_.dot(hU)/r;return n&&(s=Tr(s,0,1)),s}closestPointToPoint(e,n,r){const i=this.closestPointToPointParameter(e,n);return this.delta(r).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const pU=new X;class $xe 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 o=0,a=1,l=32;o<l;o++,a++){const c=o/l*Math.PI*2,d=a/l*Math.PI*2;i.push(Math.cos(c),Math.sin(c),1,Math.cos(d),Math.sin(d),1)}r.setAttribute("position",new Lt(i,3));const s=new $r({fog:!1,toneMapped:!1});this.cone=new eo(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),pU.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(pU),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Qu=new X,M_=new Ct,LA=new Ct;class Xxe extends eo{constructor(e){const n=cG(e),r=new Yt,i=[],s=[],o=new ct(0,0,1),a=new ct(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(o.r,o.g,o.b),s.push(a.r,a.g,a.b))}r.setAttribute("position",new Lt(i,3)),r.setAttribute("color",new Lt(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");LA.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<n.length;s++){const a=n[s];a.parent&&a.parent.isBone&&(M_.multiplyMatrices(LA,a.matrixWorld),Qu.setFromMatrixPosition(M_),i.setXYZ(o,Qu.x,Qu.y,Qu.z),M_.multiplyMatrices(LA,a.parent.matrixWorld),Qu.setFromMatrixPosition(M_),i.setXYZ(o+1,Qu.x,Qu.y,Qu.z),o+=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 qxe extends xr{constructor(e,n,r){const i=new mx(n,4,2),s=new As({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 Kxe=new X,mU=new ct,gU=new ct;class Yxe 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 px(n);i.rotateY(Math.PI*.5),this.material=new As({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),o=new Float32Array(s.count*3);i.setAttribute("color",new Qt(o,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");mU.copy(this.light.color),gU.copy(this.light.groundColor);for(let r=0,i=n.count;r<i;r++){const s=r<i/2?mU:gU;n.setXYZ(r,s.r,s.g,s.b)}n.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(Kxe.setFromMatrixPosition(this.light.matrixWorld).negate())}}class Zxe extends eo{constructor(e=10,n=10,r=4473924,i=8947848){r=new ct(r),i=new ct(i);const s=n/2,o=e/n,a=e/2,l=[],c=[];for(let p=0,y=0,x=-a;p<=n;p++,x+=o){l.push(-a,0,x,a,0,x),l.push(x,0,-a,x,0,a);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 Lt(l,3)),d.setAttribute("color",new Lt(c,3));const f=new $r({vertexColors:!0,toneMapped:!1});super(d,f),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class Qxe extends eo{constructor(e=10,n=16,r=8,i=64,s=4473924,o=8947848){s=new ct(s),o=new ct(o);const a=[],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;a.push(0,0,0),a.push(y,0,x);const S=f&1?s:o;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:o,y=e-e/r*f;for(let x=0;x<i;x++){let S=x/i*(Math.PI*2),w=Math.sin(S)*y,_=Math.cos(S)*y;a.push(w,0,_),l.push(p.r,p.g,p.b),S=(x+1)/i*(Math.PI*2),w=Math.sin(S)*y,_=Math.cos(S)*y,a.push(w,0,_),l.push(p.r,p.g,p.b)}}const c=new Yt;c.setAttribute("position",new Lt(a,3)),c.setAttribute("color",new Lt(l,3));const d=new $r({vertexColors:!0,toneMapped:!1});super(c,d),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const vU=new X,E_=new X,yU=new X;class Jxe 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 Lt([-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 Ul(i,s),this.add(this.lightPlane),i=new Yt,i.setAttribute("position",new Lt([0,0,0,0,0,1],3)),this.targetLine=new Ul(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),vU.setFromMatrixPosition(this.light.matrixWorld),E_.setFromMatrixPosition(this.light.target.matrixWorld),yU.subVectors(E_,vU),this.lightPlane.lookAt(E_),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(E_),this.targetLine.scale.z=yU.length()}}const A_=new X,Sr=new ux;class ebe extends eo{constructor(e){const n=new Yt,r=new $r({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],o={};a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4");function a(x,S){l(x),l(S)}function l(x){i.push(0,0,0),s.push(0,0,0),o[x]===void 0&&(o[x]=[]),o[x].push(i.length/3-1)}n.setAttribute("position",new Lt(i,3)),n.setAttribute("color",new Lt(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=o,this.update();const c=new ct(16755200),d=new ct(16711680),f=new ct(43775),p=new ct(16777215),y=new ct(3355443);this.setColors(c,d,f,p,y)}setColors(e,n,r,i,s){const a=this.geometry.getAttribute("color");a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,n.r,n.g,n.b),a.setXYZ(25,n.r,n.g,n.b),a.setXYZ(26,n.r,n.g,n.b),a.setXYZ(27,n.r,n.g,n.b),a.setXYZ(28,n.r,n.g,n.b),a.setXYZ(29,n.r,n.g,n.b),a.setXYZ(30,n.r,n.g,n.b),a.setXYZ(31,n.r,n.g,n.b),a.setXYZ(32,r.r,r.g,r.b),a.setXYZ(33,r.r,r.g,r.b),a.setXYZ(34,r.r,r.g,r.b),a.setXYZ(35,r.r,r.g,r.b),a.setXYZ(36,r.r,r.g,r.b),a.setXYZ(37,r.r,r.g,r.b),a.setXYZ(38,i.r,i.g,i.b),a.setXYZ(39,i.r,i.g,i.b),a.setXYZ(40,s.r,s.g,s.b),a.setXYZ(41,s.r,s.g,s.b),a.setXYZ(42,s.r,s.g,s.b),a.setXYZ(43,s.r,s.g,s.b),a.setXYZ(44,s.r,s.g,s.b),a.setXYZ(45,s.r,s.g,s.b),a.setXYZ(46,s.r,s.g,s.b),a.setXYZ(47,s.r,s.g,s.b),a.setXYZ(48,s.r,s.g,s.b),a.setXYZ(49,s.r,s.g,s.b),a.needsUpdate=!0}update(){const e=this.geometry,n=this.pointMap,r=1,i=1;Sr.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Or("c",n,e,Sr,0,0,-1),Or("t",n,e,Sr,0,0,1),Or("n1",n,e,Sr,-r,-i,-1),Or("n2",n,e,Sr,r,-i,-1),Or("n3",n,e,Sr,-r,i,-1),Or("n4",n,e,Sr,r,i,-1),Or("f1",n,e,Sr,-r,-i,1),Or("f2",n,e,Sr,r,-i,1),Or("f3",n,e,Sr,-r,i,1),Or("f4",n,e,Sr,r,i,1),Or("u1",n,e,Sr,r*.7,i*1.1,-1),Or("u2",n,e,Sr,-r*.7,i*1.1,-1),Or("u3",n,e,Sr,0,i*2,-1),Or("cf1",n,e,Sr,-r,0,1),Or("cf2",n,e,Sr,r,0,1),Or("cf3",n,e,Sr,0,-i,1),Or("cf4",n,e,Sr,0,i,1),Or("cn1",n,e,Sr,-r,0,-1),Or("cn2",n,e,Sr,r,0,-1),Or("cn3",n,e,Sr,0,-i,-1),Or("cn4",n,e,Sr,0,i,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Or(t,e,n,r,i,s,o){A_.set(i,s,o).unproject(r);const a=e[t];if(a!==void 0){const l=n.getAttribute("position");for(let c=0,d=a.length;c<d;c++)l.setXYZ(a[c],A_.x,A_.y,A_.z)}}const T_=new as;class tbe extends eo{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&&T_.setFromObject(this.object),T_.isEmpty())return;const n=T_.min,r=T_.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 nbe extends eo{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 Lt(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 rbe extends Ul{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],o=new Yt;o.setAttribute("position",new Lt(s,3)),o.computeBoundingSphere(),super(o,new $r({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=n;const a=[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 Lt(a,3)),l.computeBoundingSphere(),this.add(new xr(l,new As({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 xU=new X;let P_,DA;class ibe extends mn{constructor(e=new X(0,0,1),n=new X(0,0,0),r=1,i=16776960,s=r*.2,o=s*.2){super(),this.type="ArrowHelper",P_===void 0&&(P_=new Yt,P_.setAttribute("position",new Lt([0,0,0,0,1,0],3)),DA=new ov(0,.5,1,5,1),DA.translate(0,-.5,0)),this.position.copy(n),this.line=new Ul(P_,new $r({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new xr(DA,new As({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(r,s,o)}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{xU.set(e.z,0,-e.x).normalize();const n=Math.acos(e.y);this.quaternion.setFromAxisAngle(xU,n)}}setLength(e,n=e*.2,r=n*.2){this.line.scale.set(1,Math.max(1e-4,e-n),1),this.line.updateMatrix(),this.cone.scale.set(r,n,r),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class uG extends eo{constructor(e=1){const n=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new Yt;i.setAttribute("position",new Lt(n,3)),i.setAttribute("color",new Lt(r,3));const s=new $r({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,n,r){const i=new ct,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(n),i.toArray(s,6),i.toArray(s,9),i.set(r),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class sbe{constructor(){this.type="ShapePath",this.color=new ct,this.subPaths=[],this.currentPath=null}moveTo(e,n){return this.currentPath=new Oy,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,n),this}lineTo(e,n){return this.currentPath.lineTo(e,n),this}quadraticCurveTo(e,n,r,i){return this.currentPath.quadraticCurveTo(e,n,r,i),this}bezierCurveTo(e,n,r,i,s,o){return this.currentPath.bezierCurveTo(e,n,r,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function n(_){const E=[];for(let T=0,P=_.length;T<P;T++){const O=_[T],N=new Ch;N.curves=O.curves,E.push(N)}return E}function r(_,E){const T=E.length;let P=!1;for(let O=T-1,N=0;N<T;O=N++){let D=E[O],z=E[N],G=z.x-D.x,k=z.y-D.y;if(Math.abs(k)>Number.EPSILON){if(k<0&&(D=E[N],G=-G,z=E[O],k=-k),_.y<D.y||_.y>z.y)continue;if(_.y===D.y){if(_.x===D.x)return!0}else{const j=k*(_.x-D.x)-G*(_.y-D.y);if(j===0)return!0;if(j<0)continue;P=!P}}else{if(_.y!==D.y)continue;if(z.x<=_.x&&_.x<=D.x||D.x<=_.x&&_.x<=z.x)return!0}}return P}const i=Cl.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const c=[];if(s.length===1)return a=s[0],l=new Ch,l.curves=a.curves,c.push(l),c;let d=!i(s[0].getPoints());d=e?!d:d;const f=[],p=[];let y=[],x=0,S;p[x]=void 0,y[x]=[];for(let _=0,E=s.length;_<E;_++)a=s[_],S=a.getPoints(),o=i(S),o=e?!o:o,o?(!d&&p[x]&&x++,p[x]={s:new Ch,p:S},p[x].s.curves=a.curves,d&&x++,y[x]=[]):y[x].push({h:a,p:S[0]});if(!p[0])return n(s);if(p.length>1){let _=!1,E=0;for(let T=0,P=p.length;T<P;T++)f[T]=[];for(let T=0,P=p.length;T<P;T++){const O=y[T];for(let N=0;N<O.length;N++){const D=O[N];let z=!0;for(let G=0;G<p.length;G++)r(D.p,p[G].p)&&(T!==G&&E++,z?(z=!1,f[G].push(D)):_=!0);z&&f[T].push(D)}}E>0&&_===!1&&(y=f)}let w;for(let _=0,E=p.length;_<E;_++){l=p[_].s,c.push(l),w=y[_];for(let T=0,P=w.length;T<P;T++)l.holes.push(w[T].h)}return c}}class obe extends zl{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 abe extends Va{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:Td}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Td);const lbe=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:dR,AddEquation:ld,AddOperation:UV,AdditiveAnimationBlendMode:_R,AdditiveBlending:HP,AgXToneMapping:HV,AlphaFormat:mR,AlwaysCompare:i6,AlwaysDepth:e1,AlwaysStencilFunc:$P,AmbientLight:Q6,AnimationAction:aG,AnimationClip:jg,AnimationLoader:fxe,AnimationMixer:Fxe,AnimationObjectGroup:Uxe,AnimationUtils:lxe,ArcCurve:A6,ArrayCamera:b6,ArrowHelper:ibe,AttachedBindMode:WP,Audio:sG,AudioAnalyser:Txe,AudioContext:QR,AudioListener:Mxe,AudioLoader:_xe,AxesHelper:uG,BackSide:os,BasicDepthPacking:KV,BasicShadowMap:vV,BatchedMesh:E6,Bone:nM,BooleanKeyframeTrack:np,Box2:Gxe,Box3:as,Box3Helper:nbe,BoxGeometry:ep,BoxHelper:tbe,BufferAttribute:Qt,BufferGeometry:Yt,BufferGeometryLoader:rG,ByteType:fR,Cache:Fc,Camera:ux,CameraHelper:ebe,CanvasTexture:Iye,CapsuleGeometry:oM,CatmullRomCurve3:T6,CineonToneMapping:zV,CircleGeometry:aM,ClampToEdgeWrapping:_o,Clock:JR,Color:ct,ColorKeyframeTrack:$R,ColorManagement:Nn,CompressedArrayTexture:Rye,CompressedCubeTexture:Nye,CompressedTexture:iM,CompressedTextureLoader:hxe,ConeGeometry:lM,ConstantAlphaFactor:OV,ConstantColorFactor:IV,Controls:obe,CubeCamera:f6,CubeReflectionMapping:Zc,CubeRefractionMapping:Pd,CubeTexture:dx,CubeTextureLoader:pxe,CubeUVReflectionMapping:nv,CubicBezierCurve:FR,CubicBezierCurve3:P6,CubicInterpolant:$6,CullFaceBack:BP,CullFaceFront:gV,CullFaceFrontBack:che,CullFaceNone:mV,Curve:Xa,CurvePath:R6,CustomBlending:yV,CustomToneMapping:BV,CylinderGeometry:ov,Cylindrical:Vxe,Data3DTexture:ER,DataArrayTexture:ZS,DataTexture:Pl,DataTextureLoader:mxe,DataUtils:xpe,DecrementStencilOp:bhe,DecrementWrapStencilOp:whe,DefaultLoadingManager:K6,DepthFormat:Ah,DepthStencilFormat:Bh,DepthTexture:RR,DetachedBindMode:GV,DirectionalLight:ZR,DirectionalLightHelper:Jxe,DiscreteInterpolant:X6,DisplayP3ColorSpace:YS,DodecahedronGeometry:cM,DoubleSide:xo,DstAlphaFactor:TV,DstColorFactor:CV,DynamicCopyUsage:Dhe,DynamicDrawUsage:s6,DynamicReadUsage:khe,EdgesGeometry:N6,EllipseCurve:sM,EqualCompare:e6,EqualDepth:n1,EqualStencilFunc:Ahe,EquirectangularReflectionMapping:Ey,EquirectangularRefractionMapping:Ay,Euler:ls,EventDispatcher:zl,ExtrudeGeometry:dM,FileLoader:Ga,Float16BufferAttribute:Epe,Float32BufferAttribute:Lt,FloatType:Qs,Fog:eM,FogExp2:JS,FramebufferTexture:Cye,FrontSide:Ll,Frustum:fx,GLBufferAttribute:tC,GLSL1:jhe,GLSL3:XP,GreaterCompare:t6,GreaterDepth:i1,GreaterEqualCompare:r6,GreaterEqualDepth:r1,GreaterEqualStencilFunc:Rhe,GreaterStencilFunc:Phe,GridHelper:Zxe,Group:Ts,HalfFloatType:rv,HemisphereLight:Z6,HemisphereLightHelper:Yxe,IcosahedronGeometry:fM,ImageBitmapLoader:iG,ImageLoader:Fg,ImageUtils:l6,IncrementStencilOp:xhe,IncrementWrapStencilOp:_he,InstancedBufferAttribute:Hh,InstancedBufferGeometry:nG,InstancedInterleavedBuffer:Hxe,InstancedMesh:LR,Int16BufferAttribute:Spe,Int32BufferAttribute:Mpe,Int8BufferAttribute:bpe,IntType:VS,InterleavedBuffer:tp,InterleavedBufferAttribute:Dl,Interpolant:av,InterpolateDiscrete:Og,InterpolateLinear:Lg,InterpolateSmooth:W_,InvertStencilOp:She,KeepStencilOp:Yf,KeyframeTrack:qa,LOD:M6,LatheGeometry:hx,Layers:Ph,LessCompare:JV,LessDepth:t1,LessEqualCompare:SR,LessEqualDepth:Fh,LessEqualStencilFunc:The,LessStencilFunc:Ehe,Light:Ld,LightProbe:tG,Line:Ul,Line3:Wxe,LineBasicMaterial:$r,LineCurve:zR,LineCurve3:C6,LineDashedMaterial:V6,LineLoop:DR,LineSegments:eo,LinearDisplayP3ColorSpace:cx,LinearFilter:Cr,LinearInterpolant:WR,LinearMipMapLinearFilter:hhe,LinearMipMapNearestFilter:fhe,LinearMipmapLinearFilter:$o,LinearMipmapNearestFilter:ng,LinearSRGBColorSpace:xi,LinearToneMapping:jV,LinearTransfer:Py,Loader:Rs,LoaderUtils:wd,LoadingManager:XR,LoopOnce:WV,LoopPingPong:XV,LoopRepeat:$V,LuminanceAlphaFormat:yR,LuminanceFormat:vR,MOUSE:qf,Material:Gr,MaterialLoader:xM,MathUtils:vr,Matrix2:rN,Matrix3:$t,Matrix4:Ct,MaxEquation:wV,Mesh:xr,MeshBasicMaterial:As,MeshDepthMaterial:NR,MeshDistanceMaterial:IR,MeshLambertMaterial:B6,MeshMatcapMaterial:H6,MeshNormalMaterial:z6,MeshPhongMaterial:j6,MeshPhysicalMaterial:ta,MeshStandardMaterial:gx,MeshToonMaterial:F6,MinEquation:_V,MirroredRepeatWrapping:Ig,MixOperation:DV,MultiplyBlending:GP,MultiplyOperation:ax,NearestFilter:ri,NearestMipMapLinearFilter:dhe,NearestMipMapNearestFilter:uhe,NearestMipmapLinearFilter:oh,NearestMipmapNearestFilter:HS,NeutralToneMapping:VV,NeverCompare:QV,NeverDepth:Jw,NeverStencilFunc:Mhe,NoBlending:Vc,NoColorSpace:Oc,NoToneMapping:Tl,NormalAnimationBlendMode:KS,NormalBlending:Eh,NotEqualCompare:n6,NotEqualDepth:s1,NotEqualStencilFunc:Che,NumberKeyframeTrack:Gh,Object3D:mn,ObjectLoader:xxe,ObjectSpaceNormalMap:ZV,OctahedronGeometry:px,OneFactor:MV,OneMinusConstantAlphaFactor:LV,OneMinusConstantColorFactor:kV,OneMinusDstAlphaFactor:PV,OneMinusDstColorFactor:RV,OneMinusSrcAlphaFactor:Qw,OneMinusSrcColorFactor:AV,OrthographicCamera:Gc,P3Primaries:Ry,PCFShadowMap:zS,PCFSoftShadowMap:K0,PMREMGenerator:qP,Path:Oy,PerspectiveCamera:Pr,Plane:Rc,PlaneGeometry:iv,PlaneHelper:rbe,PointLight:YR,PointLightHelper:qxe,Points:UR,PointsMaterial:rM,PolarGridHelper:Qxe,PolyhedronGeometry:Od,PositionalAudio:Axe,PropertyBinding:Rn,PropertyMixer:oG,QuadraticBezierCurve:BR,QuadraticBezierCurve3:HR,Quaternion:qt,QuaternionKeyframeTrack:Wh,QuaternionLinearInterpolant:q6,RED_GREEN_RGTC2_Format:R1,RED_RGTC1_Format:bR,REVISION:Td,RGBADepthPacking:YV,RGBAFormat:ss,RGBAIntegerFormat:qS,RGBA_ASTC_10x10_Format:M1,RGBA_ASTC_10x5_Format:_1,RGBA_ASTC_10x6_Format:w1,RGBA_ASTC_10x8_Format:S1,RGBA_ASTC_12x10_Format:E1,RGBA_ASTC_12x12_Format:A1,RGBA_ASTC_4x4_Format:h1,RGBA_ASTC_5x4_Format:p1,RGBA_ASTC_5x5_Format:m1,RGBA_ASTC_6x5_Format:g1,RGBA_ASTC_6x6_Format:v1,RGBA_ASTC_8x5_Format:y1,RGBA_ASTC_8x6_Format:x1,RGBA_ASTC_8x8_Format:b1,RGBA_BPTC_Format:ey,RGBA_ETC2_EAC_Format:f1,RGBA_PVRTC_2BPPV1_Format:c1,RGBA_PVRTC_4BPPV1_Format:l1,RGBA_S3TC_DXT1_Format:Z0,RGBA_S3TC_DXT3_Format:Q0,RGBA_S3TC_DXT5_Format:J0,RGBDepthPacking:mhe,RGBFormat:gR,RGBIntegerFormat:phe,RGB_BPTC_SIGNED_Format:T1,RGB_BPTC_UNSIGNED_Format:P1,RGB_ETC1_Format:u1,RGB_ETC2_Format:d1,RGB_PVRTC_2BPPV1_Format:a1,RGB_PVRTC_4BPPV1_Format:o1,RGB_S3TC_DXT1_Format:Y0,RGDepthPacking:ghe,RGFormat:xR,RGIntegerFormat:XS,RawShaderMaterial:U6,Ray:Jh,Raycaster:lG,Rec709Primaries:Cy,RectAreaLight:J6,RedFormat:$S,RedIntegerFormat:lx,ReinhardToneMapping:FV,RenderTarget:c6,RepeatWrapping:Cd,ReplaceStencilOp:yhe,ReverseSubtractEquation:bV,RingGeometry:hM,SIGNED_RED_GREEN_RGTC2_Format:N1,SIGNED_RED_RGTC1_Format:C1,SRGBColorSpace:Fi,SRGBTransfer:er,Scene:kR,ShaderChunk:fn,ShaderLib:Da,ShaderMaterial:Zo,ShadowMaterial:D6,Shape:Ch,ShapeGeometry:pM,ShapePath:sbe,ShapeUtils:Cl,ShortType:hR,Skeleton:kd,SkeletonHelper:Xxe,SkinnedMesh:tM,Source:ch,Sphere:Hi,SphereGeometry:mx,Spherical:rC,SphericalHarmonics3:eG,SplineCurve:VR,SpotLight:KR,SpotLightHelper:$xe,Sprite:S6,SpriteMaterial:OR,SrcAlphaFactor:Zw,SrcAlphaSaturateFactor:NV,SrcColorFactor:EV,StaticCopyUsage:Lhe,StaticDrawUsage:Ny,StaticReadUsage:Ihe,StereoCamera:wxe,StreamCopyUsage:Uhe,StreamDrawUsage:Nhe,StreamReadUsage:Ohe,StringKeyframeTrack:rp,SubtractEquation:xV,SubtractiveBlending:VP,TOUCH:Kf,TangentSpaceNormalMap:ou,TetrahedronGeometry:mM,Texture:fr,TextureLoader:Y6,TextureUtils:lye,TorusGeometry:gM,TorusKnotGeometry:vM,Triangle:Ks,TriangleFanDrawMode:I1,TriangleStripDrawMode:wR,TrianglesDrawMode:qV,TubeGeometry:yM,UVMapping:BS,Uint16BufferAttribute:AR,Uint32BufferAttribute:TR,Uint8BufferAttribute:_pe,Uint8ClampedBufferAttribute:wpe,Uniform:nN,UniformsGroup:Bxe,UniformsLib:dt,UniformsUtils:PR,UnsignedByteType:Ha,UnsignedInt248Type:zh,UnsignedInt5999Type:pR,UnsignedIntType:Qc,UnsignedShort4444Type:GS,UnsignedShort5551Type:WS,UnsignedShortType:kg,VSMShadowMap:Oa,Vector2:He,Vector3:X,Vector4:On,VectorKeyframeTrack:$h,VideoTexture:Pye,WebGL3DRenderTarget:cpe,WebGLArrayRenderTarget:lpe,WebGLCoordinateSystem:Ml,WebGLCubeRenderTarget:h6,WebGLMultipleRenderTargets:abe,WebGLRenderTarget:Va,WebGLRenderer:_6,WebGLUtils:x6,WebGPUCoordinateSystem:Iy,WireframeGeometry:L6,WrapAroundEnding:Ty,ZeroCurvatureEnding:ah,ZeroFactor:SV,ZeroSlopeEnding:lh,ZeroStencilOp:vhe,createCanvasElement:a6},Symbol.toStringTag,{value:"Module"}));var UA={exports:{}},Ju={};/**
|
||
* @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 bU;function cbe(){return bU||(bU=1,Ju.ConcurrentRoot=1,Ju.ContinuousEventPriority=4,Ju.DefaultEventPriority=16,Ju.DiscreteEventPriority=1,Ju.IdleEventPriority=536870912,Ju.LegacyRoot=0),Ju}var _U;function ube(){return _U||(_U=1,UA.exports=cbe()),UA.exports}var Km=ube();function dbe(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 fbe=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),wU=fbe?R.useEffect:R.useLayoutEffect;function hbe(t){const e=typeof t=="function"?dbe(t):t,n=(r=e.getState,i=Object.is)=>{const[,s]=R.useReducer(w=>w+1,0),o=e.getState(),a=R.useRef(o),l=R.useRef(r),c=R.useRef(i),d=R.useRef(!1),f=R.useRef();f.current===void 0&&(f.current=r(o));let p,y=!1;(a.current!==o||l.current!==r||c.current!==i||d.current)&&(p=r(o),y=!i(f.current,p)),wU(()=>{y&&(f.current=p),a.current=o,l.current=r,c.current=i,d.current=!1});const x=R.useRef(o);wU(()=>{const w=()=>{try{const E=e.getState(),T=l.current(E);c.current(f.current,T)||(a.current=E,f.current=T,s())}catch{d.current=!0,s()}},_=e.subscribe(w);return e.getState()!==x.current&&w(),_},[]);const S=y?p:f.current;return R.useDebugValue(S),S};return Object.assign(n,e),n[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const r=[n,e];return{next(){const i=r.length<=0;return{value:r.shift(),done:i}}}},n}var jA={exports:{}},FA={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 SU;function pbe(){return SU||(SU=1,(function(t){function e(B,J){var Y=B.length;B.push(J);e:for(;0<Y;){var V=Y-1>>>1,q=B[V];if(0<i(q,J))B[V]=J,B[Y]=q,Y=V;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],Y=B.pop();if(Y!==J){B[0]=Y;e:for(var V=0,q=B.length,pe=q>>>1;V<pe;){var ae=2*(V+1)-1,ce=B[ae],Se=ae+1,Ee=B[Se];if(0>i(ce,Y))Se<q&&0>i(Ee,ce)?(B[V]=Ee,B[Se]=Y,V=Se):(B[V]=ce,B[ae]=Y,V=ae);else if(Se<q&&0>i(Ee,Y))B[V]=Ee,B[Se]=Y,V=Se;else break e}}return J}function i(B,J){var Y=B.sortIndex-J.sortIndex;return Y!==0?Y:B.id-J.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,f=null,p=3,y=!1,x=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(B){for(var J=n(c);J!==null;){if(J.callback===null)r(c);else if(J.startTime<=B)r(c),J.sortIndex=J.expirationTime,e(l,J);else break;J=n(c)}}function P(B){if(S=!1,T(B),!x)if(n(l)!==null)x=!0,se(O);else{var J=n(c);J!==null&&fe(P,J.startTime-B)}}function O(B,J){x=!1,S&&(S=!1,_(z),z=-1),y=!0;var Y=p;try{for(T(J),f=n(l);f!==null&&(!(f.expirationTime>J)||B&&!j());){var V=f.callback;if(typeof V=="function"){f.callback=null,p=f.priorityLevel;var q=V(f.expirationTime<=J);J=t.unstable_now(),typeof q=="function"?f.callback=q:f===n(l)&&r(l),T(J)}else r(l);f=n(l)}if(f!==null)var pe=!0;else{var ae=n(c);ae!==null&&fe(P,ae.startTime-J),pe=!1}return pe}finally{f=null,p=Y,y=!1}}var N=!1,D=null,z=-1,G=5,k=-1;function j(){return!(t.unstable_now()-k<G)}function H(){if(D!==null){var B=t.unstable_now();k=B;var J=!0;try{J=D(!0,B)}finally{J?ee():(N=!1,D=null)}}else N=!1}var ee;if(typeof E=="function")ee=function(){E(H)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,he=te.port2;te.port1.onmessage=H,ee=function(){he.postMessage(null)}}else ee=function(){w(H,0)};function se(B){D=B,N||(N=!0,ee())}function fe(B,J){z=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,se(O))},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"):G=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 Y=p;p=J;try{return B()}finally{p=Y}},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 Y=p;p=B;try{return J()}finally{p=Y}},t.unstable_scheduleCallback=function(B,J,Y){var V=t.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?V+Y:V):Y=V,B){case 1:var q=-1;break;case 2:q=250;break;case 5:q=1073741823;break;case 4:q=1e4;break;default:q=5e3}return q=Y+q,B={id:d++,callback:J,priorityLevel:B,startTime:Y,expirationTime:q,sortIndex:-1},Y>V?(B.sortIndex=Y,e(c,B),n(l)===null&&B===n(c)&&(S?(_(z),z=-1):S=!0,fe(P,Y-V))):(B.sortIndex=q,e(l,B),x||y||(x=!0,se(O))),B},t.unstable_shouldYield=j,t.unstable_wrapCallback=function(B){var J=p;return function(){var Y=p;p=J;try{return B.apply(this,arguments)}finally{p=Y}}}})(zA)),zA}var MU;function mbe(){return MU||(MU=1,FA.exports=pbe()),FA.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 BA,EU;function gbe(){return EU||(EU=1,BA=function(e){var n={},r=Xh(),i=mbe(),s=Object.assign;function o(m){for(var g="https://reactjs.org/docs/error-decoder.html?invariant="+m,M=1;M<arguments.length;M++)g+="&args[]="+encodeURIComponent(arguments[M]);return"Minified React error #"+m+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var a=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"),_=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),P=Symbol.for("react.offscreen"),O=Symbol.iterator;function N(m){return m===null||typeof m!="object"?null:(m=O&&m[O]||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 _: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 g=m.render;return m=m.displayName,m||(m=g.displayName||g.name||"",m=m!==""?"ForwardRef("+m+")":"ForwardRef"),m;case E:return g=m.displayName||null,g!==null?g:D(m.type)||"Memo";case T:g=m._payload,m=m._init;try{return D(m(g))}catch{}}return null}function z(m){var g=m.type;switch(m.tag){case 24:return"Cache";case 9:return(g.displayName||"Context")+".Consumer";case 10:return(g._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return m=g.render,m=m.displayName||m.name||"",g.displayName||(m!==""?"ForwardRef("+m+")":"ForwardRef");case 7:return"Fragment";case 5:return g;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return D(g);case 8:return g===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 g=="function")return g.displayName||g.name||null;if(typeof g=="string")return g}return null}function G(m){var g=m,M=m;if(m.alternate)for(;g.return;)g=g.return;else{m=g;do g=m,(g.flags&4098)!==0&&(M=g.return),m=g.return;while(m)}return g.tag===3?M:null}function k(m){if(G(m)!==m)throw Error(o(188))}function j(m){var g=m.alternate;if(!g){if(g=G(m),g===null)throw Error(o(188));return g!==m?null:m}for(var M=m,C=g;;){var L=M.return;if(L===null)break;var F=L.alternate;if(F===null){if(C=L.return,C!==null){M=C;continue}break}if(L.child===F.child){for(F=L.child;F;){if(F===M)return k(L),m;if(F===C)return k(L),g;F=F.sibling}throw Error(o(188))}if(M.return!==C.return)M=L,C=F;else{for(var ie=!1,ye=L.child;ye;){if(ye===M){ie=!0,M=L,C=F;break}if(ye===C){ie=!0,C=L,M=F;break}ye=ye.sibling}if(!ie){for(ye=F.child;ye;){if(ye===M){ie=!0,M=F,C=L;break}if(ye===C){ie=!0,C=F,M=L;break}ye=ye.sibling}if(!ie)throw Error(o(189))}}if(M.alternate!==C)throw Error(o(190))}if(M.tag!==3)throw Error(o(188));return M.stateNode.current===M?m:g}function H(m){return m=j(m),m!==null?ee(m):null}function ee(m){if(m.tag===5||m.tag===6)return m;for(m=m.child;m!==null;){var g=ee(m);if(g!==null)return g;m=m.sibling}return null}function te(m){if(m.tag===5||m.tag===6)return m;for(m=m.child;m!==null;){if(m.tag!==4){var g=te(m);if(g!==null)return g}m=m.sibling}return null}var he=Array.isArray,se=e.getPublicInstance,fe=e.getRootHostContext,B=e.getChildHostContext,J=e.prepareForCommit,Y=e.resetAfterCommit,V=e.createInstance,q=e.appendInitialChild,pe=e.finalizeInitialChildren,ae=e.prepareUpdate,ce=e.shouldSetTextContent,Se=e.createTextInstance,Ee=e.scheduleTimeout,$e=e.cancelTimeout,Me=e.noTimeout,Ge=e.isPrimaryRenderer,We=e.supportsMutation,ue=e.supportsPersistence,Z=e.supportsHydration,Ve=e.getInstanceFromNode,Le=e.preparePortalMount,re=e.getCurrentEventPriority,Ce=e.detachDeletedInstance,qe=e.supportsMicrotasks,Ze=e.scheduleMicrotask,Q=e.supportsTestSelectors,W=e.findFiberRoot,be=e.getBoundingRect,Ue=e.getTextContent,ze=e.isHiddenSubtree,Fe=e.matchAccessibilityRole,bt=e.setFocusIfFocusable,rt=e.setupIntersectionObserver,ft=e.appendChild,Xt=e.appendChildToContainer,Ke=e.commitTextUpdate,ne=e.commitMount,et=e.commitUpdate,Mt=e.insertBefore,vt=e.insertInContainerBefore,Zt=e.removeChild,de=e.removeChildFromContainer,Xe=e.resetTextContent,le=e.hideInstance,Ye=e.hideTextInstance,Re=e.unhideInstance,Be=e.unhideTextInstance,ot=e.clearContainer,pt=e.cloneInstance,Jt=e.createContainerChildSet,pn=e.appendChildToContainerChildSet,jn=e.finalizeContainerChildren,en=e.replaceContainerChildren,Hn=e.cloneHiddenInstance,pr=e.cloneHiddenTextInstance,Mi=e.canHydrateInstance,na=e.canHydrateTextInstance,Ei=e.canHydrateSuspenseInstance,Ka=e.isSuspenseInstancePending,Ns=e.isSuspenseInstanceFallback,ra=e.registerSuspenseInstanceRetry,Ai=e.getNextHydratableSibling,Ao=e.getFirstHydratableChild,ia=e.getFirstHydratableChildWithinContainer,au=e.getFirstHydratableChildWithinSuspenseInstance,lu=e.hydrateInstance,To=e.hydrateTextInstance,cu=e.hydrateSuspenseInstance,Bl=e.getNextHydratableInstanceAfterSuspenseInstance,K=e.commitHydratedContainer,xe=e.commitHydratedSuspenseInstance,Te=e.clearSuspenseBoundary,Ie=e.clearSuspenseBoundaryFromContainer,we=e.shouldDeleteUnhydratedTailInstances,it=e.didNotMatchHydratedContainerTextInstance,yt=e.didNotMatchHydratedTextInstance,lt;function Et(m){if(lt===void 0)try{throw Error()}catch(M){var g=M.stack.trim().match(/\n( *(at )?)/);lt=g&&g[1]||""}return`
|
||
`+lt+m}var jt=!1;function Bt(m,g){if(!m||jt)return"";jt=!0;var M=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(g)if(g=function(){throw Error()},Object.defineProperty(g.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(g,[])}catch(st){var C=st}Reflect.construct(m,[],g)}else{try{g.call()}catch(st){C=st}m.call(g.prototype)}else{try{throw Error()}catch(st){C=st}m()}}catch(st){if(st&&C&&typeof st.stack=="string"){for(var L=st.stack.split(`
|
||
`),F=C.stack.split(`
|
||
`),ie=L.length-1,ye=F.length-1;1<=ie&&0<=ye&&L[ie]!==F[ye];)ye--;for(;1<=ie&&0<=ye;ie--,ye--)if(L[ie]!==F[ye]){if(ie!==1||ye!==1)do if(ie--,ye--,0>ye||L[ie]!==F[ye]){var je=`
|
||
`+L[ie].replace(" at new "," at ");return m.displayName&&je.includes("<anonymous>")&&(je=je.replace("<anonymous>",m.displayName)),je}while(1<=ie&&0<=ye);break}}}finally{jt=!1,Error.prepareStackTrace=M}return(m=m?m.displayName||m.name:"")?Et(m):""}var Rt=Object.prototype.hasOwnProperty,Sn=[],Mn=-1;function yn(m){return{current:m}}function Kt(m){0>Mn||(m.current=Sn[Mn],Sn[Mn]=null,Mn--)}function Ut(m,g){Mn++,Sn[Mn]=m.current,m.current=g}var mt={},xn=yn(mt),tn=yn(!1),Rr=mt;function li(m,g){var M=m.type.contextTypes;if(!M)return mt;var C=m.stateNode;if(C&&C.__reactInternalMemoizedUnmaskedChildContext===g)return C.__reactInternalMemoizedMaskedChildContext;var L={},F;for(F in M)L[F]=g[F];return C&&(m=m.stateNode,m.__reactInternalMemoizedUnmaskedChildContext=g,m.__reactInternalMemoizedMaskedChildContext=L),L}function In(m){return m=m.childContextTypes,m!=null}function Is(){Kt(tn),Kt(xn)}function Vn(m,g,M){if(xn.current!==mt)throw Error(o(168));Ut(xn,g),Ut(tn,M)}function to(m,g,M){var C=m.stateNode;if(g=g.childContextTypes,typeof C.getChildContext!="function")return M;C=C.getChildContext();for(var L in C)if(!(L in g))throw Error(o(108,z(m)||"Unknown",L));return s({},M,C)}function Ya(m){return m=(m=m.stateNode)&&m.__reactInternalMemoizedMergedChildContext||mt,Rr=xn.current,Ut(xn,m),Ut(tn,tn.current),!0}function Xr(m,g,M){var C=m.stateNode;if(!C)throw Error(o(169));M?(m=to(m,g,Rr),C.__reactInternalMemoizedMergedChildContext=m,Kt(tn),Kt(xn),Ut(xn,m)):Kt(tn),Ut(tn,M)}var ci=Math.clz32?Math.clz32:bM,Dd=Math.log,Za=Math.LN2;function bM(m){return m>>>=0,m===0?32:31-(Dd(m)/Za|0)|0}var uu=64,Pn=4194304;function du(m){switch(m&-m){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return m&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return m&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return m}}function Ud(m,g){var M=m.pendingLanes;if(M===0)return 0;var C=0,L=m.suspendedLanes,F=m.pingedLanes,ie=M&268435455;if(ie!==0){var ye=ie&~L;ye!==0?C=du(ye):(F&=ie,F!==0&&(C=du(F)))}else ie=M&~L,ie!==0?C=du(ie):F!==0&&(C=du(F));if(C===0)return 0;if(g!==0&&g!==C&&(g&L)===0&&(L=C&-C,F=g&-g,L>=F||L===16&&(F&4194240)!==0))return g;if((C&4)!==0&&(C|=M&16),g=m.entangledLanes,g!==0)for(m=m.entanglements,g&=C;0<g;)M=31-ci(g),L=1<<M,C|=m[M],g&=~L;return C}function lv(m,g){switch(m){case 1:case 2:case 4:return g+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 g+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 yx(m,g){for(var M=m.suspendedLanes,C=m.pingedLanes,L=m.expirationTimes,F=m.pendingLanes;0<F;){var ie=31-ci(F),ye=1<<ie,je=L[ie];je===-1?((ye&M)===0||(ye&C)!==0)&&(L[ie]=lv(ye,g)):je<=g&&(m.expiredLanes|=ye),F&=~ye}}function ip(m){return m=m.pendingLanes&-1073741825,m!==0?m:m&1073741824?1073741824:0}function sp(m){for(var g=[],M=0;31>M;M++)g.push(m);return g}function Hl(m,g,M){m.pendingLanes|=g,g!==536870912&&(m.suspendedLanes=0,m.pingedLanes=0),m=m.eventTimes,g=31-ci(g),m[g]=M}function op(m,g){var M=m.pendingLanes&~g;m.pendingLanes=g,m.suspendedLanes=0,m.pingedLanes=0,m.expiredLanes&=g,m.mutableReadLanes&=g,m.entangledLanes&=g,g=m.entanglements;var C=m.eventTimes;for(m=m.expirationTimes;0<M;){var L=31-ci(M),F=1<<L;g[L]=0,C[L]=-1,m[L]=-1,M&=~F}}function Po(m,g){var M=m.entangledLanes|=g;for(m=m.entanglements;M;){var C=31-ci(M),L=1<<C;L&g|m[C]&g&&(m[C]|=g),M&=~L}}var un=0;function sa(m){return m&=-m,1<m?4<m?(m&268435455)!==0?16:536870912:4:1}var Vl=i.unstable_scheduleCallback,fu=i.unstable_cancelCallback,Qa=i.unstable_shouldYield,_M=i.unstable_requestPaint,Nr=i.unstable_now,Gl=i.unstable_ImmediatePriority,wM=i.unstable_UserBlockingPriority,ap=i.unstable_NormalPriority,lp=i.unstable_IdlePriority,jd=null,Co=null;function Fd(m){if(Co&&typeof Co.onCommitFiberRoot=="function")try{Co.onCommitFiberRoot(jd,m,void 0,(m.current.flags&128)===128)}catch{}}function zd(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var Ti=typeof Object.is=="function"?Object.is:zd,ks=null,cp=!1,cv=!1;function up(m){ks===null?ks=[m]:ks.push(m)}function dp(m){cp=!0,up(m)}function Os(){if(!cv&&ks!==null){cv=!0;var m=0,g=un;try{var M=ks;for(un=1;m<M.length;m++){var C=M[m];do C=C(!0);while(C!==null)}ks=null,cp=!1}catch(L){throw ks!==null&&(ks=ks.slice(m+1)),Vl(Gl,Os),L}finally{un=g,cv=!1}}return null}var xx=a.ReactCurrentBatchConfig;function no(m,g){if(Ti(m,g))return!0;if(typeof m!="object"||m===null||typeof g!="object"||g===null)return!1;var M=Object.keys(m),C=Object.keys(g);if(M.length!==C.length)return!1;for(C=0;C<M.length;C++){var L=M[C];if(!Rt.call(g,L)||!Ti(m[L],g[L]))return!1}return!0}function uv(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=Bt(m.type,!1),m;case 11:return m=Bt(m.type.render,!1),m;case 1:return m=Bt(m.type,!0),m;default:return""}}function $i(m,g){if(m&&m.defaultProps){g=s({},g),m=m.defaultProps;for(var M in m)g[M]===void 0&&(g[M]=m[M]);return g}return g}var Bd=yn(null),Wl=null,oa=null,fp=null;function Pi(){fp=oa=Wl=null}function $l(m,g,M){Ge?(Ut(Bd,g._currentValue),g._currentValue=M):(Ut(Bd,g._currentValue2),g._currentValue2=M)}function Hd(m){var g=Bd.current;Kt(Bd),Ge?m._currentValue=g:m._currentValue2=g}function Xl(m,g,M){for(;m!==null;){var C=m.alternate;if((m.childLanes&g)!==g?(m.childLanes|=g,C!==null&&(C.childLanes|=g)):C!==null&&(C.childLanes&g)!==g&&(C.childLanes|=g),m===M)break;m=m.return}}function hu(m,g){Wl=m,fp=oa=null,m=m.dependencies,m!==null&&m.firstContext!==null&&((m.lanes&g)!==0&&(Fr=!0),m.firstContext=null)}function Xi(m){var g=Ge?m._currentValue:m._currentValue2;if(fp!==m)if(m={context:m,memoizedValue:g,next:null},oa===null){if(Wl===null)throw Error(o(308));oa=m,Wl.dependencies={lanes:0,firstContext:m}}else oa=oa.next=m;return g}var Ls=null,Ds=!1;function pu(m){m.updateQueue={baseState:m.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function dv(m,g){m=m.updateQueue,g.updateQueue===m&&(g.updateQueue={baseState:m.baseState,firstBaseUpdate:m.firstBaseUpdate,lastBaseUpdate:m.lastBaseUpdate,shared:m.shared,effects:m.effects})}function aa(m,g){return{eventTime:m,lane:g,tag:0,payload:null,callback:null,next:null}}function Ja(m,g){var M=m.updateQueue;M!==null&&(M=M.shared,gr!==null&&(m.mode&1)!==0&&(an&2)===0?(m=M.interleaved,m===null?(g.next=g,Ls===null?Ls=[M]:Ls.push(M)):(g.next=m.next,m.next=g),M.interleaved=g):(m=M.pending,m===null?g.next=g:(g.next=m.next,m.next=g),M.pending=g))}function hp(m,g,M){if(g=g.updateQueue,g!==null&&(g=g.shared,(M&4194240)!==0)){var C=g.lanes;C&=m.pendingLanes,M|=C,g.lanes=M,Po(m,M)}}function pp(m,g){var M=m.updateQueue,C=m.alternate;if(C!==null&&(C=C.updateQueue,M===C)){var L=null,F=null;if(M=M.firstBaseUpdate,M!==null){do{var ie={eventTime:M.eventTime,lane:M.lane,tag:M.tag,payload:M.payload,callback:M.callback,next:null};F===null?L=F=ie:F=F.next=ie,M=M.next}while(M!==null);F===null?L=F=g:F=F.next=g}else L=F=g;M={baseState:C.baseState,firstBaseUpdate:L,lastBaseUpdate:F,shared:C.shared,effects:C.effects},m.updateQueue=M;return}m=M.lastBaseUpdate,m===null?M.firstBaseUpdate=g:m.next=g,M.lastBaseUpdate=g}function mp(m,g,M,C){var L=m.updateQueue;Ds=!1;var F=L.firstBaseUpdate,ie=L.lastBaseUpdate,ye=L.shared.pending;if(ye!==null){L.shared.pending=null;var je=ye,st=je.next;je.next=null,ie===null?F=st:ie.next=st,ie=je;var St=m.alternate;St!==null&&(St=St.updateQueue,ye=St.lastBaseUpdate,ye!==ie&&(ye===null?St.firstBaseUpdate=st:ye.next=st,St.lastBaseUpdate=je))}if(F!==null){var rn=L.baseState;ie=0,St=st=je=null,ye=F;do{var zt=ye.lane,ln=ye.eventTime;if((C&zt)===zt){St!==null&&(St=St.next={eventTime:ln,lane:0,tag:ye.tag,payload:ye.payload,callback:ye.callback,next:null});e:{var xt=m,Jr=ye;switch(zt=g,ln=M,Jr.tag){case 1:if(xt=Jr.payload,typeof xt=="function"){rn=xt.call(ln,rn,zt);break e}rn=xt;break e;case 3:xt.flags=xt.flags&-65537|128;case 0:if(xt=Jr.payload,zt=typeof xt=="function"?xt.call(ln,rn,zt):xt,zt==null)break e;rn=s({},rn,zt);break e;case 2:Ds=!0}}ye.callback!==null&&ye.lane!==0&&(m.flags|=64,zt=L.effects,zt===null?L.effects=[ye]:zt.push(ye))}else ln={eventTime:ln,lane:zt,tag:ye.tag,payload:ye.payload,callback:ye.callback,next:null},St===null?(st=St=ln,je=rn):St=St.next=ln,ie|=zt;if(ye=ye.next,ye===null){if(ye=L.shared.pending,ye===null)break;zt=ye,ye=zt.next,zt.next=null,L.lastBaseUpdate=zt,L.shared.pending=null}}while(!0);if(St===null&&(je=rn),L.baseState=je,L.firstBaseUpdate=st,L.lastBaseUpdate=St,g=L.shared.interleaved,g!==null){L=g;do ie|=L.lane,L=L.next;while(L!==g)}else F===null&&(L.shared.lanes=0);ko|=ie,m.lanes=ie,m.memoizedState=rn}}function bx(m,g,M){if(m=g.effects,g.effects=null,m!==null)for(g=0;g<m.length;g++){var C=m[g],L=C.callback;if(L!==null){if(C.callback=null,C=M,typeof L!="function")throw Error(o(191,L));L.call(C)}}}var _x=new r.Component().refs;function fv(m,g,M,C){g=m.memoizedState,M=M(C,g),M=M==null?g:s({},g,M),m.memoizedState=M,m.lanes===0&&(m.updateQueue.baseState=M)}var gp={isMounted:function(m){return(m=m._reactInternals)?G(m)===m:!1},enqueueSetState:function(m,g,M){m=m._reactInternals;var C=Cn(),L=co(m),F=aa(C,L);F.payload=g,M!=null&&(F.callback=M),Ja(m,F),g=fi(m,L,C),g!==null&&hp(g,m,L)},enqueueReplaceState:function(m,g,M){m=m._reactInternals;var C=Cn(),L=co(m),F=aa(C,L);F.tag=1,F.payload=g,M!=null&&(F.callback=M),Ja(m,F),g=fi(m,L,C),g!==null&&hp(g,m,L)},enqueueForceUpdate:function(m,g){m=m._reactInternals;var M=Cn(),C=co(m),L=aa(M,C);L.tag=2,g!=null&&(L.callback=g),Ja(m,L),g=fi(m,C,M),g!==null&&hp(g,m,C)}};function hv(m,g,M,C,L,F,ie){return m=m.stateNode,typeof m.shouldComponentUpdate=="function"?m.shouldComponentUpdate(C,F,ie):g.prototype&&g.prototype.isPureReactComponent?!no(M,C)||!no(L,F):!0}function wx(m,g,M){var C=!1,L=mt,F=g.contextType;return typeof F=="object"&&F!==null?F=Xi(F):(L=In(g)?Rr:xn.current,C=g.contextTypes,F=(C=C!=null)?li(m,L):mt),g=new g(M,F),m.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=gp,m.stateNode=g,g._reactInternals=m,C&&(m=m.stateNode,m.__reactInternalMemoizedUnmaskedChildContext=L,m.__reactInternalMemoizedMaskedChildContext=F),g}function Sx(m,g,M,C){m=g.state,typeof g.componentWillReceiveProps=="function"&&g.componentWillReceiveProps(M,C),typeof g.UNSAFE_componentWillReceiveProps=="function"&&g.UNSAFE_componentWillReceiveProps(M,C),g.state!==m&&gp.enqueueReplaceState(g,g.state,null)}function pv(m,g,M,C){var L=m.stateNode;L.props=M,L.state=m.memoizedState,L.refs=_x,pu(m);var F=g.contextType;typeof F=="object"&&F!==null?L.context=Xi(F):(F=In(g)?Rr:xn.current,L.context=li(m,F)),L.state=m.memoizedState,F=g.getDerivedStateFromProps,typeof F=="function"&&(fv(m,g,F,M),L.state=m.memoizedState),typeof g.getDerivedStateFromProps=="function"||typeof L.getSnapshotBeforeUpdate=="function"||typeof L.UNSAFE_componentWillMount!="function"&&typeof L.componentWillMount!="function"||(g=L.state,typeof L.componentWillMount=="function"&&L.componentWillMount(),typeof L.UNSAFE_componentWillMount=="function"&&L.UNSAFE_componentWillMount(),g!==L.state&&gp.enqueueReplaceState(L,L.state,null),mp(m,M,L,C),L.state=m.memoizedState),typeof L.componentDidMount=="function"&&(m.flags|=4194308)}var mu=[],el=0,vp=null,yp=0,Us=[],us=0,ql=null,la=1,ca="";function Kl(m,g){mu[el++]=yp,mu[el++]=vp,vp=m,yp=g}function Mx(m,g,M){Us[us++]=la,Us[us++]=ca,Us[us++]=ql,ql=m;var C=la;m=ca;var L=32-ci(C)-1;C&=~(1<<L),M+=1;var F=32-ci(g)+L;if(30<F){var ie=L-L%5;F=(C&(1<<ie)-1).toString(32),C>>=ie,L-=ie,la=1<<32-ci(g)+L|M<<L|C,ca=F+m}else la=1<<F|M<<L|C,ca=m}function mv(m){m.return!==null&&(Kl(m,1),Mx(m,1,0))}function gv(m){for(;m===vp;)vp=mu[--el],mu[el]=null,yp=mu[--el],mu[el]=null;for(;m===ql;)ql=Us[--us],Us[us]=null,ca=Us[--us],Us[us]=null,la=Us[--us],Us[us]=null}var Ci=null,qr=null,Qn=!1,gu=!1,js=null;function vv(m,g){var M=vs(5,null,null,0);M.elementType="DELETED",M.stateNode=g,M.return=m,g=m.deletions,g===null?(m.deletions=[M],m.flags|=16):g.push(M)}function yv(m,g){switch(m.tag){case 5:return g=Mi(g,m.type,m.pendingProps),g!==null?(m.stateNode=g,Ci=m,qr=Ao(g),!0):!1;case 6:return g=na(g,m.pendingProps),g!==null?(m.stateNode=g,Ci=m,qr=null,!0):!1;case 13:if(g=Ei(g),g!==null){var M=ql!==null?{id:la,overflow:ca}:null;return m.memoizedState={dehydrated:g,treeContext:M,retryLane:1073741824},M=vs(18,null,null,0),M.stateNode=g,M.return=m,m.child=M,Ci=m,qr=null,!0}return!1;default:return!1}}function xp(m){return(m.mode&1)!==0&&(m.flags&128)===0}function tl(m){if(Qn){var g=qr;if(g){var M=g;if(!yv(m,g)){if(xp(m))throw Error(o(418));g=Ai(M);var C=Ci;g&&yv(m,g)?vv(C,M):(m.flags=m.flags&-4097|2,Qn=!1,Ci=m)}}else{if(xp(m))throw Error(o(418));m.flags=m.flags&-4097|2,Qn=!1,Ci=m}}}function Ex(m){for(m=m.return;m!==null&&m.tag!==5&&m.tag!==3&&m.tag!==13;)m=m.return;Ci=m}function Vd(m){if(!Z||m!==Ci)return!1;if(!Qn)return Ex(m),Qn=!0,!1;if(m.tag!==3&&(m.tag!==5||we(m.type)&&!ce(m.type,m.memoizedProps))){var g=qr;if(g){if(xp(m)){for(m=qr;m;)m=Ai(m);throw Error(o(418))}for(;g;)vv(m,g),g=Ai(g)}}if(Ex(m),m.tag===13){if(!Z)throw Error(o(316));if(m=m.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(o(317));qr=Bl(m)}else qr=Ci?Ai(m.stateNode):null;return!0}function vu(){Z&&(qr=Ci=null,gu=Qn=!1)}function bp(m){js===null?js=[m]:js.push(m)}function yu(m,g,M){if(m=M.ref,m!==null&&typeof m!="function"&&typeof m!="object"){if(M._owner){if(M=M._owner,M){if(M.tag!==1)throw Error(o(309));var C=M.stateNode}if(!C)throw Error(o(147,m));var L=C,F=""+m;return g!==null&&g.ref!==null&&typeof g.ref=="function"&&g.ref._stringRef===F?g.ref:(g=function(ie){var ye=L.refs;ye===_x&&(ye=L.refs={}),ie===null?delete ye[F]:ye[F]=ie},g._stringRef=F,g)}if(typeof m!="string")throw Error(o(284));if(!M._owner)throw Error(o(290,m))}return m}function nl(m,g){throw m=Object.prototype.toString.call(g),Error(o(31,m==="[object Object]"?"object with keys {"+Object.keys(g).join(", ")+"}":m))}function xu(m){var g=m._init;return g(m._payload)}function Ax(m){function g(Ne,_e){if(m){var De=Ne.deletions;De===null?(Ne.deletions=[_e],Ne.flags|=16):De.push(_e)}}function M(Ne,_e){if(!m)return null;for(;_e!==null;)g(Ne,_e),_e=_e.sibling;return null}function C(Ne,_e){for(Ne=new Map;_e!==null;)_e.key!==null?Ne.set(_e.key,_e):Ne.set(_e.index,_e),_e=_e.sibling;return Ne}function L(Ne,_e){return Ne=Sa(Ne,_e),Ne.index=0,Ne.sibling=null,Ne}function F(Ne,_e,De){return Ne.index=De,m?(De=Ne.alternate,De!==null?(De=De.index,De<_e?(Ne.flags|=2,_e):De):(Ne.flags|=2,_e)):(Ne.flags|=1048576,_e)}function ie(Ne){return m&&Ne.alternate===null&&(Ne.flags|=2),Ne}function ye(Ne,_e,De,gt){return _e===null||_e.tag!==6?(_e=Xp(De,Ne.mode,gt),_e.return=Ne,_e):(_e=L(_e,De),_e.return=Ne,_e)}function je(Ne,_e,De,gt){var Ot=De.type;return Ot===d?St(Ne,_e,De.props.children,gt,De.key):_e!==null&&(_e.elementType===Ot||typeof Ot=="object"&&Ot!==null&&Ot.$$typeof===T&&xu(Ot)===_e.type)?(gt=L(_e,De.props),gt.ref=yu(Ne,_e,De),gt.return=Ne,gt):(gt=$p(De.type,De.key,De.props,null,Ne.mode,gt),gt.ref=yu(Ne,_e,De),gt.return=Ne,gt)}function st(Ne,_e,De,gt){return _e===null||_e.tag!==4||_e.stateNode.containerInfo!==De.containerInfo||_e.stateNode.implementation!==De.implementation?(_e=qp(De,Ne.mode,gt),_e.return=Ne,_e):(_e=L(_e,De.children||[]),_e.return=Ne,_e)}function St(Ne,_e,De,gt,Ot){return _e===null||_e.tag!==7?(_e=vc(De,Ne.mode,gt,Ot),_e.return=Ne,_e):(_e=L(_e,De),_e.return=Ne,_e)}function rn(Ne,_e,De){if(typeof _e=="string"&&_e!==""||typeof _e=="number")return _e=Xp(""+_e,Ne.mode,De),_e.return=Ne,_e;if(typeof _e=="object"&&_e!==null){switch(_e.$$typeof){case l:return De=$p(_e.type,_e.key,_e.props,null,Ne.mode,De),De.ref=yu(Ne,null,_e),De.return=Ne,De;case c:return _e=qp(_e,Ne.mode,De),_e.return=Ne,_e;case T:var gt=_e._init;return rn(Ne,gt(_e._payload),De)}if(he(_e)||N(_e))return _e=vc(_e,Ne.mode,De,null),_e.return=Ne,_e;nl(Ne,_e)}return null}function zt(Ne,_e,De,gt){var Ot=_e!==null?_e.key:null;if(typeof De=="string"&&De!==""||typeof De=="number")return Ot!==null?null:ye(Ne,_e,""+De,gt);if(typeof De=="object"&&De!==null){switch(De.$$typeof){case l:return De.key===Ot?je(Ne,_e,De,gt):null;case c:return De.key===Ot?st(Ne,_e,De,gt):null;case T:return Ot=De._init,zt(Ne,_e,Ot(De._payload),gt)}if(he(De)||N(De))return Ot!==null?null:St(Ne,_e,De,gt,null);nl(Ne,De)}return null}function ln(Ne,_e,De,gt,Ot){if(typeof gt=="string"&>!==""||typeof gt=="number")return Ne=Ne.get(De)||null,ye(_e,Ne,""+gt,Ot);if(typeof gt=="object"&>!==null){switch(gt.$$typeof){case l:return Ne=Ne.get(gt.key===null?De:gt.key)||null,je(_e,Ne,gt,Ot);case c:return Ne=Ne.get(gt.key===null?De:gt.key)||null,st(_e,Ne,gt,Ot);case T:var on=gt._init;return ln(Ne,_e,De,on(gt._payload),Ot)}if(he(gt)||N(gt))return Ne=Ne.get(De)||null,St(_e,Ne,gt,Ot,null);nl(_e,gt)}return null}function xt(Ne,_e,De,gt){for(var Ot=null,on=null,sn=_e,En=_e=0,_r=null;sn!==null&&En<De.length;En++){sn.index>En?(_r=sn,sn=null):_r=sn.sibling;var bn=zt(Ne,sn,De[En],gt);if(bn===null){sn===null&&(sn=_r);break}m&&sn&&bn.alternate===null&&g(Ne,sn),_e=F(bn,_e,En),on===null?Ot=bn:on.sibling=bn,on=bn,sn=_r}if(En===De.length)return M(Ne,sn),Qn&&Kl(Ne,En),Ot;if(sn===null){for(;En<De.length;En++)sn=rn(Ne,De[En],gt),sn!==null&&(_e=F(sn,_e,En),on===null?Ot=sn:on.sibling=sn,on=sn);return Qn&&Kl(Ne,En),Ot}for(sn=C(Ne,sn);En<De.length;En++)_r=ln(sn,Ne,En,De[En],gt),_r!==null&&(m&&_r.alternate!==null&&sn.delete(_r.key===null?En:_r.key),_e=F(_r,_e,En),on===null?Ot=_r:on.sibling=_r,on=_r);return m&&sn.forEach(function(Ma){return g(Ne,Ma)}),Qn&&Kl(Ne,En),Ot}function Jr(Ne,_e,De,gt){var Ot=N(De);if(typeof Ot!="function")throw Error(o(150));if(De=Ot.call(De),De==null)throw Error(o(151));for(var on=Ot=null,sn=_e,En=_e=0,_r=null,bn=De.next();sn!==null&&!bn.done;En++,bn=De.next()){sn.index>En?(_r=sn,sn=null):_r=sn.sibling;var Ma=zt(Ne,sn,bn.value,gt);if(Ma===null){sn===null&&(sn=_r);break}m&&sn&&Ma.alternate===null&&g(Ne,sn),_e=F(Ma,_e,En),on===null?Ot=Ma:on.sibling=Ma,on=Ma,sn=_r}if(bn.done)return M(Ne,sn),Qn&&Kl(Ne,En),Ot;if(sn===null){for(;!bn.done;En++,bn=De.next())bn=rn(Ne,bn.value,gt),bn!==null&&(_e=F(bn,_e,En),on===null?Ot=bn:on.sibling=bn,on=bn);return Qn&&Kl(Ne,En),Ot}for(sn=C(Ne,sn);!bn.done;En++,bn=De.next())bn=ln(sn,Ne,En,bn.value,gt),bn!==null&&(m&&bn.alternate!==null&&sn.delete(bn.key===null?En:bn.key),_e=F(bn,_e,En),on===null?Ot=bn:on.sibling=bn,on=bn);return m&&sn.forEach(function(Kv){return g(Ne,Kv)}),Qn&&Kl(Ne,En),Ot}function ys(Ne,_e,De,gt){if(typeof De=="object"&&De!==null&&De.type===d&&De.key===null&&(De=De.props.children),typeof De=="object"&&De!==null){switch(De.$$typeof){case l:e:{for(var Ot=De.key,on=_e;on!==null;){if(on.key===Ot){if(Ot=De.type,Ot===d){if(on.tag===7){M(Ne,on.sibling),_e=L(on,De.props.children),_e.return=Ne,Ne=_e;break e}}else if(on.elementType===Ot||typeof Ot=="object"&&Ot!==null&&Ot.$$typeof===T&&xu(Ot)===on.type){M(Ne,on.sibling),_e=L(on,De.props),_e.ref=yu(Ne,on,De),_e.return=Ne,Ne=_e;break e}M(Ne,on);break}else g(Ne,on);on=on.sibling}De.type===d?(_e=vc(De.props.children,Ne.mode,gt,De.key),_e.return=Ne,Ne=_e):(gt=$p(De.type,De.key,De.props,null,Ne.mode,gt),gt.ref=yu(Ne,_e,De),gt.return=Ne,Ne=gt)}return ie(Ne);case c:e:{for(on=De.key;_e!==null;){if(_e.key===on)if(_e.tag===4&&_e.stateNode.containerInfo===De.containerInfo&&_e.stateNode.implementation===De.implementation){M(Ne,_e.sibling),_e=L(_e,De.children||[]),_e.return=Ne,Ne=_e;break e}else{M(Ne,_e);break}else g(Ne,_e);_e=_e.sibling}_e=qp(De,Ne.mode,gt),_e.return=Ne,Ne=_e}return ie(Ne);case T:return on=De._init,ys(Ne,_e,on(De._payload),gt)}if(he(De))return xt(Ne,_e,De,gt);if(N(De))return Jr(Ne,_e,De,gt);nl(Ne,De)}return typeof De=="string"&&De!==""||typeof De=="number"?(De=""+De,_e!==null&&_e.tag===6?(M(Ne,_e.sibling),_e=L(_e,De),_e.return=Ne,Ne=_e):(M(Ne,_e),_e=Xp(De,Ne.mode,gt),_e.return=Ne,Ne=_e),ie(Ne)):M(Ne,_e)}return ys}var ua=Ax(!0),Tx=Ax(!1),bu={},qi=yn(bu),Yl=yn(bu),Zl=yn(bu);function ro(m){if(m===bu)throw Error(o(174));return m}function _p(m,g){Ut(Zl,g),Ut(Yl,m),Ut(qi,bu),m=fe(g),Kt(qi),Ut(qi,m)}function _u(){Kt(qi),Kt(Yl),Kt(Zl)}function Px(m){var g=ro(Zl.current),M=ro(qi.current);g=B(M,m.type,g),M!==g&&(Ut(Yl,m),Ut(qi,g))}function xv(m){Yl.current===m&&(Kt(qi),Kt(Yl))}var nr=yn(0);function wp(m){for(var g=m;g!==null;){if(g.tag===13){var M=g.memoizedState;if(M!==null&&(M=M.dehydrated,M===null||Ka(M)||Ns(M)))return g}else if(g.tag===19&&g.memoizedProps.revealOrder!==void 0){if((g.flags&128)!==0)return g}else if(g.child!==null){g.child.return=g,g=g.child;continue}if(g===m)break;for(;g.sibling===null;){if(g.return===null||g.return===m)return null;g=g.return}g.sibling.return=g.return,g=g.sibling}return null}var ds=[];function Ql(){for(var m=0;m<ds.length;m++){var g=ds[m];Ge?g._workInProgressVersionPrimary=null:g._workInProgressVersionSecondary=null}ds.length=0}var Gd=a.ReactCurrentDispatcher,fs=a.ReactCurrentBatchConfig,Jl=0,rr=null,Dr=null,Ur=null,Sp=!1,Ro=!1,ec=0,Wd=0;function jr(){throw Error(o(321))}function Mp(m,g){if(g===null)return!1;for(var M=0;M<g.length&&M<m.length;M++)if(!Ti(m[M],g[M]))return!1;return!0}function wu(m,g,M,C,L,F){if(Jl=F,rr=g,g.memoizedState=null,g.updateQueue=null,g.lanes=0,Gd.current=m===null||m.memoizedState===null?Ev:Av,m=M(C,L),Ro){F=0;do{if(Ro=!1,ec=0,25<=F)throw Error(o(301));F+=1,Ur=Dr=null,g.updateQueue=null,Gd.current=Tv,m=M(C,L)}while(Ro)}if(Gd.current=Au,g=Dr!==null&&Dr.next!==null,Jl=0,Ur=Dr=rr=null,Sp=!1,g)throw Error(o(300));return m}function rl(){var m=ec!==0;return ec=0,m}function io(){var m={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ur===null?rr.memoizedState=Ur=m:Ur=Ur.next=m,Ur}function so(){if(Dr===null){var m=rr.alternate;m=m!==null?m.memoizedState:null}else m=Dr.next;var g=Ur===null?rr.memoizedState:Ur.next;if(g!==null)Ur=g,Dr=m;else{if(m===null)throw Error(o(310));Dr=m,m={memoizedState:Dr.memoizedState,baseState:Dr.baseState,baseQueue:Dr.baseQueue,queue:Dr.queue,next:null},Ur===null?rr.memoizedState=Ur=m:Ur=Ur.next=m}return Ur}function No(m,g){return typeof g=="function"?g(m):g}function $d(m){var g=so(),M=g.queue;if(M===null)throw Error(o(311));M.lastRenderedReducer=m;var C=Dr,L=C.baseQueue,F=M.pending;if(F!==null){if(L!==null){var ie=L.next;L.next=F.next,F.next=ie}C.baseQueue=L=F,M.pending=null}if(L!==null){F=L.next,C=C.baseState;var ye=ie=null,je=null,st=F;do{var St=st.lane;if((Jl&St)===St)je!==null&&(je=je.next={lane:0,action:st.action,hasEagerState:st.hasEagerState,eagerState:st.eagerState,next:null}),C=st.hasEagerState?st.eagerState:m(C,st.action);else{var rn={lane:St,action:st.action,hasEagerState:st.hasEagerState,eagerState:st.eagerState,next:null};je===null?(ye=je=rn,ie=C):je=je.next=rn,rr.lanes|=St,ko|=St}st=st.next}while(st!==null&&st!==F);je===null?ie=C:je.next=ye,Ti(C,g.memoizedState)||(Fr=!0),g.memoizedState=C,g.baseState=ie,g.baseQueue=je,M.lastRenderedState=C}if(m=M.interleaved,m!==null){L=m;do F=L.lane,rr.lanes|=F,ko|=F,L=L.next;while(L!==m)}else L===null&&(M.lanes=0);return[g.memoizedState,M.dispatch]}function Xd(m){var g=so(),M=g.queue;if(M===null)throw Error(o(311));M.lastRenderedReducer=m;var C=M.dispatch,L=M.pending,F=g.memoizedState;if(L!==null){M.pending=null;var ie=L=L.next;do F=m(F,ie.action),ie=ie.next;while(ie!==L);Ti(F,g.memoizedState)||(Fr=!0),g.memoizedState=F,g.baseQueue===null&&(g.baseState=F),M.lastRenderedState=F}return[F,C]}function bv(){}function _v(m,g){var M=rr,C=so(),L=g(),F=!Ti(C.memoizedState,L);if(F&&(C.memoizedState=L,Fr=!0),C=C.queue,Su(da.bind(null,M,C,m),[m]),C.getSnapshot!==g||F||Ur!==null&&Ur.memoizedState.tag&1){if(M.flags|=2048,Kd(9,Sv.bind(null,M,C,L,g),void 0,null),gr===null)throw Error(o(349));(Jl&30)!==0||wv(M,g,L)}return L}function wv(m,g,M){m.flags|=16384,m={getSnapshot:g,value:M},g=rr.updateQueue,g===null?(g={lastEffect:null,stores:null},rr.updateQueue=g,g.stores=[m]):(M=g.stores,M===null?g.stores=[m]:M.push(m))}function Sv(m,g,M,C){g.value=M,g.getSnapshot=C,Ep(g)&&fi(m,1,-1)}function da(m,g,M){return M(function(){Ep(g)&&fi(m,1,-1)})}function Ep(m){var g=m.getSnapshot;m=m.value;try{var M=g();return!Ti(m,M)}catch{return!0}}function qd(m){var g=io();return typeof m=="function"&&(m=m()),g.memoizedState=g.baseState=m,m={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:m},g.queue=m,m=m.dispatch=SM.bind(null,rr,m),[g.memoizedState,m]}function Kd(m,g,M,C){return m={tag:m,create:g,destroy:M,deps:C,next:null},g=rr.updateQueue,g===null?(g={lastEffect:null,stores:null},rr.updateQueue=g,g.lastEffect=m.next=m):(M=g.lastEffect,M===null?g.lastEffect=m.next=m:(C=M.next,M.next=m,m.next=C,g.lastEffect=m)),m}function Cx(){return so().memoizedState}function il(m,g,M,C){var L=io();rr.flags|=m,L.memoizedState=Kd(1|g,M,void 0,C===void 0?null:C)}function Ap(m,g,M,C){var L=so();C=C===void 0?null:C;var F=void 0;if(Dr!==null){var ie=Dr.memoizedState;if(F=ie.destroy,C!==null&&Mp(C,ie.deps)){L.memoizedState=Kd(g,M,F,C);return}}rr.flags|=m,L.memoizedState=Kd(1|g,M,F,C)}function Tp(m,g){return il(8390656,8,m,g)}function Su(m,g){return Ap(2048,8,m,g)}function Wn(m,g){return Ap(4,2,m,g)}function Pp(m,g){return Ap(4,4,m,g)}function Yd(m,g){if(typeof g=="function")return m=m(),g(m),function(){g(null)};if(g!=null)return m=m(),g.current=m,function(){g.current=null}}function Mu(m,g,M){return M=M!=null?M.concat([m]):null,Ap(4,4,Yd.bind(null,g,m),M)}function Cp(){}function Rp(m,g){var M=so();g=g===void 0?null:g;var C=M.memoizedState;return C!==null&&g!==null&&Mp(g,C[1])?C[0]:(M.memoizedState=[m,g],m)}function Eu(m,g){var M=so();g=g===void 0?null:g;var C=M.memoizedState;return C!==null&&g!==null&&Mp(g,C[1])?C[0]:(m=m(),M.memoizedState=[m,g],m)}function Np(m,g){var M=un;un=M!==0&&4>M?M:4,m(!0);var C=fs.transition;fs.transition={};try{m(!1),g()}finally{un=M,fs.transition=C}}function tc(){return so().memoizedState}function Rx(m,g,M){var C=co(m);M={lane:C,action:M,hasEagerState:!1,eagerState:null,next:null},Nx(m)?Mv(g,M):(Zd(m,g,M),M=Cn(),m=fi(m,C,M),m!==null&&Qd(m,g,C))}function SM(m,g,M){var C=co(m),L={lane:C,action:M,hasEagerState:!1,eagerState:null,next:null};if(Nx(m))Mv(g,L);else{Zd(m,g,L);var F=m.alternate;if(m.lanes===0&&(F===null||F.lanes===0)&&(F=g.lastRenderedReducer,F!==null))try{var ie=g.lastRenderedState,ye=F(ie,M);if(L.hasEagerState=!0,L.eagerState=ye,Ti(ye,ie))return}catch{}finally{}M=Cn(),m=fi(m,C,M),m!==null&&Qd(m,g,C)}}function Nx(m){var g=m.alternate;return m===rr||g!==null&&g===rr}function Mv(m,g){Ro=Sp=!0;var M=m.pending;M===null?g.next=g:(g.next=M.next,M.next=g),m.pending=g}function Zd(m,g,M){gr!==null&&(m.mode&1)!==0&&(an&2)===0?(m=g.interleaved,m===null?(M.next=M,Ls===null?Ls=[g]:Ls.push(g)):(M.next=m.next,m.next=M),g.interleaved=M):(m=g.pending,m===null?M.next=M:(M.next=m.next,m.next=M),g.pending=M)}function Qd(m,g,M){if((M&4194240)!==0){var C=g.lanes;C&=m.pendingLanes,M|=C,g.lanes=M,Po(m,M)}}var Au={readContext:Xi,useCallback:jr,useContext:jr,useEffect:jr,useImperativeHandle:jr,useInsertionEffect:jr,useLayoutEffect:jr,useMemo:jr,useReducer:jr,useRef:jr,useState:jr,useDebugValue:jr,useDeferredValue:jr,useTransition:jr,useMutableSource:jr,useSyncExternalStore:jr,useId:jr,unstable_isNewReconciler:!1},Ev={readContext:Xi,useCallback:function(m,g){return io().memoizedState=[m,g===void 0?null:g],m},useContext:Xi,useEffect:Tp,useImperativeHandle:function(m,g,M){return M=M!=null?M.concat([m]):null,il(4194308,4,Yd.bind(null,g,m),M)},useLayoutEffect:function(m,g){return il(4194308,4,m,g)},useInsertionEffect:function(m,g){return il(4,2,m,g)},useMemo:function(m,g){var M=io();return g=g===void 0?null:g,m=m(),M.memoizedState=[m,g],m},useReducer:function(m,g,M){var C=io();return g=M!==void 0?M(g):g,C.memoizedState=C.baseState=g,m={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:m,lastRenderedState:g},C.queue=m,m=m.dispatch=Rx.bind(null,rr,m),[C.memoizedState,m]},useRef:function(m){var g=io();return m={current:m},g.memoizedState=m},useState:qd,useDebugValue:Cp,useDeferredValue:function(m){var g=qd(m),M=g[0],C=g[1];return Tp(function(){var L=fs.transition;fs.transition={};try{C(m)}finally{fs.transition=L}},[m]),M},useTransition:function(){var m=qd(!1),g=m[0];return m=Np.bind(null,m[1]),io().memoizedState=m,[g,m]},useMutableSource:function(){},useSyncExternalStore:function(m,g,M){var C=rr,L=io();if(Qn){if(M===void 0)throw Error(o(407));M=M()}else{if(M=g(),gr===null)throw Error(o(349));(Jl&30)!==0||wv(C,g,M)}L.memoizedState=M;var F={value:M,getSnapshot:g};return L.queue=F,Tp(da.bind(null,C,F,m),[m]),C.flags|=2048,Kd(9,Sv.bind(null,C,F,M,g),void 0,null),M},useId:function(){var m=io(),g=gr.identifierPrefix;if(Qn){var M=ca,C=la;M=(C&~(1<<32-ci(C)-1)).toString(32)+M,g=":"+g+"R"+M,M=ec++,0<M&&(g+="H"+M.toString(32)),g+=":"}else M=Wd++,g=":"+g+"r"+M.toString(32)+":";return m.memoizedState=g},unstable_isNewReconciler:!1},Av={readContext:Xi,useCallback:Rp,useContext:Xi,useEffect:Su,useImperativeHandle:Mu,useInsertionEffect:Wn,useLayoutEffect:Pp,useMemo:Eu,useReducer:$d,useRef:Cx,useState:function(){return $d(No)},useDebugValue:Cp,useDeferredValue:function(m){var g=$d(No),M=g[0],C=g[1];return Su(function(){var L=fs.transition;fs.transition={};try{C(m)}finally{fs.transition=L}},[m]),M},useTransition:function(){var m=$d(No)[0],g=so().memoizedState;return[m,g]},useMutableSource:bv,useSyncExternalStore:_v,useId:tc,unstable_isNewReconciler:!1},Tv={readContext:Xi,useCallback:Rp,useContext:Xi,useEffect:Su,useImperativeHandle:Mu,useInsertionEffect:Wn,useLayoutEffect:Pp,useMemo:Eu,useReducer:Xd,useRef:Cx,useState:function(){return Xd(No)},useDebugValue:Cp,useDeferredValue:function(m){var g=Xd(No),M=g[0],C=g[1];return Su(function(){var L=fs.transition;fs.transition={};try{C(m)}finally{fs.transition=L}},[m]),M},useTransition:function(){var m=Xd(No)[0],g=so().memoizedState;return[m,g]},useMutableSource:bv,useSyncExternalStore:_v,useId:tc,unstable_isNewReconciler:!1};function Pv(m,g){try{var M="",C=g;do M+=uv(C),C=C.return;while(C);var L=M}catch(F){L=`
|
||
Error generating stack: `+F.message+`
|
||
`+F.stack}return{value:m,source:g,stack:L}}function Ip(m,g){try{console.error(g.value)}catch(M){setTimeout(function(){throw M})}}var MM=typeof WeakMap=="function"?WeakMap:Map;function Ix(m,g,M){M=aa(-1,M),M.tag=3,M.payload={element:null};var C=g.value;return M.callback=function(){Iu||(Iu=!0,Yn=C),Ip(m,g)},M}function kp(m,g,M){M=aa(-1,M),M.tag=3;var C=m.type.getDerivedStateFromError;if(typeof C=="function"){var L=g.value;M.payload=function(){return C(L)},M.callback=function(){Ip(m,g)}}var F=m.stateNode;return F!==null&&typeof F.componentDidCatch=="function"&&(M.callback=function(){Ip(m,g),typeof C!="function"&&(lo===null?lo=new Set([this]):lo.add(this));var ie=g.stack;this.componentDidCatch(g.value,{componentStack:ie!==null?ie:""})}),M}function fa(m,g,M){var C=m.pingCache;if(C===null){C=m.pingCache=new MM;var L=new Set;C.set(g,L)}else L=C.get(g),L===void 0&&(L=new Set,C.set(g,L));L.has(M)||(L.add(M),m=$v.bind(null,m,g,M),g.then(m,m))}function Cv(m){do{var g;if((g=m.tag===13)&&(g=m.memoizedState,g=g!==null?g.dehydrated!==null:!0),g)return m;m=m.return}while(m!==null);return null}function nc(m,g,M,C,L){return(m.mode&1)===0?(m===g?m.flags|=65536:(m.flags|=128,M.flags|=131072,M.flags&=-52805,M.tag===1&&(M.alternate===null?M.tag=17:(g=aa(-1,1),g.tag=2,Ja(M,g))),M.lanes|=1),m):(m.flags|=65536,m.lanes=L,m)}function Ir(m){m.flags|=4}function Tu(m,g){if(m!==null&&m.child===g.child)return!0;if((g.flags&16)!==0)return!1;for(m=g.child;m!==null;){if((m.flags&12854)!==0||(m.subtreeFlags&12854)!==0)return!1;m=m.sibling}return!0}var hs,rc,Op,Lp;if(We)hs=function(m,g){for(var M=g.child;M!==null;){if(M.tag===5||M.tag===6)q(m,M.stateNode);else if(M.tag!==4&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===g)break;for(;M.sibling===null;){if(M.return===null||M.return===g)return;M=M.return}M.sibling.return=M.return,M=M.sibling}},rc=function(){},Op=function(m,g,M,C,L){if(m=m.memoizedProps,m!==C){var F=g.stateNode,ie=ro(qi.current);M=ae(F,M,m,C,L,ie),(g.updateQueue=M)&&Ir(g)}},Lp=function(m,g,M,C){M!==C&&Ir(g)};else if(ue){hs=function(m,g,M,C){for(var L=g.child;L!==null;){if(L.tag===5){var F=L.stateNode;M&&C&&(F=Hn(F,L.type,L.memoizedProps,L)),q(m,F)}else if(L.tag===6)F=L.stateNode,M&&C&&(F=pr(F,L.memoizedProps,L)),q(m,F);else if(L.tag!==4){if(L.tag===22&&L.memoizedState!==null)F=L.child,F!==null&&(F.return=L),hs(m,L,!0,!0);else if(L.child!==null){L.child.return=L,L=L.child;continue}}if(L===g)break;for(;L.sibling===null;){if(L.return===null||L.return===g)return;L=L.return}L.sibling.return=L.return,L=L.sibling}};var sl=function(m,g,M,C){for(var L=g.child;L!==null;){if(L.tag===5){var F=L.stateNode;M&&C&&(F=Hn(F,L.type,L.memoizedProps,L)),pn(m,F)}else if(L.tag===6)F=L.stateNode,M&&C&&(F=pr(F,L.memoizedProps,L)),pn(m,F);else if(L.tag!==4){if(L.tag===22&&L.memoizedState!==null)F=L.child,F!==null&&(F.return=L),sl(m,L,!0,!0);else if(L.child!==null){L.child.return=L,L=L.child;continue}}if(L===g)break;for(;L.sibling===null;){if(L.return===null||L.return===g)return;L=L.return}L.sibling.return=L.return,L=L.sibling}};rc=function(m,g){var M=g.stateNode;if(!Tu(m,g)){m=M.containerInfo;var C=Jt(m);sl(C,g,!1,!1),M.pendingChildren=C,Ir(g),jn(m,C)}},Op=function(m,g,M,C,L){var F=m.stateNode,ie=m.memoizedProps;if((m=Tu(m,g))&&ie===C)g.stateNode=F;else{var ye=g.stateNode,je=ro(qi.current),st=null;ie!==C&&(st=ae(ye,M,ie,C,L,je)),m&&st===null?g.stateNode=F:(F=pt(F,st,M,ie,C,g,m,ye),pe(F,M,C,L,je)&&Ir(g),g.stateNode=F,m?Ir(g):hs(F,g,!1,!1))}},Lp=function(m,g,M,C){M!==C?(m=ro(Zl.current),M=ro(qi.current),g.stateNode=Se(C,m,M,g),Ir(g)):g.stateNode=m.stateNode}}else rc=function(){},Op=function(){},Lp=function(){};function ha(m,g){if(!Qn)switch(m.tailMode){case"hidden":g=m.tail;for(var M=null;g!==null;)g.alternate!==null&&(M=g),g=g.sibling;M===null?m.tail=null:M.sibling=null;break;case"collapsed":M=m.tail;for(var C=null;M!==null;)M.alternate!==null&&(C=M),M=M.sibling;C===null?g||m.tail===null?m.tail=null:m.tail.sibling=null:C.sibling=null}}function mr(m){var g=m.alternate!==null&&m.alternate.child===m.child,M=0,C=0;if(g)for(var L=m.child;L!==null;)M|=L.lanes|L.childLanes,C|=L.subtreeFlags&14680064,C|=L.flags&14680064,L.return=m,L=L.sibling;else for(L=m.child;L!==null;)M|=L.lanes|L.childLanes,C|=L.subtreeFlags,C|=L.flags,L.return=m,L=L.sibling;return m.subtreeFlags|=C,m.childLanes=M,g}function Dp(m,g,M){var C=g.pendingProps;switch(gv(g),g.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mr(g),null;case 1:return In(g.type)&&Is(),mr(g),null;case 3:return C=g.stateNode,_u(),Kt(tn),Kt(xn),Ql(),C.pendingContext&&(C.context=C.pendingContext,C.pendingContext=null),(m===null||m.child===null)&&(Vd(g)?Ir(g):m===null||m.memoizedState.isDehydrated&&(g.flags&256)===0||(g.flags|=1024,js!==null&&(ff(js),js=null))),rc(m,g),mr(g),null;case 5:xv(g),M=ro(Zl.current);var L=g.type;if(m!==null&&g.stateNode!=null)Op(m,g,L,C,M),m.ref!==g.ref&&(g.flags|=512,g.flags|=2097152);else{if(!C){if(g.stateNode===null)throw Error(o(166));return mr(g),null}if(m=ro(qi.current),Vd(g)){if(!Z)throw Error(o(175));m=lu(g.stateNode,g.type,g.memoizedProps,M,m,g,!gu),g.updateQueue=m,m!==null&&Ir(g)}else{var F=V(L,C,M,m,g);hs(F,g,!1,!1),g.stateNode=F,pe(F,L,C,M,m)&&Ir(g)}g.ref!==null&&(g.flags|=512,g.flags|=2097152)}return mr(g),null;case 6:if(m&&g.stateNode!=null)Lp(m,g,m.memoizedProps,C);else{if(typeof C!="string"&&g.stateNode===null)throw Error(o(166));if(m=ro(Zl.current),M=ro(qi.current),Vd(g)){if(!Z)throw Error(o(176));if(m=g.stateNode,C=g.memoizedProps,(M=To(m,C,g,!gu))&&(L=Ci,L!==null))switch(F=(L.mode&1)!==0,L.tag){case 3:it(L.stateNode.containerInfo,m,C,F);break;case 5:yt(L.type,L.memoizedProps,L.stateNode,m,C,F)}M&&Ir(g)}else g.stateNode=Se(C,m,M,g)}return mr(g),null;case 13:if(Kt(nr),C=g.memoizedState,Qn&&qr!==null&&(g.mode&1)!==0&&(g.flags&128)===0){for(m=qr;m;)m=Ai(m);return vu(),g.flags|=98560,g}if(C!==null&&C.dehydrated!==null){if(C=Vd(g),m===null){if(!C)throw Error(o(318));if(!Z)throw Error(o(344));if(m=g.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(o(317));cu(m,g)}else vu(),(g.flags&128)===0&&(g.memoizedState=null),g.flags|=4;return mr(g),null}return js!==null&&(ff(js),js=null),(g.flags&128)!==0?(g.lanes=M,g):(C=C!==null,M=!1,m===null?Vd(g):M=m.memoizedState!==null,C&&!M&&(g.child.flags|=8192,(g.mode&1)!==0&&(m===null||(nr.current&1)!==0?cr===0&&(cr=3):Vp())),g.updateQueue!==null&&(g.flags|=4),mr(g),null);case 4:return _u(),rc(m,g),m===null&&Le(g.stateNode.containerInfo),mr(g),null;case 10:return Hd(g.type._context),mr(g),null;case 17:return In(g.type)&&Is(),mr(g),null;case 19:if(Kt(nr),L=g.memoizedState,L===null)return mr(g),null;if(C=(g.flags&128)!==0,F=L.rendering,F===null)if(C)ha(L,!1);else{if(cr!==0||m!==null&&(m.flags&128)!==0)for(m=g.child;m!==null;){if(F=wp(m),F!==null){for(g.flags|=128,ha(L,!1),m=F.updateQueue,m!==null&&(g.updateQueue=m,g.flags|=4),g.subtreeFlags=0,m=M,C=g.child;C!==null;)M=C,L=m,M.flags&=14680066,F=M.alternate,F===null?(M.childLanes=0,M.lanes=L,M.child=null,M.subtreeFlags=0,M.memoizedProps=null,M.memoizedState=null,M.updateQueue=null,M.dependencies=null,M.stateNode=null):(M.childLanes=F.childLanes,M.lanes=F.lanes,M.child=F.child,M.subtreeFlags=0,M.deletions=null,M.memoizedProps=F.memoizedProps,M.memoizedState=F.memoizedState,M.updateQueue=F.updateQueue,M.type=F.type,L=F.dependencies,M.dependencies=L===null?null:{lanes:L.lanes,firstContext:L.firstContext}),C=C.sibling;return Ut(nr,nr.current&1|2),g.child}m=m.sibling}L.tail!==null&&Nr()>ll&&(g.flags|=128,C=!0,ha(L,!1),g.lanes=4194304)}else{if(!C)if(m=wp(F),m!==null){if(g.flags|=128,C=!0,m=m.updateQueue,m!==null&&(g.updateQueue=m,g.flags|=4),ha(L,!0),L.tail===null&&L.tailMode==="hidden"&&!F.alternate&&!Qn)return mr(g),null}else 2*Nr()-L.renderingStartTime>ll&&M!==1073741824&&(g.flags|=128,C=!0,ha(L,!1),g.lanes=4194304);L.isBackwards?(F.sibling=g.child,g.child=F):(m=L.last,m!==null?m.sibling=F:g.child=F,L.last=F)}return L.tail!==null?(g=L.tail,L.rendering=g,L.tail=g.sibling,L.renderingStartTime=Nr(),g.sibling=null,m=nr.current,Ut(nr,C?m&1|2:m&1),g):(mr(g),null);case 22:case 23:return hf(),C=g.memoizedState!==null,m!==null&&m.memoizedState!==null!==C&&(g.flags|=8192),C&&(g.mode&1)!==0?(di&1073741824)!==0&&(mr(g),We&&g.subtreeFlags&6&&(g.flags|=8192)):mr(g),null;case 24:return null;case 25:return null}throw Error(o(156,g.tag))}var Rv=a.ReactCurrentOwner,Fr=!1;function lr(m,g,M,C){g.child=m===null?Tx(g,null,M,C):ua(g,m.child,M,C)}function $n(m,g,M,C,L){M=M.render;var F=g.ref;return hu(g,L),C=wu(m,g,M,C,F,L),M=rl(),m!==null&&!Fr?(g.updateQueue=m.updateQueue,g.flags&=-2053,m.lanes&=~L,Ki(m,g,L)):(Qn&&M&&mv(g),g.flags|=1,lr(m,g,C,L),g.child)}function Gn(m,g,M,C,L){if(m===null){var F=M.type;return typeof F=="function"&&!Wp(F)&&F.defaultProps===void 0&&M.compare===null&&M.defaultProps===void 0?(g.tag=15,g.type=F,pa(m,g,F,C,L)):(m=$p(M.type,null,C,g,g.mode,L),m.ref=g.ref,m.return=g,g.child=m)}if(F=m.child,(m.lanes&L)===0){var ie=F.memoizedProps;if(M=M.compare,M=M!==null?M:no,M(ie,C)&&m.ref===g.ref)return Ki(m,g,L)}return g.flags|=1,m=Sa(F,C),m.ref=g.ref,m.return=g,g.child=m}function pa(m,g,M,C,L){if(m!==null&&no(m.memoizedProps,C)&&m.ref===g.ref)if(Fr=!1,(m.lanes&L)!==0)(m.flags&131072)!==0&&(Fr=!0);else return g.lanes=m.lanes,Ki(m,g,L);return ma(m,g,M,C,L)}function Kr(m,g,M){var C=g.pendingProps,L=C.children,F=m!==null?m.memoizedState:null;if(C.mode==="hidden")if((g.mode&1)===0)g.memoizedState={baseLanes:0,cachePool:null},Ut(fc,di),di|=M;else if((M&1073741824)!==0)g.memoizedState={baseLanes:0,cachePool:null},C=F!==null?F.baseLanes:M,Ut(fc,di),di|=C;else return m=F!==null?F.baseLanes|M:M,g.lanes=g.childLanes=1073741824,g.memoizedState={baseLanes:m,cachePool:null},g.updateQueue=null,Ut(fc,di),di|=m,null;else F!==null?(C=F.baseLanes|M,g.memoizedState=null):C=M,Ut(fc,di),di|=C;return lr(m,g,L,M),g.child}function Ri(m,g){var M=g.ref;(m===null&&M!==null||m!==null&&m.ref!==M)&&(g.flags|=512,g.flags|=2097152)}function ma(m,g,M,C,L){var F=In(M)?Rr:xn.current;return F=li(g,F),hu(g,L),M=wu(m,g,M,C,F,L),C=rl(),m!==null&&!Fr?(g.updateQueue=m.updateQueue,g.flags&=-2053,m.lanes&=~L,Ki(m,g,L)):(Qn&&C&&mv(g),g.flags|=1,lr(m,g,M,L),g.child)}function ic(m,g,M,C,L){if(In(M)){var F=!0;Ya(g)}else F=!1;if(hu(g,L),g.stateNode===null)m!==null&&(m.alternate=null,g.alternate=null,g.flags|=2),wx(g,M,C),pv(g,M,C,L),C=!0;else if(m===null){var ie=g.stateNode,ye=g.memoizedProps;ie.props=ye;var je=ie.context,st=M.contextType;typeof st=="object"&&st!==null?st=Xi(st):(st=In(M)?Rr:xn.current,st=li(g,st));var St=M.getDerivedStateFromProps,rn=typeof St=="function"||typeof ie.getSnapshotBeforeUpdate=="function";rn||typeof ie.UNSAFE_componentWillReceiveProps!="function"&&typeof ie.componentWillReceiveProps!="function"||(ye!==C||je!==st)&&Sx(g,ie,C,st),Ds=!1;var zt=g.memoizedState;ie.state=zt,mp(g,C,ie,L),je=g.memoizedState,ye!==C||zt!==je||tn.current||Ds?(typeof St=="function"&&(fv(g,M,St,C),je=g.memoizedState),(ye=Ds||hv(g,M,ye,C,zt,je,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"&&(g.flags|=4194308)):(typeof ie.componentDidMount=="function"&&(g.flags|=4194308),g.memoizedProps=C,g.memoizedState=je),ie.props=C,ie.state=je,ie.context=st,C=ye):(typeof ie.componentDidMount=="function"&&(g.flags|=4194308),C=!1)}else{ie=g.stateNode,dv(m,g),ye=g.memoizedProps,st=g.type===g.elementType?ye:$i(g.type,ye),ie.props=st,rn=g.pendingProps,zt=ie.context,je=M.contextType,typeof je=="object"&&je!==null?je=Xi(je):(je=In(M)?Rr:xn.current,je=li(g,je));var ln=M.getDerivedStateFromProps;(St=typeof ln=="function"||typeof ie.getSnapshotBeforeUpdate=="function")||typeof ie.UNSAFE_componentWillReceiveProps!="function"&&typeof ie.componentWillReceiveProps!="function"||(ye!==rn||zt!==je)&&Sx(g,ie,C,je),Ds=!1,zt=g.memoizedState,ie.state=zt,mp(g,C,ie,L);var xt=g.memoizedState;ye!==rn||zt!==xt||tn.current||Ds?(typeof ln=="function"&&(fv(g,M,ln,C),xt=g.memoizedState),(st=Ds||hv(g,M,st,C,zt,xt,je)||!1)?(St||typeof ie.UNSAFE_componentWillUpdate!="function"&&typeof ie.componentWillUpdate!="function"||(typeof ie.componentWillUpdate=="function"&&ie.componentWillUpdate(C,xt,je),typeof ie.UNSAFE_componentWillUpdate=="function"&&ie.UNSAFE_componentWillUpdate(C,xt,je)),typeof ie.componentDidUpdate=="function"&&(g.flags|=4),typeof ie.getSnapshotBeforeUpdate=="function"&&(g.flags|=1024)):(typeof ie.componentDidUpdate!="function"||ye===m.memoizedProps&&zt===m.memoizedState||(g.flags|=4),typeof ie.getSnapshotBeforeUpdate!="function"||ye===m.memoizedProps&&zt===m.memoizedState||(g.flags|=1024),g.memoizedProps=C,g.memoizedState=xt),ie.props=C,ie.state=xt,ie.context=je,C=st):(typeof ie.componentDidUpdate!="function"||ye===m.memoizedProps&&zt===m.memoizedState||(g.flags|=4),typeof ie.getSnapshotBeforeUpdate!="function"||ye===m.memoizedProps&&zt===m.memoizedState||(g.flags|=1024),C=!1)}return ui(m,g,M,C,F,L)}function ui(m,g,M,C,L,F){Ri(m,g);var ie=(g.flags&128)!==0;if(!C&&!ie)return L&&Xr(g,M,!1),Ki(m,g,F);C=g.stateNode,Rv.current=g;var ye=ie&&typeof M.getDerivedStateFromError!="function"?null:C.render();return g.flags|=1,m!==null&&ie?(g.child=ua(g,m.child,null,F),g.child=ua(g,null,ye,F)):lr(m,g,ye,F),g.memoizedState=C.state,L&&Xr(g,M,!0),g.child}function Jd(m){var g=m.stateNode;g.pendingContext?Vn(m,g.pendingContext,g.pendingContext!==g.context):g.context&&Vn(m,g.context,!1),_p(m,g.containerInfo)}function Nv(m,g,M,C,L){return vu(),bp(L),g.flags|=256,lr(m,g,M,C),g.child}var ef={dehydrated:null,treeContext:null,retryLane:0};function sc(m){return{baseLanes:m,cachePool:null}}function Iv(m,g,M){var C=g.pendingProps,L=nr.current,F=!1,ie=(g.flags&128)!==0,ye;if((ye=ie)||(ye=m!==null&&m.memoizedState===null?!1:(L&2)!==0),ye?(F=!0,g.flags&=-129):(m===null||m.memoizedState!==null)&&(L|=1),Ut(nr,L&1),m===null)return tl(g),m=g.memoizedState,m!==null&&(m=m.dehydrated,m!==null)?((g.mode&1)===0?g.lanes=1:Ns(m)?g.lanes=8:g.lanes=1073741824,null):(L=C.children,m=C.fallback,F?(C=g.mode,F=g.child,L={mode:"hidden",children:L},(C&1)===0&&F!==null?(F.childLanes=0,F.pendingProps=L):F=gf(L,C,0,null),m=vc(m,C,M,null),F.return=g,m.return=g,F.sibling=m,g.child=F,g.child.memoizedState=sc(M),g.memoizedState=ef,m):oo(g,L));if(L=m.memoizedState,L!==null){if(ye=L.dehydrated,ye!==null){if(ie)return g.flags&256?(g.flags&=-257,nf(m,g,M,Error(o(422)))):g.memoizedState!==null?(g.child=m.child,g.flags|=128,null):(F=C.fallback,L=g.mode,C=gf({mode:"visible",children:C.children},L,0,null),F=vc(F,L,M,null),F.flags|=2,C.return=g,F.return=g,C.sibling=F,g.child=C,(g.mode&1)!==0&&ua(g,m.child,null,M),g.child.memoizedState=sc(M),g.memoizedState=ef,F);if((g.mode&1)===0)g=nf(m,g,M,null);else if(Ns(ye))g=nf(m,g,M,Error(o(419)));else if(C=(M&m.childLanes)!==0,Fr||C){if(C=gr,C!==null){switch(M&-M){case 4:F=2;break;case 16:F=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:F=32;break;case 536870912:F=268435456;break;default:F=0}C=(F&(C.suspendedLanes|M))!==0?0:F,C!==0&&C!==L.retryLane&&(L.retryLane=C,fi(m,C,-1))}Vp(),g=nf(m,g,M,Error(o(421)))}else Ka(ye)?(g.flags|=128,g.child=m.child,g=Ux.bind(null,m),ra(ye,g),g=null):(M=L.treeContext,Z&&(qr=au(ye),Ci=g,Qn=!0,js=null,gu=!1,M!==null&&(Us[us++]=la,Us[us++]=ca,Us[us++]=ql,la=M.id,ca=M.overflow,ql=g)),g=oo(g,g.pendingProps.children),g.flags|=4096);return g}return F?(C=Up(m,g,C.children,C.fallback,M),F=g.child,L=m.child.memoizedState,F.memoizedState=L===null?sc(M):{baseLanes:L.baseLanes|M,cachePool:null},F.childLanes=m.childLanes&~M,g.memoizedState=ef,C):(M=tf(m,g,C.children,M),g.memoizedState=null,M)}return F?(C=Up(m,g,C.children,C.fallback,M),F=g.child,L=m.child.memoizedState,F.memoizedState=L===null?sc(M):{baseLanes:L.baseLanes|M,cachePool:null},F.childLanes=m.childLanes&~M,g.memoizedState=ef,C):(M=tf(m,g,C.children,M),g.memoizedState=null,M)}function oo(m,g){return g=gf({mode:"visible",children:g},m.mode,0,null),g.return=m,m.child=g}function tf(m,g,M,C){var L=m.child;return m=L.sibling,M=Sa(L,{mode:"visible",children:M}),(g.mode&1)===0&&(M.lanes=C),M.return=g,M.sibling=null,m!==null&&(C=g.deletions,C===null?(g.deletions=[m],g.flags|=16):C.push(m)),g.child=M}function Up(m,g,M,C,L){var F=g.mode;m=m.child;var ie=m.sibling,ye={mode:"hidden",children:M};return(F&1)===0&&g.child!==m?(M=g.child,M.childLanes=0,M.pendingProps=ye,g.deletions=null):(M=Sa(m,ye),M.subtreeFlags=m.subtreeFlags&14680064),ie!==null?C=Sa(ie,C):(C=vc(C,F,L,null),C.flags|=2),C.return=g,M.return=g,M.sibling=C,g.child=M,C}function nf(m,g,M,C){return C!==null&&bp(C),ua(g,m.child,null,M),m=oo(g,g.pendingProps.children),m.flags|=2,g.memoizedState=null,m}function kx(m,g,M){m.lanes|=g;var C=m.alternate;C!==null&&(C.lanes|=g),Xl(m.return,g,M)}function Io(m,g,M,C,L){var F=m.memoizedState;F===null?m.memoizedState={isBackwards:g,rendering:null,renderingStartTime:0,last:C,tail:M,tailMode:L}:(F.isBackwards=g,F.rendering=null,F.renderingStartTime=0,F.last=C,F.tail=M,F.tailMode=L)}function oc(m,g,M){var C=g.pendingProps,L=C.revealOrder,F=C.tail;if(lr(m,g,C.children,M),C=nr.current,(C&2)!==0)C=C&1|2,g.flags|=128;else{if(m!==null&&(m.flags&128)!==0)e:for(m=g.child;m!==null;){if(m.tag===13)m.memoizedState!==null&&kx(m,M,g);else if(m.tag===19)kx(m,M,g);else if(m.child!==null){m.child.return=m,m=m.child;continue}if(m===g)break e;for(;m.sibling===null;){if(m.return===null||m.return===g)break e;m=m.return}m.sibling.return=m.return,m=m.sibling}C&=1}if(Ut(nr,C),(g.mode&1)===0)g.memoizedState=null;else switch(L){case"forwards":for(M=g.child,L=null;M!==null;)m=M.alternate,m!==null&&wp(m)===null&&(L=M),M=M.sibling;M=L,M===null?(L=g.child,g.child=null):(L=M.sibling,M.sibling=null),Io(g,!1,L,M,F);break;case"backwards":for(M=null,L=g.child,g.child=null;L!==null;){if(m=L.alternate,m!==null&&wp(m)===null){g.child=L;break}m=L.sibling,L.sibling=M,M=L,L=m}Io(g,!0,M,null,F);break;case"together":Io(g,!1,null,null,void 0);break;default:g.memoizedState=null}return g.child}function Ki(m,g,M){if(m!==null&&(g.dependencies=m.dependencies),ko|=g.lanes,(M&g.childLanes)===0)return null;if(m!==null&&g.child!==m.child)throw Error(o(153));if(g.child!==null){for(m=g.child,M=Sa(m,m.pendingProps),g.child=M,M.return=g;m.sibling!==null;)m=m.sibling,M=M.sibling=Sa(m,m.pendingProps),M.return=g;M.sibling=null}return g.child}function jp(m,g,M){switch(g.tag){case 3:Jd(g),vu();break;case 5:Px(g);break;case 1:In(g.type)&&Ya(g);break;case 4:_p(g,g.stateNode.containerInfo);break;case 10:$l(g,g.type._context,g.memoizedProps.value);break;case 13:var C=g.memoizedState;if(C!==null)return C.dehydrated!==null?(Ut(nr,nr.current&1),g.flags|=128,null):(M&g.child.childLanes)!==0?Iv(m,g,M):(Ut(nr,nr.current&1),m=Ki(m,g,M),m!==null?m.sibling:null);Ut(nr,nr.current&1);break;case 19:if(C=(M&g.childLanes)!==0,(m.flags&128)!==0){if(C)return oc(m,g,M);g.flags|=128}var L=g.memoizedState;if(L!==null&&(L.rendering=null,L.tail=null,L.lastEffect=null),Ut(nr,nr.current),C)break;return null;case 22:case 23:return g.lanes=0,Kr(m,g,M)}return Ki(m,g,M)}function Fp(m,g){switch(gv(g),g.tag){case 1:return In(g.type)&&Is(),m=g.flags,m&65536?(g.flags=m&-65537|128,g):null;case 3:return _u(),Kt(tn),Kt(xn),Ql(),m=g.flags,(m&65536)!==0&&(m&128)===0?(g.flags=m&-65537|128,g):null;case 5:return xv(g),null;case 13:if(Kt(nr),m=g.memoizedState,m!==null&&m.dehydrated!==null){if(g.alternate===null)throw Error(o(340));vu()}return m=g.flags,m&65536?(g.flags=m&-65537|128,g):null;case 19:return Kt(nr),null;case 4:return _u(),null;case 10:return Hd(g.type._context),null;case 22:case 23:return hf(),null;case 24:return null;default:return null}}var Ni=!1,zr=!1,ac=typeof WeakSet=="function"?WeakSet:Set,ut=null;function Fs(m,g){var M=m.ref;if(M!==null)if(typeof M=="function")try{M(null)}catch(C){ki(m,g,C)}else M.current=null}function ga(m,g,M){try{M()}catch(C){ki(m,g,C)}}var kv=!1;function Ov(m,g){for(J(m.containerInfo),ut=g;ut!==null;)if(m=ut,g=m.child,(m.subtreeFlags&1028)!==0&&g!==null)g.return=m,ut=g;else for(;ut!==null;){m=ut;try{var M=m.alternate;if((m.flags&1024)!==0)switch(m.tag){case 0:case 11:case 15:break;case 1:if(M!==null){var C=M.memoizedProps,L=M.memoizedState,F=m.stateNode,ie=F.getSnapshotBeforeUpdate(m.elementType===m.type?C:$i(m.type,C),L);F.__reactInternalSnapshotBeforeUpdate=ie}break;case 3:We&&ot(m.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(ye){ki(m,m.return,ye)}if(g=m.sibling,g!==null){g.return=m.return,ut=g;break}ut=m.return}return M=kv,kv=!1,M}function va(m,g,M){var C=g.updateQueue;if(C=C!==null?C.lastEffect:null,C!==null){var L=C=C.next;do{if((L.tag&m)===m){var F=L.destroy;L.destroy=void 0,F!==void 0&&ga(g,M,F)}L=L.next}while(L!==C)}}function Yr(m,g){if(g=g.updateQueue,g=g!==null?g.lastEffect:null,g!==null){var M=g=g.next;do{if((M.tag&m)===m){var C=M.create;M.destroy=C()}M=M.next}while(M!==g)}}function Ii(m){var g=m.ref;if(g!==null){var M=m.stateNode;switch(m.tag){case 5:m=se(M);break;default:m=M}typeof g=="function"?g(m):g.current=m}}function Kn(m,g,M){if(Co&&typeof Co.onCommitFiberUnmount=="function")try{Co.onCommitFiberUnmount(jd,g)}catch{}switch(g.tag){case 0:case 11:case 14:case 15:if(m=g.updateQueue,m!==null&&(m=m.lastEffect,m!==null)){var C=m=m.next;do{var L=C,F=L.destroy;L=L.tag,F!==void 0&&((L&2)!==0||(L&4)!==0)&&ga(g,M,F),C=C.next}while(C!==m)}break;case 1:if(Fs(g,M),m=g.stateNode,typeof m.componentWillUnmount=="function")try{m.props=g.memoizedProps,m.state=g.memoizedState,m.componentWillUnmount()}catch(ie){ki(g,M,ie)}break;case 5:Fs(g,M);break;case 4:We?Uv(m,g,M):ue&&ue&&(g=g.stateNode.containerInfo,M=Jt(g),en(g,M))}}function zs(m,g,M){for(var C=g;;)if(Kn(m,C,M),C.child===null||We&&C.tag===4){if(C===g)break;for(;C.sibling===null;){if(C.return===null||C.return===g)return;C=C.return}C.sibling.return=C.return,C=C.sibling}else C.child.return=C,C=C.child}function Lv(m){var g=m.alternate;g!==null&&(m.alternate=null,Lv(g)),m.child=null,m.deletions=null,m.sibling=null,m.tag===5&&(g=m.stateNode,g!==null&&Ce(g)),m.stateNode=null,m.return=null,m.dependencies=null,m.memoizedProps=null,m.memoizedState=null,m.pendingProps=null,m.stateNode=null,m.updateQueue=null}function Dv(m){return m.tag===5||m.tag===3||m.tag===4}function zp(m){e:for(;;){for(;m.sibling===null;){if(m.return===null||Dv(m.return))return null;m=m.return}for(m.sibling.return=m.return,m=m.sibling;m.tag!==5&&m.tag!==6&&m.tag!==18;){if(m.flags&2||m.child===null||m.tag===4)continue e;m.child.return=m,m=m.child}if(!(m.flags&2))return m.stateNode}}function Bp(m){if(We){e:{for(var g=m.return;g!==null;){if(Dv(g))break e;g=g.return}throw Error(o(160))}var M=g;switch(M.tag){case 5:g=M.stateNode,M.flags&32&&(Xe(g),M.flags&=-33),M=zp(m),Pu(m,M,g);break;case 3:case 4:g=M.stateNode.containerInfo,M=zp(m),Hp(m,M,g);break;default:throw Error(o(161))}}}function Hp(m,g,M){var C=m.tag;if(C===5||C===6)m=m.stateNode,g?vt(M,m,g):Xt(M,m);else if(C!==4&&(m=m.child,m!==null))for(Hp(m,g,M),m=m.sibling;m!==null;)Hp(m,g,M),m=m.sibling}function Pu(m,g,M){var C=m.tag;if(C===5||C===6)m=m.stateNode,g?Mt(M,m,g):ft(M,m);else if(C!==4&&(m=m.child,m!==null))for(Pu(m,g,M),m=m.sibling;m!==null;)Pu(m,g,M),m=m.sibling}function Uv(m,g,M){for(var C=g,L=!1,F,ie;;){if(!L){L=C.return;e:for(;;){if(L===null)throw Error(o(160));switch(F=L.stateNode,L.tag){case 5:ie=!1;break e;case 3:F=F.containerInfo,ie=!0;break e;case 4:F=F.containerInfo,ie=!0;break e}L=L.return}L=!0}if(C.tag===5||C.tag===6)zs(m,C,M),ie?de(F,C.stateNode):Zt(F,C.stateNode);else if(C.tag===18)ie?Ie(F,C.stateNode):Te(F,C.stateNode);else if(C.tag===4){if(C.child!==null){F=C.stateNode.containerInfo,ie=!0,C.child.return=C,C=C.child;continue}}else if(Kn(m,C,M),C.child!==null){C.child.return=C,C=C.child;continue}if(C===g)break;for(;C.sibling===null;){if(C.return===null||C.return===g)return;C=C.return,C.tag===4&&(L=!1)}C.sibling.return=C.return,C=C.sibling}}function ol(m,g){if(We){switch(g.tag){case 0:case 11:case 14:case 15:va(3,g,g.return),Yr(3,g),va(5,g,g.return);return;case 1:return;case 5:var M=g.stateNode;if(M!=null){var C=g.memoizedProps;m=m!==null?m.memoizedProps:C;var L=g.type,F=g.updateQueue;g.updateQueue=null,F!==null&&et(M,F,L,m,C,g)}return;case 6:if(g.stateNode===null)throw Error(o(162));M=g.memoizedProps,Ke(g.stateNode,m!==null?m.memoizedProps:M,M);return;case 3:Z&&m!==null&&m.memoizedState.isDehydrated&&K(g.stateNode.containerInfo);return;case 12:return;case 13:Cu(g);return;case 19:Cu(g);return;case 17:return}throw Error(o(163))}switch(g.tag){case 0:case 11:case 14:case 15:va(3,g,g.return),Yr(3,g),va(5,g,g.return);return;case 12:return;case 13:Cu(g);return;case 19:Cu(g);return;case 3:Z&&m!==null&&m.memoizedState.isDehydrated&&K(g.stateNode.containerInfo);break;case 22:case 23:return}e:if(ue){switch(g.tag){case 1:case 5:case 6:break e;case 3:case 4:g=g.stateNode,en(g.containerInfo,g.pendingChildren);break e}throw Error(o(163))}}function Cu(m){var g=m.updateQueue;if(g!==null){m.updateQueue=null;var M=m.stateNode;M===null&&(M=m.stateNode=new ac),g.forEach(function(C){var L=jx.bind(null,m,C);M.has(C)||(M.add(C),C.then(L,L))})}}function EM(m,g){for(ut=g;ut!==null;){g=ut;var M=g.deletions;if(M!==null)for(var C=0;C<M.length;C++){var L=M[C];try{var F=m;We?Uv(F,L,g):zs(F,L,g);var ie=L.alternate;ie!==null&&(ie.return=null),L.return=null}catch(Ot){ki(L,g,Ot)}}if(M=g.child,(g.subtreeFlags&12854)!==0&&M!==null)M.return=g,ut=M;else for(;ut!==null;){g=ut;try{var ye=g.flags;if(ye&32&&We&&Xe(g.stateNode),ye&512){var je=g.alternate;if(je!==null){var st=je.ref;st!==null&&(typeof st=="function"?st(null):st.current=null)}}if(ye&8192)switch(g.tag){case 13:if(g.memoizedState!==null){var St=g.alternate;(St===null||St.memoizedState===null)&&(uf=Nr())}break;case 22:var rn=g.memoizedState!==null,zt=g.alternate,ln=zt!==null&&zt.memoizedState!==null;if(M=g,We){e:if(C=M,L=rn,F=null,We)for(var xt=C;;){if(xt.tag===5){if(F===null){F=xt;var Jr=xt.stateNode;L?le(Jr):Re(xt.stateNode,xt.memoizedProps)}}else if(xt.tag===6){if(F===null){var ys=xt.stateNode;L?Ye(ys):Be(ys,xt.memoizedProps)}}else if((xt.tag!==22&&xt.tag!==23||xt.memoizedState===null||xt===C)&&xt.child!==null){xt.child.return=xt,xt=xt.child;continue}if(xt===C)break;for(;xt.sibling===null;){if(xt.return===null||xt.return===C)break e;F===xt&&(F=null),xt=xt.return}F===xt&&(F=null),xt.sibling.return=xt.return,xt=xt.sibling}}if(rn&&!ln&&(M.mode&1)!==0){ut=M;for(var Ne=M.child;Ne!==null;){for(M=ut=Ne;ut!==null;){C=ut;var _e=C.child;switch(C.tag){case 0:case 11:case 14:case 15:va(4,C,C.return);break;case 1:Fs(C,C.return);var De=C.stateNode;if(typeof De.componentWillUnmount=="function"){var gt=C.return;try{De.props=C.memoizedProps,De.state=C.memoizedState,De.componentWillUnmount()}catch(Ot){ki(C,gt,Ot)}}break;case 5:Fs(C,C.return);break;case 22:if(C.memoizedState!==null){Fv(M);continue}}_e!==null?(_e.return=C,ut=_e):Fv(M)}Ne=Ne.sibling}}}switch(ye&4102){case 2:Bp(g),g.flags&=-3;break;case 6:Bp(g),g.flags&=-3,ol(g.alternate,g);break;case 4096:g.flags&=-4097;break;case 4100:g.flags&=-4097,ol(g.alternate,g);break;case 4:ol(g.alternate,g)}}catch(Ot){ki(g,g.return,Ot)}if(M=g.sibling,M!==null){M.return=g.return,ut=M;break}ut=g.return}}}function rf(m,g,M){ut=m,sf(m)}function sf(m,g,M){for(var C=(m.mode&1)!==0;ut!==null;){var L=ut,F=L.child;if(L.tag===22&&C){var ie=L.memoizedState!==null||Ni;if(!ie){var ye=L.alternate,je=ye!==null&&ye.memoizedState!==null||zr;ye=Ni;var st=zr;if(Ni=ie,(zr=je)&&!st)for(ut=L;ut!==null;)ie=ut,je=ie.child,ie.tag===22&&ie.memoizedState!==null?lc(L):je!==null?(je.return=ie,ut=je):lc(L);for(;F!==null;)ut=F,sf(F),F=F.sibling;ut=L,Ni=ye,zr=st}jv(m)}else(L.subtreeFlags&8772)!==0&&F!==null?(F.return=L,ut=F):jv(m)}}function jv(m){for(;ut!==null;){var g=ut;if((g.flags&8772)!==0){var M=g.alternate;try{if((g.flags&8772)!==0)switch(g.tag){case 0:case 11:case 15:zr||Yr(5,g);break;case 1:var C=g.stateNode;if(g.flags&4&&!zr)if(M===null)C.componentDidMount();else{var L=g.elementType===g.type?M.memoizedProps:$i(g.type,M.memoizedProps);C.componentDidUpdate(L,M.memoizedState,C.__reactInternalSnapshotBeforeUpdate)}var F=g.updateQueue;F!==null&&bx(g,F,C);break;case 3:var ie=g.updateQueue;if(ie!==null){if(M=null,g.child!==null)switch(g.child.tag){case 5:M=se(g.child.stateNode);break;case 1:M=g.child.stateNode}bx(g,ie,M)}break;case 5:var ye=g.stateNode;M===null&&g.flags&4&&ne(ye,g.type,g.memoizedProps,g);break;case 6:break;case 4:break;case 12:break;case 13:if(Z&&g.memoizedState===null){var je=g.alternate;if(je!==null){var st=je.memoizedState;if(st!==null){var St=st.dehydrated;St!==null&&xe(St)}}}break;case 19:case 17:case 21:case 22:case 23:break;default:throw Error(o(163))}zr||g.flags&512&&Ii(g)}catch(rn){ki(g,g.return,rn)}}if(g===m){ut=null;break}if(M=g.sibling,M!==null){M.return=g.return,ut=M;break}ut=g.return}}function Fv(m){for(;ut!==null;){var g=ut;if(g===m){ut=null;break}var M=g.sibling;if(M!==null){M.return=g.return,ut=M;break}ut=g.return}}function lc(m){for(;ut!==null;){var g=ut;try{switch(g.tag){case 0:case 11:case 15:var M=g.return;try{Yr(4,g)}catch(je){ki(g,M,je)}break;case 1:var C=g.stateNode;if(typeof C.componentDidMount=="function"){var L=g.return;try{C.componentDidMount()}catch(je){ki(g,L,je)}}var F=g.return;try{Ii(g)}catch(je){ki(g,F,je)}break;case 5:var ie=g.return;try{Ii(g)}catch(je){ki(g,ie,je)}}}catch(je){ki(g,g.return,je)}if(g===m){ut=null;break}var ye=g.sibling;if(ye!==null){ye.return=g.return,ut=ye;break}ut=g.return}}var of=0,cc=1,uc=2,ya=3,Ru=4;if(typeof Symbol=="function"&&Symbol.for){var dc=Symbol.for;of=dc("selector.component"),cc=dc("selector.has_pseudo_class"),uc=dc("selector.role"),ya=dc("selector.test_id"),Ru=dc("selector.text")}function af(m){var g=Ve(m);if(g!=null){if(typeof g.memoizedProps["data-testname"]!="string")throw Error(o(364));return g}if(m=W(m),m===null)throw Error(o(362));return m.stateNode.current}function lf(m,g){switch(g.$$typeof){case of:if(m.type===g.value)return!0;break;case cc:e:{g=g.value,m=[m,0];for(var M=0;M<m.length;){var C=m[M++],L=m[M++],F=g[L];if(C.tag!==5||!ze(C)){for(;F!=null&&lf(C,F);)L++,F=g[L];if(L===g.length){g=!0;break e}else for(C=C.child;C!==null;)m.push(C,L),C=C.sibling}}g=!1}return g;case uc:if(m.tag===5&&Fe(m.stateNode,g.value))return!0;break;case Ru:if((m.tag===5||m.tag===6)&&(m=Ue(m),m!==null&&0<=m.indexOf(g.value)))return!0;break;case ya:if(m.tag===5&&(m=m.memoizedProps["data-testname"],typeof m=="string"&&m.toLowerCase()===g.value.toLowerCase()))return!0;break;default:throw Error(o(365))}return!1}function al(m){switch(m.$$typeof){case of:return"<"+(D(m.value)||"Unknown")+">";case cc:return":has("+(al(m)||"")+")";case uc:return'[role="'+m.value+'"]';case Ru:return'"'+m.value+'"';case ya:return'[data-testname="'+m.value+'"]';default:throw Error(o(365))}}function ps(m,g){var M=[];m=[m,0];for(var C=0;C<m.length;){var L=m[C++],F=m[C++],ie=g[F];if(L.tag!==5||!ze(L)){for(;ie!=null&&lf(L,ie);)F++,ie=g[F];if(F===g.length)M.push(L);else for(L=L.child;L!==null;)m.push(L,F),L=L.sibling}}return M}function xa(m,g){if(!Q)throw Error(o(363));m=af(m),m=ps(m,g),g=[],m=Array.from(m);for(var M=0;M<m.length;){var C=m[M++];if(C.tag===5)ze(C)||g.push(C.stateNode);else for(C=C.child;C!==null;)m.push(C),C=C.sibling}return g}var zv=Math.ceil,cf=a.ReactCurrentDispatcher,ao=a.ReactCurrentOwner,Fn=a.ReactCurrentBatchConfig,an=0,gr=null,zn=null,Jn=0,di=0,fc=yn(0),cr=0,Nu=null,ko=0,ms=0,hc=0,ba=null,br=null,uf=0,ll=1/0;function pc(){ll=Nr()+500}var Iu=!1,Yn=null,lo=null,ku=!1,Oo=null,mc=0,gc=0,_a=null,Xn=-1,ur=0;function Cn(){return(an&6)!==0?Nr():Xn!==-1?Xn:Xn=Nr()}function co(m){return(m.mode&1)===0?1:(an&2)!==0&&Jn!==0?Jn&-Jn:xx.transition!==null?(ur===0&&(m=uu,uu<<=1,(uu&4194240)===0&&(uu=64),ur=m),ur):(m=un,m!==0?m:re())}function fi(m,g,M){if(50<gc)throw gc=0,_a=null,Error(o(185));var C=cl(m,g);return C===null?null:(Hl(C,g,M),((an&2)===0||C!==gr)&&(C===gr&&((an&2)===0&&(ms|=g),cr===4&&Qr(C,Jn)),Yi(C,M),g===1&&an===0&&(m.mode&1)===0&&(pc(),cp&&Os())),C)}function cl(m,g){m.lanes|=g;var M=m.alternate;for(M!==null&&(M.lanes|=g),M=m,m=m.return;m!==null;)m.childLanes|=g,M=m.alternate,M!==null&&(M.childLanes|=g),M=m,m=m.return;return M.tag===3?M.stateNode:null}function Yi(m,g){var M=m.callbackNode;yx(m,g);var C=Ud(m,m===gr?Jn:0);if(C===0)M!==null&&fu(M),m.callbackNode=null,m.callbackPriority=0;else if(g=C&-C,m.callbackPriority!==g){if(M!=null&&fu(M),g===1)m.tag===0?dp(gs.bind(null,m)):up(gs.bind(null,m)),qe?Ze(function(){an===0&&Os()}):Vl(Gl,Os),M=null;else{switch(sa(C)){case 1:M=Gl;break;case 4:M=wM;break;case 16:M=ap;break;case 536870912:M=lp;break;default:M=ap}M=Gp(M,Zr.bind(null,m))}m.callbackPriority=g,m.callbackNode=M}}function Zr(m,g){if(Xn=-1,ur=0,(an&6)!==0)throw Error(o(327));var M=m.callbackNode;if(Lo()&&m.callbackNode!==M)return null;var C=Ud(m,m===gr?Jn:0);if(C===0)return null;if((C&30)!==0||(C&m.expiredLanes)!==0||g)g=pf(m,C);else{g=C;var L=an;an|=2;var F=Vv();(gr!==m||Jn!==g)&&(pc(),wa(m,g));do try{Lx();break}catch(ye){Hv(m,ye)}while(!0);Pi(),cf.current=F,an=L,zn!==null?g=0:(gr=null,Jn=0,g=cr)}if(g!==0){if(g===2&&(L=ip(m),L!==0&&(C=L,g=df(m,L))),g===1)throw M=Nu,wa(m,0),Qr(m,C),Yi(m,Nr()),M;if(g===6)Qr(m,C);else{if(L=m.current.alternate,(C&30)===0&&!Bv(L)&&(g=pf(m,C),g===2&&(F=ip(m),F!==0&&(C=F,g=df(m,F))),g===1))throw M=Nu,wa(m,0),Qr(m,C),Yi(m,Nr()),M;switch(m.finishedWork=L,m.finishedLanes=C,g){case 0:case 1:throw Error(o(345));case 2:uo(m,br);break;case 3:if(Qr(m,C),(C&130023424)===C&&(g=uf+500-Nr(),10<g)){if(Ud(m,0)!==0)break;if(L=m.suspendedLanes,(L&C)!==C){Cn(),m.pingedLanes|=m.suspendedLanes&L;break}m.timeoutHandle=Ee(uo.bind(null,m,br),g);break}uo(m,br);break;case 4:if(Qr(m,C),(C&4194240)===C)break;for(g=m.eventTimes,L=-1;0<C;){var ie=31-ci(C);F=1<<ie,ie=g[ie],ie>L&&(L=ie),C&=~F}if(C=L,C=Nr()-C,C=(120>C?120:480>C?480:1080>C?1080:1920>C?1920:3e3>C?3e3:4320>C?4320:1960*zv(C/1960))-C,10<C){m.timeoutHandle=Ee(uo.bind(null,m,br),C);break}uo(m,br);break;case 5:uo(m,br);break;default:throw Error(o(329))}}}return Yi(m,Nr()),m.callbackNode===M?Zr.bind(null,m):null}function df(m,g){var M=ba;return m.current.memoizedState.isDehydrated&&(wa(m,g).flags|=256),m=pf(m,g),m!==2&&(g=br,br=M,g!==null&&ff(g)),m}function ff(m){br===null?br=m:br.push.apply(br,m)}function Bv(m){for(var g=m;;){if(g.flags&16384){var M=g.updateQueue;if(M!==null&&(M=M.stores,M!==null))for(var C=0;C<M.length;C++){var L=M[C],F=L.getSnapshot;L=L.value;try{if(!Ti(F(),L))return!1}catch{return!1}}}if(M=g.child,g.subtreeFlags&16384&&M!==null)M.return=g,g=M;else{if(g===m)break;for(;g.sibling===null;){if(g.return===null||g.return===m)return!0;g=g.return}g.sibling.return=g.return,g=g.sibling}}return!0}function Qr(m,g){for(g&=~hc,g&=~ms,m.suspendedLanes|=g,m.pingedLanes&=~g,m=m.expirationTimes;0<g;){var M=31-ci(g),C=1<<M;m[M]=-1,g&=~C}}function gs(m){if((an&6)!==0)throw Error(o(327));Lo();var g=Ud(m,0);if((g&1)===0)return Yi(m,Nr()),null;var M=pf(m,g);if(m.tag!==0&&M===2){var C=ip(m);C!==0&&(g=C,M=df(m,C))}if(M===1)throw M=Nu,wa(m,0),Qr(m,g),Yi(m,Nr()),M;if(M===6)throw Error(o(345));return m.finishedWork=m.current.alternate,m.finishedLanes=g,uo(m,br),Yi(m,Nr()),null}function Ou(m){Oo!==null&&Oo.tag===0&&(an&6)===0&&Lo();var g=an;an|=1;var M=Fn.transition,C=un;try{if(Fn.transition=null,un=1,m)return m()}finally{un=C,Fn.transition=M,an=g,(an&6)===0&&Os()}}function hf(){di=fc.current,Kt(fc)}function wa(m,g){m.finishedWork=null,m.finishedLanes=0;var M=m.timeoutHandle;if(M!==Me&&(m.timeoutHandle=Me,$e(M)),zn!==null)for(M=zn.return;M!==null;){var C=M;switch(gv(C),C.tag){case 1:C=C.type.childContextTypes,C!=null&&Is();break;case 3:_u(),Kt(tn),Kt(xn),Ql();break;case 5:xv(C);break;case 4:_u();break;case 13:Kt(nr);break;case 19:Kt(nr);break;case 10:Hd(C.type._context);break;case 22:case 23:hf()}M=M.return}if(gr=m,zn=m=Sa(m.current,null),Jn=di=g,cr=0,Nu=null,hc=ms=ko=0,br=ba=null,Ls!==null){for(g=0;g<Ls.length;g++)if(M=Ls[g],C=M.interleaved,C!==null){M.interleaved=null;var L=C.next,F=M.pending;if(F!==null){var ie=F.next;F.next=L,C.next=ie}M.pending=C}Ls=null}return m}function Hv(m,g){do{var M=zn;try{if(Pi(),Gd.current=Au,Sp){for(var C=rr.memoizedState;C!==null;){var L=C.queue;L!==null&&(L.pending=null),C=C.next}Sp=!1}if(Jl=0,Ur=Dr=rr=null,Ro=!1,ec=0,ao.current=null,M===null||M.return===null){cr=1,Nu=g,zn=null;break}e:{var F=m,ie=M.return,ye=M,je=g;if(g=Jn,ye.flags|=32768,je!==null&&typeof je=="object"&&typeof je.then=="function"){var st=je,St=ye,rn=St.tag;if((St.mode&1)===0&&(rn===0||rn===11||rn===15)){var zt=St.alternate;zt?(St.updateQueue=zt.updateQueue,St.memoizedState=zt.memoizedState,St.lanes=zt.lanes):(St.updateQueue=null,St.memoizedState=null)}var ln=Cv(ie);if(ln!==null){ln.flags&=-257,nc(ln,ie,ye,F,g),ln.mode&1&&fa(F,st,g),g=ln,je=st;var xt=g.updateQueue;if(xt===null){var Jr=new Set;Jr.add(je),g.updateQueue=Jr}else xt.add(je);break e}else{if((g&1)===0){fa(F,st,g),Vp();break e}je=Error(o(426))}}else if(Qn&&ye.mode&1){var ys=Cv(ie);if(ys!==null){(ys.flags&65536)===0&&(ys.flags|=256),nc(ys,ie,ye,F,g),bp(je);break e}}F=je,cr!==4&&(cr=2),ba===null?ba=[F]:ba.push(F),je=Pv(je,ye),ye=ie;do{switch(ye.tag){case 3:ye.flags|=65536,g&=-g,ye.lanes|=g;var Ne=Ix(ye,je,g);pp(ye,Ne);break e;case 1:F=je;var _e=ye.type,De=ye.stateNode;if((ye.flags&128)===0&&(typeof _e.getDerivedStateFromError=="function"||De!==null&&typeof De.componentDidCatch=="function"&&(lo===null||!lo.has(De)))){ye.flags|=65536,g&=-g,ye.lanes|=g;var gt=kp(ye,F,g);pp(ye,gt);break e}}ye=ye.return}while(ye!==null)}Wv(M)}catch(Ot){g=Ot,zn===M&&M!==null&&(zn=M=M.return);continue}break}while(!0)}function Vv(){var m=cf.current;return cf.current=Au,m===null?Au:m}function Vp(){(cr===0||cr===3||cr===2)&&(cr=4),gr===null||(ko&268435455)===0&&(ms&268435455)===0||Qr(gr,Jn)}function pf(m,g){var M=an;an|=2;var C=Vv();gr===m&&Jn===g||wa(m,g);do try{Ox();break}catch(L){Hv(m,L)}while(!0);if(Pi(),an=M,cf.current=C,zn!==null)throw Error(o(261));return gr=null,Jn=0,cr}function Ox(){for(;zn!==null;)Gv(zn)}function Lx(){for(;zn!==null&&!Qa();)Gv(zn)}function Gv(m){var g=qv(m.alternate,m,di);m.memoizedProps=m.pendingProps,g===null?Wv(m):zn=g,ao.current=null}function Wv(m){var g=m;do{var M=g.alternate;if(m=g.return,(g.flags&32768)===0){if(M=Dp(M,g,di),M!==null){zn=M;return}}else{if(M=Fp(M,g),M!==null){M.flags&=32767,zn=M;return}if(m!==null)m.flags|=32768,m.subtreeFlags=0,m.deletions=null;else{cr=6,zn=null;return}}if(g=g.sibling,g!==null){zn=g;return}zn=g=m}while(g!==null);cr===0&&(cr=5)}function uo(m,g){var M=un,C=Fn.transition;try{Fn.transition=null,un=1,Dx(m,g,M)}finally{Fn.transition=C,un=M}return null}function Dx(m,g,M){do Lo();while(Oo!==null);if((an&6)!==0)throw Error(o(327));var C=m.finishedWork,L=m.finishedLanes;if(C===null)return null;if(m.finishedWork=null,m.finishedLanes=0,C===m.current)throw Error(o(177));m.callbackNode=null,m.callbackPriority=0;var F=C.lanes|C.childLanes;if(op(m,F),m===gr&&(zn=gr=null,Jn=0),(C.subtreeFlags&2064)===0&&(C.flags&2064)===0||ku||(ku=!0,Gp(ap,function(){return Lo(),null})),F=(C.flags&15990)!==0,(C.subtreeFlags&15990)!==0||F){F=Fn.transition,Fn.transition=null;var ie=un;un=1;var ye=an;an|=4,ao.current=null,Ov(m,C),EM(m,C),Y(m.containerInfo),m.current=C,rf(C),_M(),an=ye,un=ie,Fn.transition=F}else m.current=C;if(ku&&(ku=!1,Oo=m,mc=L),F=m.pendingLanes,F===0&&(lo=null),Fd(C.stateNode),Yi(m,Nr()),g!==null)for(M=m.onRecoverableError,C=0;C<g.length;C++)M(g[C]);if(Iu)throw Iu=!1,m=Yn,Yn=null,m;return(mc&1)!==0&&m.tag!==0&&Lo(),F=m.pendingLanes,(F&1)!==0?m===_a?gc++:(gc=0,_a=m):gc=0,Os(),null}function Lo(){if(Oo!==null){var m=sa(mc),g=Fn.transition,M=un;try{if(Fn.transition=null,un=16>m?16:m,Oo===null)var C=!1;else{if(m=Oo,Oo=null,mc=0,(an&6)!==0)throw Error(o(331));var L=an;for(an|=4,ut=m.current;ut!==null;){var F=ut,ie=F.child;if((ut.flags&16)!==0){var ye=F.deletions;if(ye!==null){for(var je=0;je<ye.length;je++){var st=ye[je];for(ut=st;ut!==null;){var St=ut;switch(St.tag){case 0:case 11:case 15:va(8,St,F)}var rn=St.child;if(rn!==null)rn.return=St,ut=rn;else for(;ut!==null;){St=ut;var zt=St.sibling,ln=St.return;if(Lv(St),St===st){ut=null;break}if(zt!==null){zt.return=ln,ut=zt;break}ut=ln}}}var xt=F.alternate;if(xt!==null){var Jr=xt.child;if(Jr!==null){xt.child=null;do{var ys=Jr.sibling;Jr.sibling=null,Jr=ys}while(Jr!==null)}}ut=F}}if((F.subtreeFlags&2064)!==0&&ie!==null)ie.return=F,ut=ie;else e:for(;ut!==null;){if(F=ut,(F.flags&2048)!==0)switch(F.tag){case 0:case 11:case 15:va(9,F,F.return)}var Ne=F.sibling;if(Ne!==null){Ne.return=F.return,ut=Ne;break e}ut=F.return}}var _e=m.current;for(ut=_e;ut!==null;){ie=ut;var De=ie.child;if((ie.subtreeFlags&2064)!==0&&De!==null)De.return=ie,ut=De;else e:for(ie=_e;ut!==null;){if(ye=ut,(ye.flags&2048)!==0)try{switch(ye.tag){case 0:case 11:case 15:Yr(9,ye)}}catch(Ot){ki(ye,ye.return,Ot)}if(ye===ie){ut=null;break e}var gt=ye.sibling;if(gt!==null){gt.return=ye.return,ut=gt;break e}ut=ye.return}}if(an=L,Os(),Co&&typeof Co.onPostCommitFiberRoot=="function")try{Co.onPostCommitFiberRoot(jd,m)}catch{}C=!0}return C}finally{un=M,Fn.transition=g}}return!1}function mf(m,g,M){g=Pv(M,g),g=Ix(m,g,1),Ja(m,g),g=Cn(),m=cl(m,1),m!==null&&(Hl(m,1,g),Yi(m,g))}function ki(m,g,M){if(m.tag===3)mf(m,m,M);else for(;g!==null;){if(g.tag===3){mf(g,m,M);break}else if(g.tag===1){var C=g.stateNode;if(typeof g.type.getDerivedStateFromError=="function"||typeof C.componentDidCatch=="function"&&(lo===null||!lo.has(C))){m=Pv(M,m),m=kp(g,m,1),Ja(g,m),m=Cn(),g=cl(g,1),g!==null&&(Hl(g,1,m),Yi(g,m));break}}g=g.return}}function $v(m,g,M){var C=m.pingCache;C!==null&&C.delete(g),g=Cn(),m.pingedLanes|=m.suspendedLanes&M,gr===m&&(Jn&M)===M&&(cr===4||cr===3&&(Jn&130023424)===Jn&&500>Nr()-uf?wa(m,0):hc|=M),Yi(m,g)}function Xv(m,g){g===0&&((m.mode&1)===0?g=1:(g=Pn,Pn<<=1,(Pn&130023424)===0&&(Pn=4194304)));var M=Cn();m=cl(m,g),m!==null&&(Hl(m,g,M),Yi(m,M))}function Ux(m){var g=m.memoizedState,M=0;g!==null&&(M=g.retryLane),Xv(m,M)}function jx(m,g){var M=0;switch(m.tag){case 13:var C=m.stateNode,L=m.memoizedState;L!==null&&(M=L.retryLane);break;case 19:C=m.stateNode;break;default:throw Error(o(314))}C!==null&&C.delete(g),Xv(m,M)}var qv;qv=function(m,g,M){if(m!==null)if(m.memoizedProps!==g.pendingProps||tn.current)Fr=!0;else{if((m.lanes&M)===0&&(g.flags&128)===0)return Fr=!1,jp(m,g,M);Fr=(m.flags&131072)!==0}else Fr=!1,Qn&&(g.flags&1048576)!==0&&Mx(g,yp,g.index);switch(g.lanes=0,g.tag){case 2:var C=g.type;m!==null&&(m.alternate=null,g.alternate=null,g.flags|=2),m=g.pendingProps;var L=li(g,xn.current);hu(g,M),L=wu(null,g,C,m,L,M);var F=rl();return g.flags|=1,typeof L=="object"&&L!==null&&typeof L.render=="function"&&L.$$typeof===void 0?(g.tag=1,g.memoizedState=null,g.updateQueue=null,In(C)?(F=!0,Ya(g)):F=!1,g.memoizedState=L.state!==null&&L.state!==void 0?L.state:null,pu(g),L.updater=gp,g.stateNode=L,L._reactInternals=g,pv(g,C,m,M),g=ui(null,g,C,!0,F,M)):(g.tag=0,Qn&&F&&mv(g),lr(null,g,L,M),g=g.child),g;case 16:C=g.elementType;e:{switch(m!==null&&(m.alternate=null,g.alternate=null,g.flags|=2),m=g.pendingProps,L=C._init,C=L(C._payload),g.type=C,L=g.tag=AM(C),m=$i(C,m),L){case 0:g=ma(null,g,C,m,M);break e;case 1:g=ic(null,g,C,m,M);break e;case 11:g=$n(null,g,C,m,M);break e;case 14:g=Gn(null,g,C,$i(C.type,m),M);break e}throw Error(o(306,C,""))}return g;case 0:return C=g.type,L=g.pendingProps,L=g.elementType===C?L:$i(C,L),ma(m,g,C,L,M);case 1:return C=g.type,L=g.pendingProps,L=g.elementType===C?L:$i(C,L),ic(m,g,C,L,M);case 3:e:{if(Jd(g),m===null)throw Error(o(387));C=g.pendingProps,F=g.memoizedState,L=F.element,dv(m,g),mp(g,C,null,M);var ie=g.memoizedState;if(C=ie.element,Z&&F.isDehydrated)if(F={element:C,isDehydrated:!1,cache:ie.cache,transitions:ie.transitions},g.updateQueue.baseState=F,g.memoizedState=F,g.flags&256){L=Error(o(423)),g=Nv(m,g,C,M,L);break e}else if(C!==L){L=Error(o(424)),g=Nv(m,g,C,M,L);break e}else for(Z&&(qr=ia(g.stateNode.containerInfo),Ci=g,Qn=!0,js=null,gu=!1),M=Tx(g,null,C,M),g.child=M;M;)M.flags=M.flags&-3|4096,M=M.sibling;else{if(vu(),C===L){g=Ki(m,g,M);break e}lr(m,g,C,M)}g=g.child}return g;case 5:return Px(g),m===null&&tl(g),C=g.type,L=g.pendingProps,F=m!==null?m.memoizedProps:null,ie=L.children,ce(C,L)?ie=null:F!==null&&ce(C,F)&&(g.flags|=32),Ri(m,g),lr(m,g,ie,M),g.child;case 6:return m===null&&tl(g),null;case 13:return Iv(m,g,M);case 4:return _p(g,g.stateNode.containerInfo),C=g.pendingProps,m===null?g.child=ua(g,null,C,M):lr(m,g,C,M),g.child;case 11:return C=g.type,L=g.pendingProps,L=g.elementType===C?L:$i(C,L),$n(m,g,C,L,M);case 7:return lr(m,g,g.pendingProps,M),g.child;case 8:return lr(m,g,g.pendingProps.children,M),g.child;case 12:return lr(m,g,g.pendingProps.children,M),g.child;case 10:e:{if(C=g.type._context,L=g.pendingProps,F=g.memoizedProps,ie=L.value,$l(g,C,ie),F!==null)if(Ti(F.value,ie)){if(F.children===L.children&&!tn.current){g=Ki(m,g,M);break e}}else for(F=g.child,F!==null&&(F.return=g);F!==null;){var ye=F.dependencies;if(ye!==null){ie=F.child;for(var je=ye.firstContext;je!==null;){if(je.context===C){if(F.tag===1){je=aa(-1,M&-M),je.tag=2;var st=F.updateQueue;if(st!==null){st=st.shared;var St=st.pending;St===null?je.next=je:(je.next=St.next,St.next=je),st.pending=je}}F.lanes|=M,je=F.alternate,je!==null&&(je.lanes|=M),Xl(F.return,M,g),ye.lanes|=M;break}je=je.next}}else if(F.tag===10)ie=F.type===g.type?null:F.child;else if(F.tag===18){if(ie=F.return,ie===null)throw Error(o(341));ie.lanes|=M,ye=ie.alternate,ye!==null&&(ye.lanes|=M),Xl(ie,M,g),ie=F.sibling}else ie=F.child;if(ie!==null)ie.return=F;else for(ie=F;ie!==null;){if(ie===g){ie=null;break}if(F=ie.sibling,F!==null){F.return=ie.return,ie=F;break}ie=ie.return}F=ie}lr(m,g,L.children,M),g=g.child}return g;case 9:return L=g.type,C=g.pendingProps.children,hu(g,M),L=Xi(L),C=C(L),g.flags|=1,lr(m,g,C,M),g.child;case 14:return C=g.type,L=$i(C,g.pendingProps),L=$i(C.type,L),Gn(m,g,C,L,M);case 15:return pa(m,g,g.type,g.pendingProps,M);case 17:return C=g.type,L=g.pendingProps,L=g.elementType===C?L:$i(C,L),m!==null&&(m.alternate=null,g.alternate=null,g.flags|=2),g.tag=1,In(C)?(m=!0,Ya(g)):m=!1,hu(g,M),wx(g,C,L),pv(g,C,L,M),ui(null,g,C,!0,m,M);case 19:return oc(m,g,M);case 22:return Kr(m,g,M)}throw Error(o(156,g.tag))};function Gp(m,g){return Vl(m,g)}function Fx(m,g,M,C){this.tag=m,this.key=M,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=g,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=C,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vs(m,g,M,C){return new Fx(m,g,M,C)}function Wp(m){return m=m.prototype,!(!m||!m.isReactComponent)}function AM(m){if(typeof m=="function")return Wp(m)?1:0;if(m!=null){if(m=m.$$typeof,m===S)return 11;if(m===E)return 14}return 2}function Sa(m,g){var M=m.alternate;return M===null?(M=vs(m.tag,g,m.key,m.mode),M.elementType=m.elementType,M.type=m.type,M.stateNode=m.stateNode,M.alternate=m,m.alternate=M):(M.pendingProps=g,M.type=m.type,M.flags=0,M.subtreeFlags=0,M.deletions=null),M.flags=m.flags&14680064,M.childLanes=m.childLanes,M.lanes=m.lanes,M.child=m.child,M.memoizedProps=m.memoizedProps,M.memoizedState=m.memoizedState,M.updateQueue=m.updateQueue,g=m.dependencies,M.dependencies=g===null?null:{lanes:g.lanes,firstContext:g.firstContext},M.sibling=m.sibling,M.index=m.index,M.ref=m.ref,M}function $p(m,g,M,C,L,F){var ie=2;if(C=m,typeof m=="function")Wp(m)&&(ie=1);else if(typeof m=="string")ie=5;else e:switch(m){case d:return vc(M.children,L,F,g);case f:ie=8,L|=8;break;case p:return m=vs(12,M,g,L|2),m.elementType=p,m.lanes=F,m;case w:return m=vs(13,M,g,L),m.elementType=w,m.lanes=F,m;case _:return m=vs(19,M,g,L),m.elementType=_,m.lanes=F,m;case P:return gf(M,L,F,g);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 E:ie=14;break e;case T:ie=16,C=null;break e}throw Error(o(130,m==null?m:typeof m,""))}return g=vs(ie,M,g,L),g.elementType=m,g.type=C,g.lanes=F,g}function vc(m,g,M,C){return m=vs(7,m,C,g),m.lanes=M,m}function gf(m,g,M,C){return m=vs(22,m,C,g),m.elementType=P,m.lanes=M,m.stateNode={},m}function Xp(m,g,M){return m=vs(6,m,null,g),m.lanes=M,m}function qp(m,g,M){return g=vs(4,m.children!==null?m.children:[],m.key,g),g.lanes=M,g.stateNode={containerInfo:m.containerInfo,pendingChildren:null,implementation:m.implementation},g}function Kp(m,g,M,C,L){this.tag=g,this.containerInfo=m,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Me,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=sp(0),this.expirationTimes=sp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sp(0),this.identifierPrefix=C,this.onRecoverableError=L,Z&&(this.mutableSourceEagerHydrationData=null)}function zx(m,g,M,C,L,F,ie,ye,je){return m=new Kp(m,g,M,ye,je),g===1?(g=1,F===!0&&(g|=8)):g=0,F=vs(3,null,null,g),m.current=F,F.stateNode=m,F.memoizedState={element:C,isDehydrated:M,cache:null,transitions:null},pu(F),m}function Bx(m){if(!m)return mt;m=m._reactInternals;e:{if(G(m)!==m||m.tag!==1)throw Error(o(170));var g=m;do{switch(g.tag){case 3:g=g.stateNode.context;break e;case 1:if(In(g.type)){g=g.stateNode.__reactInternalMemoizedMergedChildContext;break e}}g=g.return}while(g!==null);throw Error(o(171))}if(m.tag===1){var M=m.type;if(In(M))return to(m,M,g)}return g}function Hx(m){var g=m._reactInternals;if(g===void 0)throw typeof m.render=="function"?Error(o(188)):(m=Object.keys(m).join(","),Error(o(268,m)));return m=H(g),m===null?null:m.stateNode}function Bs(m,g){if(m=m.memoizedState,m!==null&&m.dehydrated!==null){var M=m.retryLane;m.retryLane=M!==0&&M<g?M:g}}function vf(m,g){Bs(m,g),(m=m.alternate)&&Bs(m,g)}function Yp(m){return m=H(m),m===null?null:m.stateNode}function Vx(){return null}return n.attemptContinuousHydration=function(m){if(m.tag===13){var g=Cn();fi(m,134217728,g),vf(m,134217728)}},n.attemptHydrationAtCurrentPriority=function(m){if(m.tag===13){var g=Cn(),M=co(m);fi(m,M,g),vf(m,M)}},n.attemptSynchronousHydration=function(m){switch(m.tag){case 3:var g=m.stateNode;if(g.current.memoizedState.isDehydrated){var M=du(g.pendingLanes);M!==0&&(Po(g,M|1),Yi(g,Nr()),(an&6)===0&&(pc(),Os()))}break;case 13:var C=Cn();Ou(function(){return fi(m,1,C)}),vf(m,1)}},n.batchedUpdates=function(m,g){var M=an;an|=1;try{return m(g)}finally{an=M,an===0&&(pc(),cp&&Os())}},n.createComponentSelector=function(m){return{$$typeof:of,value:m}},n.createContainer=function(m,g,M,C,L,F,ie){return zx(m,g,!1,null,M,C,L,F,ie)},n.createHasPseudoClassSelector=function(m){return{$$typeof:cc,value:m}},n.createHydrationContainer=function(m,g,M,C,L,F,ie,ye,je){return m=zx(M,C,!0,m,L,F,ie,ye,je),m.context=Bx(null),M=m.current,C=Cn(),L=co(M),F=aa(C,L),F.callback=g??null,Ja(M,F),m.current.lanes=L,Hl(m,L,C),Yi(m,C),m},n.createPortal=function(m,g,M){var C=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:C==null?null:""+C,children:m,containerInfo:g,implementation:M}},n.createRoleSelector=function(m){return{$$typeof:uc,value:m}},n.createTestNameSelector=function(m){return{$$typeof:ya,value:m}},n.createTextSelector=function(m){return{$$typeof:Ru,value:m}},n.deferredUpdates=function(m){var g=un,M=Fn.transition;try{return Fn.transition=null,un=16,m()}finally{un=g,Fn.transition=M}},n.discreteUpdates=function(m,g,M,C,L){var F=un,ie=Fn.transition;try{return Fn.transition=null,un=1,m(g,M,C,L)}finally{un=F,Fn.transition=ie,an===0&&pc()}},n.findAllNodes=xa,n.findBoundingRects=function(m,g){if(!Q)throw Error(o(363));g=xa(m,g),m=[];for(var M=0;M<g.length;M++)m.push(be(g[M]));for(g=m.length-1;0<g;g--){M=m[g];for(var C=M.x,L=C+M.width,F=M.y,ie=F+M.height,ye=g-1;0<=ye;ye--)if(g!==ye){var je=m[ye],st=je.x,St=st+je.width,rn=je.y,zt=rn+je.height;if(C>=st&&F>=rn&&L<=St&&ie<=zt){m.splice(g,1);break}else if(C!==st||M.width!==je.width||zt<F||rn>ie){if(!(F!==rn||M.height!==je.height||St<C||st>L)){st>C&&(je.width+=st-C,je.x=C),St<L&&(je.width=L-st),m.splice(g,1);break}}else{rn>F&&(je.height+=rn-F,je.y=F),zt<ie&&(je.height=ie-rn),m.splice(g,1);break}}}return m},n.findHostInstance=Hx,n.findHostInstanceWithNoPortals=function(m){return m=j(m),m=m!==null?te(m):null,m===null?null:m.stateNode},n.findHostInstanceWithWarning=function(m){return Hx(m)},n.flushControlled=function(m){var g=an;an|=1;var M=Fn.transition,C=un;try{Fn.transition=null,un=1,m()}finally{un=C,Fn.transition=M,an=g,an===0&&(pc(),Os())}},n.flushPassiveEffects=Lo,n.flushSync=Ou,n.focusWithin=function(m,g){if(!Q)throw Error(o(363));for(m=af(m),g=ps(m,g),g=Array.from(g),m=0;m<g.length;){var M=g[m++];if(!ze(M)){if(M.tag===5&&bt(M.stateNode))return!0;for(M=M.child;M!==null;)g.push(M),M=M.sibling}}return!1},n.getCurrentUpdatePriority=function(){return un},n.getFindAllNodesFailureDescription=function(m,g){if(!Q)throw Error(o(363));var M=0,C=[];m=[af(m),0];for(var L=0;L<m.length;){var F=m[L++],ie=m[L++],ye=g[ie];if((F.tag!==5||!ze(F))&&(lf(F,ye)&&(C.push(al(ye)),ie++,ie>M&&(M=ie)),ie<g.length))for(F=F.child;F!==null;)m.push(F,ie),F=F.sibling}if(M<g.length){for(m=[];M<g.length;M++)m.push(al(g[M]));return`findAllNodes was able to match part of the selector:
|
||
`+(C.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 se(m.child.stateNode);default:return m.child.stateNode}},n.injectIntoDevTools=function(m){if(m={bundleType:m.bundleType,version:m.version,rendererPackageName:m.rendererPackageName,rendererConfig:m.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:Yp,findFiberByHostInstance:m.findFiberByHostInstance||Vx,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")m=!1;else{var g=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(g.isDisabled||!g.supportsFiber)m=!0;else{try{jd=g.inject(m),Co=g}catch{}m=!!g.checkDCE}}return m},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(m,g,M,C){if(!Q)throw Error(o(363));m=xa(m,g);var L=rt(m,M,C).disconnect;return{disconnect:function(){L()}}},n.registerMutableSourceForHydration=function(m,g){var M=g._getVersion;M=M(g._source),m.mutableSourceEagerHydrationData==null?m.mutableSourceEagerHydrationData=[g,M]:m.mutableSourceEagerHydrationData.push(g,M)},n.runWithPriority=function(m,g){var M=un;try{return un=m,g()}finally{un=M}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(m,g,M,C){var L=g.current,F=Cn(),ie=co(L);return M=Bx(M),g.context===null?g.context=M:g.pendingContext=M,g=aa(F,ie),g.payload={element:m},C=C===void 0?null:C,C!==null&&(g.callback=C),Ja(L,g),m=fi(L,ie,F),m!==null&&hp(m,L,ie),ie},n}),BA}var AU;function vbe(){return AU||(AU=1,jA.exports=gbe()),jA.exports}var ybe=vbe();const xbe=B1(ybe);var HA={exports:{}},VA={};/**
|
||
* @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 TU;function bbe(){return TU||(TU=1,(function(t){function e(B,J){var Y=B.length;B.push(J);e:for(;0<Y;){var V=Y-1>>>1,q=B[V];if(0<i(q,J))B[V]=J,B[Y]=q,Y=V;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],Y=B.pop();if(Y!==J){B[0]=Y;e:for(var V=0,q=B.length,pe=q>>>1;V<pe;){var ae=2*(V+1)-1,ce=B[ae],Se=ae+1,Ee=B[Se];if(0>i(ce,Y))Se<q&&0>i(Ee,ce)?(B[V]=Ee,B[Se]=Y,V=Se):(B[V]=ce,B[ae]=Y,V=ae);else if(Se<q&&0>i(Ee,Y))B[V]=Ee,B[Se]=Y,V=Se;else break e}}return J}function i(B,J){var Y=B.sortIndex-J.sortIndex;return Y!==0?Y:B.id-J.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,f=null,p=3,y=!1,x=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(B){for(var J=n(c);J!==null;){if(J.callback===null)r(c);else if(J.startTime<=B)r(c),J.sortIndex=J.expirationTime,e(l,J);else break;J=n(c)}}function P(B){if(S=!1,T(B),!x)if(n(l)!==null)x=!0,se(O);else{var J=n(c);J!==null&&fe(P,J.startTime-B)}}function O(B,J){x=!1,S&&(S=!1,_(z),z=-1),y=!0;var Y=p;try{for(T(J),f=n(l);f!==null&&(!(f.expirationTime>J)||B&&!j());){var V=f.callback;if(typeof V=="function"){f.callback=null,p=f.priorityLevel;var q=V(f.expirationTime<=J);J=t.unstable_now(),typeof q=="function"?f.callback=q:f===n(l)&&r(l),T(J)}else r(l);f=n(l)}if(f!==null)var pe=!0;else{var ae=n(c);ae!==null&&fe(P,ae.startTime-J),pe=!1}return pe}finally{f=null,p=Y,y=!1}}var N=!1,D=null,z=-1,G=5,k=-1;function j(){return!(t.unstable_now()-k<G)}function H(){if(D!==null){var B=t.unstable_now();k=B;var J=!0;try{J=D(!0,B)}finally{J?ee():(N=!1,D=null)}}else N=!1}var ee;if(typeof E=="function")ee=function(){E(H)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,he=te.port2;te.port1.onmessage=H,ee=function(){he.postMessage(null)}}else ee=function(){w(H,0)};function se(B){D=B,N||(N=!0,ee())}function fe(B,J){z=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,se(O))},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"):G=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 Y=p;p=J;try{return B()}finally{p=Y}},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 Y=p;p=B;try{return J()}finally{p=Y}},t.unstable_scheduleCallback=function(B,J,Y){var V=t.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?V+Y:V):Y=V,B){case 1:var q=-1;break;case 2:q=250;break;case 5:q=1073741823;break;case 4:q=1e4;break;default:q=5e3}return q=Y+q,B={id:d++,callback:J,priorityLevel:B,startTime:Y,expirationTime:q,sortIndex:-1},Y>V?(B.sortIndex=Y,e(c,B),n(l)===null&&B===n(c)&&(S?(_(z),z=-1):S=!0,fe(P,Y-V))):(B.sortIndex=q,e(l,B),x||y||(x=!0,se(O))),B},t.unstable_shouldYield=j,t.unstable_wrapCallback=function(B){var J=p;return function(){var Y=p;p=J;try{return B.apply(this,arguments)}finally{p=Y}}}})(VA)),VA}var PU;function _be(){return PU||(PU=1,HA.exports=bbe()),HA.exports}var CU=_be();const iN={},wbe=t=>void Object.assign(iN,t);function Sbe(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 _=y.object;w=Fm(_,{type:d,root:x,attach:p,primitive:!0})}else{const _=iN[S];if(!_)throw new Error(`R3F: ${S} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(f))throw new Error("R3F: The args prop must be an array!");w=Fm(new _(...f),{type:d,root:x,attach:p,memoizedProps:{args:f}})}return w.__r3f.attach===void 0&&(w.isBufferGeometry?w.__r3f.attach="geometry":w.isMaterial&&(w.__r3f.attach="material")),S!=="inject"&&$A(w,y),w}function r(d,f){let p=!1;if(f){var y,x;(y=f.__r3f)!=null&&y.attach?WA(d,f,f.__r3f.attach):f.isObject3D&&d.isObject3D&&(d.add(f),p=!0),p||(x=d.__r3f)==null||x.objects.push(f),f.__r3f||Fm(f,{}),f.__r3f.parent=d,sC(f),zm(f)}}function i(d,f,p){let y=!1;if(f){var x,S;if((x=f.__r3f)!=null&&x.attach)WA(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){f.parent=d,f.dispatchEvent({type:"added"}),d.dispatchEvent({type:"childadded",child:f});const w=d.children.filter(E=>E!==f),_=w.indexOf(p);d.children=[...w.slice(0,_),f,...w.slice(_)],y=!0}y||(S=d.__r3f)==null||S.objects.push(f),f.__r3f||Fm(f,{}),f.__r3f.parent=d,sC(f),zm(f)}}function s(d,f,p=!1){d&&[...d].forEach(y=>o(f,y,p))}function o(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(P=>P!==f)),(x=f.__r3f)!=null&&x.attach)OU(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){var w;d.remove(f),(w=f.__r3f)!=null&&w.root&&Rbe(q_(f),f)}const E=(S=f.__r3f)==null?void 0:S.primitive,T=!E&&(p===void 0?f.dispose!==null:p);if(!E){var _;s((_=f.__r3f)==null?void 0:_.objects,f,T),s(f.children,f,T)}if(delete f.__r3f,T&&f.dispose&&f.type!=="Scene"){const P=()=>{try{f.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?CU.unstable_scheduleCallback(CU.unstable_IdlePriority,P):P()}zm(d)}}function a(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 _ of d.children)_.__r3f&&r(w,_);d.children=d.children.filter(_=>!_.__r3f)}d.__r3f.objects.forEach(_=>r(w,_)),d.__r3f.objects=[],d.__r3f.autoRemovedBeforeAppend||o(S,d),w.parent&&(w.__r3f.autoRemovedBeforeAppend=!0),r(S,w),w.raycast&&w.__r3f.eventCount&&q_(w).getState().internal.interaction.push(w),[y,y.alternate].forEach(_=>{_!==null&&(_.stateNode=w,_.ref&&(typeof _.ref=="function"?_.ref(w):_.ref.current=w))})}const l=()=>{};return{reconciler:xbe({createInstance:n,removeChild:o,appendChild:r,appendInitialChild:r,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(d,f)=>{if(!f)return;const p=d.getState().scene;p.__r3f&&(p.__r3f.root=d,r(p,f))},removeChildFromContainer:(d,f)=>{f&&o(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:_,...E}=y,{args:T=[],children:P,...O}=p;if(!Array.isArray(w))throw new Error("R3F: the args prop must be an array!");if(w.some((D,z)=>D!==T[z]))return[!0];const N=vG(d,E,O,!0);return N.changes.length?[!1,N]:null}},commitUpdate(d,[f,p],y,x,S,w){f?a(d,y,S,w):$A(d,p)},commitMount(d,f,p,y){var x;const S=(x=d.__r3f)!=null?x:{};d.raycast&&S.handlers&&S.eventCount&&q_(d).getState().internal.interaction.push(d)},getPublicInstance:d=>d,prepareForCommit:()=>null,preparePortalMount:d=>Fm(d.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(d){var f;const{attach:p,parent:y}=(f=d.__r3f)!=null?f:{};p&&y&&OU(y,d,p),d.isObject3D&&(d.visible=!1),zm(d)},unhideInstance(d,f){var p;const{attach:y,parent:x}=(p=d.__r3f)!=null?p:{};y&&x&&WA(x,d,y),(d.isObject3D&&f.visible==null||f.visible)&&(d.visible=!0),zm(d)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():Km.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&sr.fun(performance.now)?performance.now:sr.fun(Date.now)?Date.now:()=>0,scheduleTimeout:sr.fun(setTimeout)?setTimeout:void 0,cancelTimeout:sr.fun(clearTimeout)?clearTimeout:void 0}),applyProps:$A}}var RU,NU;const GA=t=>"colorSpace"in t||"outputColorSpace"in t,dG=()=>{var t;return(t=iN.ColorManagement)!=null?t:null},fG=t=>t&&t.isOrthographicCamera,Mbe=t=>t&&t.hasOwnProperty("current"),vx=typeof window<"u"&&((RU=window.document)!=null&&RU.createElement||((NU=window.navigator)==null?void 0:NU.product)==="ReactNative")?R.useLayoutEffect:R.useEffect;function hG(t){const e=R.useRef(t);return vx(()=>void(e.current=t),[t]),e}function Ebe({set:t}){return vx(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}class pG extends R.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}pG.getDerivedStateFromError=()=>({error:!0});const mG="__default",IU=new Map,Abe=t=>t&&!!t.memoized&&!!t.changes;function gG(t){var e;const n=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(t)?Math.min(Math.max(t[0],n),t[1]):t}const R0=t=>{var e;return(e=t.__r3f)==null?void 0:e.root.getState()};function q_(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 o=sr.arr(t);if(o&&n==="reference")return t===e;if((o||s)&&t===e)return!0;let a;for(a in t)if(!(a in e))return!1;if(s&&n==="shallow"&&r==="shallow"){for(a in i?e:t)if(!sr.equ(t[a],e[a],{strict:i,objects:"reference"}))return!1}else for(a in i?e:t)if(t[a]!==e[a])return!1;if(sr.und(a)){if(o&&t.length===0&&e.length===0||s&&Object.keys(t).length===0&&Object.keys(e).length===0)return!0;if(t!==e)return!1}return!0}};function Tbe(t){t.dispose&&t.type!=="Scene"&&t.dispose();for(const e in t)e.dispose==null||e.dispose(),delete t[e]}function Fm(t,e){const n=t;return n.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},t}function iC(t,e){let n=t;if(e.includes("-")){const r=e.split("-"),i=r.pop();return n=r.reduce((s,o)=>s[o],t),{target:n,key:i}}else return{target:n,key:e}}const kU=/-\d+$/;function WA(t,e,n){if(sr.str(n)){if(kU.test(n)){const s=n.replace(kU,""),{target:o,key:a}=iC(t,s);Array.isArray(o[a])||(o[a]=[])}const{target:r,key:i}=iC(t,n);e.__r3f.previousAttach=r[i],r[i]=e}else e.__r3f.previousAttach=n(t,e)}function OU(t,e,n){var r,i;if(sr.str(n)){const{target:s,key:o}=iC(t,n),a=e.__r3f.previousAttach;a===void 0?delete s[o]:s[o]=a}else(r=e.__r3f)==null||r.previousAttach==null||r.previousAttach(t,e);(i=e.__r3f)==null||delete i.previousAttach}function vG(t,{children:e,key:n,ref:r,...i},{children:s,key:o,ref:a,...l}={},c=!1){const d=t.__r3f,f=Object.entries(i),p=[];if(c){const x=Object.keys(l);for(let S=0;S<x.length;S++)i.hasOwnProperty(x[S])||f.unshift([x[S],mG+"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 _=[];x.includes("-")&&(_=x.split("-")),p.push([x,S,!1,_]);for(const E in i){const T=i[E];E.startsWith(`${x}-`)&&p.push([E,T,!1,E.split("-")])}});const y={...i};return d!=null&&d.memoizedProps&&d!=null&&d.memoizedProps.args&&(y.args=d.memoizedProps.args),d!=null&&d.memoizedProps&&d!=null&&d.memoizedProps.attach&&(y.attach=d.memoizedProps.attach),{memoized:y,changes:p}}function $A(t,e){var n;const r=t.__r3f,i=r==null?void 0:r.root,s=i==null||i.getState==null?void 0:i.getState(),{memoized:o,changes:a}=Abe(e)?e:vG(t,e),l=r==null?void 0:r.eventCount;t.__r3f&&(t.__r3f.memoizedProps=o);for(let p=0;p<a.length;p++){let[y,x,S,w]=a[p];if(GA(t)){const P="srgb",O="srgb-linear";y==="encoding"?(y="colorSpace",x=x===3001?P:O):y==="outputEncoding"&&(y="outputColorSpace",x=x===3001?P:O)}let _=t,E=_[y];if(w.length&&(E=w.reduce((T,P)=>T[P],t),!(E&&E.set))){const[T,...P]=w.reverse();_=P.reverse().reduce((O,N)=>O[N],t),y=T}if(x===mG+"remove")if(_.constructor){let T=IU.get(_.constructor);T||(T=new _.constructor,IU.set(_.constructor,T)),x=T[y]}else x=0;if(S&&r)x?r.handlers[y]=x:delete r.handlers[y],r.eventCount=Object.keys(r.handlers).length;else if(E&&E.set&&(E.copy||E instanceof Ph)){if(Array.isArray(x))E.fromArray?E.fromArray(x):E.set(...x);else if(E.copy&&x&&x.constructor&&E.constructor===x.constructor)E.copy(x);else if(x!==void 0){var c;const T=(c=E)==null?void 0:c.isColor;!T&&E.setScalar?E.setScalar(x):E instanceof Ph&&x instanceof Ph?E.mask=x.mask:E.set(x),!dG()&&s&&!s.linear&&T&&E.convertSRGBToLinear()}}else{var d;if(_[y]=x,(d=_[y])!=null&&d.isTexture&&_[y].format===ss&&_[y].type===Ha&&s){const T=_[y];GA(T)&&GA(s.gl)?T.colorSpace=s.gl.outputColorSpace:T.encoding=s.gl.outputEncoding}}zm(t)}if(r&&r.parent&&t.raycast&&l!==r.eventCount){const p=q_(t).getState().internal,y=p.interaction.indexOf(t);y>-1&&p.interaction.splice(y,1),r.eventCount&&p.interaction.push(t)}return!(a.length===1&&a[0][0]==="onUpdate")&&a.length&&(n=t.__r3f)!=null&&n.parent&&sC(t),t}function zm(t){var e,n;const r=(e=t.__r3f)==null||(n=e.root)==null||n.getState==null?void 0:n.getState();r&&r.internal.frames===0&&r.invalidate()}function sC(t){t.onUpdate==null||t.onUpdate(t)}function Pbe(t,e){t.manual||(fG(t)?(t.left=e.width/-2,t.right=e.width/2,t.top=e.height/2,t.bottom=e.height/-2):t.aspect=e.width/e.height,t.updateProjectionMatrix(),t.updateMatrixWorld())}function C_(t){return(t.eventObject||t.object).uuid+"/"+t.index+t.instanceId}function Cbe(){var t;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Km.DefaultEventPriority;switch((t=e.event)==null?void 0:t.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Km.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Km.ContinuousEventPriority;default:return Km.DefaultEventPriority}}function yG(t,e,n,r){const i=n.get(e);i&&(n.delete(e),n.size===0&&(t.delete(r),i.target.releasePointerCapture(r)))}function Rbe(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)=>{yG(n.capturedMap,e,r,i)})}function Nbe(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 _=0;_<y.length;_++){const E=R0(y[_]);E&&(E.raycaster.camera=void 0)}d.previousRoot||d.events.compute==null||d.events.compute(l,d);function x(_){const E=R0(_);if(!E||!E.events.enabled||E.raycaster.camera===null)return[];if(E.raycaster.camera===void 0){var T;E.events.compute==null||E.events.compute(l,E,(T=E.previousRoot)==null?void 0:T.getState()),E.raycaster.camera===void 0&&(E.raycaster.camera=null)}return E.raycaster.camera?E.raycaster.intersectObject(_,!0):[]}let S=y.flatMap(x).sort((_,E)=>{const T=R0(_.object),P=R0(E.object);return!T||!P?_.distance-E.distance:P.events.priority-T.events.priority||_.distance-E.distance}).filter(_=>{const E=C_(_);return f.has(E)?!1:(f.add(E),!0)});d.events.filter&&(S=d.events.filter(S,d));for(const _ of S){let E=_.object;for(;E;){var w;(w=E.__r3f)!=null&&w.eventCount&&p.push({..._,eventObject:E}),E=E.parent}}if("pointerId"in l&&d.internal.capturedMap.has(l.pointerId))for(let _ of d.internal.capturedMap.get(l.pointerId).values())f.has(C_(_.intersection))||p.push(_.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=R0(x.object)||p,{raycaster:w,pointer:_,camera:E,internal:T}=S,P=new X(_.x,_.y,0).unproject(E),O=k=>{var j,H;return(j=(H=T.capturedMap.get(k))==null?void 0:H.has(x.eventObject))!=null?j:!1},N=k=>{const j={intersection:x,target:c.target};T.capturedMap.has(k)?T.capturedMap.get(k).set(x.eventObject,j):T.capturedMap.set(k,new Map([[x.eventObject,j]])),c.target.setPointerCapture(k)},D=k=>{const j=T.capturedMap.get(k);j&&yG(T.capturedMap,x.eventObject,j,k)};let z={};for(let k in c){let j=c[k];typeof j!="function"&&(z[k]=j)}let G={...x,...z,pointer:_,intersections:l,stopped:y.stopped,delta:d,unprojectedPoint:P,ray:w.ray,camera:E,stopPropagation(){const k="pointerId"in c&&T.capturedMap.get(c.pointerId);if((!k||k.has(x.eventObject))&&(G.stopped=y.stopped=!0,T.hovered.size&&Array.from(T.hovered.values()).find(j=>j.eventObject===x.eventObject))){const j=l.slice(0,l.indexOf(x));s([...j,x])}},target:{hasPointerCapture:O,setPointerCapture:N,releasePointerCapture:D},currentTarget:{hasPointerCapture:O,setPointerCapture:N,releasePointerCapture:D},nativeEvent:c};if(f(G),y.stopped===!0)break}}return l}function s(l){const{internal:c}=t.getState();for(const d of c.hovered.values())if(!l.length||!l.find(f=>f.object===d.object&&f.index===d.index&&f.instanceId===d.instanceId)){const p=d.eventObject.__r3f,y=p==null?void 0:p.handlers;if(c.hovered.delete(C_(d)),p!=null&&p.eventCount){const x={...d,intersections:l};y.onPointerOut==null||y.onPointerOut(x),y.onPointerLeave==null||y.onPointerLeave(x)}}}function o(l,c){for(let d=0;d<c.length;d++){const f=c[d].__r3f;f==null||f.handlers.onPointerMissed==null||f.handlers.onPointerMissed(l)}}function a(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),_=x?e(d):0;l==="onPointerDown"&&(p.initialClick=[d.offsetX,d.offsetY],p.initialHits=w.map(T=>T.eventObject)),x&&!w.length&&_<=2&&(o(d,p.interaction),f&&f(d)),y&&s(w);function E(T){const P=T.eventObject,O=P.__r3f,N=O==null?void 0:O.handlers;if(O!=null&&O.eventCount)if(y){if(N.onPointerOver||N.onPointerEnter||N.onPointerOut||N.onPointerLeave){const D=C_(T),z=p.hovered.get(D);z?z.stopped&&T.stopPropagation():(p.hovered.set(D,T),N.onPointerOver==null||N.onPointerOver(T),N.onPointerEnter==null||N.onPointerEnter(T))}N.onPointerMove==null||N.onPointerMove(T)}else{const D=N[l];D?(!x||p.initialHits.includes(P))&&(o(d,p.interaction.filter(z=>!p.initialHits.includes(z))),D(T)):x&&p.initialHits.includes(P)&&o(d,p.interaction.filter(z=>!p.initialHits.includes(z)))}}i(w,d,_,E)}}return{handlePointer:a}}const xG=t=>!!(t!=null&&t.render),bG=R.createContext(null),Ibe=(t,e)=>{const n=hbe((a,l)=>{const c=new X,d=new X,f=new X;function p(_=l().camera,E=d,T=l().size){const{width:P,height:O,top:N,left:D}=T,z=P/O;E.isVector3?f.copy(E):f.set(...E);const G=_.getWorldPosition(c).distanceTo(f);if(fG(_))return{width:P/_.zoom,height:O/_.zoom,top:N,left:D,factor:1,distance:G,aspect:z};{const k=_.fov*Math.PI/180,j=2*Math.tan(k/2)*G,H=j*(P/O);return{width:H,height:j,top:N,left:D,factor:P/H,distance:G,aspect:z}}}let y;const x=_=>a(E=>({performance:{...E.performance,current:_}})),S=new He;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(_=1)=>t(l(),_),advance:(_,E)=>e(_,E,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new JR,pointer:S,mouse:S,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const _=l();y&&clearTimeout(y),_.performance.current!==_.performance.min&&x(_.performance.min),y=setTimeout(()=>x(l().performance.max),_.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:p},setEvents:_=>a(E=>({...E,events:{...E.events,..._}})),setSize:(_,E,T,P,O)=>{const N=l().camera,D={width:_,height:E,top:P||0,left:O||0,updateStyle:T};a(z=>({size:D,viewport:{...z.viewport,...p(N,d,D)}}))},setDpr:_=>a(E=>{const T=gG(_);return{viewport:{...E.viewport,dpr:T,initialDpr:E.viewport.initialDpr||T}}}),setFrameloop:(_="always")=>{const E=l().clock;E.stop(),E.elapsedTime=0,_!=="never"&&(E.start(),E.elapsedTime=0),a(()=>({frameloop:_}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:R.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(_,E,T)=>{const P=l().internal;return P.priority=P.priority+(E>0?1:0),P.subscribers.push({ref:_,priority:E,store:T}),P.subscribers=P.subscribers.sort((O,N)=>O.priority-N.priority),()=>{const O=l().internal;O!=null&&O.subscribers&&(O.priority=O.priority-(E>0?1:0),O.subscribers=O.subscribers.filter(N=>N.ref!==_))}}}}}),r=n.getState();let i=r.size,s=r.viewport.dpr,o=r.camera;return n.subscribe(()=>{const{camera:a,size:l,viewport:c,gl:d,set:f}=n.getState();if(l.width!==i.width||l.height!==i.height||c.dpr!==s){var p;i=l,s=c.dpr,Pbe(a,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)}a!==o&&(o=a,f(y=>({viewport:{...y.viewport,...y.viewport.getCurrentViewport(a)}})))}),n.subscribe(a=>t(a)),n};let R_,kbe=new Set,Obe=new Set,Lbe=new Set;function XA(t,e){if(t.size)for(const{callback:n}of t.values())n(e)}function N0(t,e){switch(t){case"before":return XA(kbe,e);case"after":return XA(Obe,e);case"tail":return XA(Lbe,e)}}let qA,KA;function YA(t,e,n){let r=e.clock.getDelta();for(e.frameloop==="never"&&typeof t=="number"&&(r=t-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=t),qA=e.internal.subscribers,R_=0;R_<qA.length;R_++)KA=qA[R_],KA.ref.current(KA.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 Dbe(t){let e=!1,n=!1,r,i,s;function o(c){i=requestAnimationFrame(o),e=!0,r=0,N0("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+=YA(c,s))}if(n=!1,N0("after",c),r===0)return N0("tail",c),e=!1,cancelAnimationFrame(i)}function a(c,d=1){var f;if(!c)return t.forEach(p=>a(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(o)))}function l(c,d=!0,f,p){if(d&&N0("before",c),f)YA(c,f,p);else for(const y of t.values())YA(c,y.store.getState());d&&N0("after",c)}return{loop:o,invalidate:a,advance:l}}function _G(){const t=R.useContext(bG);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function ed(t=n=>n,e){return _G()(t,e)}function wG(t,e=0){const n=_G(),r=n.getState().internal.subscribe,i=hG(t);return vx(()=>r(i,e,n),[e,r,n]),null}const zg=new Map,{invalidate:LU,advance:DU}=Dbe(zg),{reconciler:D1,applyProps:Nm}=Sbe(zg,Cbe),Im={objects:"shallow",strict:!1},Ube=(t,e)=>{const n=typeof t=="function"?t(e):t;return xG(n)?n:new _6({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...t})};function jbe(t,e){const n=typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement;if(e){const{width:r,height:i,top:s,left:o,updateStyle:a=n}=e;return{width:r,height:i,top:s,left:o,updateStyle:a}}else if(typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&t.parentElement){const{width:r,height:i,top:s,left:o}=t.parentElement.getBoundingClientRect();return{width:r,height:i,top:s,left:o,updateStyle:n}}else if(typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)return{width:t.width,height:t.height,top:0,left:0,updateStyle:n};return{width:0,height:0,top:0,left:0}}function Fbe(t){const e=zg.get(t),n=e==null?void 0:e.fiber,r=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,s=r||Ibe(LU,DU),o=n||D1.createContainer(s,Km.ConcurrentRoot,null,!1,null,"",i,null);e||zg.set(t,{fiber:o,store:s});let a,l=!1,c;return{configure(d={}){let{gl:f,size:p,scene:y,events:x,onCreated:S,shadows:w=!1,linear:_=!1,flat:E=!1,legacy:T=!1,orthographic:P=!1,frameloop:O="always",dpr:N=[1,2],performance:D,raycaster:z,camera:G,onPointerMissed:k}=d,j=s.getState(),H=j.gl;j.gl||j.set({gl:H=Ube(f,t)});let ee=j.raycaster;ee||j.set({raycaster:ee=new lG});const{params:te,...he}=z||{};if(sr.equ(he,ee,Im)||Nm(ee,{...he}),sr.equ(te,ee.params,Im)||Nm(ee,{params:{...ee.params,...te}}),!j.camera||j.camera===c&&!sr.equ(c,G,Im)){c=G;const Y=G instanceof ux,V=Y?G:P?new Gc(0,0,0,0,.1,1e3):new Pr(75,0,.1,1e3);Y||(V.position.z=5,G&&(Nm(V,G),("aspect"in G||"left"in G||"right"in G||"bottom"in G||"top"in G)&&(V.manual=!0,V.updateProjectionMatrix())),!j.camera&&!(G!=null&&G.rotation)&&V.lookAt(0,0,0)),j.set({camera:V}),ee.camera=V}if(!j.scene){let Y;y!=null&&y.isScene?Y=y:(Y=new kR,y&&Nm(Y,y)),j.set({scene:Fm(Y)})}if(!j.xr){var se;const Y=(pe,ae)=>{const ce=s.getState();ce.frameloop!=="never"&&DU(pe,!0,ce,ae)},V=()=>{const pe=s.getState();pe.gl.xr.enabled=pe.gl.xr.isPresenting,pe.gl.xr.setAnimationLoop(pe.gl.xr.isPresenting?Y:null),pe.gl.xr.isPresenting||LU(pe)},q={connect(){const pe=s.getState().gl;pe.xr.addEventListener("sessionstart",V),pe.xr.addEventListener("sessionend",V)},disconnect(){const pe=s.getState().gl;pe.xr.removeEventListener("sessionstart",V),pe.xr.removeEventListener("sessionend",V)}};typeof((se=H.xr)==null?void 0:se.addEventListener)=="function"&&q.connect(),j.set({xr:q})}if(H.shadowMap){const Y=H.shadowMap.enabled,V=H.shadowMap.type;if(H.shadowMap.enabled=!!w,sr.boo(w))H.shadowMap.type=K0;else if(sr.str(w)){var fe;const q={basic:vV,percentage:zS,soft:K0,variance:Oa};H.shadowMap.type=(fe=q[w])!=null?fe:K0}else sr.obj(w)&&Object.assign(H.shadowMap,w);(Y!==H.shadowMap.enabled||V!==H.shadowMap.type)&&(H.shadowMap.needsUpdate=!0)}const B=dG();B&&("enabled"in B?B.enabled=!T:"legacyMode"in B&&(B.legacyMode=T)),l||Nm(H,{outputEncoding:_?3e3:3001,toneMapping:E?Tl:dR}),j.legacy!==T&&j.set(()=>({legacy:T})),j.linear!==_&&j.set(()=>({linear:_})),j.flat!==E&&j.set(()=>({flat:E})),f&&!sr.fun(f)&&!xG(f)&&!sr.equ(f,H,Im)&&Nm(H,f),x&&!j.events.handlers&&j.set({events:x(s)});const J=jbe(t,p);return sr.equ(J,j.size,Im)||j.setSize(J.width,J.height,J.updateStyle,J.top,J.left),N&&j.viewport.dpr!==gG(N)&&j.setDpr(N),j.frameloop!==O&&j.setFrameloop(O),j.onPointerMissed||j.set({onPointerMissed:k}),D&&!sr.equ(D,j.performance,Im)&&j.set(Y=>({performance:{...Y.performance,...D}})),a=S,l=!0,this},render(d){return l||this.configure(),D1.updateContainer(v.jsx(zbe,{store:s,children:d,onCreated:a,rootElement:t}),o,null,()=>{}),s},unmount(){SG(t)}}}function zbe({store:t,children:e,onCreated:n,rootElement:r}){return vx(()=>{const i=t.getState();i.set(s=>({internal:{...s.internal,active:!0}})),n&&n(i),t.getState().events.connected||i.events.connect==null||i.events.connect(r)},[]),v.jsx(bG.Provider,{value:t,children:e})}function SG(t,e){const n=zg.get(t),r=n==null?void 0:n.fiber;if(r){const i=n==null?void 0:n.store.getState();i&&(i.internal.active=!1),D1.updateContainer(null,r,null,()=>{i&&setTimeout(()=>{try{var s,o,a,l;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(o=s.renderLists)==null||o.dispose==null||o.dispose(),(a=i.gl)==null||a.forceContextLoss==null||a.forceContextLoss(),(l=i.gl)!=null&&l.xr&&i.xr.disconnect(),Tbe(i),zg.delete(t)}catch{}},500)})}}D1.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:R.version});const ZA={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function Bbe(t){const{handlePointer:e}=Nbe(t);return{priority:1,enabled:!0,compute(n,r,i){r.pointer.set(n.offsetX/r.size.width*2-1,-(n.offsetY/r.size.height)*2+1),r.raycaster.setFromCamera(r.pointer,r.camera)},connected:void 0,handlers:Object.keys(ZA).reduce((n,r)=>({...n,[r]:e(r)}),{}),update:()=>{var n;const{events:r,internal:i}=t.getState();(n=i.lastEvent)!=null&&n.current&&r.handlers&&r.handlers.onPointerMove(i.lastEvent.current)},connect:n=>{var r;const{set:i,events:s}=t.getState();s.disconnect==null||s.disconnect(),i(o=>({events:{...o.events,connected:n}})),Object.entries((r=s.handlers)!=null?r:[]).forEach(([o,a])=>{const[l,c]=ZA[o];n.addEventListener(l,a,{passive:c})})},disconnect:()=>{const{set:n,events:r}=t.getState();if(r.connected){var i;Object.entries((i=r.handlers)!=null?i:[]).forEach(([s,o])=>{if(r&&r.connected instanceof HTMLElement){const[a]=ZA[s];r.connected.removeEventListener(a,o)}}),n(s=>({events:{...s.events,connected:void 0}}))}}}}function UU(t,e){let n;return(...r)=>{window.clearTimeout(n),n=window.setTimeout(()=>t(...r),e)}}function Hbe({debounce:t,scroll:e,polyfill:n,offsetSize:r}={debounce:0,scroll:!1,offsetSize:!1}){const i=n||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,o]=R.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),a=R.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),l=t?typeof t=="number"?t:t.scroll:null,c=t?typeof t=="number"?t:t.resize:null,d=R.useRef(!1);R.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[f,p,y]=R.useMemo(()=>{const _=()=>{if(!a.current.element)return;const{left:E,top:T,width:P,height:O,bottom:N,right:D,x:z,y:G}=a.current.element.getBoundingClientRect(),k={left:E,top:T,width:P,height:O,bottom:N,right:D,x:z,y:G};a.current.element instanceof HTMLElement&&r&&(k.height=a.current.element.offsetHeight,k.width=a.current.element.offsetWidth),Object.freeze(k),d.current&&!$be(a.current.lastBounds,k)&&o(a.current.lastBounds=k)};return[_,c?UU(_,c):_,l?UU(_,l):_]},[o,r,l,c]);function x(){a.current.scrollContainers&&(a.current.scrollContainers.forEach(_=>_.removeEventListener("scroll",y,!0)),a.current.scrollContainers=null),a.current.resizeObserver&&(a.current.resizeObserver.disconnect(),a.current.resizeObserver=null),a.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",a.current.orientationHandler))}function S(){a.current.element&&(a.current.resizeObserver=new i(y),a.current.resizeObserver.observe(a.current.element),e&&a.current.scrollContainers&&a.current.scrollContainers.forEach(_=>_.addEventListener("scroll",y,{capture:!0,passive:!0})),a.current.orientationHandler=()=>{y()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",a.current.orientationHandler))}const w=_=>{!_||_===a.current.element||(x(),a.current.element=_,a.current.scrollContainers=MG(_),S())};return Gbe(y,!!e),Vbe(p),R.useEffect(()=>{x(),S()},[e,y,p]),R.useEffect(()=>x,[]),[w,s,f]}function Vbe(t){R.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function Gbe(t,e){R.useEffect(()=>{if(e){const n=t;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[t,e])}function MG(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,...MG(t.parentElement)]}const Wbe=["x","y","top","bottom","left","right","width","height"],$be=(t,e)=>Wbe.every(n=>t[n]===e[n]);var Xbe=Object.defineProperty,qbe=Object.defineProperties,Kbe=Object.getOwnPropertyDescriptors,jU=Object.getOwnPropertySymbols,Ybe=Object.prototype.hasOwnProperty,Zbe=Object.prototype.propertyIsEnumerable,FU=(t,e,n)=>e in t?Xbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,zU=(t,e)=>{for(var n in e||(e={}))Ybe.call(e,n)&&FU(t,n,e[n]);if(jU)for(var n of jU(e))Zbe.call(e,n)&&FU(t,n,e[n]);return t},Qbe=(t,e)=>qbe(t,Kbe(e)),BU,HU;typeof window<"u"&&((BU=window.document)!=null&&BU.createElement||((HU=window.navigator)==null?void 0:HU.product)==="ReactNative")?R.useLayoutEffect:R.useEffect;function EG(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=t.child;for(;r;){const i=EG(r,e,n);if(i)return i;r=r.sibling}}function AG(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const VU=console.error;console.error=function(){const t=[...arguments].join("");if(t!=null&&t.startsWith("Warning:")&&t.includes("useContext")){console.error=VU;return}return VU.apply(this,arguments)};const sN=AG(R.createContext(null));class TG extends R.Component{render(){return R.createElement(sN.Provider,{value:this._reactInternals},this.props.children)}}function Jbe(){const t=R.useContext(sN);if(t===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=R.useId();return R.useMemo(()=>{for(const r of[t,t==null?void 0:t.alternate]){if(!r)continue;const i=EG(r,!1,s=>{let o=s.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(i)return i}},[t,e])}function e_e(){const t=Jbe(),[e]=R.useState(()=>new Map);e.clear();let n=t;for(;n;){if(n.type&&typeof n.type=="object"){const i=n.type._context===void 0&&n.type.Provider===n.type?n.type:n.type._context;i&&i!==sN&&!e.has(i)&&e.set(i,R.useContext(AG(i)))}n=n.return}return e}function t_e(){const t=e_e();return R.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>r=>R.createElement(e,null,R.createElement(n.Provider,Qbe(zU({},r),{value:t.get(n)}))),e=>R.createElement(TG,zU({},e))),[t])}const n_e=R.forwardRef(function({children:e,fallback:n,resize:r,style:i,gl:s,events:o=Bbe,eventSource:a,eventPrefix:l,shadows:c,linear:d,flat:f,legacy:p,orthographic:y,frameloop:x,dpr:S,performance:w,raycaster:_,camera:E,scene:T,onPointerMissed:P,onCreated:O,...N},D){R.useMemo(()=>wbe(lbe),[]);const z=t_e(),[G,k]=Hbe({scroll:!0,debounce:{scroll:50,resize:0},...r}),j=R.useRef(null),H=R.useRef(null);R.useImperativeHandle(D,()=>j.current);const ee=hG(P),[te,he]=R.useState(!1),[se,fe]=R.useState(!1);if(te)throw te;if(se)throw se;const B=R.useRef(null);vx(()=>{const Y=j.current;k.width>0&&k.height>0&&Y&&(B.current||(B.current=Fbe(Y)),B.current.configure({gl:s,events:o,shadows:c,linear:d,flat:f,legacy:p,orthographic:y,frameloop:x,dpr:S,performance:w,raycaster:_,camera:E,scene:T,size:k,onPointerMissed:(...V)=>ee.current==null?void 0:ee.current(...V),onCreated:V=>{V.events.connect==null||V.events.connect(a?Mbe(a)?a.current:a:H.current),l&&V.setEvents({compute:(q,pe)=>{const ae=q[l+"X"],ce=q[l+"Y"];pe.pointer.set(ae/pe.size.width*2-1,-(ce/pe.size.height)*2+1),pe.raycaster.setFromCamera(pe.pointer,pe.camera)}}),O==null||O(V)}}),B.current.render(v.jsx(z,{children:v.jsx(pG,{set:fe,children:v.jsx(R.Suspense,{fallback:v.jsx(Ebe,{set:he}),children:e??null})})})))}),R.useEffect(()=>{const Y=j.current;if(Y)return()=>SG(Y)},[]);const J=a?"none":"auto";return v.jsx("div",{ref:H,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:J,...i},...N,children:v.jsx("div",{ref:G,style:{width:"100%",height:"100%"},children:v.jsx("canvas",{ref:j,style:{display:"block"},children:n})})})}),r_e=R.forwardRef(function(e,n){return v.jsx(TG,{children:v.jsx(n_e,{...e,ref:n})})});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)}var i_e=Object.defineProperty,s_e=(t,e,n)=>e in t?i_e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,o_e=(t,e,n)=>(s_e(t,e+"",n),n);class a_e{constructor(){o_e(this,"_listeners")}addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(n);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,o=i.length;s<o;s++)i[s].call(this,e);e.target=null}}}var l_e=Object.defineProperty,c_e=(t,e,n)=>e in t?l_e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Wt=(t,e,n)=>(c_e(t,typeof e!="symbol"?e+"":e,n),n);const N_=new Jh,GU=new Rc,u_e=Math.cos(70*(Math.PI/180)),WU=(t,e)=>(t%e+e)%e;let d_e=class extends a_e{constructor(e,n){super(),Wt(this,"object"),Wt(this,"domElement"),Wt(this,"enabled",!0),Wt(this,"target",new X),Wt(this,"minDistance",0),Wt(this,"maxDistance",1/0),Wt(this,"minZoom",0),Wt(this,"maxZoom",1/0),Wt(this,"minPolarAngle",0),Wt(this,"maxPolarAngle",Math.PI),Wt(this,"minAzimuthAngle",-1/0),Wt(this,"maxAzimuthAngle",1/0),Wt(this,"enableDamping",!1),Wt(this,"dampingFactor",.05),Wt(this,"enableZoom",!0),Wt(this,"zoomSpeed",1),Wt(this,"enableRotate",!0),Wt(this,"rotateSpeed",1),Wt(this,"enablePan",!0),Wt(this,"panSpeed",1),Wt(this,"screenSpacePanning",!0),Wt(this,"keyPanSpeed",7),Wt(this,"zoomToCursor",!1),Wt(this,"autoRotate",!1),Wt(this,"autoRotateSpeed",2),Wt(this,"reverseOrbit",!1),Wt(this,"reverseHorizontalOrbit",!1),Wt(this,"reverseVerticalOrbit",!1),Wt(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),Wt(this,"mouseButtons",{LEFT:qf.ROTATE,MIDDLE:qf.DOLLY,RIGHT:qf.PAN}),Wt(this,"touches",{ONE:Kf.ROTATE,TWO:Kf.DOLLY_PAN}),Wt(this,"target0"),Wt(this,"position0"),Wt(this,"zoom0"),Wt(this,"_domElementKeyEvents",null),Wt(this,"getPolarAngle"),Wt(this,"getAzimuthalAngle"),Wt(this,"setPolarAngle"),Wt(this,"setAzimuthalAngle"),Wt(this,"getDistance"),Wt(this,"getZoomScale"),Wt(this,"listenToKeyEvents"),Wt(this,"stopListenToKeyEvents"),Wt(this,"saveState"),Wt(this,"reset"),Wt(this,"update"),Wt(this,"connect"),Wt(this,"dispose"),Wt(this,"dollyIn"),Wt(this,"dollyOut"),Wt(this,"getScale"),Wt(this,"setScale"),this.object=e,this.domElement=n,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>d.phi,this.getAzimuthalAngle=()=>d.theta,this.setPolarAngle=de=>{let Xe=WU(de,2*Math.PI),le=d.phi;le<0&&(le+=2*Math.PI),Xe<0&&(Xe+=2*Math.PI);let Ye=Math.abs(Xe-le);2*Math.PI-Ye<Ye&&(Xe<le?Xe+=2*Math.PI:le+=2*Math.PI),f.phi=Xe-le,r.update()},this.setAzimuthalAngle=de=>{let Xe=WU(de,2*Math.PI),le=d.theta;le<0&&(le+=2*Math.PI),Xe<0&&(Xe+=2*Math.PI);let Ye=Math.abs(Xe-le);2*Math.PI-Ye<Ye&&(Xe<le?Xe+=2*Math.PI:le+=2*Math.PI),f.theta=Xe-le,r.update()},this.getDistance=()=>r.object.position.distanceTo(r.target),this.listenToKeyEvents=de=>{de.addEventListener("keydown",ft),this._domElementKeyEvents=de},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=a.NONE},this.update=(()=>{const de=new X,Xe=new X(0,1,0),le=new qt().setFromUnitVectors(e.up,Xe),Ye=le.clone().invert(),Re=new X,Be=new qt,ot=2*Math.PI;return function(){const Jt=r.object.position;le.setFromUnitVectors(e.up,Xe),Ye.copy(le).invert(),de.copy(Jt).sub(r.target),de.applyQuaternion(le),d.setFromVector3(de),r.autoRotate&&l===a.NONE&&te(H()),r.enableDamping?(d.theta+=f.theta*r.dampingFactor,d.phi+=f.phi*r.dampingFactor):(d.theta+=f.theta,d.phi+=f.phi);let pn=r.minAzimuthAngle,jn=r.maxAzimuthAngle;isFinite(pn)&&isFinite(jn)&&(pn<-Math.PI?pn+=ot:pn>Math.PI&&(pn-=ot),jn<-Math.PI?jn+=ot:jn>Math.PI&&(jn-=ot),pn<=jn?d.theta=Math.max(pn,Math.min(jn,d.theta)):d.theta=d.theta>(pn+jn)/2?Math.max(pn,d.theta):Math.min(jn,d.theta)),d.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,d.phi)),d.makeSafe(),r.enableDamping===!0?r.target.addScaledVector(y,r.dampingFactor):r.target.add(y),r.zoomToCursor&&G||r.object.isOrthographicCamera?d.radius=pe(d.radius):d.radius=pe(d.radius*p),de.setFromSpherical(d),de.applyQuaternion(Ye),Jt.copy(r.target).add(de),r.object.matrixAutoUpdate||r.object.updateMatrix(),r.object.lookAt(r.target),r.enableDamping===!0?(f.theta*=1-r.dampingFactor,f.phi*=1-r.dampingFactor,y.multiplyScalar(1-r.dampingFactor)):(f.set(0,0,0),y.set(0,0,0));let en=!1;if(r.zoomToCursor&&G){let Hn=null;if(r.object instanceof Pr&&r.object.isPerspectiveCamera){const pr=de.length();Hn=pe(pr*p);const Mi=pr-Hn;r.object.position.addScaledVector(D,Mi),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const pr=new X(z.x,z.y,0);pr.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/p)),r.object.updateProjectionMatrix(),en=!0;const Mi=new X(z.x,z.y,0);Mi.unproject(r.object),r.object.position.sub(Mi).add(pr),r.object.updateMatrixWorld(),Hn=de.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;Hn!==null&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(Hn).add(r.object.position):(N_.origin.copy(r.object.position),N_.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(N_.direction))<u_e?e.lookAt(r.target):(GU.setFromNormalAndCoplanarPoint(r.object.up,r.target),N_.intersectPlane(GU,r.target))))}else r.object instanceof Gc&&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,G=!1,en||Re.distanceToSquared(r.object.position)>c||8*(1-Be.dot(r.object.quaternion))>c?(r.dispatchEvent(i),Re.copy(r.object.position),Be.copy(r.object.quaternion),en=!1,!0):!1}})(),this.connect=de=>{r.domElement=de,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",ne),r.domElement.addEventListener("pointerdown",be),r.domElement.addEventListener("pointercancel",ze),r.domElement.addEventListener("wheel",rt)},this.dispose=()=>{var de,Xe,le,Ye,Re,Be;r.domElement&&(r.domElement.style.touchAction="auto"),(de=r.domElement)==null||de.removeEventListener("contextmenu",ne),(Xe=r.domElement)==null||Xe.removeEventListener("pointerdown",be),(le=r.domElement)==null||le.removeEventListener("pointercancel",ze),(Ye=r.domElement)==null||Ye.removeEventListener("wheel",rt),(Re=r.domElement)==null||Re.ownerDocument.removeEventListener("pointermove",Ue),(Be=r.domElement)==null||Be.ownerDocument.removeEventListener("pointerup",ze),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",ft)};const r=this,i={type:"change"},s={type:"start"},o={type:"end"},a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=a.NONE;const c=1e-6,d=new rC,f=new rC;let p=1;const y=new X,x=new He,S=new He,w=new He,_=new He,E=new He,T=new He,P=new He,O=new He,N=new He,D=new X,z=new He;let G=!1;const k=[],j={};function H(){return 2*Math.PI/60/60*r.autoRotateSpeed}function ee(){return Math.pow(.95,r.zoomSpeed)}function te(de){r.reverseOrbit||r.reverseHorizontalOrbit?f.theta+=de:f.theta-=de}function he(de){r.reverseOrbit||r.reverseVerticalOrbit?f.phi+=de:f.phi-=de}const se=(()=>{const de=new X;return function(le,Ye){de.setFromMatrixColumn(Ye,0),de.multiplyScalar(-le),y.add(de)}})(),fe=(()=>{const de=new X;return function(le,Ye){r.screenSpacePanning===!0?de.setFromMatrixColumn(Ye,1):(de.setFromMatrixColumn(Ye,0),de.crossVectors(r.object.up,de)),de.multiplyScalar(le),y.add(de)}})(),B=(()=>{const de=new X;return function(le,Ye){const Re=r.domElement;if(Re&&r.object instanceof Pr&&r.object.isPerspectiveCamera){const Be=r.object.position;de.copy(Be).sub(r.target);let ot=de.length();ot*=Math.tan(r.object.fov/2*Math.PI/180),se(2*le*ot/Re.clientHeight,r.object.matrix),fe(2*Ye*ot/Re.clientHeight,r.object.matrix)}else Re&&r.object instanceof Gc&&r.object.isOrthographicCamera?(se(le*(r.object.right-r.object.left)/r.object.zoom/Re.clientWidth,r.object.matrix),fe(Ye*(r.object.top-r.object.bottom)/r.object.zoom/Re.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function J(de){r.object instanceof Pr&&r.object.isPerspectiveCamera||r.object instanceof Gc&&r.object.isOrthographicCamera?p=de:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function Y(de){J(p/de)}function V(de){J(p*de)}function q(de){if(!r.zoomToCursor||!r.domElement)return;G=!0;const Xe=r.domElement.getBoundingClientRect(),le=de.clientX-Xe.left,Ye=de.clientY-Xe.top,Re=Xe.width,Be=Xe.height;z.x=le/Re*2-1,z.y=-(Ye/Be)*2+1,D.set(z.x,z.y,1).unproject(r.object).sub(r.object.position).normalize()}function pe(de){return Math.max(r.minDistance,Math.min(r.maxDistance,de))}function ae(de){x.set(de.clientX,de.clientY)}function ce(de){q(de),P.set(de.clientX,de.clientY)}function Se(de){_.set(de.clientX,de.clientY)}function Ee(de){S.set(de.clientX,de.clientY),w.subVectors(S,x).multiplyScalar(r.rotateSpeed);const Xe=r.domElement;Xe&&(te(2*Math.PI*w.x/Xe.clientHeight),he(2*Math.PI*w.y/Xe.clientHeight)),x.copy(S),r.update()}function $e(de){O.set(de.clientX,de.clientY),N.subVectors(O,P),N.y>0?Y(ee()):N.y<0&&V(ee()),P.copy(O),r.update()}function Me(de){E.set(de.clientX,de.clientY),T.subVectors(E,_).multiplyScalar(r.panSpeed),B(T.x,T.y),_.copy(E),r.update()}function Ge(de){q(de),de.deltaY<0?V(ee()):de.deltaY>0&&Y(ee()),r.update()}function We(de){let Xe=!1;switch(de.code){case r.keys.UP:B(0,r.keyPanSpeed),Xe=!0;break;case r.keys.BOTTOM:B(0,-r.keyPanSpeed),Xe=!0;break;case r.keys.LEFT:B(r.keyPanSpeed,0),Xe=!0;break;case r.keys.RIGHT:B(-r.keyPanSpeed,0),Xe=!0;break}Xe&&(de.preventDefault(),r.update())}function ue(){if(k.length==1)x.set(k[0].pageX,k[0].pageY);else{const de=.5*(k[0].pageX+k[1].pageX),Xe=.5*(k[0].pageY+k[1].pageY);x.set(de,Xe)}}function Z(){if(k.length==1)_.set(k[0].pageX,k[0].pageY);else{const de=.5*(k[0].pageX+k[1].pageX),Xe=.5*(k[0].pageY+k[1].pageY);_.set(de,Xe)}}function Ve(){const de=k[0].pageX-k[1].pageX,Xe=k[0].pageY-k[1].pageY,le=Math.sqrt(de*de+Xe*Xe);P.set(0,le)}function Le(){r.enableZoom&&Ve(),r.enablePan&&Z()}function re(){r.enableZoom&&Ve(),r.enableRotate&&ue()}function Ce(de){if(k.length==1)S.set(de.pageX,de.pageY);else{const le=Zt(de),Ye=.5*(de.pageX+le.x),Re=.5*(de.pageY+le.y);S.set(Ye,Re)}w.subVectors(S,x).multiplyScalar(r.rotateSpeed);const Xe=r.domElement;Xe&&(te(2*Math.PI*w.x/Xe.clientHeight),he(2*Math.PI*w.y/Xe.clientHeight)),x.copy(S)}function qe(de){if(k.length==1)E.set(de.pageX,de.pageY);else{const Xe=Zt(de),le=.5*(de.pageX+Xe.x),Ye=.5*(de.pageY+Xe.y);E.set(le,Ye)}T.subVectors(E,_).multiplyScalar(r.panSpeed),B(T.x,T.y),_.copy(E)}function Ze(de){const Xe=Zt(de),le=de.pageX-Xe.x,Ye=de.pageY-Xe.y,Re=Math.sqrt(le*le+Ye*Ye);O.set(0,Re),N.set(0,Math.pow(O.y/P.y,r.zoomSpeed)),Y(N.y),P.copy(O)}function Q(de){r.enableZoom&&Ze(de),r.enablePan&&qe(de)}function W(de){r.enableZoom&&Ze(de),r.enableRotate&&Ce(de)}function be(de){var Xe,le;r.enabled!==!1&&(k.length===0&&((Xe=r.domElement)==null||Xe.ownerDocument.addEventListener("pointermove",Ue),(le=r.domElement)==null||le.ownerDocument.addEventListener("pointerup",ze)),et(de),de.pointerType==="touch"?Xt(de):Fe(de))}function Ue(de){r.enabled!==!1&&(de.pointerType==="touch"?Ke(de):bt(de))}function ze(de){var Xe,le,Ye;Mt(de),k.length===0&&((Xe=r.domElement)==null||Xe.releasePointerCapture(de.pointerId),(le=r.domElement)==null||le.ownerDocument.removeEventListener("pointermove",Ue),(Ye=r.domElement)==null||Ye.ownerDocument.removeEventListener("pointerup",ze)),r.dispatchEvent(o),l=a.NONE}function Fe(de){let Xe;switch(de.button){case 0:Xe=r.mouseButtons.LEFT;break;case 1:Xe=r.mouseButtons.MIDDLE;break;case 2:Xe=r.mouseButtons.RIGHT;break;default:Xe=-1}switch(Xe){case qf.DOLLY:if(r.enableZoom===!1)return;ce(de),l=a.DOLLY;break;case qf.ROTATE:if(de.ctrlKey||de.metaKey||de.shiftKey){if(r.enablePan===!1)return;Se(de),l=a.PAN}else{if(r.enableRotate===!1)return;ae(de),l=a.ROTATE}break;case qf.PAN:if(de.ctrlKey||de.metaKey||de.shiftKey){if(r.enableRotate===!1)return;ae(de),l=a.ROTATE}else{if(r.enablePan===!1)return;Se(de),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function bt(de){if(r.enabled!==!1)switch(l){case a.ROTATE:if(r.enableRotate===!1)return;Ee(de);break;case a.DOLLY:if(r.enableZoom===!1)return;$e(de);break;case a.PAN:if(r.enablePan===!1)return;Me(de);break}}function rt(de){r.enabled===!1||r.enableZoom===!1||l!==a.NONE&&l!==a.ROTATE||(de.preventDefault(),r.dispatchEvent(s),Ge(de),r.dispatchEvent(o))}function ft(de){r.enabled===!1||r.enablePan===!1||We(de)}function Xt(de){switch(vt(de),k.length){case 1:switch(r.touches.ONE){case Kf.ROTATE:if(r.enableRotate===!1)return;ue(),l=a.TOUCH_ROTATE;break;case Kf.PAN:if(r.enablePan===!1)return;Z(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(r.touches.TWO){case Kf.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Le(),l=a.TOUCH_DOLLY_PAN;break;case Kf.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;re(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function Ke(de){switch(vt(de),l){case a.TOUCH_ROTATE:if(r.enableRotate===!1)return;Ce(de),r.update();break;case a.TOUCH_PAN:if(r.enablePan===!1)return;qe(de),r.update();break;case a.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Q(de),r.update();break;case a.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;W(de),r.update();break;default:l=a.NONE}}function ne(de){r.enabled!==!1&&de.preventDefault()}function et(de){k.push(de)}function Mt(de){delete j[de.pointerId];for(let Xe=0;Xe<k.length;Xe++)if(k[Xe].pointerId==de.pointerId){k.splice(Xe,1);return}}function vt(de){let Xe=j[de.pointerId];Xe===void 0&&(Xe=new He,j[de.pointerId]=Xe),Xe.set(de.pageX,de.pageY)}function Zt(de){const Xe=de.pointerId===k[0].pointerId?k[1]:k[0];return j[Xe.pointerId]}this.dollyIn=(de=ee())=>{V(de),r.update()},this.dollyOut=(de=ee())=>{Y(de),r.update()},this.getScale=()=>p,this.setScale=de=>{J(de),r.update()},this.getZoomScale=()=>ee(),n!==void 0&&this.connect(n),this.update()}};const f_e=R.forwardRef(({makeDefault:t,camera:e,regress:n,domElement:r,enableDamping:i=!0,keyEvents:s=!1,onChange:o,onStart:a,onEnd:l,...c},d)=>{const f=ed(N=>N.invalidate),p=ed(N=>N.camera),y=ed(N=>N.gl),x=ed(N=>N.events),S=ed(N=>N.setEvents),w=ed(N=>N.set),_=ed(N=>N.get),E=ed(N=>N.performance),T=e||p,P=r||x.connected||y.domElement,O=R.useMemo(()=>new d_e(T),[T]);return wG(()=>{O.enabled&&O.update()},-1),R.useEffect(()=>(s&&O.connect(s===!0?P:s),O.connect(P),()=>void O.dispose()),[s,P,n,O,f]),R.useEffect(()=>{const N=G=>{f(),n&&E.regress(),o&&o(G)},D=G=>{a&&a(G)},z=G=>{l&&l(G)};return O.addEventListener("change",N),O.addEventListener("start",D),O.addEventListener("end",z),()=>{O.removeEventListener("start",D),O.removeEventListener("end",z),O.removeEventListener("change",N)}},[o,a,l,O,f,S]),R.useEffect(()=>{if(t){const N=_().controls;return w({controls:O}),()=>w({controls:N})}},[t,O]),R.createElement("primitive",oC({ref:d,object:O,enableDamping:i},c))});function $U(t,e){if(e===qV)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===I1||e===wR){let n=t.getIndex();if(n===null){const o=[],a=t.getAttribute("position");if(a!==void 0){for(let l=0;l<a.count;l++)o.push(l);t.setIndex(o),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===I1)for(let o=1;o<=r;o++)i.push(n.getX(0)),i.push(n.getX(o)),i.push(n.getX(o+1));else for(let o=0;o<r;o++)o%2===0?(i.push(n.getX(o)),i.push(n.getX(o+1)),i.push(n.getX(o+2))):(i.push(n.getX(o+2)),i.push(n.getX(o+1)),i.push(n.getX(o)));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 h_e extends Rs{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(n){return new y_e(n)}),this.register(function(n){return new x_e(n)}),this.register(function(n){return new P_e(n)}),this.register(function(n){return new C_e(n)}),this.register(function(n){return new R_e(n)}),this.register(function(n){return new __e(n)}),this.register(function(n){return new w_e(n)}),this.register(function(n){return new S_e(n)}),this.register(function(n){return new M_e(n)}),this.register(function(n){return new v_e(n)}),this.register(function(n){return new E_e(n)}),this.register(function(n){return new b_e(n)}),this.register(function(n){return new T_e(n)}),this.register(function(n){return new A_e(n)}),this.register(function(n){return new m_e(n)}),this.register(function(n){return new N_e(n)}),this.register(function(n){return new I_e(n)})}load(e,n,r,i){const s=this;let o;if(this.resourcePath!=="")o=this.resourcePath;else if(this.path!==""){const c=wd.extractUrlBase(e);o=wd.resolveURL(c,this.path)}else o=wd.extractUrlBase(e);this.manager.itemStart(e);const a=function(c){i?i(c):console.error(c),s.manager.itemError(e),s.manager.itemEnd(e)},l=new Ga(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,o,function(d){n(d),s.manager.itemEnd(e)},a)}catch(d){a(d)}},r,a)}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 o={},a={},l=new TextDecoder;if(typeof e=="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(l.decode(new Uint8Array(e,0,4))===PG){try{o[vn.KHR_BINARY_GLTF]=new k_e(e)}catch(f){i&&i(f);return}s=JSON.parse(o[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 $_e(s,{path:n||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d<this.pluginCallbacks.length;d++){const f=this.pluginCallbacks[d](c);f.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[f.name]=f,o[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:o[f]=new g_e;break;case vn.KHR_DRACO_MESH_COMPRESSION:o[f]=new O_e(s,this.dracoLoader);break;case vn.KHR_TEXTURE_TRANSFORM:o[f]=new L_e;break;case vn.KHR_MESH_QUANTIZATION:o[f]=new D_e;break;default:p.indexOf(f)>=0&&a[f]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(r,i)}parseAsync(e,n){const r=this;return new Promise(function(i,s){r.parse(e,n,i,s)})}}function p_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 m_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 ct(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 ZR(d),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new YR(d),c.distance=f;break;case"spot":c=new KR(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,Pc(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],a=(s.extensions&&s.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(l){return r._getNodeRef(n.cache,a,l)})}}class g_e{constructor(){this.name=vn.KHR_MATERIALS_UNLIT}getMaterialType(){return As}extendParams(e,n,r){const i=[];e.color=new ct(1,1,1),e.opacity=1;const s=n.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const o=s.baseColorFactor;e.color.setRGB(o[0],o[1],o[2],xi),e.opacity=o[3]}s.baseColorTexture!==void 0&&i.push(r.assignTexture(e,"map",s.baseColorTexture,Fi))}return Promise.all(i)}}class v_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 y_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:ta}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];if(o.clearcoatFactor!==void 0&&(n.clearcoat=o.clearcoatFactor),o.clearcoatTexture!==void 0&&s.push(r.assignTexture(n,"clearcoatMap",o.clearcoatTexture)),o.clearcoatRoughnessFactor!==void 0&&(n.clearcoatRoughness=o.clearcoatRoughnessFactor),o.clearcoatRoughnessTexture!==void 0&&s.push(r.assignTexture(n,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),o.clearcoatNormalTexture!==void 0&&(s.push(r.assignTexture(n,"clearcoatNormalMap",o.clearcoatNormalTexture)),o.clearcoatNormalTexture.scale!==void 0)){const a=o.clearcoatNormalTexture.scale;n.clearcoatNormalScale=new He(a,a)}return Promise.all(s)}}class x_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:ta}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 b_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:ta}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return o.iridescenceFactor!==void 0&&(n.iridescence=o.iridescenceFactor),o.iridescenceTexture!==void 0&&s.push(r.assignTexture(n,"iridescenceMap",o.iridescenceTexture)),o.iridescenceIor!==void 0&&(n.iridescenceIOR=o.iridescenceIor),n.iridescenceThicknessRange===void 0&&(n.iridescenceThicknessRange=[100,400]),o.iridescenceThicknessMinimum!==void 0&&(n.iridescenceThicknessRange[0]=o.iridescenceThicknessMinimum),o.iridescenceThicknessMaximum!==void 0&&(n.iridescenceThicknessRange[1]=o.iridescenceThicknessMaximum),o.iridescenceThicknessTexture!==void 0&&s.push(r.assignTexture(n,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(s)}}class __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:ta}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 ct(0,0,0),n.sheenRoughness=0,n.sheen=1;const o=i.extensions[this.name];if(o.sheenColorFactor!==void 0){const a=o.sheenColorFactor;n.sheenColor.setRGB(a[0],a[1],a[2],xi)}return o.sheenRoughnessFactor!==void 0&&(n.sheenRoughness=o.sheenRoughnessFactor),o.sheenColorTexture!==void 0&&s.push(r.assignTexture(n,"sheenColorMap",o.sheenColorTexture,Fi)),o.sheenRoughnessTexture!==void 0&&s.push(r.assignTexture(n,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(s)}}class w_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:ta}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return o.transmissionFactor!==void 0&&(n.transmission=o.transmissionFactor),o.transmissionTexture!==void 0&&s.push(r.assignTexture(n,"transmissionMap",o.transmissionTexture)),Promise.all(s)}}class S_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:ta}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];n.thickness=o.thicknessFactor!==void 0?o.thicknessFactor:0,o.thicknessTexture!==void 0&&s.push(r.assignTexture(n,"thicknessMap",o.thicknessTexture)),n.attenuationDistance=o.attenuationDistance||1/0;const a=o.attenuationColor||[1,1,1];return n.attenuationColor=new ct().setRGB(a[0],a[1],a[2],xi),Promise.all(s)}}class M_e{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:ta}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 E_e{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:ta}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];n.specularIntensity=o.specularFactor!==void 0?o.specularFactor:1,o.specularTexture!==void 0&&s.push(r.assignTexture(n,"specularIntensityMap",o.specularTexture));const a=o.specularColorFactor||[1,1,1];return n.specularColor=new ct().setRGB(a[0],a[1],a[2],xi),o.specularColorTexture!==void 0&&s.push(r.assignTexture(n,"specularColorMap",o.specularColorTexture,Fi)),Promise.all(s)}}class A_e{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:ta}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return n.bumpScale=o.bumpFactor!==void 0?o.bumpFactor:1,o.bumpTexture!==void 0&&s.push(r.assignTexture(n,"bumpMap",o.bumpTexture)),Promise.all(s)}}class T_e{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:ta}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return o.anisotropyStrength!==void 0&&(n.anisotropy=o.anisotropyStrength),o.anisotropyRotation!==void 0&&(n.anisotropyRotation=o.anisotropyRotation),o.anisotropyTexture!==void 0&&s.push(r.assignTexture(n,"anisotropyMap",o.anisotropyTexture)),Promise.all(s)}}class P_e{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],o=n.options.ktx2Loader;if(!o){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,o)}}class C_e{constructor(e){this.parser=e,this.name=vn.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[n])return null;const o=s.extensions[n],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class R_e{constructor(e){this.parser=e,this.name=vn.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[n])return null;const o=s.extensions[n],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class N_e{constructor(e){this.name=vn.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const n=this.parser.json,r=n.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const i=r.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=i.byteOffset||0,c=i.byteLength||0,d=i.count,f=i.byteStride,p=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(d,f,p,i.mode,i.filter).then(function(y){return y.buffer}):o.ready.then(function(){const y=new ArrayBuffer(d*f);return o.decodeGltfBuffer(new Uint8Array(y),d,f,p,i.mode,i.filter),y})})}else return null}}class I_e{constructor(e){this.name=vn.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const n=this.parser.json,r=n.nodes[e];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const i=n.meshes[r.mesh];for(const c of i.primitives)if(c.mode!==Bo.TRIANGLES&&c.mode!==Bo.TRIANGLE_STRIP&&c.mode!==Bo.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=r.extensions[this.name].attributes,a=[],l={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(d=>(l[c]=d,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const d=c.pop(),f=d.isGroup?d.children:[d],p=c[0].count,y=[];for(const x of f){const S=new Ct,w=new X,_=new qt,E=new X(1,1,1),T=new LR(x.geometry,x.material,p);for(let P=0;P<p;P++)l.TRANSLATION&&w.fromBufferAttribute(l.TRANSLATION,P),l.ROTATION&&_.fromBufferAttribute(l.ROTATION,P),l.SCALE&&E.fromBufferAttribute(l.SCALE,P),T.setMatrixAt(P,S.compose(w,_,E));for(const P in l)if(P==="_COLOR_0"){const O=l[P];T.instanceColor=new Hh(O.array,O.itemSize,O.normalized)}else P!=="TRANSLATION"&&P!=="ROTATION"&&P!=="SCALE"&&x.geometry.setAttribute(P,l[P]);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 PG="glTF",I0=12,XU={JSON:1313821514,BIN:5130562};class k_e{constructor(e){this.name=vn.KHR_BINARY_GLTF,this.content=null,this.body=null;const n=new DataView(e,0,I0),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!==PG)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-I0,s=new DataView(e,I0);let o=0;for(;o<i;){const a=s.getUint32(o,!0);o+=4;const l=s.getUint32(o,!0);if(o+=4,l===XU.JSON){const c=new Uint8Array(e,I0+o,a);this.content=r.decode(c)}else if(l===XU.BIN){const c=I0+o;this.body=e.slice(c,c+a)}o+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class O_e{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,o=e.extensions[this.name].attributes,a={},l={},c={};for(const d in o){const f=aC[d]||d.toLowerCase();a[f]=o[d]}for(const d in e.attributes){const f=aC[d]||d.toLowerCase();if(o[d]!==void 0){const p=r.accessors[e.attributes[d]],y=ig[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)},a,c,xi,p)})})}}class L_e{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 D_e{constructor(){this.name=vn.KHR_MESH_QUANTIZATION}}class CG extends av{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 o=0;o!==i;o++)n[o]=r[s+o];return n}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=a*2,c=a*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,_=y-p,E=1-w,T=_-p+f;for(let P=0;P!==a;P++){const O=o[S+P+a],N=o[S+P+l]*d,D=o[x+P+a],z=o[x+P]*d;s[P]=E*O+T*N+w*D+_*z}return s}}const U_e=new qt;class j_e extends CG{interpolate_(e,n,r,i){const s=super.interpolate_(e,n,r,i);return U_e.fromArray(s).normalize().toArray(s),s}}const Bo={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},ig={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},qU={9728:ri,9729:Cr,9984:HS,9985:ng,9986:oh,9987:$o},KU={33071:_o,33648:Ig,10497:Cd},QA={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},aC={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"},td={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},F_e={CUBICSPLINE:void 0,LINEAR:Lg,STEP:Og},JA={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function z_e(t){return t.DefaultMaterial===void 0&&(t.DefaultMaterial=new gx({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Ll})),t.DefaultMaterial}function zf(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 Pc(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 B_e(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 o=[],a=[],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;o.push(p)}if(i){const p=f.NORMAL!==void 0?n.getDependency("accessor",f.NORMAL):t.attributes.normal;a.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(o),Promise.all(a),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 H_e(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 V_e(t){let e;const n=t.extensions&&t.extensions[vn.KHR_DRACO_MESH_COMPRESSION];if(n?e="draco:"+n.bufferView+":"+n.indices+":"+eT(n.attributes):e=t.indices+":"+eT(t.attributes)+":"+t.mode,t.targets!==void 0)for(let r=0,i=t.targets.length;r<i;r++)e+=":"+eT(t.targets[r]);return e}function eT(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 lC(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 G_e(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 W_e=new Ct;class $_e{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new p_e,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,i=-1,s=!1,o=-1;if(typeof navigator<"u"){const a=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(a)===!0;const l=a.match(/Version\/(\d+)/);i=r&&l?parseInt(l[1],10):-1,s=a.indexOf("Firefox")>-1,o=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||r&&i<17||s&&o<98?this.textureLoader=new Y6(this.options.manager):this.textureLoader=new iG(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Ga(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,n){const r=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(o){const a={scene:o[0][i.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:i.asset,parser:r,userData:{}};return zf(s,a,i),Pc(a,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){for(const l of a.scenes)l.updateMatrixWorld();e(a)})}).catch(n)}_markDefs(){const e=this.json.nodes||[],n=this.json.skins||[],r=this.json.meshes||[];for(let i=0,s=n.length;i<s;i++){const o=n[i].joints;for(let a=0,l=o.length;a<l;a++)e[o[a]].isBone=!0}for(let i=0,s=e.length;i<s;i++){const o=e[i];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(r[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.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=(o,a)=>{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,d]of o.children.entries())s(d,a.children[c])};return s(r,i),i.name+="_instance_"+e.uses[n]++,i}_invokeOne(e){const n=Object.values(this.plugins);n.push(this);for(let r=0;r<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,o){return r.getDependency(e,o)})),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,o){r.load(wd.resolveURL(n.uri,i.path),s,void 0,function(){o(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 o=QA[i.type],a=ig[i.componentType],l=i.normalized===!0,c=new a(i.count*o);return Promise.resolve(new Qt(c,o,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(o){const a=o[0],l=QA[i.type],c=ig[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 _=Math.floor(p/y),E="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+_+":"+i.count;let T=n.cache.get(E);T||(S=new c(a,_*y,i.count*y/d),T=new tp(S,y/d),n.cache.add(E,T)),w=new Dl(T,l,p%y/d,x)}else a===null?S=new c(i.count*l):S=new c(a,p,i.count*l),w=new Qt(S,l,x);if(i.sparse!==void 0){const _=QA.SCALAR,E=ig[i.sparse.indices.componentType],T=i.sparse.indices.byteOffset||0,P=i.sparse.values.byteOffset||0,O=new E(o[1],T,i.sparse.count*_),N=new c(o[2],P,i.sparse.count*l);a!==null&&(w=new Qt(w.array.slice(),w.itemSize,w.normalized)),w.normalized=!1;for(let D=0,z=O.length;D<z;D++){const G=O[D];if(w.setX(G,N[D*l]),l>=2&&w.setY(G,N[D*l+1]),l>=3&&w.setZ(G,N[D*l+2]),l>=4&&w.setW(G,N[D*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}w.normalized=x}return w})}loadTexture(e){const n=this.json,r=this.options,s=n.textures[e].source,o=n.images[s];let a=this.textureLoader;if(o.uri){const l=r.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,n,r){const i=this,s=this.json,o=s.textures[e],a=s.images[n],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(n,r).then(function(d){d.flipY=!1,d.name=o.name||a.name||"",d.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(d.name=a.uri);const p=(s.samplers||{})[o.sampler]||{};return d.magFilter=qU[p.magFilter]||Cr,d.minFilter=qU[p.minFilter]||$o,d.wrapS=KU[p.wrapS]||Cd,d.wrapT=KU[p.wrapT]||Cd,i.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,n){const r=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(f=>f.clone());const o=i.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=r.getDependency("bufferView",o.bufferView).then(function(f){c=!0;const p=new Blob([f],{type:o.mimeType});return l=a.createObjectURL(p),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(l).then(function(f){return new Promise(function(p,y){let x=p;n.isImageBitmapLoader===!0&&(x=function(S){const w=new fr(S);w.needsUpdate=!0,p(w)}),n.load(wd.resolveURL(f,s.path),x,void 0,y)})}).then(function(f){return c===!0&&a.revokeObjectURL(l),Pc(f,o),f.userData.mimeType=o.mimeType||G_e(o.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),f});return this.sourceCache[e]=d,d}assignTexture(e,n,r,i){const s=this;return this.getDependency("texture",r.index).then(function(o){if(!o)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(o=o.clone(),o.channel=r.texCoord),s.extensions[vn.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[vn.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[vn.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return i!==void 0&&(o.colorSpace=i),e[n]=o,o})}assignFinalMaterial(e){const n=e.geometry;let r=e.material;const i=n.attributes.tangent===void 0,s=n.attributes.color!==void 0,o=n.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new rM,Gr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(a,l)),r=l}else if(e.isLine){const a="LineBasicMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new $r,Gr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(a,l)),r=l}if(i||s||o){let a="ClonedMaterial:"+r.uuid+":";i&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=r.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(r))),r=l}e.material=r}getMaterialType(){return gx}loadMaterial(e){const n=this,r=this.json,i=this.extensions,s=r.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[vn.KHR_MATERIALS_UNLIT]){const f=i[vn.KHR_MATERIALS_UNLIT];o=f.getMaterialType(),c.push(f.extendParams(a,s,n))}else{const f=s.pbrMetallicRoughness||{};if(a.color=new ct(1,1,1),a.opacity=1,Array.isArray(f.baseColorFactor)){const p=f.baseColorFactor;a.color.setRGB(p[0],p[1],p[2],xi),a.opacity=p[3]}f.baseColorTexture!==void 0&&c.push(n.assignTexture(a,"map",f.baseColorTexture,Fi)),a.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,a.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(c.push(n.assignTexture(a,"metalnessMap",f.metallicRoughnessTexture)),c.push(n.assignTexture(a,"roughnessMap",f.metallicRoughnessTexture))),o=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=xo);const d=s.alphaMode||JA.OPAQUE;if(d===JA.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===JA.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==As&&(c.push(n.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new He(1,1),s.normalTexture.scale!==void 0)){const f=s.normalTexture.scale;a.normalScale.set(f,f)}if(s.occlusionTexture!==void 0&&o!==As&&(c.push(n.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==As){const f=s.emissiveFactor;a.emissive=new ct().setRGB(f[0],f[1],f[2],xi)}return s.emissiveTexture!==void 0&&o!==As&&c.push(n.assignTexture(a,"emissiveMap",s.emissiveTexture,Fi)),Promise.all(c).then(function(){const f=new o(a);return s.name&&(f.name=s.name),Pc(f,s),n.associations.set(f,{materials:e}),s.extensions&&zf(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(a){return r[vn.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,n).then(function(l){return YU(l,a,n)})}const o=[];for(let a=0,l=e.length;a<l;a++){const c=e[a],d=V_e(c),f=i[d];if(f)o.push(f.promise);else{let p;c.extensions&&c.extensions[vn.KHR_DRACO_MESH_COMPRESSION]?p=s(c):p=YU(new Yt,c,n),i[d]={primitive:c,promise:p},o.push(p)}}return Promise.all(o)}loadMesh(e){const n=this,r=this.json,i=this.extensions,s=r.meshes[e],o=s.primitives,a=[];for(let l=0,c=o.length;l<c;l++){const d=o[l].material===void 0?z_e(this.cache):this.getDependency("material",o[l].material);a.push(d)}return a.push(n.loadGeometries(o)),Promise.all(a).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=o[y];let _;const E=c[y];if(w.mode===Bo.TRIANGLES||w.mode===Bo.TRIANGLE_STRIP||w.mode===Bo.TRIANGLE_FAN||w.mode===void 0)_=s.isSkinnedMesh===!0?new tM(S,E):new xr(S,E),_.isSkinnedMesh===!0&&_.normalizeSkinWeights(),w.mode===Bo.TRIANGLE_STRIP?_.geometry=$U(_.geometry,wR):w.mode===Bo.TRIANGLE_FAN&&(_.geometry=$U(_.geometry,I1));else if(w.mode===Bo.LINES)_=new eo(S,E);else if(w.mode===Bo.LINE_STRIP)_=new Ul(S,E);else if(w.mode===Bo.LINE_LOOP)_=new DR(S,E);else if(w.mode===Bo.POINTS)_=new UR(S,E);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+w.mode);Object.keys(_.geometry.morphAttributes).length>0&&H_e(_,s),_.name=n.createUniqueName(s.name||"mesh_"+e),Pc(_,s),w.extensions&&zf(i,_,w),n.assignFinalMaterial(_),f.push(_)}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&&zf(i,f[0],s),f[0];const p=new Ts;s.extensions&&zf(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 Pr(vr.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):r.type==="orthographic"&&(n=new Gc(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),r.name&&(n.name=this.createUniqueName(r.name)),Pc(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(),o=i,a=[],l=[];for(let c=0,d=o.length;c<d;c++){const f=o[c];if(f){a.push(f);const p=new Ct;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 kd(a,l)})}loadAnimation(e){const n=this.json,r=this,i=n.animations[e],s=i.name?i.name:"animation_"+e,o=[],a=[],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,_=i.parameters!==void 0?i.parameters[x.input]:x.input,E=i.parameters!==void 0?i.parameters[x.output]:x.output;S.node!==void 0&&(o.push(this.getDependency("node",w)),a.push(this.getDependency("accessor",_)),l.push(this.getDependency("accessor",E)),c.push(x),d.push(S))}return Promise.all([Promise.all(o),Promise.all(a),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],_=[];for(let E=0,T=p.length;E<T;E++){const P=p[E],O=y[E],N=x[E],D=S[E],z=w[E];if(P===void 0)continue;P.updateMatrix&&P.updateMatrix();const G=r._createAnimationTracks(P,O,N,D,z);if(G)for(let k=0;k<G.length;k++)_.push(G[k])}return new jg(s,void 0,_)})}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 o=r._getNodeRef(r.meshCache,i.mesh,s);return i.weights!==void 0&&o.traverse(function(a){if(a.isMesh)for(let l=0,c=i.weights.length;l<c;l++)a.morphTargetInfluences[l]=i.weights[l]}),o})}loadNode(e){const n=this.json,r=this,i=n.nodes[e],s=r._loadNodeShallow(e),o=[],a=i.children||[];for(let c=0,d=a.length;c<d;c++)o.push(r.getDependency("node",a[c]));const l=i.skin===void 0?Promise.resolve(null):r.getDependency("skin",i.skin);return Promise.all([s,Promise.all(o),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,W_e)});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],o=s.name?i.createUniqueName(s.name):"",a=[],l=i._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return l&&a.push(l),s.camera!==void 0&&a.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){a.push(c)}),this.nodeCache[e]=Promise.all(a).then(function(c){let d;if(s.isBone===!0?d=new nM:c.length>1?d=new Ts: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=o),Pc(d,s),s.extensions&&zf(r,d,s),s.matrix!==void 0){const f=new Ct;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 Ts;r.name&&(s.name=i.createUniqueName(r.name)),Pc(s,r),r.extensions&&zf(n,s,r);const o=r.nodes||[],a=[];for(let l=0,c=o.length;l<c;l++)a.push(i.getDependency("node",o[l]));return Promise.all(a).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 o=[],a=e.name?e.name:e.uuid,l=[];td[s.path]===td.weights?e.traverse(function(p){p.morphTargetInfluences&&l.push(p.name?p.name:p.uuid)}):l.push(a);let c;switch(td[s.path]){case td.weights:c=Gh;break;case td.rotation:c=Wh;break;case td.position:case td.scale:c=$h;break;default:switch(r.itemSize){case 1:c=Gh;break;case 2:case 3:default:c=$h;break}break}const d=i.interpolation!==void 0?F_e[i.interpolation]:Lg,f=this._getArrayFromAccessor(r);for(let p=0,y=l.length;p<y;p++){const x=new c(l[p]+"."+td[s.path],n.array,f,d);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(x),o.push(x)}return o}_getArrayFromAccessor(e){let n=e.array;if(e.normalized){const r=lC(n.constructor),i=new Float32Array(n.length);for(let s=0,o=n.length;s<o;s++)i[s]=n[s]*r;n=i}return n}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(r){const i=this instanceof Wh?j_e:CG;return new i(this.times,this.values,this.getValueSize()/3,r)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function X_e(t,e,n){const r=e.attributes,i=new as;if(r.POSITION!==void 0){const a=n.json.accessors[r.POSITION],l=a.min,c=a.max;if(l!==void 0&&c!==void 0){if(i.set(new X(l[0],l[1],l[2]),new X(c[0],c[1],c[2])),a.normalized){const d=lC(ig[a.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 a=new X,l=new X;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=lC(ig[p.componentType]);l.multiplyScalar(S)}a.max(l)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(a)}t.boundingBox=i;const o=new Hi;i.getCenter(o.center),o.radius=i.min.distanceTo(i.max)/2,t.boundingSphere=o}function YU(t,e,n){const r=e.attributes,i=[];function s(o,a){return n.getDependency("accessor",o).then(function(l){t.setAttribute(a,l)})}for(const o in r){const a=aC[o]||o.toLowerCase();a in t.attributes||i.push(s(r[o],a))}if(e.indices!==void 0&&!t.index){const o=n.getDependency("accessor",e.indices).then(function(a){t.setIndex(a)});i.push(o)}return Nn.workingColorSpace!==xi&&"COLOR_0"in r&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Nn.workingColorSpace}" not supported.`),Pc(t,e),X_e(t,e,n),Promise.all(i).then(function(){return e.targets!==void 0?B_e(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 I_=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),Dn=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),ZU=class extends mn{constructor(t){super(),this.weight=0,this.isBinary=!1,this.overrideBlink="none",this.overrideLookAt="none",this.overrideMouth="none",this._binds=[],this.name=`VRMExpression_${t}`,this.expressionName=t,this.type="VRMExpression",this.visible=!1}get binds(){return this._binds}get overrideBlinkAmount(){return this.overrideBlink==="block"?0<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 RG(t,e,n){var r,i;const s=t.parser.json,o=(r=s.nodes)==null?void 0:r[e];if(o==null)return console.warn(`extractPrimitivesInternal: Attempt to use nodes[${e}] of glTF but the node doesn't exist`),null;const a=o.mesh;if(a==null)return null;const l=(i=s.meshes)==null?void 0:i[a];if(l==null)return console.warn(`extractPrimitivesInternal: Attempt to use meshes[${a}] of glTF but the mesh doesn't exist`),null;const c=l.primitives.length,d=[];return n.traverse(f=>{d.length<c&&f.isMesh&&d.push(f)}),d}function QU(t,e){return Dn(this,null,function*(){const n=yield t.parser.getDependency("node",e);return RG(t,e,n)})}function JU(t){return Dn(this,null,function*(){const e=yield t.parser.getDependencies("node"),n=new Map;return e.forEach((r,i)=>{const s=RG(t,i,r);s!=null&&n.set(i,s)}),n})}var cC={Aa:"aa",Ih:"ih",Ou:"ou",Ee:"ee",Oh:"oh",Blink:"blink",Happy:"happy",Angry:"angry",Sad:"sad",Relaxed:"relaxed",LookUp:"lookUp",Surprised:"surprised",LookDown:"lookDown",LookLeft:"lookLeft",LookRight:"lookRight",BlinkLeft:"blinkLeft",BlinkRight:"blinkRight",Neutral:"neutral"};function NG(t){return Math.max(Math.min(t,1),0)}var ej=class IG{constructor(){this.blinkExpressionNames=["blink","blinkLeft","blinkRight"],this.lookAtExpressionNames=["lookLeft","lookRight","lookUp","lookDown"],this.mouthExpressionNames=["aa","ee","ih","oh","ou"],this._expressions=[],this._expressionMap={}}get expressions(){return this._expressions.concat()}get expressionMap(){return Object.assign({},this._expressionMap)}get presetExpressionMap(){const e={},n=new Set(Object.values(cC));return Object.entries(this._expressionMap).forEach(([r,i])=>{n.has(r)&&(e[r]=i)}),e}get customExpressionMap(){const e={},n=new Set(Object.values(cC));return Object.entries(this._expressionMap).forEach(([r,i])=>{n.has(r)||(e[r]=i)}),e}copy(e){return this._expressions.concat().forEach(r=>{this.unregisterExpression(r)}),e._expressions.forEach(r=>{this.registerExpression(r)}),this.blinkExpressionNames=e.blinkExpressionNames.concat(),this.lookAtExpressionNames=e.lookAtExpressionNames.concat(),this.mouthExpressionNames=e.mouthExpressionNames.concat(),this}clone(){return new IG().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=NG(n))}resetValues(){this._expressions.forEach(e=>{e.weight=0})}getExpressionTrackName(e){const n=this.getExpression(e);return n?`${n.name}.weight`:null}update(){const e=this._calculateWeightMultipliers();this._expressions.forEach(n=>{n.clearAppliedWeight()}),this._expressions.forEach(n=>{let r=1;const i=n.expressionName;this.blinkExpressionNames.indexOf(i)!==-1&&(r*=e.blink),this.lookAtExpressionNames.indexOf(i)!==-1&&(r*=e.lookAt),this.mouthExpressionNames.indexOf(i)!==-1&&(r*=e.mouth),n.applyWeight({multiplier:r})})}_calculateWeightMultipliers(){let e=1,n=1,r=1;return this._expressions.forEach(i=>{e-=i.overrideBlinkAmount,n-=i.overrideLookAtAmount,r-=i.overrideMouthAmount}),e=Math.max(0,e),n=Math.max(0,n),r=Math.max(0,r),{blink:e,lookAt:n,mouth:r}}},k0={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",RimColor:"rimColor",OutlineColor:"outlineColor"},q_e={_Color:k0.Color,_EmissionColor:k0.EmissionColor,_ShadeColor:k0.ShadeColor,_RimColor:k0.RimColor,_OutlineColor:k0.OutlineColor},K_e=new ct,kG=class OG{constructor({material:e,type:n,targetValue:r,targetAlpha:i}){this.material=e,this.type=n,this.targetValue=r,this.targetAlpha=i??1;const s=this._initColorBindState(),o=this._initAlphaBindState();this._state={color:s,alpha:o}}applyWeight(e){const{color:n,alpha:r}=this._state;if(n!=null){const{propertyName:i,deltaValue:s}=n,o=this.material[i];o!=null&&o.add(K_e.copy(s).multiplyScalar(e))}if(r!=null){const{propertyName:i,deltaValue:s}=r;this.material[i]!=null&&(this.material[i]+=s*e)}}clearAppliedWeight(){const{color:e,alpha:n}=this._state;if(e!=null){const{propertyName:r,initialValue:i}=e,s=this.material[r];s!=null&&s.copy(i)}if(n!=null){const{propertyName:r,initialValue:i}=n;this.material[r]!=null&&(this.material[r]=i)}}_initColorBindState(){var e,n,r;const{material:i,type:s,targetValue:o}=this,a=this._getPropertyNameMap(),l=(n=(e=a==null?void 0:a[s])==null?void 0:e[0])!=null?n:null;if(l==null)return console.warn(`Tried to add a material color bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type is not supported.`),null;const d=i[l].clone(),f=new ct(o.r-d.r,o.g-d.g,o.b-d.b);return{propertyName:l,initialValue:d,deltaValue:f}}_initAlphaBindState(){var e,n,r;const{material:i,type:s,targetAlpha:o}=this,a=this._getPropertyNameMap(),l=(n=(e=a==null?void 0:a[s])==null?void 0:e[1])!=null?n:null;if(l==null&&o!==1)return console.warn(`Tried to add a material alpha bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type does not support alpha.`),null;if(l==null)return null;const c=i[l],d=o-c;return{propertyName:l,initialValue:c,deltaValue:d}}_getPropertyNameMap(){var e,n;return(n=(e=Object.entries(OG._propertyNameMapMap).find(([r])=>this.material[r]===!0))==null?void 0:e[1])!=null?n:null}};kG._propertyNameMapMap={isMeshStandardMaterial:{color:["color","opacity"],emissionColor:["emissive",null]},isMeshBasicMaterial:{color:["color","opacity"]},isMToonMaterial:{color:["color","opacity"],emissionColor:["emissive",null],outlineColor:["outlineColorFactor",null],matcapColor:["matcapFactor",null],rimColor:["parametricRimColorFactor",null],shadeColor:["shadeColorFactor",null]}};var tj=kG,U1=class{constructor({primitives:t,index:e,weight:n}){this.primitives=t,this.index=e,this.weight=n}applyWeight(t){this.primitives.forEach(e=>{var n;((n=e.morphTargetInfluences)==null?void 0:n[this.index])!=null&&(e.morphTargetInfluences[this.index]+=this.weight*t)})}clearAppliedWeight(){this.primitives.forEach(t=>{var e;((e=t.morphTargetInfluences)==null?void 0:e[this.index])!=null&&(t.morphTargetInfluences[this.index]=0)})}},nj=new He,LG=class DG{constructor({material:e,scale:n,offset:r}){var i,s;this.material=e,this.scale=n,this.offset=r;const o=(i=Object.entries(DG._propertyNamesMap).find(([a])=>e[a]===!0))==null?void 0:i[1];o==null?(console.warn(`Tried to add a texture transform bind to the material ${(s=e.name)!=null?s:"(no name)"} but the material is not supported.`),this._properties=[]):(this._properties=[],o.forEach(a=>{var l;const c=(l=e[a])==null?void 0:l.clone();if(!c)return null;e[a]=c;const d=c.offset.clone(),f=c.repeat.clone(),p=r.clone().sub(d),y=n.clone().sub(f);this._properties.push({name:a,initialOffset:d,deltaOffset:p,initialScale:f,deltaScale:y})}))}applyWeight(e){this._properties.forEach(n=>{const r=this.material[n.name];r!==void 0&&(r.offset.add(nj.copy(n.deltaOffset).multiplyScalar(e)),r.repeat.add(nj.copy(n.deltaScale).multiplyScalar(e)))})}clearAppliedWeight(){this._properties.forEach(e=>{const n=this.material[e.name];n!==void 0&&(n.offset.copy(e.initialOffset),n.repeat.copy(e.initialScale))})}};LG._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};var rj=LG,Y_e=new Set(["1.0","1.0-beta"]),UG=class jG{get name(){return"VRMExpressionLoaderPlugin"}constructor(e){this.parser=e}afterRoot(e){return Dn(this,null,function*(){e.userData.vrmExpressionManager=yield this._import(e)})}_import(e){return Dn(this,null,function*(){const n=yield this._v1Import(e);if(n)return n;const r=yield this._v0Import(e);return r||null})}_v1Import(e){return Dn(this,null,function*(){var n,r;const i=this.parser.json;if(!(((n=i.extensionsUsed)==null?void 0:n.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!Y_e.has(a))return console.warn(`VRMExpressionLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.expressions;if(!l)return null;const c=new Set(Object.values(cC)),d=new Map;l.preset!=null&&Object.entries(l.preset).forEach(([p,y])=>{if(y!=null){if(!c.has(p)){console.warn(`VRMExpressionLoaderPlugin: Unknown preset name "${p}" detected. Ignoring the expression`);return}d.set(p,y)}}),l.custom!=null&&Object.entries(l.custom).forEach(([p,y])=>{if(c.has(p)){console.warn(`VRMExpressionLoaderPlugin: Custom expression cannot have preset name "${p}". Ignoring the expression`);return}d.set(p,y)});const f=new ej;return yield Promise.all(Array.from(d.entries()).map(p=>Dn(this,[p],function*([y,x]){var S,w,_,E,T,P,O;const N=new ZU(y);if(e.scene.add(N),N.isBinary=(S=x.isBinary)!=null?S:!1,N.overrideBlink=(w=x.overrideBlink)!=null?w:"none",N.overrideLookAt=(_=x.overrideLookAt)!=null?_:"none",N.overrideMouth=(E=x.overrideMouth)!=null?E:"none",(T=x.morphTargetBinds)==null||T.forEach(D=>Dn(this,null,function*(){var z;if(D.node===void 0||D.index===void 0)return;const G=yield QU(e,D.node),k=D.index;if(!G.every(j=>Array.isArray(j.morphTargetInfluences)&&k<j.morphTargetInfluences.length)){console.warn(`VRMExpressionLoaderPlugin: ${x.name} attempts to index morph #${k} but not found.`);return}N.addBind(new U1({primitives:G,index:k,weight:(z=D.weight)!=null?z:1}))})),x.materialColorBinds||x.textureTransformBinds){const D=[];e.scene.traverse(z=>{const G=z.material;G&&(Array.isArray(G)?D.push(...G):D.push(G))}),(P=x.materialColorBinds)==null||P.forEach(z=>Dn(this,null,function*(){D.filter(k=>{var j;const H=(j=this.parser.associations.get(k))==null?void 0:j.materials;return z.material===H}).forEach(k=>{N.addBind(new tj({material:k,type:z.type,targetValue:new ct().fromArray(z.targetValue),targetAlpha:z.targetValue[3]}))})})),(O=x.textureTransformBinds)==null||O.forEach(z=>Dn(this,null,function*(){D.filter(k=>{var j;const H=(j=this.parser.associations.get(k))==null?void 0:j.materials;return z.material===H}).forEach(k=>{var j,H;N.addBind(new rj({material:k,offset:new He().fromArray((j=z.offset)!=null?j:[0,0]),scale:new He().fromArray((H=z.scale)!=null?H:[1,1])}))})}))}f.registerExpression(N)}))),f})}_v0Import(e){return Dn(this,null,function*(){var n;const r=this.parser.json,i=(n=r.extensions)==null?void 0:n.VRM;if(!i)return null;const s=i.blendShapeMaster;if(!s)return null;const o=new ej,a=s.blendShapeGroups;if(!a)return o;const l=new Set;return yield Promise.all(a.map(c=>Dn(this,null,function*(){var d;const f=c.presetName,p=f!=null&&jG.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 ZU(y);e.scene.add(x),x.isBinary=(d=c.isBinary)!=null?d:!1,c.binds&&c.binds.forEach(w=>Dn(this,null,function*(){var _;if(w.mesh===void 0||w.index===void 0)return;const E=[];if((_=r.nodes)==null||_.forEach((P,O)=>{P.mesh===w.mesh&&E.push(O)}),E.length===0){console.warn(`VRMExpressionLoaderPlugin: ${c.name} attempts to bind a morph target to the mesh #${w.mesh} but the mesh is not found or not used in the scene. Ignoring the bind.`);return}const T=w.index;yield Promise.all(E.map(P=>Dn(this,null,function*(){var O;const N=yield QU(e,P);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 U1({primitives:N,index:T,weight:.01*((O=w.weight)!=null?O: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 _=[];e.scene.traverse(T=>{if(T.material){const P=T.material;Array.isArray(P)?_.push(...P.filter(O=>(O.name===w.materialName||O.name===w.materialName+" (Outline)")&&_.indexOf(O)===-1)):P.name===w.materialName&&_.indexOf(P)===-1&&_.push(P)}});const E=w.propertyName;_.forEach(T=>{if(E==="_MainTex_ST"){const O=new He(w.targetValue[0],w.targetValue[1]),N=new He(w.targetValue[2],w.targetValue[3]);N.y=1-N.y-O.y,x.addBind(new rj({material:T,scale:O,offset:N}));return}const P=q_e[E];if(P){x.addBind(new tj({material:T,type:P,targetValue:new ct().fromArray(w.targetValue),targetAlpha:w.targetValue[3]}));return}console.warn(E+" is not supported")})}),o.registerExpression(x)}))),o})}};UG.v0v1PresetNameMap={a:"aa",e:"ee",i:"ih",o:"oh",u:"ou",blink:"blink",joy:"happy",angry:"angry",sorrow:"sad",fun:"relaxed",lookup:"lookUp",lookdown:"lookDown",lookleft:"lookLeft",lookright:"lookRight",blink_l:"blinkLeft",blink_r:"blinkRight",neutral:"neutral"};var Z_e=UG,oN=class Bm{constructor(e,n){this._firstPersonOnlyLayer=Bm.DEFAULT_FIRSTPERSON_ONLY_LAYER,this._thirdPersonOnlyLayer=Bm.DEFAULT_THIRDPERSON_ONLY_LAYER,this._initializedLayers=!1,this.humanoid=e,this.meshAnnotations=n}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMFirstPerson: humanoid must be same in order to copy");return this.meshAnnotations=e.meshAnnotations.map(n=>({meshes:n.meshes.concat(),type:n.type})),this}clone(){return new Bm(this.humanoid,this.meshAnnotations).copy(this)}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}setup({firstPersonOnlyLayer:e=Bm.DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:n=Bm.DEFAULT_THIRDPERSON_ONLY_LAYER}={}){this._initializedLayers||(this._firstPersonOnlyLayer=e,this._thirdPersonOnlyLayer=n,this.meshAnnotations.forEach(r=>{r.meshes.forEach(i=>{r.type==="firstPersonOnly"?(i.layers.set(this._firstPersonOnlyLayer),i.traverse(s=>s.layers.set(this._firstPersonOnlyLayer))):r.type==="thirdPersonOnly"?(i.layers.set(this._thirdPersonOnlyLayer),i.traverse(s=>s.layers.set(this._thirdPersonOnlyLayer))):r.type==="auto"&&this._createHeadlessModel(i)})}),this._initializedLayers=!0)}_excludeTriangles(e,n,r,i){let s=0;if(n!=null&&n.length>0)for(let o=0;o<e.length;o+=3){const a=e[o],l=e[o+1],c=e[o+2],d=n[a],f=r[a];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++]=a,e[s++]=l,e[s++]=c)}return s}_createErasedMesh(e,n){const r=new tM(e.geometry.clone(),e.material);r.name=`${e.name}(erase)`,r.frustumCulled=e.frustumCulled,r.layers.set(this._firstPersonOnlyLayer);const i=r.geometry,s=i.getAttribute("skinIndex"),o=s instanceof tC?[]:s.array,a=[];for(let S=0;S<o.length;S+=4)a.push([o[S],o[S+1],o[S+2],o[S+3]]);const l=i.getAttribute("skinWeight"),c=l instanceof tC?[]: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,a,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 kd(e.skeleton.bones,e.skeleton.boneInverses),new Ct),r}_createHeadlessModelForSkinnedMesh(e,n){const r=[];if(n.skeleton.bones.forEach((s,o)=>{this._isEraseTarget(s)&&r.push(o)}),!r.length){n.layers.enable(this._thirdPersonOnlyLayer),n.layers.enable(this._firstPersonOnlyLayer);return}n.layers.set(this._thirdPersonOnlyLayer);const i=this._createErasedMesh(n,r);e.add(i)}_createHeadlessModel(e){if(e.type==="Group")if(e.layers.set(this._thirdPersonOnlyLayer),this._isEraseTarget(e))e.traverse(n=>n.layers.set(this._thirdPersonOnlyLayer));else{const n=new Ts;n.name=`_headless_${e.name}`,n.layers.set(this._firstPersonOnlyLayer),e.parent.add(n),e.children.filter(r=>r.type==="SkinnedMesh").forEach(r=>{const i=r;this._createHeadlessModelForSkinnedMesh(n,i)})}else if(e.type==="SkinnedMesh"){const n=e;this._createHeadlessModelForSkinnedMesh(e.parent,n)}else this._isEraseTarget(e)&&(e.layers.set(this._thirdPersonOnlyLayer),e.traverse(n=>n.layers.set(this._thirdPersonOnlyLayer)))}_isEraseTarget(e){return e===this.humanoid.getRawBoneNode("head")?!0:e.parent?this._isEraseTarget(e.parent):!1}};oN.DEFAULT_FIRSTPERSON_ONLY_LAYER=9;oN.DEFAULT_THIRDPERSON_ONLY_LAYER=10;var ij=oN,Q_e=new Set(["1.0","1.0-beta"]),J_e=class{get name(){return"VRMFirstPersonLoaderPlugin"}constructor(t){this.parser=t}afterRoot(t){return Dn(this,null,function*(){const e=t.userData.vrmHumanoid;if(e!==null){if(e===void 0)throw new Error("VRMFirstPersonLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");t.userData.vrmFirstPerson=yield this._import(t,e)}})}_import(t,e){return Dn(this,null,function*(){if(e==null)return null;const n=yield this._v1Import(t,e);if(n)return n;const r=yield this._v0Import(t,e);return r||null})}_v1Import(t,e){return Dn(this,null,function*(){var n,r;const i=this.parser.json;if(!(((n=i.extensionsUsed)==null?void 0:n.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!Q_e.has(a))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.firstPerson,c=[],d=yield JU(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 ij(e,c)})}_v0Import(t,e){return Dn(this,null,function*(){var n;const r=this.parser.json,i=(n=r.extensions)==null?void 0:n.VRM;if(!i)return null;const s=i.firstPerson;if(!s)return null;const o=[],a=yield JU(t);return Array.from(a.entries()).forEach(([l,c])=>{const d=r.nodes[l],f=s.meshAnnotations?s.meshAnnotations.find(p=>p.mesh===d.mesh):void 0;o.push({meshes:c,type:this._convertV0FlagToV1Type(f==null?void 0:f.firstPersonFlag)})}),new ij(e,o)})}_convertV0FlagToV1Type(t){return t==="FirstPersonOnly"?"firstPersonOnly":t==="ThirdPersonOnly"?"thirdPersonOnly":t==="Both"?"both":"auto"}},sj=new X,oj=new X,ewe=new qt,aj=class extends Ts{constructor(t){super(),this.vrmHumanoid=t,this._boneAxesMap=new Map,Object.values(t.humanBones).forEach(e=>{const n=new uG(1);n.matrixAutoUpdate=!1,n.material.depthTest=!1,n.material.depthWrite=!1,this.add(n),this._boneAxesMap.set(e,n)})}dispose(){Array.from(this._boneAxesMap.values()).forEach(t=>{t.geometry.dispose(),t.material.dispose()})}updateMatrixWorld(t){Array.from(this._boneAxesMap.entries()).forEach(([e,n])=>{e.node.updateWorldMatrix(!0,!1),e.node.matrixWorld.decompose(sj,ewe,oj);const r=sj.set(.1,.1,.1).divide(oj);n.matrix.copy(e.node.matrixWorld).scale(r)}),super.updateMatrixWorld(t)}},tT=["hips","spine","chest","upperChest","neck","head","leftEye","rightEye","jaw","leftUpperLeg","leftLowerLeg","leftFoot","leftToes","rightUpperLeg","rightLowerLeg","rightFoot","rightToes","leftShoulder","leftUpperArm","leftLowerArm","leftHand","rightShoulder","rightUpperArm","rightLowerArm","rightHand","leftThumbMetacarpal","leftThumbProximal","leftThumbDistal","leftIndexProximal","leftIndexIntermediate","leftIndexDistal","leftMiddleProximal","leftMiddleIntermediate","leftMiddleDistal","leftRingProximal","leftRingIntermediate","leftRingDistal","leftLittleProximal","leftLittleIntermediate","leftLittleDistal","rightThumbMetacarpal","rightThumbProximal","rightThumbDistal","rightIndexProximal","rightIndexIntermediate","rightIndexDistal","rightMiddleProximal","rightMiddleIntermediate","rightMiddleDistal","rightRingProximal","rightRingIntermediate","rightRingDistal","rightLittleProximal","rightLittleIntermediate","rightLittleDistal"],twe={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 FG(t){return t.invert?t.invert():t.inverse(),t}var Bf=new X,Hf=new qt,uC=class{constructor(t){this.humanBones=t,this.restPose=this.getAbsolutePose()}getAbsolutePose(){const t={};return Object.keys(this.humanBones).forEach(e=>{const n=e,r=this.getBoneNode(n);r&&(Bf.copy(r.position),Hf.copy(r.quaternion),t[n]={position:Bf.toArray(),rotation:Hf.toArray()})}),t}getPose(){const t={};return Object.keys(this.humanBones).forEach(e=>{const n=e,r=this.getBoneNode(n);if(!r)return;Bf.set(0,0,0),Hf.identity();const i=this.restPose[n];i!=null&&i.position&&Bf.fromArray(i.position).negate(),i!=null&&i.rotation&&FG(Hf.fromArray(i.rotation)),Bf.add(r.position),Hf.premultiply(r.quaternion),t[n]={position:Bf.toArray(),rotation:Hf.toArray()}}),t}setPose(t){Object.entries(t).forEach(([e,n])=>{const r=e,i=this.getBoneNode(r);if(!i)return;const s=this.restPose[r];s&&(n!=null&&n.position&&(i.position.fromArray(n.position),s.position&&i.position.add(Bf.fromArray(s.position))),n!=null&&n.rotation&&(i.quaternion.fromArray(n.rotation),s.rotation&&i.quaternion.multiply(Hf.fromArray(s.rotation))))})}resetPose(){Object.entries(this.restPose).forEach(([t,e])=>{const n=this.getBoneNode(t);n&&(e!=null&&e.position&&n.position.fromArray(e.position),e!=null&&e.rotation&&n.quaternion.fromArray(e.rotation))})}getBone(t){var e;return(e=this.humanBones[t])!=null?e:void 0}getBoneNode(t){var e,n;return(n=(e=this.humanBones[t])==null?void 0:e.node)!=null?n:null}},nT=new X,nwe=new qt,rwe=new X,lj=class zG extends uC{static _setupTransforms(e){const n=new mn;n.name="VRMHumanoidRig";const r={},i={},s={};tT.forEach(a=>{var l;const c=e.getBoneNode(a);if(c){const d=new X,f=new qt;c.updateWorldMatrix(!0,!1),c.matrixWorld.decompose(d,f,nT),r[a]=d,i[a]=c.quaternion.clone();const p=new qt;(l=c.parent)==null||l.matrixWorld.decompose(nT,p,nT),s[a]=p}});const o={};return tT.forEach(a=>{var l;const c=e.getBoneNode(a);if(c){const d=r[a];let f=a,p;for(;p==null&&(f=twe[f],f!=null);)p=r[f];const y=new mn;y.name="Normalized_"+c.name,(f?(l=o[f])==null?void 0:l.node:n).add(y),y.position.copy(d),p&&y.position.sub(p),o[a]={node:y}}}),{rigBones:o,root:n,parentWorldRotations:s,boneRotations:i}}constructor(e){const{rigBones:n,root:r,parentWorldRotations:i,boneRotations:s}=zG._setupTransforms(e);super(n),this.original=e,this.root=r,this._parentWorldRotations=i,this._boneRotations=s}update(){tT.forEach(e=>{const n=this.original.getBoneNode(e);if(n!=null){const r=this.getBoneNode(e),i=this._parentWorldRotations[e],s=nwe.copy(i).invert(),o=this._boneRotations[e];if(n.quaternion.copy(r.quaternion).multiply(i).premultiply(s).multiply(o),e==="hips"){const a=r.getWorldPosition(rwe);n.parent.updateWorldMatrix(!0,!1);const l=n.parent.matrixWorld,c=a.applyMatrix4(l.invert());n.position.copy(c)}}})}},cj=class BG{get restPose(){return console.warn("VRMHumanoid: restPose is deprecated. Use either rawRestPose or normalizedRestPose instead."),this.rawRestPose}get rawRestPose(){return this._rawHumanBones.restPose}get normalizedRestPose(){return this._normalizedHumanBones.restPose}get humanBones(){return this._rawHumanBones.humanBones}get rawHumanBones(){return this._rawHumanBones.humanBones}get normalizedHumanBones(){return this._normalizedHumanBones.humanBones}get normalizedHumanBonesRoot(){return this._normalizedHumanBones.root}constructor(e,n){var r;this.autoUpdateHumanBones=(r=n==null?void 0:n.autoUpdateHumanBones)!=null?r:!0,this._rawHumanBones=new uC(e),this._normalizedHumanBones=new lj(this._rawHumanBones)}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new uC(e.humanBones),this._normalizedHumanBones=new lj(this._rawHumanBones),this}clone(){return new BG(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()}},iwe={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"},swe=new Set(["1.0","1.0-beta"]),uj={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"},owe=class{get name(){return"VRMHumanoidLoaderPlugin"}constructor(t,e){this.parser=t,this.helperRoot=e==null?void 0:e.helperRoot,this.autoUpdateHumanBones=e==null?void 0:e.autoUpdateHumanBones}afterRoot(t){return Dn(this,null,function*(){t.userData.vrmHumanoid=yield this._import(t)})}_import(t){return Dn(this,null,function*(){const e=yield this._v1Import(t);if(e)return e;const n=yield this._v0Import(t);return n||null})}_v1Import(t){return Dn(this,null,function*(){var e,n;const r=this.parser.json;if(!(((e=r.extensionsUsed)==null?void 0:e.indexOf("VRMC_vrm"))!==-1))return null;const s=(n=r.extensions)==null?void 0:n.VRMC_vrm;if(!s)return null;const o=s.specVersion;if(!swe.has(o))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const a=s.humanoid;if(!a)return null;const l=a.humanBones.leftThumbIntermediate!=null||a.humanBones.rightThumbIntermediate!=null,c={};a.humanBones!=null&&(yield Promise.all(Object.entries(a.humanBones).map(f=>Dn(this,[f],function*([p,y]){let x=p;const S=y.node;if(l){const _=uj[x];_!=null&&(x=_)}const w=yield this.parser.getDependency("node",S);if(w==null){console.warn(`A glTF node bound to the humanoid bone ${x} (index = ${S}) does not exist`);return}c[x]={node:w}}))));const d=new cj(this._ensureRequiredBonesExist(c),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(t.scene.add(d.normalizedHumanBonesRoot),this.helperRoot){const f=new aj(d);this.helperRoot.add(f),f.renderOrder=this.helperRoot.renderOrder}return d})}_v0Import(t){return Dn(this,null,function*(){var e;const r=(e=this.parser.json.extensions)==null?void 0:e.VRM;if(!r)return null;const i=r.humanoid;if(!i)return null;const s={};i.humanBones!=null&&(yield Promise.all(i.humanBones.map(a=>Dn(this,null,function*(){const l=a.bone,c=a.node;if(l==null||c==null)return;if(c<0){console.warn(`A glTF node index for the humanoid bone ${l} is negative (${c}), ignoring this bone.`);return}const d=yield this.parser.getDependency("node",c);if(d==null){console.warn(`A glTF node bound to the humanoid bone ${l} (index = ${c}) does not exist`);return}const f=uj[l],p=f??l;if(s[p]!=null){console.warn(`Multiple bone entries for ${p} detected (index = ${c}), ignoring duplicated entries.`);return}s[p]={node:d}}))));const o=new cj(this._ensureRequiredBonesExist(s),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(t.scene.add(o.normalizedHumanBonesRoot),this.helperRoot){const a=new aj(o);this.helperRoot.add(a),a.renderOrder=this.helperRoot.renderOrder}return o})}_ensureRequiredBonesExist(t){const e=Object.values(iwe).filter(n=>t[n]==null);if(e.length>0)throw new Error(`VRMHumanoidLoaderPlugin: These humanoid bones are required but not exist: ${e.join(", ")}`);return t}},dj=class extends Yt{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new Qt(new Float32Array(195),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(new Uint16Array(189),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentTheta!==this.theta&&(this._currentTheta=this.theta,t=!0),this._currentRadius!==this.radius&&(this._currentRadius=this.radius,t=!0),t&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,0,0,0);for(let t=0;t<64;t++){const e=t/63*this._currentTheta;this._attrPos.setXYZ(t+1,this._currentRadius*Math.sin(e),0,this._currentRadius*Math.cos(e))}this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<63;t++)this._attrIndex.setXYZ(t*3,0,t+1,t+2);this._attrIndex.needsUpdate=!0}},awe=class extends Yt{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new X,this._currentTail=new X,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}},k_=new qt,fj=new qt,O0=new X,hj=new X,pj=Math.sqrt(2)/2,lwe=new qt(0,0,-pj,pj),cwe=new X(0,1,0),uwe=class extends Ts{constructor(t){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=t;{const e=new dj;e.radius=.5;const n=new As({color:65280,transparent:!0,opacity:.5,side:xo,depthTest:!1,depthWrite:!1});this._meshPitch=new xr(e,n),this.add(this._meshPitch)}{const e=new dj;e.radius=.5;const n=new As({color:16711680,transparent:!0,opacity:.5,side:xo,depthTest:!1,depthWrite:!1});this._meshYaw=new xr(e,n),this.add(this._meshYaw)}{const e=new awe;e.radius=.1;const n=new $r({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new eo(e,n),this._lineTarget.frustumCulled=!1,this.add(this._lineTarget)}}dispose(){this._meshYaw.geometry.dispose(),this._meshYaw.material.dispose(),this._meshPitch.geometry.dispose(),this._meshPitch.material.dispose(),this._lineTarget.geometry.dispose(),this._lineTarget.material.dispose()}updateMatrixWorld(t){const e=vr.DEG2RAD*this.vrmLookAt.yaw;this._meshYaw.geometry.theta=e,this._meshYaw.geometry.update();const n=vr.DEG2RAD*this.vrmLookAt.pitch;this._meshPitch.geometry.theta=n,this._meshPitch.geometry.update(),this.vrmLookAt.getLookAtWorldPosition(O0),this.vrmLookAt.getLookAtWorldQuaternion(k_),k_.multiply(this.vrmLookAt.getFaceFrontQuaternion(fj)),this._meshYaw.position.copy(O0),this._meshYaw.quaternion.copy(k_),this._meshPitch.position.copy(O0),this._meshPitch.quaternion.copy(k_),this._meshPitch.quaternion.multiply(fj.setFromAxisAngle(cwe,e)),this._meshPitch.quaternion.multiply(lwe);const{target:r,autoUpdate:i}=this.vrmLookAt;r!=null&&i&&(r.getWorldPosition(hj).sub(O0),this._lineTarget.geometry.tail.copy(hj),this._lineTarget.geometry.update(),this._lineTarget.position.copy(O0)),super.updateMatrixWorld(t)}},dwe=new X,fwe=new X;function dC(t,e){return t.matrixWorld.decompose(dwe,e,fwe),e}function K_(t){return[Math.atan2(-t.z,t.x),Math.atan2(t.y,Math.sqrt(t.x*t.x+t.z*t.z))]}function mj(t){const e=Math.round(t/2/Math.PI);return t-2*Math.PI*e}var gj=new X(0,0,1),hwe=new X,pwe=new X,mwe=new X,gwe=new qt,rT=new qt,vj=new qt,vwe=new qt,iT=new ls,HG=class VG{constructor(e,n){this.offsetFromHeadBone=new X,this.autoUpdate=!0,this.faceFront=new X(0,0,1),this.humanoid=e,this.applier=n,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new 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 VG(this.humanoid,this.applier).copy(this)}reset(){this._yaw=0,this._pitch=0,this._needsUpdate=!0}getLookAtWorldPosition(e){const n=this.humanoid.getRawBoneNode("head");return e.copy(this.offsetFromHeadBone).applyMatrix4(n.matrixWorld)}getLookAtWorldQuaternion(e){const n=this.humanoid.getRawBoneNode("head");return dC(n,e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(gj)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[n,r]=K_(this.faceFront);return iT.set(0,.5*Math.PI+n,r,"YZX"),e.setFromEuler(iT).premultiply(vwe.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(rT),this.getFaceFrontQuaternion(vj),e.copy(gj).applyQuaternion(rT).applyQuaternion(vj).applyEuler(this.getEuler(iT))}lookAt(e){const n=gwe.copy(this._restHeadWorldQuaternion).multiply(FG(this.getLookAtWorldQuaternion(rT))),r=this.getLookAtWorldPosition(pwe),i=mwe.copy(e).sub(r).applyQuaternion(n).normalize(),[s,o]=K_(this.faceFront),[a,l]=K_(i),c=mj(a-s),d=mj(o-l);this._yaw=vr.RAD2DEG*c,this._pitch=vr.RAD2DEG*d,this._needsUpdate=!0}update(e){this.target!=null&&this.autoUpdate&&this.lookAt(this.target.getWorldPosition(hwe)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};HG.EULER_ORDER="YXZ";var ywe=HG,xwe=new X(0,0,1),ml=new qt,km=new qt,Fo=new ls(0,0,0,"YXZ"),Y_=class{constructor(t,e,n,r,i){this.humanoid=t,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=n,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i,this.faceFront=new X(0,0,1),this._restQuatLeftEye=new qt,this._restQuatRightEye=new qt,this._restLeftEyeParentWorldQuat=new qt,this._restRightEyeParentWorldQuat=new qt;const s=this.humanoid.getRawBoneNode("leftEye"),o=this.humanoid.getRawBoneNode("rightEye");s&&(this._restQuatLeftEye.copy(s.quaternion),dC(s.parent,this._restLeftEyeParentWorldQuat)),o&&(this._restQuatRightEye.copy(o.quaternion),dC(o.parent,this._restRightEyeParentWorldQuat))}applyYawPitch(t,e){const n=this.humanoid.getRawBoneNode("leftEye"),r=this.humanoid.getRawBoneNode("rightEye"),i=this.humanoid.getNormalizedBoneNode("leftEye"),s=this.humanoid.getNormalizedBoneNode("rightEye");n&&(e<0?Fo.x=-vr.DEG2RAD*this.rangeMapVerticalDown.map(-e):Fo.x=vr.DEG2RAD*this.rangeMapVerticalUp.map(e),t<0?Fo.y=-vr.DEG2RAD*this.rangeMapHorizontalInner.map(-t):Fo.y=vr.DEG2RAD*this.rangeMapHorizontalOuter.map(t),ml.setFromEuler(Fo),this._getWorldFaceFrontQuat(km),i.quaternion.copy(km).multiply(ml).multiply(km.invert()),ml.copy(this._restLeftEyeParentWorldQuat),n.quaternion.copy(i.quaternion).multiply(ml).premultiply(ml.invert()).multiply(this._restQuatLeftEye)),r&&(e<0?Fo.x=-vr.DEG2RAD*this.rangeMapVerticalDown.map(-e):Fo.x=vr.DEG2RAD*this.rangeMapVerticalUp.map(e),t<0?Fo.y=-vr.DEG2RAD*this.rangeMapHorizontalOuter.map(-t):Fo.y=vr.DEG2RAD*this.rangeMapHorizontalInner.map(t),ml.setFromEuler(Fo),this._getWorldFaceFrontQuat(km),s.quaternion.copy(km).multiply(ml).multiply(km.invert()),ml.copy(this._restRightEyeParentWorldQuat),r.quaternion.copy(s.quaternion).multiply(ml).premultiply(ml.invert()).multiply(this._restQuatRightEye))}lookAt(t){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=vr.RAD2DEG*t.y,n=vr.RAD2DEG*t.x;this.applyYawPitch(e,n)}_getWorldFaceFrontQuat(t){if(this.faceFront.distanceToSquared(xwe)<.01)return t.identity();const[e,n]=K_(this.faceFront);return Fo.set(0,.5*Math.PI+e,n,"YZX"),t.setFromEuler(Fo)}};Y_.type="bone";var fC=class{constructor(t,e,n,r,i){this.expressions=t,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=n,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i}applyYawPitch(t,e){e<0?(this.expressions.setValue("lookDown",0),this.expressions.setValue("lookUp",this.rangeMapVerticalUp.map(-e))):(this.expressions.setValue("lookUp",0),this.expressions.setValue("lookDown",this.rangeMapVerticalDown.map(e))),t<0?(this.expressions.setValue("lookLeft",0),this.expressions.setValue("lookRight",this.rangeMapHorizontalOuter.map(-t))):(this.expressions.setValue("lookRight",0),this.expressions.setValue("lookLeft",this.rangeMapHorizontalOuter.map(t)))}lookAt(t){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=vr.RAD2DEG*t.y,n=vr.RAD2DEG*t.x;this.applyYawPitch(e,n)}};fC.type="expression";var yj=class{constructor(t,e){this.inputMaxValue=t,this.outputScale=e}map(t){return this.outputScale*NG(t/this.inputMaxValue)}},bwe=new Set(["1.0","1.0-beta"]),O_=.01,_we=class{get name(){return"VRMLookAtLoaderPlugin"}constructor(t,e){this.parser=t,this.helperRoot=e==null?void 0:e.helperRoot}afterRoot(t){return Dn(this,null,function*(){const e=t.userData.vrmHumanoid;if(e===null)return;if(e===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");const n=t.userData.vrmExpressionManager;if(n!==null){if(n===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmExpressionManager is undefined. VRMExpressionLoaderPlugin have to be used first");t.userData.vrmLookAt=yield this._import(t,e,n)}})}_import(t,e,n){return Dn(this,null,function*(){if(e==null||n==null)return null;const r=yield this._v1Import(t,e,n);if(r)return r;const i=yield this._v0Import(t,e,n);return i||null})}_v1Import(t,e,n){return Dn(this,null,function*(){var r,i,s;const o=this.parser.json;if(!(((r=o.extensionsUsed)==null?void 0:r.indexOf("VRMC_vrm"))!==-1))return null;const l=(i=o.extensions)==null?void 0:i.VRMC_vrm;if(!l)return null;const c=l.specVersion;if(!bwe.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 fC(n,p,y,x,S):w=new Y_(e,p,y,x,S);const _=this._importLookAt(e,w);return _.offsetFromHeadBone.fromArray((s=d.offsetFromHeadBone)!=null?s:[0,.06,0]),_})}_v1ImportRangeMap(t,e){var n,r;let i=(n=t==null?void 0:t.inputMaxValue)!=null?n:90;const s=(r=t==null?void 0:t.outputScale)!=null?r:e;return i<O_&&(console.warn("VRMLookAtLoaderPlugin: inputMaxValue of a range map is too small. Consider reviewing the range map!"),i=O_),new yj(i,s)}_v0Import(t,e,n){return Dn(this,null,function*(){var r,i,s,o;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 fC(n,f,p,y,x):S=new Y_(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,-((o=c.firstPersonBoneOffset.z)!=null?o:0)):w.offsetFromHeadBone.set(0,.06,0),w.faceFront.set(0,0,-1),S instanceof Y_&&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 o=(r=t==null?void 0:t.yRange)!=null?r:e;return s<O_&&(console.warn("VRMLookAtLoaderPlugin: xRange of a degree map is too small. Consider reviewing the degree map!"),s=O_),new yj(s,o)}_importLookAt(t,e){const n=new ywe(t,e);if(this.helperRoot){const r=new uwe(n);this.helperRoot.add(r),r.renderOrder=this.helperRoot.renderOrder}return n}};function wwe(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 Swe=new Set(["1.0","1.0-beta"]),Mwe=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 Dn(this,null,function*(){t.userData.vrmMeta=yield this._import(t)})}_import(t){return Dn(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 Dn(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 o=(n=i.extensions)==null?void 0:n.VRMC_vrm;if(o==null)return null;const a=o.specVersion;if(!Swe.has(a))return console.warn(`VRMMetaLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.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 Dn(this,null,function*(){var e;const r=(e=this.parser.json.extensions)==null?void 0:e.VRM;if(!r)return null;const i=r.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 Dn(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 o=yield this.parser.getDependency("bufferView",r.bufferView),a=new Blob([o],{type:r.mimeType});i=URL.createObjectURL(a)}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 Fg().loadAsync(wwe(i,this.parser.options.path)).catch(o=>(console.error(o),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null))})}},Ewe=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()}},Awe=class extends Ewe{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)})}},Twe=Object.defineProperty,xj=Object.getOwnPropertySymbols,Pwe=Object.prototype.hasOwnProperty,Cwe=Object.prototype.propertyIsEnumerable,bj=(t,e,n)=>e in t?Twe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_j=(t,e)=>{for(var n in e||(e={}))Pwe.call(e,n)&&bj(t,n,e[n]);if(xj)for(var n of xj(e))Cwe.call(e,n)&&bj(t,n,e[n]);return t},dh=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),Rwe={"":3e3,srgb:3001};function Nwe(t,e){parseInt(Td,10)>=152?t.colorSpace=e:t.encoding=Rwe[e]}var Iwe=class{get pending(){return Promise.all(this._pendings)}constructor(t,e){this._parser=t,this._materialParams=e,this._pendings=[]}assignPrimitive(t,e){e!=null&&(this._materialParams[t]=e)}assignColor(t,e,n){if(e!=null){const r=new ct().fromArray(e);n&&r.convertSRGBToLinear(),this._materialParams[t]=r}}assignTexture(t,e,n){return dh(this,null,function*(){const r=dh(this,null,function*(){if(e!=null){const i=yield this._parser.assignTexture(this._materialParams,t,e);if(i==null){console.warn("GLTFMToonMaterialParamsAssignHelper: Failed to load texture. The rendering result may be wrong");return}n&&Nwe(i,"srgb")}});return this._pendings.push(r),r})}assignTextureByIndex(t,e,n){return dh(this,null,function*(){return this.assignTexture(t,e!=null?{index:e}:void 0,n)})}},kwe=`// #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>
|
||
|
||
}`,Owe=`// #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();
|
||
}
|
||
`,Lwe={None:"none"},wj={None:"none",ScreenCoordinates:"screenCoordinates"},Dwe={3e3:"",3001:"srgb"};function sT(t){return parseInt(Td,10)>=152?t.colorSpace:Dwe[t.encoding]}var Uwe=class extends Zo{constructor(t={}){var e;super({vertexShader:kwe,fragmentShader:Owe}),this.uvAnimationScrollXSpeedFactor=0,this.uvAnimationScrollYSpeedFactor=0,this.uvAnimationRotationSpeedFactor=0,this.fog=!0,this.normalMapType=ou,this._ignoreVertexColor=!0,this._v0CompatShade=!1,this._debugMode=Lwe.None,this._outlineWidthMode=wj.None,this._isOutline=!1,t.transparentWithZWrite&&(t.depthWrite=!0),delete t.transparentWithZWrite,t.fog=!0,t.lights=!0,t.clipping=!0,this.uniforms=PR.merge([dt.common,dt.normalmap,dt.emissivemap,dt.fog,dt.lights,{litFactor:{value:new ct(1,1,1)},mapUvTransform:{value:new $t},colorAlpha:{value:1},normalMapUvTransform:{value:new $t},shadeColorFactor:{value:new ct(0,0,0)},shadeMultiplyTexture:{value:null},shadeMultiplyTextureUvTransform:{value:new $t},shadingShiftFactor:{value:0},shadingShiftTexture:{value:null},shadingShiftTextureUvTransform:{value:new $t},shadingShiftTextureScale:{value:1},shadingToonyFactor:{value:.9},giEqualizationFactor:{value:.9},matcapFactor:{value:new ct(1,1,1)},matcapTexture:{value:null},matcapTextureUvTransform:{value:new $t},parametricRimColorFactor:{value:new ct(0,0,0)},rimMultiplyTexture:{value:null},rimMultiplyTextureUvTransform:{value:new $t},rimLightingMixFactor:{value:1},parametricRimFresnelPowerFactor:{value:5},parametricRimLiftFactor:{value:0},emissive:{value:new ct(0,0,0)},emissiveIntensity:{value:1},emissiveMapUvTransform:{value:new $t},outlineWidthMultiplyTexture:{value:null},outlineWidthMultiplyTextureUvTransform:{value:new $t},outlineWidthFactor:{value:0},outlineColorFactor:{value:new ct(0,0,0)},outlineLightingMixFactor:{value:1},uvAnimationMaskTexture:{value:null},uvAnimationMaskTextureUvTransform:{value:new $t},uvAnimationScrollXOffset:{value:0},uvAnimationScrollYOffset:{value:0},uvAnimationRotationPhase:{value:0}},(e=t.uniforms)!=null?e:{}]),this.setValues(t),this._uploadUniformsWorkaround(),this.customProgramCacheKey=()=>[...Object.entries(this._generateDefines()).map(([n,r])=>`${n}:${r}`),this.matcapTexture?`matcapTextureColorSpace:${sT(this.matcapTexture)}`:"",this.shadeMultiplyTexture?`shadeMultiplyTextureColorSpace:${sT(this.shadeMultiplyTexture)}`:"",this.rimMultiplyTexture?`rimMultiplyTextureColorSpace:${sT(this.rimMultiplyTexture)}`:""].join(","),this.onBeforeCompile=n=>{const r=parseInt(Td,10),i=Object.entries(_j(_j({},this._generateDefines()),this.defines)).filter(([s,o])=>!!o).map(([s,o])=>`#define ${s} ${o}`).join(`
|
||
`)+`
|
||
`;n.vertexShader=i+n.vertexShader,n.fragmentShader=i+n.fragmentShader,r<154&&(n.fragmentShader=n.fragmentShader.replace("#include <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(Td,10),e=this.outlineWidthMultiplyTexture!==null,n=this.map!==null||this.normalMap!==null||this.emissiveMap!==null||this.shadeMultiplyTexture!==null||this.shadingShiftTexture!==null||this.rimMultiplyTexture!==null||this.uvAnimationMaskTexture!==null;return{THREE_VRM_THREE_REVISION:t,OUTLINE:this._isOutline,MTOON_USE_UV:e||n,MTOON_UVS_VERTEX_ONLY:e&&!n,V0_COMPAT_SHADE:this._v0CompatShade,USE_SHADEMULTIPLYTEXTURE:this.shadeMultiplyTexture!==null,USE_SHADINGSHIFTTEXTURE:this.shadingShiftTexture!==null,USE_MATCAPTEXTURE:this.matcapTexture!==null,USE_RIMMULTIPLYTEXTURE:this.rimMultiplyTexture!==null,USE_OUTLINEWIDTHMULTIPLYTEXTURE:this._isOutline&&this.outlineWidthMultiplyTexture!==null,USE_UVANIMATIONMASKTEXTURE:this.uvAnimationMaskTexture!==null,IGNORE_VERTEX_COLOR:this._ignoreVertexColor===!0,DEBUG_NORMAL:this._debugMode==="normal",DEBUG_LITSHADERATE:this._debugMode==="litShadeRate",DEBUG_UV:this._debugMode==="uv",OUTLINE_WIDTH_SCREEN:this._isOutline&&this._outlineWidthMode===wj.ScreenCoordinates}}_updateTextureMatrix(t,e){t.value&&(t.value.matrixAutoUpdate&&t.value.updateMatrix(),e.value.copy(t.value.matrix))}},jwe=new Set(["1.0","1.0-beta"]),GG=class Z_{get name(){return Z_.EXTENSION_NAME}constructor(e,n={}){var r,i,s,o;this.parser=e,this.materialType=(r=n.materialType)!=null?r:Uwe,this.renderOrderOffset=(i=n.renderOrderOffset)!=null?i:0,this.v0CompatShade=(s=n.v0CompatShade)!=null?s:!1,this.debugMode=(o=n.debugMode)!=null?o:"none",this._mToonMaterialSet=new Set}beforeRoot(){return dh(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(e){return dh(this,null,function*(){e.userData.vrmMToonMaterials=Array.from(this._mToonMaterialSet)})}getMaterialType(e){return this._getMToonExtension(e)?this.materialType:null}extendMaterialParams(e,n){const r=this._getMToonExtension(e);return r?this._extendMaterialParams(r,n):null}loadMesh(e){return dh(this,null,function*(){var n;const r=this.parser,s=(n=r.json.meshes)==null?void 0:n[e];if(s==null)throw new Error(`MToonMaterialLoaderPlugin: Attempt to use meshes[${e}] of glTF but the mesh doesn't exist`);const o=s.primitives,a=yield r.loadMesh(e);if(o.length===1){const l=a,c=o[0].material;c!=null&&this._setupPrimitive(l,c)}else{const l=a;for(let c=0;c<o.length;c++){const d=l.children[c],f=o[c].material;f!=null&&this._setupPrimitive(d,f)}}return a})}_removeUnlitExtensionIfMToonExists(){const r=this.parser.json.materials;r==null||r.map((i,s)=>{var o;this._getMToonExtension(s)&&((o=i.extensions)!=null&&o.KHR_materials_unlit)&&delete i.extensions.KHR_materials_unlit})}_getMToonExtension(e){var n,r;const o=(n=this.parser.json.materials)==null?void 0:n[e];if(o==null){console.warn(`MToonMaterialLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[Z_.EXTENSION_NAME];if(a==null)return;const l=a.specVersion;if(!jwe.has(l)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${Z_.EXTENSION_NAME} specVersion "${l}"`);return}return a}_extendMaterialParams(e,n){return dh(this,null,function*(){var r;delete n.metalness,delete n.roughness;const i=new Iwe(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=os,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)}};GG.EXTENSION_NAME="VRMC_materials_mtoon";var Fwe=GG,zwe=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),WG=class hC{get name(){return hC.EXTENSION_NAME}constructor(e){this.parser=e}extendMaterialParams(e,n){return zwe(this,null,function*(){const r=this._getHDREmissiveMultiplierExtension(e);if(r==null)return;console.warn("VRMMaterialsHDREmissiveMultiplierLoaderPlugin: `VRMC_materials_hdr_emissiveMultiplier` is archived. Use `KHR_materials_emissive_strength` instead.");const i=r.emissiveMultiplier;n.emissiveIntensity=i})}_getHDREmissiveMultiplierExtension(e){var n,r;const o=(n=this.parser.json.materials)==null?void 0:n[e];if(o==null){console.warn(`VRMMaterialsHDREmissiveMultiplierLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[hC.EXTENSION_NAME];if(a!=null)return a}};WG.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var Bwe=WG,Hwe=Object.defineProperty,Vwe=Object.defineProperties,Gwe=Object.getOwnPropertyDescriptors,Sj=Object.getOwnPropertySymbols,Wwe=Object.prototype.hasOwnProperty,$we=Object.prototype.propertyIsEnumerable,Mj=(t,e,n)=>e in t?Hwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,gl=(t,e)=>{for(var n in e||(e={}))Wwe.call(e,n)&&Mj(t,n,e[n]);if(Sj)for(var n of Sj(e))$we.call(e,n)&&Mj(t,n,e[n]);return t},Ej=(t,e)=>Vwe(t,Gwe(e)),Xwe=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())});function Om(t){return Math.pow(t,2.2)}var qwe=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 Xwe(this,null,function*(){var t;const e=this.parser.json,n=(t=e.extensions)==null?void 0:t.VRM,r=n==null?void 0:n.materialProperties;r&&(this._populateRenderQueueMap(r),r.forEach((i,s)=>{var o,a;const l=(o=e.materials)==null?void 0:o[s];if(l==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${s}] of glTF but the material doesn't exist`);return}if(i.shader==="VRM/MToon"){const c=this._parseV0MToonProperties(i,l);e.materials[s]=c}else if((a=i.shader)!=null&&a.startsWith("VRM/Unlit")){const c=this._parseV0UnlitProperties(i,l);e.materials[s]=c}else i.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${i.shader}`)}))})}_parseV0MToonProperties(t,e){var n,r,i,s,o,a,l,c,d,f,p,y,x,S,w,_,E,T,P,O,N,D,z,G,k,j,H,ee,te,he,se,fe,B,J,Y,V,q,pe,ae,ce,Se,Ee,$e,Me,Ge,We,ue,Z,Ve,Le,re,Ce,qe,Ze,Q;const W=(r=(n=t.keywordMap)==null?void 0:n._ALPHABLEND_ON)!=null?r:!1,Ue=((i=t.floatProperties)==null?void 0:i._ZWrite)===1&&W,ze=this._v0ParseRenderQueue(t),Fe=(o=(s=t.keywordMap)==null?void 0:s._ALPHATEST_ON)!=null?o:!1,bt=W?"BLEND":Fe?"MASK":"OPAQUE",rt=Fe?(l=(a=t.floatProperties)==null?void 0:a._Cutoff)!=null?l:.5:void 0,Xt=((d=(c=t.floatProperties)==null?void 0:c._CullMode)!=null?d:2)===0,Ke=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:Om(it)),et=(y=t.textureProperties)==null?void 0:y._MainTex,Mt=et!=null?{index:et,extensions:gl({},Ke)}:void 0,vt=(S=(x=t.floatProperties)==null?void 0:x._BumpScale)!=null?S:1,Zt=(w=t.textureProperties)==null?void 0:w._BumpMap,de=Zt!=null?{index:Zt,scale:vt,extensions:gl({},Ke)}:void 0,Xe=((E=(_=t.vectorProperties)==null?void 0:_._EmissionColor)!=null?E:[0,0,0,1]).map(Om),le=(T=t.textureProperties)==null?void 0:T._EmissionMap,Ye=le!=null?{index:le,extensions:gl({},Ke)}:void 0,Re=((O=(P=t.vectorProperties)==null?void 0:P._ShadeColor)!=null?O:[.97,.81,.86,1]).map(Om),Be=(N=t.textureProperties)==null?void 0:N._ShadeTexture,ot=Be!=null?{index:Be,extensions:gl({},Ke)}:void 0;let pt=(z=(D=t.floatProperties)==null?void 0:D._ShadeShift)!=null?z:0,Jt=(k=(G=t.floatProperties)==null?void 0:G._ShadeToony)!=null?k:.9;Jt=vr.lerp(Jt,1,.5+.5*pt),pt=-pt-(1-Jt);const pn=(H=(j=t.floatProperties)==null?void 0:j._IndirectLightIntensity)!=null?H:.1,jn=pn?1-pn:void 0,en=(ee=t.textureProperties)==null?void 0:ee._SphereAdd,Hn=en!=null?[1,1,1]:void 0,pr=en!=null?{index:en}:void 0,Mi=(he=(te=t.floatProperties)==null?void 0:te._RimLightingMix)!=null?he:0,na=(se=t.textureProperties)==null?void 0:se._RimTexture,Ei=na!=null?{index:na,extensions:gl({},Ke)}:void 0,Ka=((B=(fe=t.vectorProperties)==null?void 0:fe._RimColor)!=null?B:[0,0,0,1]).map(Om),Ns=(Y=(J=t.floatProperties)==null?void 0:J._RimFresnelPower)!=null?Y:1,ra=(q=(V=t.floatProperties)==null?void 0:V._RimLift)!=null?q:0,Ai=["none","worldCoordinates","screenCoordinates"][(ae=(pe=t.floatProperties)==null?void 0:pe._OutlineWidthMode)!=null?ae:0];let Ao=(Se=(ce=t.floatProperties)==null?void 0:ce._OutlineWidth)!=null?Se:0;Ao=.01*Ao;const ia=(Ee=t.textureProperties)==null?void 0:Ee._OutlineWidthTexture,au=ia!=null?{index:ia,extensions:gl({},Ke)}:void 0,lu=((Me=($e=t.vectorProperties)==null?void 0:$e._OutlineColor)!=null?Me:[0,0,0]).map(Om),cu=((We=(Ge=t.floatProperties)==null?void 0:Ge._OutlineColorMode)!=null?We:0)===1?(Z=(ue=t.floatProperties)==null?void 0:ue._OutlineLightingMix)!=null?Z:1:0,Bl=(Ve=t.textureProperties)==null?void 0:Ve._UvAnimMaskTexture,K=Bl!=null?{index:Bl,extensions:gl({},Ke)}:void 0,xe=(re=(Le=t.floatProperties)==null?void 0:Le._UvAnimScrollX)!=null?re:0;let Te=(qe=(Ce=t.floatProperties)==null?void 0:Ce._UvAnimScrollY)!=null?qe:0;Te!=null&&(Te=-Te);const Ie=(Q=(Ze=t.floatProperties)==null?void 0:Ze._UvAnimRotation)!=null?Q:0,we={specVersion:"1.0",transparentWithZWrite:Ue,renderQueueOffsetNumber:ze,shadeColorFactor:Re,shadeMultiplyTexture:ot,shadingShiftFactor:pt,shadingToonyFactor:Jt,giEqualizationFactor:jn,matcapFactor:Hn,matcapTexture:pr,rimLightingMixFactor:Mi,rimMultiplyTexture:Ei,parametricRimColorFactor:Ka,parametricRimFresnelPowerFactor:Ns,parametricRimLiftFactor:ra,outlineWidthMode:Ai,outlineWidthFactor:Ao,outlineWidthMultiplyTexture:au,outlineColorFactor:lu,outlineLightingMixFactor:cu,uvAnimationMaskTexture:K,uvAnimationScrollXSpeedFactor:xe,uvAnimationScrollYSpeedFactor:Te,uvAnimationRotationSpeedFactor:Ie};return Ej(gl({},e),{pbrMetallicRoughness:{baseColorFactor:ne,baseColorTexture:Mt},normalTexture:de,emissiveTexture:Ye,emissiveFactor:Xe,alphaMode:bt,alphaCutoff:rt,doubleSided:Xt,extensions:{VRMC_materials_mtoon:we}})}_parseV0UnlitProperties(t,e){var n,r,i,s,o;const a=t.shader==="VRM/UnlitTransparentZWrite",l=t.shader==="VRM/UnlitTransparent"||a,c=this._v0ParseRenderQueue(t),d=t.shader==="VRM/UnlitCutout",f=l?"BLEND":d?"MASK":"OPAQUE",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(Om),S=(o=t.textureProperties)==null?void 0:o._MainTex,w=S!=null?{index:S,extensions:gl({},y)}:void 0,_={specVersion:"1.0",transparentWithZWrite:a,renderQueueOffsetNumber:c,shadeColorFactor:x,shadeMultiplyTexture:w};return Ej(gl({},e),{pbrMetallicRoughness:{baseColorFactor:x,baseColorTexture:w},alphaMode:f,alphaCutoff:p,extensions:{VRMC_materials_mtoon:_}})}_portTextureTransform(t){var e,n,r,i,s;const o=(e=t.vectorProperties)==null?void 0:e._MainTex;if(o==null)return{};const a=[(n=o==null?void 0:o[0])!=null?n:0,(r=o==null?void 0:o[1])!=null?r:0],l=[(i=o==null?void 0:o[2])!=null?i:1,(s=o==null?void 0:o[3])!=null?s:1];return a[1]=1-l[1]-a[1],{KHR_texture_transform:{offset:a,scale:l}}}_v0ParseRenderQueue(t){var e,n;const r=t.shader==="VRM/UnlitTransparentZWrite",i=((e=t.keywordMap)==null?void 0:e._ALPHABLEND_ON)!=null||t.shader==="VRM/UnlitTransparent"||r,s=((n=t.floatProperties)==null?void 0:n._ZWrite)===1||r;let o=0;if(i){const a=t.renderQueue;a!=null&&(s?o=this._renderQueueMapTransparentZWrite.get(a):o=this._renderQueueMapTransparent.get(a))}return o}_populateRenderQueueMap(t){const e=new Set,n=new Set;t.forEach(r=>{var i,s;const o=r.shader==="VRM/UnlitTransparentZWrite",a=((i=r.keywordMap)==null?void 0:i._ALPHABLEND_ON)!=null||r.shader==="VRM/UnlitTransparent"||o,l=((s=r.floatProperties)==null?void 0:s._ZWrite)===1||o;if(a){const c=r.renderQueue;c!=null&&(l?n.add(c):e.add(c))}}),e.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${e.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),n.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${n.size} render queues for TransparentZWrite materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),Array.from(e).sort().forEach((r,i)=>{const s=Math.min(Math.max(i-e.size+1,-9),0);this._renderQueueMapTransparent.set(r,s)}),Array.from(n).sort().forEach((r,i)=>{const s=Math.min(Math.max(i,0),9);this._renderQueueMapTransparentZWrite.set(r,s)})}},Aj=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),nd=new X,oT=class extends Ts{constructor(t){super(),this._attrPosition=new Qt(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(s6);const e=new Yt;e.setAttribute("position",this._attrPosition);const n=new $r({color:16711935,depthTest:!1,depthWrite:!1});this._line=new Ul(e,n),this.add(this._line),this.constraint=t}updateMatrixWorld(t){nd.setFromMatrixPosition(this.constraint.destination.matrixWorld),this._attrPosition.setXYZ(0,nd.x,nd.y,nd.z),this.constraint.source&&nd.setFromMatrixPosition(this.constraint.source.matrixWorld),this._attrPosition.setXYZ(1,nd.x,nd.y,nd.z),this._attrPosition.needsUpdate=!0,super.updateMatrixWorld(t)}};function Tj(t,e){return e.set(t.elements[12],t.elements[13],t.elements[14])}var Kwe=new X,Ywe=new X;function Zwe(t,e){return t.decompose(Kwe,e,Ywe),e}function j1(t){return t.invert?t.invert():t.inverse(),t}var aN=class{constructor(t,e){this.destination=t,this.source=e,this.weight=1}},Qwe=new X,Jwe=new X,e1e=new X,t1e=new qt,n1e=new qt,r1e=new qt,i1e=class extends aN{get aimAxis(){return this._aimAxis}set aimAxis(t){this._aimAxis=t,this._v3AimAxis.set(t==="PositiveX"?1:t==="NegativeX"?-1:0,t==="PositiveY"?1:t==="NegativeY"?-1:0,t==="PositiveZ"?1:t==="NegativeZ"?-1:0)}get dependencies(){const t=new Set([this.source]);return this.destination.parent&&t.add(this.destination.parent),t}constructor(t,e){super(t,e),this._aimAxis="PositiveX",this._v3AimAxis=new X(1,0,0),this._dstRestQuat=new qt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);const t=t1e.identity(),e=n1e.identity();this.destination.parent&&(Zwe(this.destination.parent.matrixWorld,t),j1(e.copy(t)));const n=Qwe.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(t),r=Tj(this.source.matrixWorld,Jwe).sub(Tj(this.destination.matrixWorld,e1e)).normalize(),i=r1e.setFromUnitVectors(n,r).premultiply(e).multiply(t).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}};function s1e(t,e){const n=[t];let r=t.parent;for(;r!==null;)n.unshift(r),r=r.parent;n.forEach(i=>{e(i)})}var o1e=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)s1e(s,o=>{const a=this._objectConstraintsMap.get(o);if(a)for(const l of a)this._processConstraint(l,e,n,r)});r(t),n.add(t)}},a1e=new qt,l1e=new qt,c1e=class extends aN{get dependencies(){return new Set([this.source])}constructor(t,e){super(t,e),this._dstRestQuat=new qt,this._invSrcRestQuat=new qt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),j1(this._invSrcRestQuat.copy(this.source.quaternion))}update(){const t=a1e.copy(this._invSrcRestQuat).multiply(this.source.quaternion),e=l1e.copy(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(e,this.weight)}},u1e=new X,d1e=new qt,f1e=new qt,h1e=class extends aN{get rollAxis(){return this._rollAxis}set rollAxis(t){this._rollAxis=t,this._v3RollAxis.set(t==="X"?1:0,t==="Y"?1:0,t==="Z"?1:0)}get dependencies(){return new Set([this.source])}constructor(t,e){super(t,e),this._rollAxis="X",this._v3RollAxis=new X(1,0,0),this._dstRestQuat=new qt,this._invDstRestQuat=new qt,this._invSrcRestQuatMulDstRestQuat=new qt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),j1(this._invDstRestQuat.copy(this._dstRestQuat)),j1(this._invSrcRestQuatMulDstRestQuat.copy(this.source.quaternion)).multiply(this._dstRestQuat)}update(){const t=d1e.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),e=u1e.copy(this._v3RollAxis).applyQuaternion(t),r=f1e.setFromUnitVectors(e,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(r,this.weight)}},p1e=new Set(["1.0","1.0-beta"]),$G=class W0{get name(){return W0.EXTENSION_NAME}constructor(e,n){this.parser=e,this.helperRoot=n==null?void 0:n.helperRoot}afterRoot(e){return Aj(this,null,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){return Aj(this,null,function*(){var n;const r=this.parser.json;if(!(((n=r.extensionsUsed)==null?void 0:n.indexOf(W0.EXTENSION_NAME))!==-1))return null;const s=new o1e,o=yield this.parser.getDependencies("node");return o.forEach((a,l)=>{var c;const d=r.nodes[l],f=(c=d==null?void 0:d.extensions)==null?void 0:c[W0.EXTENSION_NAME];if(f==null)return;const p=f.specVersion;if(!p1e.has(p)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${W0.EXTENSION_NAME} specVersion "${p}"`);return}const y=f.constraint;if(y.roll!=null){const x=this._importRollConstraint(a,o,y.roll);s.addConstraint(x)}else if(y.aim!=null){const x=this._importAimConstraint(a,o,y.aim);s.addConstraint(x)}else if(y.rotation!=null){const x=this._importRotationConstraint(a,o,y.rotation);s.addConstraint(x)}}),e.scene.updateMatrixWorld(),s.setInitState(),s})}_importRollConstraint(e,n,r){const{source:i,rollAxis:s,weight:o}=r,a=n[i],l=new h1e(e,a);if(s!=null&&(l.rollAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new oT(l);this.helperRoot.add(c)}return l}_importAimConstraint(e,n,r){const{source:i,aimAxis:s,weight:o}=r,a=n[i],l=new i1e(e,a);if(s!=null&&(l.aimAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new oT(l);this.helperRoot.add(c)}return l}_importRotationConstraint(e,n,r){const{source:i,weight:s}=r,o=n[i],a=new c1e(e,o);if(s!=null&&(a.weight=s),this.helperRoot){const l=new oT(a);this.helperRoot.add(l)}return a}};$G.EXTENSION_NAME="VRMC_node_constraint";var m1e=$G,L_=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),lN=class{},aT=new X,Vf=new X,XG=class extends lN{get type(){return"capsule"}constructor(t){var e,n,r,i;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new X(0,0,0),this.tail=(n=t==null?void 0:t.tail)!=null?n:new X(0,0,0),this.radius=(r=t==null?void 0:t.radius)!=null?r:0,this.inside=(i=t==null?void 0:t.inside)!=null?i:!1}calculateCollision(t,e,n,r){aT.setFromMatrixPosition(t),Vf.subVectors(this.tail,this.offset).applyMatrix4(t),Vf.sub(aT);const i=Vf.lengthSq();r.copy(e).sub(aT);const s=Vf.dot(r);s<=0||(i<=s||Vf.multiplyScalar(s/i),r.sub(Vf));const o=r.length(),a=this.inside?this.radius-n-o:o-n-this.radius;return a<0&&(r.multiplyScalar(1/o),this.inside&&r.negate()),a}},lT=new X,Pj=new $t,qG=class extends lN{get type(){return"plane"}constructor(t){var e,n;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new X(0,0,0),this.normal=(n=t==null?void 0:t.normal)!=null?n:new X(0,0,1)}calculateCollision(t,e,n,r){r.setFromMatrixPosition(t),r.negate().add(e),Pj.getNormalMatrix(t),lT.copy(this.normal).applyNormalMatrix(Pj).normalize();const i=r.dot(lT)-n;return r.copy(lT),i}},g1e=new X,KG=class extends lN{get type(){return"sphere"}constructor(t){var e,n,r;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new X(0,0,0),this.radius=(n=t==null?void 0:t.radius)!=null?n:0,this.inside=(r=t==null?void 0:t.inside)!=null?r:!1}calculateCollision(t,e,n,r){r.subVectors(e,g1e.setFromMatrixPosition(t));const i=r.length(),s=this.inside?this.radius-n-i:i-n-this.radius;return s<0&&(r.multiplyScalar(1/i),this.inside&&r.negate()),s}},vl=new X,v1e=class extends Yt{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new X,this._currentTail=new X,this._shape=t,this._attrPos=new Qt(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0);const n=vl.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(n)>1e-10&&(this._currentTail.copy(n),t=!0),t&&this._buildPosition()}_buildPosition(){vl.copy(this._currentTail).sub(this._currentOffset);const t=vl.length()/this._currentRadius;for(let r=0;r<=16;r++){const i=r/16*Math.PI;this._attrPos.setXYZ(r,-Math.sin(i),-Math.cos(i),0),this._attrPos.setXYZ(17+r,t+Math.sin(i),Math.cos(i),0),this._attrPos.setXYZ(34+r,-Math.sin(i),0,-Math.cos(i)),this._attrPos.setXYZ(51+r,t+Math.sin(i),0,Math.cos(i))}for(let r=0;r<32;r++){const i=r/16*Math.PI;this._attrPos.setXYZ(68+r,0,Math.sin(i),Math.cos(i)),this._attrPos.setXYZ(100+r,t,Math.sin(i),Math.cos(i))}const e=Math.atan2(vl.y,Math.sqrt(vl.x*vl.x+vl.z*vl.z)),n=-Math.atan2(vl.z,vl.x);this.rotateZ(e),this.rotateY(n),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<34;t++){const e=(t+1)%34;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(68+t*2,34+t,34+e)}for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(136+t*2,68+t,68+e),this._attrIndex.setXY(200+t*2,100+t,100+e)}this._attrIndex.needsUpdate=!0}},y1e=class extends Yt{constructor(t){super(),this.worldScale=1,this._currentOffset=new X,this._currentNormal=new X,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}},x1e=class extends Yt{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new X,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}},b1e=new X,cT=class extends Ts{constructor(t){if(super(),this.matrixAutoUpdate=!1,this.collider=t,this.collider.shape instanceof KG)this._geometry=new x1e(this.collider.shape);else if(this.collider.shape instanceof XG)this._geometry=new v1e(this.collider.shape);else if(this.collider.shape instanceof qG)this._geometry=new y1e(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");const e=new $r({color:16711935,depthTest:!1,depthWrite:!1});this._line=new eo(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(t){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=b1e.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},_1e=class extends Yt{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new X,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}},w1e=new X,S1e=class extends Ts{constructor(t){super(),this.matrixAutoUpdate=!1,this.springBone=t,this._geometry=new _1e(this.springBone);const e=new $r({color:16776960,depthTest:!1,depthWrite:!1});this._line=new eo(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(t){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=w1e.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},uT=class extends mn{constructor(t){super(),this.colliderMatrix=new Ct,this.shape=t}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),M1e(this.colliderMatrix,this.matrixWorld,this.shape.offset)}};function M1e(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 E1e=new Ct;function A1e(t){return t.invert?t.invert():t.getInverse(E1e.copy(t)),t}var T1e=class{constructor(t){this._inverseCache=new Ct,this._shouldUpdateInverse=!0,this.matrix=t;const e={set:(n,r,i)=>(this._shouldUpdateInverse=!0,n[r]=i,!0)};this._originalElements=t.elements,t.elements=new Proxy(t.elements,e)}get inverse(){return this._shouldUpdateInverse&&(A1e(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},dT=new Ct,Lm=new X,L0=new X,D0=new X,U0=new X,P1e=new Ct,C1e=class{constructor(t,e,n={},r=[]){this._currentTail=new X,this._prevTail=new X,this._boneAxis=new X,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new Ct,this._initialLocalRotation=new qt,this._initialLocalChildPosition=new X;var i,s,o,a,l,c;this.bone=t,this.bone.matrixAutoUpdate=!1,this.child=e,this.settings={hitRadius:(i=n.hitRadius)!=null?i:0,stiffness:(s=n.stiffness)!=null?s:1,gravityPower:(o=n.gravityPower)!=null?o:0,gravityDir:(l=(a=n.gravityDir)==null?void 0:a.clone())!=null?l:new X(0,-1,0),dragForce:(c=n.dragForce)!=null?c:.4},this.colliderGroups=r}get dependencies(){const t=new Set,e=this.bone.parent;e&&t.add(e);for(let n=0;n<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 T1e(this._center.matrixWorld)))}get initialLocalChildPosition(){return this._initialLocalChildPosition}get _parentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:dT}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=L0.copy(this._boneAxis).transformDirection(this._initialLocalMatrix).transformDirection(this._parentMatrixWorld);U0.copy(this._currentTail).add(Lm.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),D0.setFromMatrixPosition(this.bone.matrixWorld),U0.sub(D0).normalize().multiplyScalar(this._worldSpaceBoneLength).add(D0),this._collision(U0),this._prevTail.copy(this._currentTail),this._currentTail.copy(U0).applyMatrix4(this._getMatrixWorldToCenter());const n=P1e.multiplyMatrices(this._parentMatrixWorld,this._initialLocalMatrix).invert();this.bone.quaternion.setFromUnitVectors(this._boneAxis,Lm.copy(U0).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,Lm);if(i<0){t.addScaledVector(Lm,-i),t.sub(D0);const s=t.length();t.multiplyScalar(this._worldSpaceBoneLength/s).add(D0)}}}_calcWorldSpaceBoneLength(){Lm.setFromMatrixPosition(this.bone.matrixWorld),this.child?L0.setFromMatrixPosition(this.child.matrixWorld):(L0.copy(this._initialLocalChildPosition),L0.applyMatrix4(this.bone.matrixWorld)),this._worldSpaceBoneLength=Lm.sub(L0).length()}_getMatrixCenterToWorld(){return this._center?this._center.matrixWorld:dT}_getMatrixWorldToCenter(){return this._center?this._center.userData.inverseCacheProxy.inverse:dT}};function R1e(t,e){const n=[];let r=t;for(;r!==null;)n.unshift(r),r=r.parent;n.forEach(i=>{e(i)})}function pC(t,e){t.children.forEach(n=>{e(n)||pC(n,e)})}function N1e(t){var e;const n=new Map;for(const r of t){let i=r;do{const s=((e=n.get(i))!=null?e:0)+1;if(s===t.size)return i;n.set(i,s),i=i.parent}while(i!==null)}return null}var Cj=class{constructor(){this._joints=new Set,this._sortedJoints=[],this._hasWarnedCircularDependency=!1,this._ancestors=[],this._objectSpringBonesMap=new Map,this._isSortedJointsDirty=!1,this._relevantChildrenUpdated=this._relevantChildrenUpdated.bind(this)}get joints(){return this._joints}get springBones(){return console.warn("VRMSpringBoneManager: springBones is deprecated. use joints instead."),this._joints}get colliderGroups(){const t=new Set;return this._joints.forEach(e=>{e.colliderGroups.forEach(n=>{t.add(n)})}),Array.from(t)}get colliders(){const t=new Set;return this.colliderGroups.forEach(e=>{e.colliders.forEach(n=>{t.add(n)})}),Array.from(t)}addJoint(t){this._joints.add(t);let e=this._objectSpringBonesMap.get(t.bone);e==null&&(e=new Set,this._objectSpringBonesMap.set(t.bone,e)),e.add(t),this._isSortedJointsDirty=!0}addSpringBone(t){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(t)}deleteJoint(t){this._joints.delete(t),this._objectSpringBonesMap.get(t.bone).delete(t),this._isSortedJointsDirty=!0}deleteSpringBone(t){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(t)}setInitState(){this._sortJoints();for(let t=0;t<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),pC(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=N1e(r);this._ancestors=[],i&&(this._ancestors.push(i),pC(i,s=>{var o,a;return((a=(o=this._objectSpringBonesMap.get(s))==null?void 0:o.size)!=null?a:0)>0?!0:(this._ancestors.push(s),!1)})),this._isSortedJointsDirty=!1}_insertJointSort(t,e,n,r,i){if(n.has(t))return;if(e.has(t)){this._hasWarnedCircularDependency||(console.warn("VRMSpringBoneManager: Circular dependency detected"),this._hasWarnedCircularDependency=!0);return}e.add(t);const s=t.dependencies;for(const o of s){let a=!1,l=null;R1e(o,c=>{const d=this._objectSpringBonesMap.get(c);if(d)for(const f of d)a=!0,this._insertJointSort(f,e,n,r,i);else a||(l=c)}),l&&i.add(l)}r.push(t),n.add(t)}_relevantChildrenUpdated(t){var e,n;return((n=(e=this._objectSpringBonesMap.get(t))==null?void 0:e.size)!=null?n:0)>0?!0:(t.updateWorldMatrix(!1,!1),!1)}},Rj="VRMC_springBone_extended_collider",I1e=new Set(["1.0","1.0-beta"]),k1e=new Set(["1.0"]),YG=class Hm{get name(){return Hm.EXTENSION_NAME}constructor(e,n){var r;this.parser=e,this.jointHelperRoot=n==null?void 0:n.jointHelperRoot,this.colliderHelperRoot=n==null?void 0:n.colliderHelperRoot,this.useExtendedColliders=(r=n==null?void 0:n.useExtendedColliders)!=null?r:!0}afterRoot(e){return L_(this,null,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return L_(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 L_(this,null,function*(){var n,r,i,s,o;const a=e.parser.json;if(!(((n=a.extensionsUsed)==null?void 0:n.indexOf(Hm.EXTENSION_NAME))!==-1))return null;const c=new Cj,d=yield e.parser.getDependencies("node"),f=(r=a.extensions)==null?void 0:r[Hm.EXTENSION_NAME];if(!f)return null;const p=f.specVersion;if(!I1e.has(p))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Hm.EXTENSION_NAME} specVersion "${p}"`),null;const y=(i=f.colliders)==null?void 0:i.map((S,w)=>{var _,E,T,P,O,N,D,z,G,k,j,H,ee,te,he;const se=d[S.node];if(se==null)return console.warn(`VRMSpringBoneLoaderPlugin: The collider #${w} attempted to reference a node #${S.node} but not found. Skipping the collider`),null;const fe=S.shape,B=(_=S.extensions)==null?void 0:_[Rj];if(this.useExtendedColliders&&B!=null){const J=B.specVersion;if(!k1e.has(J))console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Rj} specVersion "${J}". Fallbacking to the ${Hm.EXTENSION_NAME} definition`);else{const Y=B.shape;if(Y.sphere)return this._importSphereCollider(se,{offset:new X().fromArray((E=Y.sphere.offset)!=null?E:[0,0,0]),radius:(T=Y.sphere.radius)!=null?T:0,inside:(P=Y.sphere.inside)!=null?P:!1});if(Y.capsule)return this._importCapsuleCollider(se,{offset:new X().fromArray((O=Y.capsule.offset)!=null?O:[0,0,0]),radius:(N=Y.capsule.radius)!=null?N:0,tail:new X().fromArray((D=Y.capsule.tail)!=null?D:[0,0,0]),inside:(z=Y.capsule.inside)!=null?z:!1});if(Y.plane)return this._importPlaneCollider(se,{offset:new X().fromArray((G=Y.plane.offset)!=null?G:[0,0,0]),normal:new X().fromArray((k=Y.plane.normal)!=null?k:[0,0,1])})}}if(fe.sphere)return this._importSphereCollider(se,{offset:new X().fromArray((j=fe.sphere.offset)!=null?j:[0,0,0]),radius:(H=fe.sphere.radius)!=null?H:0,inside:!1});if(fe.capsule)return this._importCapsuleCollider(se,{offset:new X().fromArray((ee=fe.capsule.offset)!=null?ee:[0,0,0]),radius:(te=fe.capsule.radius)!=null?te:0,tail:new X().fromArray((he=fe.capsule.tail)!=null?he:[0,0,0]),inside:!1});console.warn(`VRMSpringBoneLoaderPlugin: The collider #${w} has no valid shape. Skipping the collider`)}),x=(s=f.colliderGroups)==null?void 0:s.map((S,w)=>{var _;return{colliders:((_=S.colliders)!=null?_:[]).map(T=>{const P=y==null?void 0:y[T];return P??(console.warn(`VRMSpringBoneLoaderPlugin: The collider group #${w} attempted to reference a collider #${T} but not found. Skipping the collider`),null)}).filter(T=>T!=null),name:S.name}});return(o=f.springs)==null||o.forEach((S,w)=>{var _;const E=S.joints,T=(_=S.colliderGroups)==null?void 0:_.map(N=>{const D=x==null?void 0:x[N];return D??(console.warn(`VRMSpringBoneLoaderPlugin: The spring #${w} attempted to reference a collider group #${N} but not found. Skipping the collider group`),null)}).filter(N=>N!=null),P=S.center!=null?d[S.center]:void 0;let O;E.forEach(N=>{if(O){const D=O.node,z=d[D],G=N.node,k=d[G],j={hitRadius:O.hitRadius,dragForce:O.dragForce,gravityPower:O.gravityPower,stiffness:O.stiffness,gravityDir:O.gravityDir!=null?new X().fromArray(O.gravityDir):void 0},H=this._importJoint(z,k,j,T);P&&(H.center=P),c.addJoint(H)}O=N})}),c.setInitState(),c})}_v0Import(e){return L_(this,null,function*(){var n,r,i;const s=e.parser.json;if(!(((n=s.extensionsUsed)==null?void 0:n.indexOf("VRM"))!==-1))return null;const a=(r=s.extensions)==null?void 0:r.VRM,l=a==null?void 0:a.secondaryAnimation;if(!l)return null;const c=l==null?void 0:l.boneGroups;if(!c)return null;const d=new Cj,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((E,T)=>{var P,O,N;const D=new X(0,0,0);return E.offset&&D.set((P=E.offset.x)!=null?P:0,(O=E.offset.y)!=null?O:0,E.offset.z?-E.offset.z:0),this._importSphereCollider(w,{offset:D,radius:(N=E.radius)!=null?N:0,inside:!1})})}});return c==null||c.forEach((y,x)=>{const S=y.bones;S&&S.forEach(w=>{var _,E,T,P;const O=f[w];if(O==null){console.warn(`VRMSpringBoneLoaderPlugin: The spring bone group #${x} attempted to reference a node #${w} but not found. Skipping the node`);return}const N=new X;y.gravityDir?N.set((_=y.gravityDir.x)!=null?_:0,(E=y.gravityDir.y)!=null?E:0,(T=y.gravityDir.z)!=null?T:0):N.set(0,-1,0);const D=y.center!=null?f[y.center]:void 0,z={hitRadius:y.hitRadius,dragForce:y.dragForce,gravityPower:y.gravityPower,stiffness:y.stiffiness,gravityDir:N},G=(P=y.colliderGroups)==null?void 0:P.map(k=>{const j=p==null?void 0:p[k];return j??(console.warn(`VRMSpringBoneLoaderPlugin: The spring #${x} attempted to reference a collider group #${k} but not found. Skipping the collider group`),null)}).filter(k=>k!=null);O.traverse(k=>{var j;const H=(j=k.children[0])!=null?j:null,ee=this._importJoint(k,H,z,G);D&&(ee.center=D),d.addJoint(ee)})})}),e.scene.updateMatrixWorld(),d.setInitState(),d})}_importJoint(e,n,r,i){const s=new C1e(e,n,r,i);if(this.jointHelperRoot){const o=new S1e(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,n){const r=new KG(n),i=new uT(r);if(e.add(i),this.colliderHelperRoot){const s=new cT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importCapsuleCollider(e,n){const r=new XG(n),i=new uT(r);if(e.add(i),this.colliderHelperRoot){const s=new cT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importPlaneCollider(e,n){const r=new qG(n),i=new uT(r);if(e.add(i),this.colliderHelperRoot){const s=new cT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}};YG.EXTENSION_NAME="VRMC_springBone";var O1e=YG,L1e=class{get name(){return"VRMLoaderPlugin"}constructor(t,e){var n,r,i,s,o,a,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 Z_e(t),this.firstPersonPlugin=(r=e==null?void 0:e.firstPersonPlugin)!=null?r:new J_e(t),this.humanoidPlugin=(i=e==null?void 0:e.humanoidPlugin)!=null?i:new owe(t,{helperRoot:p,autoUpdateHumanBones:y}),this.lookAtPlugin=(s=e==null?void 0:e.lookAtPlugin)!=null?s:new _we(t,{helperRoot:p}),this.metaPlugin=(o=e==null?void 0:e.metaPlugin)!=null?o:new Mwe(t),this.mtoonMaterialPlugin=(a=e==null?void 0:e.mtoonMaterialPlugin)!=null?a:new Fwe(t),this.materialsHDREmissiveMultiplierPlugin=(l=e==null?void 0:e.materialsHDREmissiveMultiplierPlugin)!=null?l:new Bwe(t),this.materialsV0CompatPlugin=(c=e==null?void 0:e.materialsV0CompatPlugin)!=null?c:new qwe(t),this.springBonePlugin=(d=e==null?void 0:e.springBonePlugin)!=null?d:new O1e(t,{colliderHelperRoot:p,jointHelperRoot:p}),this.nodeConstraintPlugin=(f=e==null?void 0:e.nodeConstraintPlugin)!=null?f:new m1e(t,{helperRoot:p})}beforeRoot(){return I_(this,null,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(t){return I_(this,null,function*(){return yield this.mtoonMaterialPlugin.loadMesh(t)})}getMaterialType(t){const e=this.mtoonMaterialPlugin.getMaterialType(t);return e??null}extendMaterialParams(t,e){return I_(this,null,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(t,e),yield this.mtoonMaterialPlugin.extendMaterialParams(t,e)})}afterRoot(t){return I_(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 Awe({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 D1e(t){const e=new Set;return t.traverse(n=>{if(!n.isMesh)return;const r=n;e.add(r)}),e}function Nj(t,e,n){if(e.size===1){const o=e.values().next().value;if(o.weight===1)return t[o.index]}const r=new Float32Array(t[0].count*3);let i=0;if(n)i=1;else for(const o of e)i+=o.weight;for(const o of e){const a=t[o.index],l=o.weight/i;for(let c=0;c<a.count;c++)r[c*3+0]+=a.getX(c)*l,r[c*3+1]+=a.getY(c)*l,r[c*3+2]+=a.getZ(c)*l}return new Qt(r,3)}function U1e(t){var e;const n=D1e(t.scene),r=new Map,i=(e=t.expressionManager)==null?void 0:e.expressionMap;if(i!=null)for(const[s,o]of Object.entries(i)){const a=new Set;for(const l of o.binds)if(l instanceof U1){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)}a.add(l)}for(const l of a)o.deleteBind(l)}for(const s of n){const o=r.get(s);if(o==null)continue;const a=s.geometry.morphAttributes;s.geometry.morphAttributes={};const l=s.geometry.clone();s.geometry=l;const c=l.morphTargetsRelative,d=a.position!=null,f=a.normal!=null,p={},y={},x=[];if(d||f){d&&(p.position=[]),f&&(p.normal=[]);let S=0;for(const[w,_]of o)d&&(p.position[S]=Nj(a.position,_,c)),f&&(p.normal[S]=Nj(a.normal,_,c)),i==null||i[w].addBind(new U1({index:S,weight:1,primitives:[s]})),y[w]=S,x.push(0),S++}l.morphAttributes=p,s.morphTargetDictionary=y,s.morphTargetInfluences=x}}function F1(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 ZG(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 j1e(t){var e;const n=F1e(t),r=new Set;for(const f of n)r.has(f.geometry)&&(f.geometry=W1e(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=z1e(p,x);y.set(x,S)}const s=new Map;for(const f of n){const p=B1e(f,i);s.set(f,p)}const o=[];for(const[f,p]of s){let y=!1;for(const x of o)if(H1e(p,x.boneInverseMap)){y=!0,x.meshes.add(f);for(const[w,_]of p)x.boneInverseMap.set(w,_);break}y||o.push({boneInverseMap:p,meshes:new Set([f])})}const a=new Map,l=new fT,c=new fT,d=new fT;for(const f of o){const{boneInverseMap:p,meshes:y}=f,x=Array.from(p.keys()),S=Array.from(p.values()),w=new kd(x,S),_=c.getOrCreate(w);for(const E of y){const T=E.geometry.getAttribute("skinIndex"),P=l.getOrCreate(T),O=E.skeleton.bones,N=O.map(G=>d.getOrCreate(G)).join(","),D=`${P};${_};${N}`;let z=a.get(D);z==null&&(z=T.clone(),V1e(z,O,x),a.set(D,z)),E.geometry.setAttribute("skinIndex",z)}for(const E of y)E.bind(w,new Ct)}}function F1e(t){const e=new Set;return t.traverse(n=>{if(!n.isSkinnedMesh)return;const r=n;e.add(r)}),e}function z1e(t,e){const n=new Set;for(let r=0;r<t.count;r++)for(let i=0;i<t.itemSize;i++){const s=F1(t,r,i);F1(e,r,i)!==0&&n.add(s)}return n}function B1e(t,e){const n=new Map,r=t.skeleton,i=t.geometry,s=i.getAttribute("skinIndex"),o=i.getAttribute("skinWeight"),a=e.get(s),l=a==null?void 0:a.get(o);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 H1e(t,e){for(const[n,r]of t.entries()){const i=e.get(n);if(i!=null&&!G1e(r,i))return!1}return!0}function V1e(t,e,n){const r=new Map;for(const s of e)r.set(s,r.size);const i=new Map;for(const[s,o]of n.entries()){const a=r.get(o);i.set(a,s)}for(let s=0;s<t.count;s++)for(let o=0;o<t.itemSize;o++){const a=F1(t,s,o),l=i.get(a);ZG(t,s,o,l)}t.needsUpdate=!0}function G1e(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 fT=class{constructor(){this._objectIndexMap=new Map,this._index=0}get(t){return this._objectIndexMap.get(t)}getOrCreate(t){let e=this._objectIndexMap.get(t);return e==null&&(e=this._index,this._objectIndexMap.set(t,e),this._index++),e}};function W1e(t){var e,n,r,i;const s=new Yt;s.name=t.name,s.setIndex(t.index);for(const[o,a]of Object.entries(t.attributes))s.setAttribute(o,a);for(const[o,a]of Object.entries(t.morphAttributes)){const l=o;s.morphAttributes[l]=a.concat()}s.morphTargetsRelative=t.morphTargetsRelative,s.groups=[];for(const o of t.groups)s.addGroup(o.start,o.count,o.materialIndex);return s.boundingSphere=(n=(e=t.boundingSphere)==null?void 0:e.clone())!=null?n:null,s.boundingBox=(i=(r=t.boundingBox)==null?void 0:r.clone())!=null?i:null,s.drawRange.start=t.drawRange.start,s.drawRange.count=t.drawRange.count,s.userData=t.userData,s}function Ij(t){if(Object.values(t).forEach(e=>{e!=null&&e.isTexture&&e.dispose()}),t.isShaderMaterial){const e=t.uniforms;e&&Object.values(e).forEach(n=>{const r=n.value;r!=null&&r.isTexture&&r.dispose()})}t.dispose()}function $1e(t){const e=t.geometry;e&&e.dispose();const n=t.skeleton;n&&n.dispose();const r=t.material;r&&(Array.isArray(r)?r.forEach(i=>Ij(i)):r&&Ij(r))}function X1e(t){t.traverse($1e)}function q1e(t,e){var n,r;console.warn("VRMUtils.removeUnnecessaryJoints: removeUnnecessaryJoints is deprecated. Use combineSkeletons instead. combineSkeletons contributes more to the performance improvement. This function will be removed in the next major version.");const i=(n=e==null?void 0:e.experimentalSameBoneCounts)!=null?n:!1,s=[];t.traverse(l=>{l.type==="SkinnedMesh"&&s.push(l)});const o=new Map;let a=0;for(const l of s){const d=l.geometry.getAttribute("skinIndex");if(o.has(d))continue;const f=new Map,p=new Map;for(let y=0;y<d.count;y++)for(let x=0;x<d.itemSize;x++){const S=F1(d,y,x);let w=f.get(S);w==null&&(w=f.size,f.set(S,w),p.set(w,S)),ZG(d,y,x,w)}d.needsUpdate=!0,o.set(d,p),a=Math.max(a,f.size)}for(const l of s){const d=l.geometry.getAttribute("skinIndex"),f=o.get(d),p=[],y=[],x=i?a:f.size;for(let w=0;w<x;w++){const _=(r=f.get(w))!=null?r:0;p.push(l.skeleton.bones[_]),y.push(l.skeleton.boneInverses[_])}const S=new kd(p,y);l.bind(S,new Ct)}}function K1e(t,e){const n=t.position.count,r=new Array(n);let i=0;const s=e.array;for(let o=0;o<s.length;o++){const a=s[o];r[a]||(r[a]=!0,i++)}return{isVertexUsed:r,vertexCount:n,verticesUsed:i}}function Y1e(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 Z1e(t,e){var n,r,i,s;e.name=t.name,e.morphTargetsRelative=t.morphTargetsRelative,t.groups.forEach(o=>{e.addGroup(o.start,o.count,o.materialIndex)}),e.boundingBox=(r=(n=t.boundingBox)==null?void 0:n.clone())!=null?r:null,e.boundingSphere=(s=(i=t.boundingSphere)==null?void 0:i.clone())!=null?s:null,e.setDrawRange(t.drawRange.start,t.drawRange.count),e.userData=t.userData}function Q1e(t,e,n){const r=e.array,i=new r.constructor(r.length);for(let s=0;s<r.length;s++){const o=r[s];i[s]=n[o]}t.setIndex(new Qt(i,e.itemSize,e.normalized))}function z1(t,e,n){const r=t.constructor,i=new r(e.length*n);let s=!0;for(let o=0;o<e.length;o++){const l=e[o]*n,c=o*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 J1e(t){var e;const n=new Map,r=[];for(const[i,s]of Object.entries(t))if(s.isInterleavedBufferAttribute){const o=s,a=o.data,l=(e=n.get(a))!=null?e:[];n.set(a,l),l.push([i,o])}else{const o=s;r.push([i,o])}return[n,r]}function eSe(t,e,n){const[r,i]=J1e(e);for(const[s,o]of r){const a=s.array,{stride:l}=s,[c]=z1(a,n,l),d=new tp(c,l);d.setUsage(s.usage);for(const[f,p]of o){const{itemSize:y,offset:x,normalized:S}=p,w=new Dl(d,y,x,S);t.setAttribute(f,w)}}for(const[s,o]of i){const a=o.array,{itemSize:l,normalized:c}=o,[d]=z1(a,n,l);t.setAttribute(s,new Qt(d,l,c))}}function tSe(t){var e;const n=new Map,r=[];for(const[i,s]of Object.entries(t)){const o=i;for(let a=0;a<s.length;a++){const l=s[a];if(l.isInterleavedBufferAttribute){const c=l,d=c.data,f=(e=n.get(d))!=null?e:[];n.set(d,f),f.push([o,a,c])}else{const c=l;r.push([o,a,c])}}}return[n,r]}function nSe(t,e,n){var r,i;let s=!0;const[o,a]=tSe(e),l={};for(const[c,d]of o){const f=c.array,{stride:p}=c,[y,x]=z1(f,n,p);s=s&&x;const S=new tp(y,p);S.setUsage(c.usage);for(const[w,_,E]of d){const{itemSize:T,offset:P,normalized:O}=E,N=new Dl(S,T,P,O);(r=l[w])!=null||(l[w]=[]),l[w][_]=N}}for(const[c,d,f]of a){const p=f,y=p.array,{itemSize:x,normalized:S}=p,[w,_]=z1(y,n,x);s=s&&_,(i=l[c])!=null||(l[c]=[]),l[c][d]=new Qt(w,x,S)}t.morphAttributes=s?{}:l}function rSe(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 o=e.get(i);if(o!=null){r.geometry=o;return}const{isVertexUsed:a,vertexCount:l,verticesUsed:c}=K1e(i.attributes,s);if(c===l)return;const{originalIndexNewIndexMap:d,newIndexOriginalIndexMap:f}=Y1e(a),p=new Yt;Z1e(i,p),e.set(i,p),Q1e(p,s,d),eSe(p,i.attributes,f),nSe(p,i.morphAttributes,f),r.geometry=p}),Array.from(e.keys()).forEach(n=>{n.dispose()})}function iSe(t){var e;((e=t.meta)==null?void 0:e.metaVersion)==="0"&&(t.scene.rotation.y=Math.PI)}var Wc=class{constructor(){}};Wc.combineMorphs=U1e;Wc.combineSkeletons=j1e;Wc.deepDispose=X1e;Wc.removeUnnecessaryJoints=q1e;Wc.removeUnnecessaryVertices=rSe;Wc.rotateVRM0=iSe;/*!
|
||
* @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 sSe={leftUpperArm:[0,0,1.2],rightUpperArm:[0,0,-1.2],leftLowerArm:[0,-.2,0],rightLowerArm:[0,.2,0]};function Na(t,e,n,r,i){var o;const s=(o=t.humanoid)==null?void 0:o.getNormalizedBoneNode(e);s&&s.rotation.set(n,r,i)}function oSe(t){var e;for(const[n,r]of Object.entries(sSe))Na(t,n,r[0],r[1],r[2]);(e=t.humanoid)==null||e.update()}function aSe(t,e,n,r,i,s){const o=Math.sin(e*1.7),a=Math.sin(e*.45),l=Math.sin(e*.32),c=Math.min(1,n*1.4),d=Math.sin(e*1.3)*c*.06;Na(t,"hips",0,l*.045,l*.03),Na(t,"spine",o*.025+s*.07,a*.022,-l*.03),Na(t,"chest",o*.02+s*.02,a*.018,0),Na(t,"upperChest",o*.015,0,0),Na(t,"neck",i*.4+d*.5,r*.4,0),Na(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;Na(t,"leftUpperArm",0,0,1.18+f+l*.04),Na(t,"rightUpperArm",0,0,-1.18-f+l*.04),Na(t,"leftLowerArm",0,-.18-Math.sin(e*.8)*.03,0),Na(t,"rightLowerArm",0,.18+Math.sin(e*.8)*.03,0)}const lSe=["happy","angry","sad","surprised","relaxed"],cSe={neutral:null,happy:"happy",angry:"angry",sad:"sad",surprised:"surprised",relaxed:"relaxed"};function uSe({url:t,audioLevel:e,emotion:n,onError:r}){const[i,s]=R.useState(null),o=R.useRef({}),a=R.useRef({t:0,next:3,active:0}),l=R.useRef({yaw:0,pitch:0,tYaw:0,tPitch:0,t:0,next:2.5,lean:0});return R.useEffect(()=>{let c=!1,d=null;const f=new h_e;return f.register(p=>new L1e(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}Wc.removeUnnecessaryVertices(p.scene),((x=y.meta)==null?void 0:x.metaVersion)==="0"&&Wc.rotateVRM0(y),y.scene.rotation.y=Math.PI,oSe(y),d=y,s(y)},void 0,p=>{console.error("VRM-Load-Fehler:",p),r("Avatar konnte nicht geladen werden (CORS/URL?).")}),()=>{c=!0,d&&Wc.deepDispose(d.scene),s(null)}},[t,r]),wG((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),aSe(i,c.clock.elapsedTime,f,p.yaw,p.pitch,p.lean);const y=i.expressionManager;if(y){const S=(o.current.aa??0)*.4+f*.6;o.current.aa=S,y.setValue("aa",S);const w=cSe[n.current];for(const T of lSe){const P=w===T?.75:0,O=o.current[T]??0,N=O+(P-O)*Math.min(1,d*4);o.current[T]=N,y.setValue(T,N)}const _=a.current;_.t+=d,_.active<=0&&_.t>_.next&&(_.active=.16,_.t=0,_.next=3+Math.random()*4);let E=0;if(_.active>0){_.active-=d;const T=1-_.active/.16;E=1-Math.abs(T-.5)*2}y.setValue("blink",Math.max(0,E))}i.update(d)}),i?v.jsx("primitive",{object:i.scene}):null}function dSe({url:t,audioLevel:e,emotion:n}){const[r,i]=R.useState(null);return v.jsxs("div",{className:"relative h-full w-full",children:[v.jsxs(r_e,{camera:{position:[0,1.35,1.25],fov:30},gl:{alpha:!0,antialias:!0},style:{background:"transparent"},children:[v.jsx("ambientLight",{intensity:.85}),v.jsx("directionalLight",{position:[1,2,2],intensity:1.1}),v.jsx("directionalLight",{position:[-1,1,-1],intensity:.4}),v.jsx(uSe,{url:t,audioLevel:e,emotion:n,onError:i},t),v.jsx(f_e,{target:[0,1.3,0],enablePan:!1,minDistance:.7,maxDistance:3,minPolarAngle:Math.PI/3,maxPolarAngle:Math.PI/1.8})]}),r&&v.jsx("div",{className:"absolute inset-x-0 bottom-3 mx-auto w-fit rounded-md bg-red-500/15 border border-red-500/30 px-3 py-1.5 text-xs text-red-300",children:r})]})}const fSe=["elevenlabs","edge"],hSe={elevenlabs:"ElevenLabs (premium)",edge:"Edge (natürlich · gratis)"};function pSe(){const[t,e]=R.useState([]),[n,r]=R.useState(localStorage.getItem("mc_voice_engine")||"elevenlabs"),[i,s]=R.useState(localStorage.getItem("mc_voice_voice")||""),[o,a]=R.useState(!1),[l,c]=R.useState(()=>{const _=localStorage.getItem("mc_voice_volume");if(_===null||_==="")return .6;const E=Number(_);return Number.isNaN(E)?.6:E}),d=R.useRef(null),f=_=>{c(_),localStorage.setItem("mc_voice_volume",String(_)),window.dispatchEvent(new CustomEvent("mc-voice-volume",{detail:_}))},p=(_,E)=>{r(_),s(E),localStorage.setItem("mc_voice_engine",_),localStorage.setItem("mc_voice_voice",E)};R.useEffect(()=>{fetch("/api/voice/voices").then(_=>_.ok?_.json():Promise.reject()).then(_=>{const E=_.voices||[];if(e(E),!i){const T=E.find(P=>P.engine===n);T&&p(n,T.id)}}).catch(()=>e([]))},[]);const y=async()=>{var _;if(!o){a(!0);try{const E=await fetch("/api/voice/tts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:"Hallo! So klingt diese Stimme auf Deutsch.",engine:n,voice:i})});if(!E.ok)throw new Error(`TTS ${E.status}`);const T=URL.createObjectURL(await E.blob());(_=d.current)==null||_.pause();const P=new Audio(T);P.volume=Math.min(1,l),d.current=P,P.onended=()=>URL.revokeObjectURL(T),await P.play()}catch(E){console.error("Probe fehlgeschlagen:",E)}finally{a(!1)}}},x=_=>{const E=t.find(T=>T.engine===_);p(_,(E==null?void 0:E.id)||"")},S=t.filter(_=>_.engine===n),w=n==="elevenlabs"&&S.length===0;return v.jsxs("div",{className:"text-sm",children:[v.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[v.jsx(Vm,{className:"h-3.5 w-3.5"})," Stimme"]}),t.length===0?v.jsx("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-300",children:"Voice-Dienst nicht erreichbar — Stimmen werden geladen, sobald der Sidecar läuft."}):v.jsxs("div",{className:"space-y-2",children:[v.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:fSe.map(_=>v.jsx("button",{onClick:()=>x(_),className:`rounded-md border px-2.5 py-1.5 text-xs transition-colors ${n===_?"border-primary/50 bg-primary/10 text-primary":"border-border/40 hover:bg-accent"}`,children:hSe[_]},_))}),v.jsx("select",{value:i,onChange:_=>p(n,_.target.value),className:"w-full rounded-md border border-border/40 bg-background/40 px-2.5 py-2 text-xs outline-none focus:border-primary/50",children:S.map(_=>v.jsx("option",{value:_.id,children:_.label},_.id))}),v.jsxs("button",{onClick:y,disabled:o||w,className:"flex w-full items-center justify-center gap-2 rounded-md border border-primary/40 bg-primary/10 px-2.5 py-2 text-xs text-primary hover:bg-primary/20 transition-colors disabled:opacity-60",children:[o?v.jsx(G1,{className:"h-3.5 w-3.5 animate-spin"}):v.jsx(LT,{className:"h-3.5 w-3.5"}),o?"Spielt …":"Probe hören"]}),v.jsxs("div",{className:"flex items-center gap-2 pt-0.5",children:[v.jsx(LT,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),v.jsx("input",{type:"range",min:0,max:1.2,step:.05,value:l,onChange:_=>f(Number(_.target.value)),className:"h-1 flex-1 cursor-pointer accent-primary",title:"Lautstärke"}),v.jsxs("span",{className:"w-9 text-right text-[11px] tabular-nums text-muted-foreground",children:[Math.round(l*100),"%"]})]}),w&&v.jsxs("p",{className:"text-[11px] text-amber-300",children:["Keine ElevenLabs-Stimmen — Key in ",v.jsx("code",{children:"~/.hermes/.env"})," fehlt, oder keine eigene Stimme angelegt."]}),n==="edge"&&v.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Edge: native deutsche Stimmen, gratis & ohne Key. Cloud (Text → Microsoft)."})]})]})}function mSe(t){const[e,n]=R.useState(!1),r=R.useRef(null),i=R.useRef([]),s=R.useRef(null),o=R.useCallback(async()=>{if(r.current)return;let l;try{l=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(f){console.error("Mikrofon-Zugriff verweigert:",f);return}s.current=l;const c=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":"audio/webm",d=new MediaRecorder(l,{mimeType:c});i.current=[],d.ondataavailable=f=>{f.data.size&&i.current.push(f.data)},d.onstop=()=>{var 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]),a=R.useCallback(()=>{var l;(l=r.current)==null||l.stop()},[]);return R.useEffect(()=>()=>{var l,c;(l=r.current)==null||l.stop(),(c=s.current)==null||c.getTracks().forEach(d=>d.stop())},[]),{recording:e,start:o,stop:a}}class cN{constructor(){Gs(this,"ctx");Gs(this,"analyser");Gs(this,"gain");Gs(this,"queue",[]);Gs(this,"playing",!1);Gs(this,"raf",0);Gs(this,"freq");Gs(this,"level",{current:0});Gs(this,"onSpeaking");const e=window.AudioContext||window.webkitAudioContext;this.ctx=new e,this.analyser=this.ctx.createAnalyser(),this.analyser.fftSize=256,this.analyser.smoothingTimeConstant=.6,this.gain=this.ctx.createGain(),this.gain.gain.value=cN.readVolume(),this.analyser.connect(this.gain),this.gain.connect(this.ctx.destination),this.freq=new Uint8Array(new ArrayBuffer(this.analyser.frequencyBinCount)),window.addEventListener("mc-voice-volume",n=>{const r=Number(n.detail);Number.isNaN(r)||(this.gain.gain.value=Math.max(0,Math.min(1.5,r)))})}static readVolume(){const e=localStorage.getItem("mc_voice_volume");if(e===null||e==="")return .6;const n=Number(e);return Number.isNaN(n)?.6:Math.max(0,Math.min(1.5,n))}async enqueue(e){this.queue.push(e),this.playing||await this.playNext()}clear(){this.queue=[]}async playNext(){var i,s;const e=this.queue.shift();if(!e){this.playing=!1,this.stopMeter(),(i=this.onSpeaking)==null||i.call(this,!1);return}if(this.playing=!0,(s=this.onSpeaking)==null||s.call(this,!0),this.ctx.state==="suspended")try{await this.ctx.resume()}catch{}let n;try{n=await this.ctx.decodeAudioData(e.slice(0))}catch{return this.playNext()}const r=this.ctx.createBufferSource();r.buffer=n,r.connect(this.analyser),r.onended=()=>{this.playNext()},r.start(),this.startMeter()}startMeter(){cancelAnimationFrame(this.raf);const e=()=>{this.analyser.getByteFrequencyData(this.freq);const n=Math.min(this.freq.length,48);let r=0;for(let s=2;s<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 gSe=[["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 vSe(t){for(const[e,n]of gSe)if(n.test(t))return e;return"neutral"}const ySe="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 xSe(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 kj(){let t=localStorage.getItem("mc_voice_session");return t||(t="voice-"+Math.random().toString(36).slice(2)+Date.now().toString(36),localStorage.setItem("mc_voice_session",t)),t}function bSe(){return{engine:localStorage.getItem("mc_voice_engine")||"elevenlabs",voice:localStorage.getItem("mc_voice_voice")||""}}function _Se(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 wSe(){const[t,e]=R.useState("idle"),[n,r]=R.useState([]),[i,s]=R.useState(null),o=R.useRef({current:0}),a=R.useRef("neutral"),l=R.useRef(null),c=R.useRef(kj()),d=R.useCallback(()=>{if(!l.current){const E=new cN;E.onSpeaking=T=>e(P=>T?"speaking":P==="speaking"?"idle":P),l.current=E,o.current=E.level}return l.current},[]),f=R.useCallback(async E=>{var ee,te,he,se;s(null);const T=d();T.clear(),e("transcribing");let P="";try{const fe=new FormData;fe.append("audio",E,"rec.webm");const B=await fetch("/api/voice/stt",{method:"POST",body:fe});if(!B.ok)throw new Error(`STT ${B.status}`);P=((ee=(await B.json()).text)==null?void 0:ee.trim())||""}catch(fe){e("error"),s(`Spracherkennung fehlgeschlagen: ${fe.message}`);return}if(!P){e("idle");return}r(fe=>[...fe,{role:"user",text:P}]),e("thinking");const{engine:O,voice:N}=bSe();let D="",z="";r(fe=>[...fe,{role:"assistant",text:""}]);let G=Promise.resolve(),k=!1,j=!1;const H=fe=>{const B=xSe(fe);B&&(G=G.then(async()=>{try{const J=await fetch("/api/voice/tts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:B,engine:O,voice:N})});if(!J.ok)throw new Error(`TTS ${J.status}`);await T.enqueue(await J.arrayBuffer()),k=!0}catch(J){j=!0,console.error("TTS-Fehler:",J)}}))};try{const fe=await fetch("/api/voice/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:P,session_id:c.current,system:ySe})});if(!fe.ok||!fe.body)throw new Error(`Agent ${fe.status}`);const B=fe.body.getReader(),J=new TextDecoder;let Y="";for(;;){const{done:V,value:q}=await B.read();if(V)break;Y+=J.decode(q,{stream:!0});const pe=Y.split(`
|
||
|
||
`);Y=pe.pop()||"";for(const ae of pe){const ce=ae.split(`
|
||
`).find(We=>We.startsWith("data:"));if(!ce)continue;const Se=ce.slice(5).trim();if(Se==="[DONE]")continue;let Ee;try{Ee=JSON.parse(Se)}catch{continue}if(Ee.error)throw new Error(Ee.error);const $e=((se=(he=(te=Ee.choices)==null?void 0:te[0])==null?void 0:he.delta)==null?void 0:se.content)||"";if(!$e)continue;D+=$e,z+=$e,a.current=vSe(D),r(We=>{const ue=We.slice();return ue[ue.length-1]={role:"assistant",text:D},ue});const{sentences:Me,rest:Ge}=_Se(z);z=Ge,Me.forEach(H)}}if(z.trim()&&H(z),await G,!D.trim()){e("idle");return}k||(e("error"),s(j?"Sprachausgabe fehlgeschlagen — Engine/Stimme prüfen.":"Keine Sprachausgabe erzeugt."))}catch(fe){e("error"),s(`Agent-Antwort fehlgeschlagen: ${fe.message}`)}},[d]),{recording:p,start:y,stop:x}=mSe(f),S=R.useCallback(()=>{d(),e("listening"),y()},[d,y]),w=R.useCallback(()=>{x()},[x]),_=R.useCallback(()=>{var E;(E=l.current)==null||E.clear(),r([]),s(null),e("idle"),localStorage.removeItem("mc_voice_session"),c.current=kj()},[]);return R.useEffect(()=>{!p&&t==="listening"&&e("transcribing")},[p,t]),{status:t,messages:n,error:i,recording:p,audioLevel:o,emotion:a,pressStart:S,pressEnd:w,reset:_}}const SSe="/avatar.vrm";function MSe(t){return t.split(/(\*\*[^*\n]+\*\*)/g).map((e,n)=>{const r=e.match(/^\*\*([^*]+)\*\*$/);return r?v.jsx("strong",{className:"font-semibold text-foreground",children:r[1]},n):v.jsx("span",{children:e},n)})}function ESe(){return v.jsx("span",{className:"inline-flex items-center gap-1 align-middle",children:[0,1,2].map(t=>v.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-muted-foreground",style:{animationDelay:`${t*.15}s`}},t))})}const ASe={idle:"Bereit — halte zum Sprechen",listening:"Höre zu …",transcribing:"Verstehe …",thinking:"Hermes denkt …",speaking:"Hermes spricht …",error:"Fehler"};function TSe(){const{status:t,messages:e,error:n,recording:r,audioLevel:i,emotion:s,pressStart:o,pressEnd:a,reset:l}=wSe(),c=R.useRef(!1),d=R.useRef(null);R.useEffect(()=>{var y;(y=d.current)==null||y.scrollIntoView({behavior:"smooth",block:"end"})},[e]),R.useEffect(()=>{const y=w=>w instanceof HTMLElement&&/^(INPUT|TEXTAREA|SELECT)$/.test(w.tagName),x=w=>{w.code!=="Space"||w.repeat||c.current||y(w.target)||(w.preventDefault(),c.current=!0,o())},S=w=>{w.code!=="Space"||!c.current||(w.preventDefault(),c.current=!1,a())};return window.addEventListener("keydown",x),window.addEventListener("keyup",S),()=>{window.removeEventListener("keydown",x),window.removeEventListener("keyup",S)}},[o,a]);const f=t==="speaking",p=t==="transcribing"||t==="thinking";return v.jsxs("div",{className:"flex h-full gap-5",children:[v.jsxs("div",{className:"relative flex min-w-0 flex-1 flex-col rounded-xl border border-border/40 bg-card/30 overflow-hidden",children:[v.jsx("div",{className:"flex-1 min-h-0",children:v.jsx(dSe,{url:SSe,audioLevel:i,emotion:s})}),v.jsxs("div",{className:"shrink-0 flex flex-col items-center gap-3 border-t border-border/40 bg-background/30 py-5 backdrop-blur-sm",children:[v.jsxs("div",{className:nt("flex items-center gap-2 text-sm",t==="error"?"text-red-400":f?"text-primary":"text-muted-foreground"),children:[p&&v.jsx(G1,{className:"h-4 w-4 animate-spin"}),f&&v.jsx(LT,{className:"h-4 w-4 animate-pulse"}),v.jsx("span",{children:n||ASe[t]})]}),v.jsx("button",{onPointerDown:y=>{y.preventDefault(),c.current=!0,o()},onPointerUp:()=>{c.current&&(c.current=!1,a())},onPointerLeave:()=>{c.current&&(c.current=!1,a())},className:nt("flex h-20 w-20 items-center justify-center rounded-full border-2 transition-all select-none touch-none",r?"border-red-500 bg-red-500/20 scale-110 shadow-lg shadow-red-500/30":"border-primary/60 bg-primary/15 hover:bg-primary/25 hover:scale-105"),title:"Gedrückt halten zum Sprechen (oder Leertaste halten)",children:v.jsx(uF,{className:nt("h-8 w-8",r?"text-red-400":"text-primary")})}),v.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Halten zum Sprechen · ",v.jsx("kbd",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:"Leertaste"})," geht auch"]})]})]}),v.jsxs("div",{className:"flex w-80 shrink-0 flex-col gap-4",children:[v.jsx("div",{className:"rounded-xl border border-border/40 bg-card/40 p-4",children:v.jsx(pSe,{})}),v.jsxs("div",{className:"flex min-h-0 flex-1 flex-col rounded-xl border border-border/40 bg-card/40",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/40 px-4 py-2.5",children:[v.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Gespräch"}),v.jsx("button",{onClick:l,className:"text-muted-foreground hover:text-foreground",title:"Neues Gespräch",children:v.jsx(dF,{className:"h-3.5 w-3.5"})})]}),v.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto p-4 scrollbar-thin",children:[e.length===0&&v.jsx("p",{className:"text-xs text-muted-foreground",children:"Halte den Knopf (oder die Leertaste) und sprich. Hermes hört zu, denkt mit seinem vollen Gedächtnis und seinen Werkzeugen — und antwortet hörbar."}),e.map((y,x)=>v.jsxs("div",{className:nt("flex flex-col gap-1",y.role==="user"?"items-end":"items-start"),children:[v.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:y.role==="user"?"Du":"Hermes"}),v.jsx("div",{className:nt("max-w-[88%] whitespace-pre-wrap break-words rounded-2xl px-3 py-2 text-sm leading-relaxed",y.role==="user"?"rounded-br-sm bg-primary/15 text-foreground":"rounded-bl-sm border border-border/40 bg-background/40 text-foreground/90"),children:y.text?MSe(y.text):v.jsx(ESe,{})})]},x)),v.jsx("div",{ref:d})]})]})]})]})}const Oj=[{id:"grundlagen",label:"Grundlagen"},{id:"moe",label:"MoE & Quant"},{id:"lokal",label:"Lokal betreiben"},{id:"modelle",label:"Modell-Landschaft"},{id:"gateway",label:"Gateway-Trick"},{id:"mcp",label:"MCP"},{id:"skills",label:"Skills"},{id:"memory",label:"Gedächtnis & RAG"},{id:"agents",label:"Agenten"},{id:"ide",label:"IDE anbinden"},{id:"tricks",label:"Tricks & Kniffe"},{id:"wartung",label:"Sicherheit & Wartung"},{id:"ressourcen",label:"Ressourcen"},{id:"troubleshooting",label:"Troubleshooting"}];function PSe(t){var e;(e=document.getElementById(t))==null||e.scrollIntoView({behavior:"smooth",block:"start"})}function mo({id:t,icon:e,color:n,title:r,kicker:i,children:s,wide:o}){return v.jsxs("section",{id:t,className:nt("scroll-mt-20 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-3",o&&"md:col-span-2"),children:[v.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[v.jsx(e,{className:nt("h-5 w-5 shrink-0",n)}),v.jsxs("div",{children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:r}),i&&v.jsx("span",{className:nt("text-[9px] font-mono",n),children:i})]})]}),v.jsx("div",{className:"text-xs text-muted-foreground space-y-2.5 leading-relaxed",children:s})]})}function Gf({children:t}){return v.jsxs("div",{className:"mt-1 rounded-xl border border-primary/25 bg-primary/[0.06] p-3 text-[11px] leading-relaxed",children:[v.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-primary mb-1",children:[v.jsx(Vm,{className:"h-3 w-3"})," Bei dir konkret"]}),v.jsx("div",{className:"text-muted-foreground space-y-1",children:t})]})}function hn({children:t}){return v.jsx("code",{className:"rounded bg-background/40 border border-border/30 px-1.5 py-0.5 font-mono text-[10px] text-foreground",children:t})}function Lr({href:t,name:e,note:n}){return v.jsxs("li",{className:"leading-relaxed",children:[v.jsxs("a",{href:t,target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold inline-flex items-center gap-0.5",children:[e,v.jsx(_8,{className:"h-3 w-3 opacity-60"})]}),v.jsxs("span",{className:"text-muted-foreground",children:[" — ",n]})]})}function CSe(){const[t,e]=R.useState(!1);return v.jsxs("div",{className:"space-y-7",children:[v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 flex items-start gap-4",children:[v.jsx("div",{className:"h-11 w-11 rounded-xl bg-primary/15 flex items-center justify-center shrink-0",children:v.jsx(PT,{className:"h-6 w-6 text-primary"})}),v.jsxs("div",{className:"space-y-1",children:[v.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Die AI-Bibel"}),v.jsxs("p",{className:"text-sm text-muted-foreground leading-relaxed max-w-2xl",children:["Allgemeines Nachschlagewerk für lokale & agentische AI — Konzepte, Tricks, Kniffe und kuratierte Quellen. ",v.jsx("span",{className:"font-semibold text-foreground",children:"Stand Juni 2026."})," ","Das meiste gilt überall; ",v.jsx("span",{className:"text-primary font-semibold",children:'„Bei dir konkret"'}),"-Kästen zeigen, was dein Stack daraus macht."]})]})]}),v.jsx("div",{className:"sticky top-0 z-10 -mx-1 px-1",children:v.jsx("div",{className:"rounded-xl border border-border/50 bg-card/70 backdrop-blur-xl p-2 shadow-lg shadow-black/20",children:v.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[v.jsx(CT,{className:"h-3.5 w-3.5 text-primary ml-1 mr-0.5 shrink-0"}),(t?Oj:Oj.slice(0,9)).map(n=>v.jsx("button",{onClick:()=>PSe(n.id),className:"rounded-lg px-2.5 py-1 text-[11px] font-semibold text-muted-foreground hover:text-primary hover:bg-primary/10 transition-colors cursor-pointer",children:n.label},n.id)),v.jsx("button",{onClick:()=>e(n=>!n),className:"rounded-lg px-2 py-1 text-[11px] font-semibold text-primary hover:bg-primary/10 transition-colors cursor-pointer",children:t?"weniger":"+ mehr"})]})})}),v.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[v.jsxs(mo,{id:"grundlagen",icon:Sd,color:"text-cyan-400",title:"1. Wie LLMs ticken",kicker:"Grundlagen",children:[v.jsxs("p",{children:["Ein LLM ist im Kern ein ",v.jsx("strong",{children:"Wahrscheinlichkeits-Rechner für das nächste Token"}),' (Wortteil). Es „weiß" nichts — es setzt fort, was statistisch am plausibelsten ist. Daraus folgt fast alles andere.']}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Tokens"})," sind die Einheit — ~¾ Wort. Ein- und Ausgabe werden in Tokens gezählt."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Kontextfenster"}),' = wie viele Tokens das Modell gleichzeitig „sehen" kann (Prompt + Antwort). Voll = Anfang fällt raus.']}),v.jsxs("li",{children:[v.jsx("strong",{children:"Parameter"})," = die trainierten Gewichte. Training ist einmalig, ",v.jsx("strong",{children:"Inferenz"})," ist jede Antwort."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Temperatur / Sampling"})," steuert Zufall: niedrig = deterministisch/präzise (Code), hoch = kreativ."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Halluzination"})," ist kein Bug, sondern die Kehrseite des Ratens. Gegenmittel: Grounding via Tools/RAG, Verifikation."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Reasoning-/Thinking-Modelle"}),' „denken" in unsichtbaren Tokens vor der Antwort — besser bei Logik, langsamer/teurer.']})]})]}),v.jsxs(mo,{id:"moe",icon:_C,color:"text-violet-400",title:"2. MoE & Quantisierung",kicker:"Mehr Modell, weniger Last",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Mixture of Experts (MoE):"})," Statt für jedes Token das ganze Netz zu aktivieren, wählt ein",v.jsx("em",{children:" Router"})," nur ein paar spezialisierte ",v.jsx("em",{children:"Experts"}),' aus. So läuft ein 100B-Modell mit der aktiven Rechenlast eines viel kleineren (z.B. „122B total / 10B aktiv").']}),v.jsxs("p",{children:[v.jsx("strong",{children:"Quantisierung:"})," Gewichte von FP16 auf weniger Bits eindampfen — kleiner & schneller bei minimalem Qualitätsverlust. Faustregel:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(hn,{children:"Q8"})," nahezu verlustfrei, größter Footprint"]}),v.jsxs("li",{children:[v.jsx(hn,{children:"Q6_K"})," sehr gut, guter Mittelweg"]}),v.jsxs("li",{children:[v.jsx(hn,{children:"Q4_K_M"})," der Sweet-Spot für lokal — viel Modell pro GB"]})]}),v.jsxs(Gf,{children:["VRAM/RAM ist die harte Grenze — ",v.jsx("strong",{children:"darum"})," ist beides hier zentral: MoE lässt 100B+ überhaupt laufen, Quant entscheidet, was reinpasst. Dein Line-up fährt durchweg ",v.jsx(hn,{children:"Q4_K_M"}),"/",v.jsx(hn,{children:"Q6_K"}),"."]})]}),v.jsxs(mo,{id:"lokal",icon:tw,color:"text-emerald-400",title:"3. Lokal betreiben: Engines & Backends",kicker:"llama.cpp, vLLM & Co.",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Inference-Engines"})," — was die Modelle ausführt:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"llama.cpp / GGUF"})," — der De-facto-Standard für lokal, CPU+GPU, läuft überall."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Ollama / LM Studio"})," — bequeme Wrapper mit One-Click-Downloads (LM Studio mit GUI)."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"vLLM / TGI"})," — Server-Engines für maximalen Durchsatz auf dicken GPUs."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"llama-swap"})," — Proxy, der ",v.jsx("em",{children:"mehrere"})," Modelle hinter ",v.jsx("em",{children:"einem"})," Port hält und je nach Anfrage automatisch ein-/aussattelt."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"GPU-Backends"})," — wie gerechnet wird:"]}),v.jsx("ul",{className:"list-disc pl-4 space-y-1",children:v.jsxs("li",{children:[v.jsx(hn,{children:"CUDA"})," NVIDIA · ",v.jsx(hn,{children:"ROCm"})," AMD · ",v.jsx(hn,{children:"Vulkan"})," herstellerübergreifend · ",v.jsx(hn,{children:"Metal"})," Apple"]})}),v.jsxs("p",{className:"pt-1",children:[v.jsx("strong",{children:"Begriffe, die immer wiederkommen:"})," Kontext (",v.jsx(hn,{children:"-c"}),"), Slots/Parallel, KV-Cache, Modell-TTL/Swap, ",v.jsx("strong",{children:"Speculative Decoding"})," (kleines Draft-Modell rät voraus → schneller)."]})]})]}),v.jsxs(Gf,{children:["Deine Box hat eine AMD-APU (gfx1151). ",v.jsx("strong",{children:"Einschränkung & Trick:"})," dort schlägt ",v.jsx(hn,{children:"Vulkan/RADV"})," das offizielle ",v.jsx(hn,{children:"ROCm"})," bei Token-Generierung um ~12–22 % — darum läuft die Engine auf Vulkan.",v.jsx(hn,{children:"llama-swap"})," hält die Alltags-Hirne dauerwarm; ",v.jsx(hn,{children:"coder"})," nutzt Spec-Decoding."]})]}),v.jsxs(mo,{id:"modelle",icon:ew,color:"text-sky-400",title:"4. Modell-Landschaft",kicker:"Stand Juni 2026",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsx("p",{children:v.jsx("strong",{children:"Open-Weight (lokal nutzbar):"})}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Qwen"})," (Alibaba) — starke Allrounder + Coder + Vision, viele Größen/MoE."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Llama"})," (Meta), ",v.jsx("strong",{children:"Gemma"})," (Google), ",v.jsx("strong",{children:"Phi"})," (Microsoft) — solide Open-Familien."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"DeepSeek"}),", ",v.jsx("strong",{children:"Mistral/Mixtral"})," — kräftige MoE-/Reasoning-Modelle."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("p",{children:v.jsx("strong",{children:"Frontier (Cloud-API):"})}),v.jsx("ul",{className:"list-disc pl-4 space-y-1",children:v.jsxs("li",{children:[v.jsx("strong",{children:"Claude"})," (Anthropic), ",v.jsx("strong",{children:"GPT"})," (OpenAI), ",v.jsx("strong",{children:"Gemini"})," (Google) — die stärksten Allrounder, aber nicht lokal."]})}),v.jsxs("p",{className:"pt-1",children:[v.jsx("strong",{children:"Modellwahl nach Aufgabe:"})," schnelles Alltags-Hirn · großes Logik-Hirn für harte Tasks · dediziertes Code-Modell · multimodal für Bilder · Embedding-Modell fürs Gedächtnis."]})]})]}),v.jsx("p",{className:"text-[11px] italic",children:'Leaderboards (HF, LMArena) sind grobe Orientierung — der einzige Benchmark, der zählt, ist deine eigene Aufgabe. Vorsicht vor „Benchmaxxing".'}),v.jsxs(Gf,{children:["Dein Line-up via llama-swap: ",v.jsx(hn,{children:"fast"})," (Alltag/Vision/MoE) · ",v.jsx(hn,{children:"heavy"})," (schwere Logik) ·",v.jsx(hn,{children:"coder"})," · ",v.jsx(hn,{children:"scout"})," · ",v.jsx(hn,{children:"vision"})," · ",v.jsx(hn,{children:"embed"})," (fürs Gedächtnis) ·",v.jsx(hn,{children:"hermes"})," (Agent-Hirn). Verwalten/tauschen im ",v.jsx("strong",{children:"Modell-Manager"}),"-Tab."]})]}),v.jsxs(mo,{id:"gateway",icon:K8,color:"text-amber-400",title:"5. Der Gateway-Trick",kicker:"OpenAI-kompatibel = überall andocken",children:[v.jsxs("p",{children:["Fast jedes AI-Tool spricht heute das ",v.jsx("strong",{children:"OpenAI-Format"})," (",v.jsx(hn,{children:"/v1/chat/completions"}),"). Ein",v.jsx("strong",{children:" Gateway"})," davor gibt dir ",v.jsx("em",{children:"einen"})," Endpunkt für alles: zentrales Key-Management, Logging und transparentes ",v.jsx("strong",{children:"Routing"})," — der Client merkt nicht, welches Modell tatsächlich antwortet."]}),v.jsxs("p",{children:["Die ",v.jsx(hn,{children:"model:auto"}),'-Idee: du sagst „auto", das Gateway wählt das passende Modell je nach Anfrage und lädt es bei Bedarf.']}),v.jsxs(Gf,{children:["Dein Gateway: ",v.jsx(hn,{children:"http://192.168.178.151:9001/v1"}),", Model ",v.jsx(hn,{children:"auto"}),", API-Key beliebig. Fertige Configs erzeugt dir der ",v.jsx("strong",{children:"Verbinden"}),"-Tab live — eine Wahrheit, kein Abtippen."]})]}),v.jsxs(mo,{id:"mcp",icon:IT,color:"text-violet-400",title:"6. MCP — Werkzeuge für Agenten",kicker:"USB-C für AI-Tools",children:[v.jsxs("p",{children:["Das ",v.jsx("strong",{children:"Model Context Protocol"})," (offen, von Anthropic initiiert) standardisiert, wie ein AI-Client mit externen Tools & Datenquellen spricht. Ein ",v.jsx("strong",{children:"MCP-Server"})," bringt Fähigkeiten: Dateien, Web-Fetch, Git, Datenbanken, eigene APIs."]}),v.jsx("p",{children:"Statt für jeden Editor eigene Tools zu schreiben, bindet jeder MCP-fähige Agent denselben Server an."}),v.jsxs("div",{className:"flex items-start gap-1.5 rounded-xl border border-amber-500/25 bg-amber-500/[0.06] p-2.5 text-[11px]",children:[v.jsx(W8,{className:"h-3.5 w-3.5 text-amber-400 shrink-0 mt-0.5"}),v.jsxs("span",{children:[v.jsx("strong",{children:"Sicherheit:"})," ein MCP-Server hat echten Zugriff (Dateien, Shell). Nur vertrauenswürdige Server laufen lassen, Rechte minimal halten, Quelle prüfen."]})]})]}),v.jsxs(mo,{id:"skills",icon:J8,color:"text-emerald-400",title:"7. Agent Skills",kicker:"Wiederverwendbare Fähigkeiten",children:[v.jsxs("p",{children:["Ein ",v.jsx("strong",{children:"Skill"})," ist ein Ordner mit einer ",v.jsx(hn,{children:"SKILL.md"})," (YAML-Kopf + Anleitung, optional Skripte/Beispiele), den der Agent für eine bestimmte Aufgabe lädt — z.B. TDD, Code-Vereinfachung, API-Design."]}),v.jsx("pre",{className:"p-2.5 bg-background/25 rounded-lg border border-border/30 font-mono text-[9px] text-foreground overflow-x-auto whitespace-pre",children:`---
|
||
name: tdd-pro
|
||
description: Treibt Entwicklung mit strikter TDD-Praxis
|
||
---
|
||
# Instructions
|
||
...`}),v.jsxs("p",{children:["Suchen & installieren über die ",v.jsx("strong",{children:"skills.sh"}),"-Registry: ",v.jsx(hn,{children:"npx skills find"})," /",v.jsx(hn,{children:"npx skills add owner/repo"}),". Skills liegen projektweit (vom Agent beim Start gelesen) oder global."]})]}),v.jsxs(mo,{id:"memory",icon:O8,color:"text-indigo-400",title:"8. Gedächtnis & RAG",kicker:"Modelle vergessen — du nicht",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:["LLMs sind ",v.jsx("strong",{children:"zustandslos"}),": ohne Hilfe weiß das Modell beim nächsten Turn nichts mehr. Gedächtnis lebt extern."]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Embeddings"})," wandeln Text in Vektoren; ein ",v.jsx("strong",{children:"Vektor-Store"})," (Chroma, …) findet semantisch Ähnliches."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"RAG"})," = relevante Fakten vor dem Turn heraussuchen und einblenden statt alles im Prompt zu halten."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Long-Context vs. RAG:"}),' riesige Fenster sind bequem, aber teuer & „lost in the middle" — gezieltes Abrufen skaliert besser.']})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Auto-lernendes Gedächtnis"})," ist die nächste Stufe:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:["extrahiert Fakten ",v.jsx("em",{children:"selbst"})," aus Gesprächen, statt nur abzuspeichern"]}),v.jsx("li",{children:"dedupliziert semantisch (kein 10× derselbe Fakt)"}),v.jsxs("li",{children:[v.jsx("strong",{children:"Graph-Sicht"})," = Fakten ",v.jsx("em",{children:"plus"})," ihre Beziehungen, nicht nur eine flache Liste"]})]})]})]}),v.jsxs(Gf,{children:["Dein Gedächtnis (Tab ",v.jsx("strong",{children:"Gedächtnis"}),") ist ",v.jsx("strong",{children:"Mem0"}),"-basiert: auto-lernend & semantisch, ",v.jsx("strong",{children:"graph-first"})," dargestellt, mit 4-Typen-Taxonomie (",v.jsx(hn,{children:"Identität"})," · ",v.jsx(hn,{children:"Wissen"})," · ",v.jsx(hn,{children:"Regeln"})," · ",v.jsx(hn,{children:"Ereignisse"}),"). Einstieg über ein kurzes ",v.jsx("strong",{children:"Hermes-Onboarding-Gespräch"})," im Terminal — der Agent lernt im Hintergrund nach jedem Turn.",v.jsx("br",{}),v.jsx("strong",{children:"Gotcha:"})," ein gelöschter Fakt kann wieder auftauchen, solange die Original-Nachricht noch im Verlauf steht (additive Extraktion)."]})]}),v.jsxs(mo,{id:"agents",icon:$c,color:"text-rose-400",title:"9. Autonome Agenten betreiben",kicker:"LLM in der Schleife",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:["Ein ",v.jsx("strong",{children:"Agent"})," ist ein LLM in einer Schleife mit Tools:",v.jsx("em",{children:" denken → Tool aufrufen → Ergebnis beobachten → weiter"}),", bis das Ziel erreicht ist."]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Guardrails"})," (Hard-Stop, Tool-Limits) verhindern Endlos-Loops, wenn ein Tool fehlt oder hängt."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Kontext-Hygiene"})," ist die wichtigste Disziplin: frische Sessions starten — vollgemüllte Historien werden langsam, driften und halluzinieren."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Kanäle:"})," CLI/Terminal, Chat-UI, Messaging (z.B. Telegram), reine API."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Least Privilege:"})," gib einem Agenten nur die Tools, die er wirklich braucht. Kritische Aktionen (Shell auf dem Host, Löschen, Geld/Deploys) hinter menschliche Freigabe."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Was sich vollautomatisch lohnt:"})," Modell-Routing, Hintergrund-Gedächtnis, Recherche. ",v.jsx("strong",{children:"Was Freigabe braucht:"})," Systembefehle, Updates/Reboots, permanentes Löschen."]})]})]}),v.jsxs(Gf,{children:[v.jsx("strong",{children:"Hermes"})," ist dein Box-Agent (Hirn = ",v.jsx(hn,{children:"fast"}),"). Reden tust du mit ihm im",v.jsx("strong",{children:" Terminal"}),"-Tab (Web-Terminal via ttyd) oder per ",v.jsx("strong",{children:"Telegram"}),". Er hat MCP-Server für Gedächtnis, Stack-Steuerung, Web-Fetch und ",v.jsx("strong",{children:"PC-Steuerung"})," (Executor auf deinem Windows-PC). Status & Verdrahtung im ",v.jsx("strong",{children:"Hermes"}),"-Tab."]})]}),v.jsxs(mo,{id:"ide",icon:lF,color:"text-cyan-400",title:"10. IDE / Editor anbinden",kicker:"Vibe-Coding lokal",children:[v.jsxs("p",{children:["Jede ",v.jsx("strong",{children:"OpenAI-kompatible"})," IDE oder Extension lässt sich auf einen lokalen Server umbiegen — Base-URL + Model eintragen, fertig:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Cline"})," & ",v.jsx("strong",{children:"Roo Code"})," (VS-Code-Extensions, voller Agent + MCP)"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Cursor"})," (VS-Code-Fork mit Top-Autocomplete)"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Continue"}),", ",v.jsx("strong",{children:"aider"})," (CLI), ",v.jsx("strong",{children:"OpenCode"})," (Desktop)"]})]}),v.jsxs(Gf,{children:["Tipp den Kram nicht ab: der ",v.jsx("strong",{children:"Verbinden"}),"-Tab generiert die fertige Config (inkl. MCP-Gedächtnis) pro Tool zum Kopieren. Essenz: Base ",v.jsx(hn,{children:"…:9001/v1"}),", Model ",v.jsx(hn,{children:"auto"}),", Key beliebig."]})]}),v.jsx(mo,{id:"tricks",icon:V8,color:"text-amber-400",title:"11. Tricks & Kniffe",kicker:"Was im Alltag wirklich spart",wide:!0,children:v.jsx("div",{className:"grid md:grid-cols-3 gap-3",children:[["Kontext sauber halten","Neue Session statt Mega-Historie. Drift, Tempo und Halluzination hängen direkt am Kontext-Müll."],["Plan-then-Act","Erst Plan/Vorgehen bestätigen lassen, dann ausführen. Spart teure Holzwege."],["Gezielte Edits","Nie ganze Dateien überschreiben für eine Zeile — Such-/Ersetz-Tools nutzen. Weniger Tokens, weniger Fehler."],["Non-interaktive Befehle","Keine interaktiven Prompts im Agent-Terminal; lange Tasks als Background-Job. Sonst hängt der Loop."],["DevTools koppeln","Browser-/Konsolen-Zugriff geben — der Agent liest echte Fehler statt blind zu raten."],["Richtige Modellwahl","Schnelles Hirn für Alltag, großes für harte Logik, Coder fürs Coden. Nicht alles mit der Kanone."],["Akzeptanzkriterien","Sag konkret, woran „fertig“ erkennbar ist. Vage Prompts → vage Ergebnisse."],["Verifizieren statt vertrauen","Tests/Live-Check fordern. „Sollte funktionieren“ ist kein Beweis."],["Regeln ins Gedächtnis","Wiederkehrende Vorlieben/Konventionen einmal ablegen — der Agent zieht sie selbst."]].map(([n,r])=>v.jsxs("div",{className:"space-y-1 p-3 bg-background/10 rounded-xl border border-border/30",children:[v.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-foreground text-[11px]",children:[v.jsx(_h,{className:"h-3 w-3 text-amber-400"})," ",n]}),v.jsx("p",{className:"text-[11px]",children:r})]},n))})}),v.jsx(mo,{id:"wartung",icon:Ym,color:"text-emerald-400",title:"12. Sicherheit & Wartung",kicker:"Damit's auch morgen noch läuft",wide:!0,children:v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{className:"flex items-center gap-1.5 font-bold text-foreground",children:[v.jsx(cF,{className:"h-3.5 w-3.5 text-emerald-400"})," Goldene Regeln"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Ein ungetesteter Restore ist kein Backup."})," Wiederherstellung mindestens einmal echt durchspielen."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Updates können Dinge still zerschießen"})," — gerade bei AI-Stacks (Embeddings, Provider-Interna). Versionen pinnen, Smoke-Test, Post-Check."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Least Privilege"})," für Agenten, MCP-Server und PC-Zugriff. Kritisches hinter Freigabe."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{className:"flex items-center gap-1.5 font-bold text-foreground",children:[v.jsx(SC,{className:"h-3.5 w-3.5 text-emerald-400"})," Bei dir im SystemDrawer"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Backup:"})," tägliches Voll-Zustands-Backup, getesteter ",v.jsx(hn,{children:"restore.sh"})," (Doku in ",v.jsx(hn,{children:"docs/BACKUP.md"}),")."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Updates:"})," git-basierter Update-Check; ",v.jsx("strong",{children:"Hermes-Update-Button"})," mit anschließendem ",v.jsx("strong",{children:"Gehirn-Check"})," (rot, falls das Update das Gedächtnis zerschießt) + Engine-Update."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Dienste & Gefahrenzone:"})," Restart/Logs pro Dienst, kritische Eingriffe getrennt."]})]}),v.jsx("p",{className:"text-[10px] italic",children:'Erreichbar über das System-Icon → Tab „Wartung".'})]})]})}),v.jsxs("section",{id:"ressourcen",className:"scroll-mt-20 md:col-span-2 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[v.jsx(CT,{className:"h-5 w-5 text-primary"}),v.jsxs("div",{children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"13. Kuratierte Ressourcen & Links"}),v.jsx("span",{className:"text-[9px] font-mono text-primary",children:"Sauber geordnet — die guten Quellen"})]})]}),v.jsxs("div",{className:"grid md:grid-cols-2 gap-5 text-xs",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(ew,{className:"h-3.5 w-3.5 text-sky-400"})," Modelle & Engines"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Lr,{href:"https://huggingface.co/models",name:"Hugging Face",note:"das Repository für offene Modelle (GGUF, Embeddings, Datasets)."}),v.jsx(Lr,{href:"https://github.com/ggml-org/llama.cpp",name:"llama.cpp",note:"die Referenz-Engine für lokale Inferenz."}),v.jsx(Lr,{href:"https://github.com/mostlygeek/llama-swap",name:"llama-swap",note:"mehrere Modelle hinter einem Port, Auto-Swap."}),v.jsx(Lr,{href:"https://ollama.com",name:"Ollama",note:"einfachster Einstieg, One-Command-Modelle."}),v.jsx(Lr,{href:"https://lmstudio.ai",name:"LM Studio",note:"lokale GUI zum Stöbern, Laden & Chatten."}),v.jsx(Lr,{href:"https://github.com/vllm-project/vllm",name:"vLLM",note:"Hochdurchsatz-Serving auf dicken GPUs."})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(IT,{className:"h-3.5 w-3.5 text-violet-400"})," MCP & Skills"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Lr,{href:"https://modelcontextprotocol.io",name:"MCP — offizielle Doku",note:"Spezifikation & Einstieg."}),v.jsx(Lr,{href:"https://github.com/modelcontextprotocol/servers",name:"Offizielle MCP-Server",note:"filesystem, git, postgres, fetch & mehr."}),v.jsx(Lr,{href:"https://smithery.ai",name:"Smithery",note:"Registry zum Suchen & Auto-Installieren von MCP-Servern."}),v.jsx(Lr,{href:"https://glama.ai/mcp/servers",name:"Glama MCP Registry",note:"kuratierte Community-Datenbank."}),v.jsx(Lr,{href:"https://skills.sh",name:"skills.sh",note:"Registry & CLI für Agent-Skills."})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx($c,{className:"h-3.5 w-3.5 text-rose-400"})," Agenten & Frameworks"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Lr,{href:"https://github.com/NousResearch/hermes-agent",name:"Hermes Agent (Nous)",note:"der Agent, der auf deiner Box läuft."}),v.jsx(Lr,{href:"https://docs.claude.com",name:"Anthropic / Claude Docs",note:"API, Tool-Use, Agent SDK, MCP."}),v.jsx(Lr,{href:"https://github.com/cline/cline",name:"Cline",note:"autonomer Coding-Agent für VS Code."}),v.jsx(Lr,{href:"https://aider.chat",name:"aider",note:"AI-Pair-Programming im Terminal, git-nativ."}),v.jsx(Lr,{href:"https://continue.dev",name:"Continue",note:"Open-Source-Autopilot für IDEs."})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(PT,{className:"h-3.5 w-3.5 text-amber-400"})," Lernen & Community"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Lr,{href:"https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview",name:"Prompt-Engineering (Anthropic)",note:"die beste praktische Anleitung."}),v.jsx(Lr,{href:"https://github.com/anthropics/anthropic-cookbook",name:"Anthropic Cookbook",note:"lauffähige Rezepte für Tools, RAG, Agenten."}),v.jsx(Lr,{href:"https://www.promptingguide.ai",name:"Prompt Engineering Guide",note:"herstellerneutrales Nachschlagewerk."}),v.jsx(Lr,{href:"https://github.com/mem0ai/mem0",name:"Mem0",note:"die auto-lernende Memory-Schicht hinter deinem Gedächtnis."}),v.jsx(Lr,{href:"https://www.reddit.com/r/LocalLLaMA/",name:"r/LocalLLaMA",note:"der Puls der lokalen-LLM-Szene."})]})]})]})]}),v.jsx(mo,{id:"troubleshooting",icon:H8,color:"text-rose-400",title:"14. Troubleshooting",kicker:"Wenn's hakt",wide:!0,children:v.jsxs("ul",{className:"space-y-2 list-disc pl-4",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Keine Verbindung?"})," Selbes LAN wie die Box? IP/Port stimmen (",v.jsx(hn,{children:":9001"}),")? Backend-Status in der ",v.jsx("strong",{children:"Zentrale"})," prüfen."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Modell antwortet nicht / langsam?"})," In der ",v.jsx("strong",{children:"Zentrale → Dienste"})," schauen, ob ",v.jsx(hn,{children:"llama-swap"})," grün ist; sonst Restart. Erstes Token nach Swap dauert (Modell lädt)."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Agent dreht durch / halluziniert?"})," Frische Session im ",v.jsx("strong",{children:"Terminal"})," starten — meist ist es vollgemüllter Kontext."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Gedächtnis findet nichts?"})," Embedding-Dienst online? Semantisch suchen (Sinn statt exaktem Wort). Leeres Gedächtnis → Hermes-Onboarding starten."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Update hat etwas zerschossen?"})," Genau dafür gibt es Backup & ",v.jsx(hn,{children:"restore.sh"})," — den getesteten Restore fahren, dann Ursache suchen."]})]})})]}),v.jsx("p",{className:"text-center text-[10px] text-muted-foreground/50 pt-2",children:"Mission Control 2 · AI-Bibel · Stand Juni 2026 — lebendes Dokument, wächst mit dem Stack."})]})}function RSe({title:t,hint:e}){return v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"text-xl font-semibold",children:t}),v.jsx("p",{className:"text-sm text-muted-foreground",children:e})]}),v.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed border-border bg-card/50 py-20 text-center",children:[v.jsx(k8,{className:"h-8 w-8 text-muted-foreground"}),v.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const Lj=[{id:"mission-control-2",label:"Mission Control",type:"user",reach:"gateway (integr"},{id:"hermes-gateway",label:"Hermes Gateway",type:"user",reach:"hermes-gateway"},{id:"mem0-service",label:"Mem0 (Gedächtnis)",type:"user",reach:"mem0"},{id:"hermes-terminal",label:"Hermes Terminal",type:"user",reach:"hermes-terminal"},{id:"llama-swap",label:"Llama Swap",type:"system",reach:"llama-swap"}];function j0({icon:t,iconClass:e,name:n,status:r,available:i,busy:s,actionLabel:o,onAction:a}){return v.jsxs("div",{className:nt("flex items-center gap-3 rounded-lg border px-3 py-2",i?"border-amber-500/30 bg-amber-500/5":"border-border/50 bg-background/20"),children:[v.jsx(t,{className:nt("h-4 w-4 shrink-0",e)}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-xs text-foreground truncate",children:n}),v.jsx("div",{className:nt("text-[10px] truncate",i?"text-amber-400/90":"text-muted-foreground"),children:r})]}),v.jsx("button",{onClick:a,disabled:!i||s,className:nt("text-[11px] font-semibold rounded-lg px-2.5 py-1 transition-colors shrink-0",i?"bg-primary text-primary-foreground hover:opacity-90 cursor-pointer":"border border-border/50 text-muted-foreground/40 cursor-default"),children:s?"…":o})]})}function NSe({label:t,ok:e,system:n,busy:r,onRestart:i,onLogs:s}){return v.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-border/50 bg-background/20 px-3 py-2",children:[v.jsx("span",{className:nt("w-1.5 h-1.5 rounded-full shrink-0",e===!0?"bg-emerald-500":e===!1?"bg-red-500":"bg-muted-foreground/40")}),v.jsxs("span",{className:"flex-1 text-xs text-foreground truncate",children:[t,n&&v.jsx("span",{className:"text-[9px] text-muted-foreground",children:" (root)"})]}),v.jsx("button",{onClick:i,disabled:r,title:"Neu starten",className:"text-muted-foreground hover:text-primary transition-colors disabled:opacity-50",children:v.jsx(Qf,{className:nt("h-3.5 w-3.5",r&&"animate-spin")})}),v.jsx("button",{onClick:s,title:"Logs ansehen",className:"text-muted-foreground hover:text-primary transition-colors",children:v.jsx(L8,{className:"h-3.5 w-3.5"})})]})}function hT(t){return t==null?"":t>1024**3?`${(t/1024**3).toFixed(2)} GB`:`${(t/1024**2).toFixed(1)} MB`}function ISe({open:t,onClose:e,defaultTab:n="maintenance"}){var Ke;const[r,i]=R.useState(null),[s,o]=R.useState([]),[a,l]=R.useState("llama-swap"),[c,d]=R.useState(""),[f,p]=R.useState(!1),[y,x]=R.useState(null),[S,w]=R.useState({}),[_,E]=R.useState("maintenance"),[T,P]=R.useState(!1),[O,N]=R.useState(""),[D,z]=R.useState(!1),[G,k]=R.useState(null),[j,H]=R.useState([]),[ee,te]=R.useState(!1),[he,se]=R.useState(null),[fe,B]=R.useState(null);function J(ne,et,Mt){B({type:"alert",title:ne,message:et,onConfirm:()=>{B(null),Mt&&Mt()}})}function Y(ne,et,Mt){B({type:"confirm",title:ne,message:et,onConfirm:()=>{B(null),Mt()},onCancel:()=>B(null)})}function V(ne){return ne?new Date(ne*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}const[q,pe]=R.useState(""),[ae,ce]=R.useState(""),[Se,Ee]=R.useState(!1),[$e,Me]=R.useState(!1);R.useEffect(()=>{t&&(pe(localStorage.getItem("mc_sudo_password")||""),ce(localStorage.getItem("mc_hf_token")||""))},[t]),R.useEffect(()=>{t&&n&&E(n)},[t,n]);const Ge=R.useRef(null);function We(){It("/api/maintenance/updates").then(i).catch(ne=>console.error("Error loading updates",ne))}function ue(){It("/api/jobs").then(ne=>o(ne.jobs||[])).catch(ne=>console.error("Error loading jobs",ne))}function Z(){It("/api/system/services").then(k).catch(()=>{})}function Ve(){It("/api/system/backups").then(ne=>H(ne.backups||[])).catch(()=>{})}function Le(ne){p(!0),x(null),It(`/api/maintenance/logs?service=${ne}&lines=150`).then(et=>{et.ok?d(et.text):(d(`Fehler beim Laden der Logs: ${et.err||"Unbekannter Fehler"}`),(et.status==="incorrect_password"||et.status==="password_required")&&x(et.status))}).catch(et=>d(`Fehler: ${et.message}`)).finally(()=>{p(!1),setTimeout(()=>{Ge.current&&(Ge.current.scrollTop=Ge.current.scrollHeight)},50)})}R.useEffect(()=>{if(!t)return;We(),ue(),Z(),Ve();const ne=setInterval(()=>{ue(),We(),Z()},3e3);return()=>clearInterval(ne)},[t]),R.useEffect(()=>{!t||_!=="logs"||Le(a)},[t,_,a]);function re(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.`),ue(),!0):!1}async function Ce(){try{const ne=await It("/api/maintenance/os-update",{method:"POST"});if(re(ne))return;ue(),E("maintenance")}catch(ne){J("Fehler",`Fehler beim Starten des OS-Updates: ${ne.message}`)}}async function qe(){try{const ne=await It("/api/maintenance/engine-update",{method:"POST"});if(re(ne))return;ue(),E("maintenance")}catch(ne){J("Fehler",`Fehler beim Engine-Update: ${ne.message}`)}}async function Ze(){try{const ne=await It("/api/maintenance/swap-update",{method:"POST"});if(re(ne))return;ue(),E("maintenance")}catch(ne){J("Fehler",`Fehler beim Router-Update: ${ne.message}`)}}async function Q(){te(!0);try{const ne=await It("/api/maintenance/hermes-update",{method:"POST"});if(re(ne))return;ue()}catch(ne){J("Fehler",`Hermes-Update fehlgeschlagen: ${ne.message}`)}finally{te(!1)}}async function W(ne){se({kind:ne,loading:!0,data:null});try{const et=await It(`/api/maintenance/update-details?kind=${ne}`);se({kind:ne,loading:!1,data:et})}catch(et){se({kind:ne,loading:!1,data:{kind:ne,error:et.message}})}}function be(){const ne=he==null?void 0:he.kind;se(null),ne==="os"?Ce():ne==="engine"?qe():ne==="swap"?Ze():ne==="hermes"&&Q()}async function Ue(){P(!0);try{await It("/api/maintenance/check-updates",{method:"POST"}),ue(),E("maintenance")}catch(ne){J("Fehler",`Fehler bei der Update-Suche: ${ne.message}`)}finally{P(!1)}}async function ze(ne,et){try{await It("/api/models/install",{method:"POST",body:JSON.stringify({repo:ne,role:et})}),J("Gestartet",`Modell-Upgrade für '${et}' (${ne}) gestartet.`),ue(),E("maintenance")}catch(Mt){J("Fehler",`Fehler beim Starten des Modell-Upgrades: ${Mt.message}`)}}async function Fe(){Y("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await It("/api/maintenance/reboot",{method:"POST"}),J("Reboot","Reboot ausgelöst. System startet neu...",()=>{e()})}catch(ne){J("Fehler",`Fehler beim Reboot: ${ne.message}`)}})}async function bt(){z(!0),N("Snapshot wird erzeugt...");try{const ne=await It("/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{z(!1)}}async function rt(ne){w(et=>({...et,[ne]:!0}));try{const et=await It("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:ne})});et.ok?J("Dienst neu gestartet",`Dienst ${ne} wurde erfolgreich neu gestartet.`,()=>{_==="logs"&&a===ne&&Le(ne)}):J("Fehler",`Fehler beim Neustart: ${et.err||"Unbekannter Fehler"}`)}catch(et){J("Fehler",`Fehler beim Neustart: ${et.message}`)}finally{w(et=>({...et,[ne]:!1}))}}async function ft(ne){try{await It(`/api/jobs/${ne}/cancel`,{method:"POST"}),ue()}catch(et){J("Fehler",`Fehler beim Abbrechen: ${et.message}`)}}const Xt=s.find(ne=>(ne.state==="running"||ne.state==="queued")&&ne.group==="maintenance");return v.jsxs(v.Fragment,{children:[v.jsx("div",{className:nt("fixed inset-0 bg-black/60 backdrop-blur-sm z-50 transition-opacity duration-300",t?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:e}),v.jsxs("div",{className:nt("fixed inset-y-0 right-0 w-full sm:w-[640px] bg-card/85 backdrop-blur-xl border-l border-border/60 shadow-2xl z-50 flex flex-col transform transition-transform duration-300 ease-in-out font-sans text-foreground",t?"translate-x-0":"translate-x-full"),children:[v.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(Sd,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),v.jsx("button",{onClick:e,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border/40 text-muted-foreground hover:bg-accent transition-colors",children:v.jsx(Md,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[v.jsx("button",{onClick:()=>E("maintenance"),className:nt("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),v.jsx("button",{onClick:()=>E("logs"),className:nt("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),v.jsx("button",{onClick:()=>E("settings"),className:nt("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),v.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[_==="maintenance"&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"space-y-2.5",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Updates"}),v.jsxs("button",{onClick:Ue,disabled:T||!!Xt,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[v.jsx(Qf,{className:nt("h-3 w-3",T&&"animate-spin")})," Nach Updates suchen"]})]}),(r==null?void 0:r.last_check)&&v.jsxs("div",{className:"text-[9px] text-muted-foreground -mt-1",children:["Zuletzt gesucht: ",V(r.last_check)]}),Xt&&v.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-300",children:[v.jsx(Qf,{className:"h-3.5 w-3.5 shrink-0 animate-spin"}),v.jsxs("span",{children:["Update läuft: ",v.jsx("span",{className:"font-semibold",children:Xt.label})," — bitte warten. Weitere Updates sind solange gesperrt."]})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsx(j0,{icon:Ym,iconClass:"text-cyan-400",name:"OS-Pakete (apt)",available:!!(r!=null&&r.os),status:r!=null&&r.os?`${r.os} verfügbar`:"aktuell",actionLabel:"Anzeigen",onAction:()=>W("os")}),v.jsx(j0,{icon:tw,iconClass:"text-violet-400",name:"Inferenz-Engine (llama.cpp)",available:!!(r!=null&&r.engine),status:r!=null&&r.engine?"Update verfügbar":"aktuell",actionLabel:"Anzeigen",onAction:()=>W("engine")}),v.jsx(j0,{icon:uI,iconClass:"text-fuchsia-400",name:"Router (llama-swap)",available:!!(r!=null&&r.swap),status:r!=null&&r.swap?"Update verfügbar":"aktuell",actionLabel:"Anzeigen",onAction:()=>W("swap")}),(()=>{var et;const ne=(et=r==null?void 0:r.components)==null?void 0:et.find(Mt=>Mt.key==="hermes_agent");return v.jsx(j0,{icon:$c,iconClass:"text-amber-400",name:"Hermes-Agent",available:(ne==null?void 0:ne.update)===!0,busy:ee,status:(ne==null?void 0:ne.update)===!0?`Update: ${ne.latest}`:(ne==null?void 0:ne.reachable)===!1?"offline":"aktuell",actionLabel:"Anzeigen",onAction:()=>W("hermes")})})(),(Ke=r==null?void 0:r.model_list)==null?void 0:Ke.map(ne=>v.jsx(j0,{icon:w8,iconClass:"text-emerald-400",name:`Modell · ${ne.role}`,available:!0,status:ne.title,actionLabel:"Upgrade",onAction:()=>ze(ne.repo,ne.role)},ne.role))]})]}),v.jsxs("div",{className:"space-y-2.5",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Dienste"}),v.jsx("div",{className:"space-y-1.5",children:Lj.map(ne=>{var et;return v.jsx(NSe,{label:ne.label,system:ne.type==="system",ok:(et=G==null?void 0:G.services.find(Mt=>Mt.name.toLowerCase().includes(ne.reach)))==null?void 0:et.ok,busy:S[ne.id],onRestart:()=>rt(ne.id),onLogs:()=>{l(ne.id),E("logs")}},ne.id)})})]}),v.jsxs("div",{className:"space-y-2.5",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Backup"}),v.jsxs("div",{className:"rounded-lg border border-border/50 bg-background/20 px-3 py-2.5 flex items-center gap-3",children:[v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-xs text-foreground truncate",children:j[0]?`Letztes: ${j[0].snapshot}`:"Noch kein Backup"}),v.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[j.length," Snapshots · Restore per CLI (restore.sh)"]})]}),v.jsxs("button",{onClick:bt,disabled:D,className:"flex items-center gap-1.5 text-[11px] font-semibold rounded-lg px-2.5 py-1 bg-primary text-primary-foreground hover:opacity-90 transition-all cursor-pointer disabled:opacity-50 shrink-0",children:[v.jsx(S8,{className:nt("h-3.5 w-3.5",D&&"animate-pulse")})," Snapshot"]})]}),O&&v.jsx("div",{className:"text-[10px] font-mono text-primary bg-primary/5 p-2 rounded-lg border border-primary/20 break-all leading-normal",children:O})]}),v.jsxs("div",{className:"space-y-2.5",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-red-400/80",children:"Gefahrenzone"}),v.jsxs("button",{onClick:Fe,className:"flex w-full items-center gap-3 p-3 rounded-lg border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 text-red-400 transition-all text-left text-xs font-semibold",children:[v.jsx(Q8,{className:"h-4.5 w-4.5"}),v.jsxs("div",{children:[v.jsx("div",{children:"Host-System neu starten"}),v.jsx("div",{className:"text-[10px] text-red-400/80 font-normal",children:"Startet die ganze Box neu"})]})]})]}),v.jsxs("div",{className:"space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),v.jsxs("span",{className:"text-[10px] font-mono bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:[s.filter(ne=>ne.state==="running"||ne.state==="queued").length," Aktiv"]})]}),v.jsx("div",{className:"space-y-3",children:s.length===0?v.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-xl p-6 text-center",children:"Aktuell keine aktiven Hintergrund-Jobs."}):s.map(ne=>{const et=ne.state==="running"||ne.state==="queued";return v.jsxs("div",{className:nt("p-3 rounded-xl border transition-all duration-300",et?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[v.jsxs("div",{className:"flex items-start justify-between gap-3",children:[v.jsxs("div",{className:"space-y-1",children:[v.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[et&&v.jsxs("span",{className:"flex h-2 w-2 relative",children:[v.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),v.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),ne.label]}),v.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[v.jsxs("span",{children:["ID: ",ne.id]}),v.jsx("span",{children:"•"}),v.jsx("span",{className:nt(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})]})]}),et&&v.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"&&v.jsxs("div",{className:"mt-3 space-y-1",children:[v.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:v.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${ne.progress??0}%`}})}),v.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[v.jsxs("span",{children:[ne.progress??0,"%"]}),ne.done_bytes!=null&&ne.total_bytes!=null&&v.jsxs("span",{children:[hT(ne.done_bytes)," / ",hT(ne.total_bytes),ne.rate_bps!=null&&` (${hT(ne.rate_bps)}/s)`]}),ne.eta_s!=null&&v.jsxs("span",{children:["ETA: ",ne.eta_s,"s"]})]})]})]},ne.id)})})]})]}),_==="logs"&&v.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("select",{value:a,onChange:ne=>l(ne.target.value),className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none text-foreground font-semibold",children:Lj.map(ne=>v.jsxs("option",{value:ne.id,children:[ne.label," (",ne.type==="system"?"systemd-root":"user",")"]},ne.id))}),v.jsxs("button",{onClick:()=>rt(a),disabled:S[a],className:"flex h-9 px-3 items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-background/20 hover:border-primary/50 transition-colors disabled:opacity-50",title:"Dienst neu starten",children:[v.jsx(Qf,{className:nt("h-3.5 w-3.5",S[a]&&"animate-spin")}),"Restart"]})]}),v.jsxs("div",{className:"flex-1 flex flex-col min-h-[300px] border border-border/60 bg-black/50 rounded-xl overflow-hidden shadow-inner",children:[v.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[v.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[v.jsx(hF,{className:"h-3 w-3 text-primary"}),v.jsxs("span",{children:["stdout/stderr - ",a]})]}),v.jsx("button",{onClick:()=>Le(a),disabled:f,className:"text-muted-foreground hover:text-foreground transition-colors",children:v.jsx(Qf,{className:nt("h-3 w-3",f&&"animate-spin")})})]}),v.jsx("pre",{ref:Ge,className:"flex-1 p-4 overflow-y-auto text-[10px] font-mono text-cyan-300/90 whitespace-pre-wrap select-text leading-relaxed scrollbar-thin",children:y==="password_required"||y==="incorrect_password"?v.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[v.jsx(bg,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),v.jsx("div",{className:"text-xs font-semibold text-amber-300",children:y==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),v.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",a," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),v.jsx("button",{onClick:()=>E("settings"),className:"px-3 py-1.5 text-[10px] font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-md transition-colors mt-2",children:"Sudo-Passwort eintragen"})]}):f&&!c?v.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):c||v.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),_==="settings"&&v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),v.jsx("p",{className:"text-[10px] text-muted-foreground leading-normal",children:"Diese Daten werden ausschließlich lokal in deinem Browser (localStorage) gespeichert und bei Bedarf an das Backend übertragen."})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[v.jsx(Ym,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),v.jsxs("div",{className:"relative",children:[v.jsx("input",{type:Se?"text":"password",value:q,onChange:ne=>pe(ne.target.value),placeholder:"Sudo-Passwort für System-Operationen",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),v.jsx("button",{type:"button",onClick:()=>Ee(!Se),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Se?v.jsx(aI,{className:"h-4 w-4"}):v.jsx(NT,{className:"h-4 w-4"})})]}),v.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Wird benötigt für systemd-Dienste (Llama Swap logs/restart), OS-Update (apt) und Reboot."})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[v.jsx(F8,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),v.jsxs("div",{className:"relative",children:[v.jsx("input",{type:$e?"text":"password",value:ae,onChange:ne=>ce(ne.target.value),placeholder:"hf_...",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),v.jsx("button",{type:"button",onClick:()=>Me(!$e),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:$e?v.jsx(aI,{className:"h-4 w-4"}):v.jsx(NT,{className:"h-4 w-4"})})]}),v.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Erlaubt das Herunterladen von geschützten oder Gate-restricted Modellen direkt über Mission Control."})]}),v.jsxs("div",{className:"flex gap-3 pt-2",children:[v.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",q),localStorage.setItem("mc_hf_token",ae),J("Erfolgreich","Einstellungen erfolgreich lokal gespeichert.")},className:"flex-1 h-9 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/90 rounded-lg transition-colors shadow shadow-primary/10 cursor-pointer",children:"Speichern"}),v.jsx("button",{onClick:()=>{pe(""),ce(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),J("Gelöscht","Zugangsdaten gelöscht.")},className:"h-9 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Zurücksetzen"})]})]})]})]}),he&&(()=>{var Zt;const ne=he.data,et={os:{icon:Ym,cls:"text-cyan-400",title:"OS-Pakete (apt)"},engine:{icon:tw,cls:"text-violet-400",title:"Inferenz-Engine (llama.cpp)"},swap:{icon:uI,cls:"text-fuchsia-400",title:"Router (llama-swap)"},hermes:{icon:$c,cls:"text-amber-400",title:"Hermes-Agent"}}[he.kind],Mt=et.icon,vt=ne?he.kind==="os"?(ne.count??0)===0:he.kind==="hermes"?(ne.behind??0)===0:ne.installed_build!=null&&ne.latest_build!=null&&ne.latest_build<=ne.installed_build:!0;return v.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4",children:[v.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:()=>se(null)}),v.jsxs("div",{className:"relative w-full max-w-lg max-h-[80vh] flex flex-col rounded-2xl border border-border/60 bg-card shadow-2xl font-sans text-foreground",children:[v.jsxs("div",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-5",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(Mt,{className:nt("h-4.5 w-4.5",et.cls)}),v.jsx("h3",{className:"text-sm font-semibold",children:et.title})]}),v.jsx("button",{onClick:()=>se(null),className:"flex h-7 w-7 items-center justify-center rounded-lg border border-border/40 text-muted-foreground hover:bg-accent transition-colors",children:v.jsx(Md,{className:"h-4 w-4"})})]}),v.jsx("div",{className:"flex-1 overflow-y-auto p-5 text-xs space-y-3 scrollbar-thin",children:he.loading?v.jsxs("div",{className:"flex h-24 items-center justify-center gap-2 text-muted-foreground",children:[v.jsx(Qf,{className:"h-4 w-4 animate-spin"})," Details werden geladen…"]}):ne!=null&&ne.error?v.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/5 p-3 text-red-400",children:ne.error}):he.kind==="os"?((ne==null?void 0:ne.count)??0)===0?v.jsx("div",{className:"text-muted-foreground",children:"Keine Pakete zu aktualisieren — System ist aktuell."}):v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"text-muted-foreground",children:[ne.count," Paket(e) werden aktualisiert:"]}),v.jsx("div",{className:"space-y-1",children:ne.packages.map(de=>v.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-border/40 bg-background/30 px-2.5 py-1.5",children:[v.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-[11px] truncate",children:[v.jsx(Y8,{className:"h-3 w-3 text-cyan-400 shrink-0"}),de.name]}),v.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] text-muted-foreground shrink-0",children:[v.jsx("span",{children:de.current}),v.jsx(J_,{className:"h-3 w-3"}),v.jsx("span",{className:"text-emerald-400",children:de.candidate})]})]},de.name))})]}):he.kind==="engine"||he.kind==="swap"?v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"flex items-center gap-2 font-mono text-[11px]",children:[v.jsxs("span",{className:"rounded-md border border-border/40 bg-background/30 px-2 py-1",children:["Build ",(ne==null?void 0:ne.installed_build)??"?"]}),v.jsx(J_,{className:"h-3.5 w-3.5 text-muted-foreground"}),v.jsxs("span",{className:"rounded-md border border-emerald-500/30 bg-emerald-500/5 px-2 py-1 text-emerald-400",children:["Build ",(ne==null?void 0:ne.latest_build)??"?"]})]}),((ne==null?void 0:ne.name)||(ne==null?void 0:ne.latest_tag))&&v.jsxs("div",{className:"text-muted-foreground",children:["Release: ",v.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)&&v.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 ",v.jsx(xg,{className:"h-3 w-3"})]}),(ne==null?void 0:ne.body)&&v.jsx("pre",{className:"whitespace-pre-wrap rounded-lg border border-border/40 bg-background/30 p-3 text-[10px] leading-relaxed text-muted-foreground max-h-60 overflow-y-auto scrollbar-thin",children:ne.body})]}):(((Zt=ne==null?void 0:ne.commits)==null?void 0:Zt.length)??0)===0?v.jsx("div",{className:"text-muted-foreground",children:"Keine neuen Commits — Hermes-Agent ist bereits aktuell."}):v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"text-muted-foreground",children:[ne.behind," neue Commit(s) auf ",v.jsxs("span",{className:"font-mono text-foreground",children:["origin/",ne.branch]}),":"]}),v.jsx("div",{className:"space-y-1",children:ne.commits.map(de=>v.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border/40 bg-background/30 px-2.5 py-1.5",children:[v.jsx(U8,{className:"h-3.5 w-3.5 text-primary shrink-0 mt-0.5"}),v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"text-[11px] truncate",children:de.subject}),v.jsxs("div",{className:"font-mono text-[9px] text-muted-foreground",children:[de.hash," · ",de.when]})]})]},de.hash))}),v.jsx("p",{className:"text-[10px] text-muted-foreground leading-normal",children:"Vor dem Update wird automatisch ein Backup erstellt; danach startet der Hermes-Gateway neu."})]})}),v.jsxs("div",{className:"flex gap-3 border-t border-border/40 p-4 shrink-0",children:[v.jsx("button",{onClick:()=>se(null),className:"h-9 flex-1 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold text-muted-foreground hover:bg-accent transition-colors cursor-pointer",children:"Schließen"}),v.jsx("button",{onClick:be,disabled:he.loading||vt||!!Xt,title:Xt?`Update läuft bereits: ${Xt.label}`:void 0,className:"h-9 flex-1 rounded-lg bg-primary text-xs font-semibold text-primary-foreground hover:opacity-90 transition-all cursor-pointer disabled:opacity-40 disabled:cursor-default",children:Xt?"Update läuft…":"Jetzt aktualisieren"})]})]})]})})(),fe&&v.jsx(hV,{type:fe.type,title:fe.title,message:fe.message,onConfirm:fe.onConfirm,onCancel:fe.onCancel})]})}function kSe(){var f,p,y,x,S;k7();const[t,e]=R.useState("dashboard"),[n,r]=R.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[i,s]=R.useState(!1),[o,a]=R.useState("maintenance"),{data:l}=y7(),{data:c}=Y1(2e4);R.useEffect(()=>{document.documentElement.classList.add("dark")},[]),R.useEffect(()=>{const w=_=>{var T;a(((T=_.detail)==null?void 0:T.tab)||"maintenance"),s(!0)};return window.addEventListener("open-system-drawer",w),()=>window.removeEventListener("open-system-drawer",w)},[]),R.useEffect(()=>{const w=_=>{var T;const E=(T=_.detail)==null?void 0:T.view;E&&e(E)};return window.addEventListener("mc-navigate",w),()=>window.removeEventListener("mc-navigate",w)},[]);const d=DT.find(w=>w.id===t);return v.jsxs("div",{className:"flex h-full relative",children:[v.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[v.jsx("div",{className:"absolute inset-0 opacity-35 animate-aurora bg-gradient-to-tr from-teal-500/20 via-indigo-500/15 to-purple-500/20 blur-[130px]"}),v.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),v.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),v.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),v.jsx(p7,{onNavigate:e}),v.jsx(ISe,{open:i,onClose:()=>s(!1),defaultTab:o}),v.jsxs("aside",{className:nt("flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",n?"w-16":"w-60"),children:[v.jsxs("div",{className:nt("flex items-center py-4 border-b border-border/40 shrink-0",n?"flex-col gap-3 px-2":"justify-between px-5"),children:[v.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[v.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!n&&v.jsxs("div",{className:"leading-tight",children:[v.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),v.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),v.jsx("button",{onClick:()=>{r(w=>{const _=!w;return localStorage.setItem("mc_sidebar_collapsed",_.toString()),_})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:n?"Maximieren":"Minimieren",children:n?v.jsx(aF,{className:"h-4 w-4"}):v.jsx(E8,{className:"h-4 w-4"})})]}),v.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:DT.map(w=>v.jsxs("button",{onClick:()=>e(w.id),className:nt("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",n?"justify-center p-2.5":"gap-3 px-3 py-2",t===w.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:n?w.label:void 0,children:[v.jsx(w.icon,{className:"h-4.5 w-4.5 shrink-0"}),!n&&v.jsx("span",{className:"truncate",children:w.label})]},w.id))}),v.jsx("div",{className:nt("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",n?"px-2 text-center":"px-5"),children:n?v.jsx("div",{className:"flex justify-center",children:v.jsx("span",{className:nt("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",l?l.engine_reachable?l.brain&&!l.brain.ready?"bg-amber-500 animate-pulse":"bg-emerald-500 animate-pulse":"bg-amber-500":"bg-red-500"),title:l?l.engine_reachable?l.brain&&!l.brain.ready?`Hirn offline (${l.brain.model??"fast"})`:"Engine + Hirn online":"Engine offline":"Backend offline"})}):v.jsxs("div",{className:"space-y-2 text-left",children:[l?v.jsxs(v.Fragment,{children:[v.jsxs("span",{className:"flex items-center gap-2",children:[v.jsx("span",{className:nt("h-2 w-2 rounded-full animate-pulse",l.engine_reachable?"bg-emerald-500":"bg-amber-500")}),v.jsxs("span",{className:"truncate",children:["Engine ",l.engine_reachable?"online":"offline"]})]}),l.brain&&!l.brain.ready&&v.jsxs("span",{className:"flex items-center gap-2 text-amber-400",title:`Agent-Hirn '${l.brain.model??"fast"}' lädt nicht/abgestürzt`,children:[v.jsx("span",{className:"h-2 w-2 rounded-full bg-amber-500 animate-pulse"}),v.jsxs("span",{className:"truncate",children:["Hirn offline",l.brain.model?` (${l.brain.model})`:""]})]})]}):v.jsxs("span",{className:"flex items-center gap-2",children:[v.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",v.jsx("span",{className:"truncate",children:"Backend offline"})]}),(c==null?void 0:c.versions)&&v.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[v.jsxs("div",{className:"truncate",title:c.versions.mc2?`${c.versions.mc2.branch}-${c.versions.mc2.hash}${c.versions.mc2.dirty?"*":""} (${c.versions.mc2.date})`:"nicht gefunden",children:[v.jsx("strong",{children:"MC2:"})," ",c.versions.mc2?`${c.versions.mc2.hash}${c.versions.mc2.dirty?"*":""}`:"—"]}),v.jsxs("div",{className:"truncate",title:((f=c.versions.engine)==null?void 0:f.type)==="git"?`${c.versions.engine.branch}-${c.versions.engine.hash}${c.versions.engine.dirty?"*":""} (${c.versions.engine.date})`:((p=c.versions.engine)==null?void 0:p.version_text)||"unbekannt",children:[v.jsx("strong",{children:"Engine:"})," ",((y=c.versions.engine)==null?void 0:y.type)==="git"?`${c.versions.engine.hash}${c.versions.engine.dirty?"*":""}`:((S=(x=c.versions.engine)==null?void 0:x.version_text)==null?void 0:S.split(" ").pop())||"—"]}),v.jsxs("div",{className:"truncate",title:c.versions.hermes_ui?`${c.versions.hermes_ui.branch}-${c.versions.hermes_ui.hash}${c.versions.hermes_ui.dirty?"*":""} (${c.versions.hermes_ui.date})`:"nicht gefunden",children:[v.jsx("strong",{children:"Hermes UI:"})," ",c.versions.hermes_ui?`${c.versions.hermes_ui.hash}${c.versions.hermes_ui.dirty?"*":""}`:"—"]}),v.jsxs("div",{className:"truncate",title:c.versions.hermes_agent?`${c.versions.hermes_agent.branch}-${c.versions.hermes_agent.hash}${c.versions.hermes_agent.dirty?"*":""} (${c.versions.hermes_agent.date})`:"nicht gefunden",children:[v.jsx("strong",{children:"Hermes Agent:"})," ",c.versions.hermes_agent?`${c.versions.hermes_agent.hash}${c.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),v.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[v.jsxs("header",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-6 bg-card/20 backdrop-blur-sm",children:[v.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:d.hint}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("a",{href:"https://git.tobisniceshomelab.ddnsfree.com/Hitonabi/mission-control-v2/src/branch/main/docs/BEDIENUNG.md",target:"_blank",rel:"noopener",className:"flex h-8 items-center rounded-md border border-border/40 bg-background/40 px-2.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer font-semibold",title:"Bedien-Anleitung",children:"Hilfe"}),v.jsxs("button",{onClick:()=>{const w=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(w)},className:"flex items-center gap-2 rounded-md border border-border/40 bg-background/40 px-2.5 py-1.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer",children:[v.jsx(I8,{className:"h-3.5 w-3.5"}),v.jsx("span",{children:"Suchen"}),v.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),v.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[t==="dashboard"&&v.jsx(zfe,{}),t==="models"&&v.jsx(Yfe,{}),t==="connect"&&v.jsx(Qfe,{}),t==="memory"&&v.jsx(she,{}),t==="agent"&&v.jsx(ahe,{}),t==="terminal"&&v.jsx(lhe,{}),t==="voice"&&v.jsx(TSe,{}),t==="guide"&&v.jsx(CSe,{}),!["dashboard","models","connect","memory","agent","terminal","voice","guide"].includes(t)&&v.jsx(RSe,{title:d.label,hint:d.hint})]})]})]})}const OSe=new s8({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});kW.createRoot(document.getElementById("root")).render(v.jsx($j.StrictMode,{children:v.jsx(o8,{client:OSe,children:v.jsx(kSe,{})})}));export{Qf as R,Vm as S,OT as T,n9 as a,B1 as g,v as j,R as r};
|