@shmulikdav/solix 1.9.2 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();function Fv(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Bv={exports:{}},dd={},zv={exports:{}},Ke={};/**
1
+ (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();function Bv(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var zv={exports:{}},hd={},Vv={exports:{}},Ke={};/**
2
2
  * @license React
3
3
  * react.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var wl=Symbol.for("react.element"),Mw=Symbol.for("react.portal"),ww=Symbol.for("react.fragment"),bw=Symbol.for("react.strict_mode"),Ew=Symbol.for("react.profiler"),Tw=Symbol.for("react.provider"),Aw=Symbol.for("react.context"),Cw=Symbol.for("react.forward_ref"),Rw=Symbol.for("react.suspense"),Pw=Symbol.for("react.memo"),Iw=Symbol.for("react.lazy"),Dg=Symbol.iterator;function Nw(n){return n===null||typeof n!="object"?null:(n=Dg&&n[Dg]||n["@@iterator"],typeof n=="function"?n:null)}var Vv={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Hv=Object.assign,Gv={};function Fo(n,e,t){this.props=n,this.context=e,this.refs=Gv,this.updater=t||Vv}Fo.prototype.isReactComponent={};Fo.prototype.setState=function(n,e){if(typeof n!="object"&&typeof n!="function"&&n!=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,n,e,"setState")};Fo.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function Wv(){}Wv.prototype=Fo.prototype;function Wp(n,e,t){this.props=n,this.context=e,this.refs=Gv,this.updater=t||Vv}var jp=Wp.prototype=new Wv;jp.constructor=Wp;Hv(jp,Fo.prototype);jp.isPureReactComponent=!0;var Ug=Array.isArray,jv=Object.prototype.hasOwnProperty,Xp={current:null},Xv={key:!0,ref:!0,__self:!0,__source:!0};function $v(n,e,t){var i,r={},s=null,o=null;if(e!=null)for(i in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)jv.call(e,i)&&!Xv.hasOwnProperty(i)&&(r[i]=e[i]);var a=arguments.length-2;if(a===1)r.children=t;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];r.children=l}if(n&&n.defaultProps)for(i in a=n.defaultProps,a)r[i]===void 0&&(r[i]=a[i]);return{$$typeof:wl,type:n,key:s,ref:o,props:r,_owner:Xp.current}}function Lw(n,e){return{$$typeof:wl,type:n.type,key:e,ref:n.ref,props:n.props,_owner:n._owner}}function $p(n){return typeof n=="object"&&n!==null&&n.$$typeof===wl}function Dw(n){var e={"=":"=0",":":"=2"};return"$"+n.replace(/[=:]/g,function(t){return e[t]})}var kg=/\/+/g;function mh(n,e){return typeof n=="object"&&n!==null&&n.key!=null?Dw(""+n.key):e.toString(36)}function qc(n,e,t,i,r){var s=typeof n;(s==="undefined"||s==="boolean")&&(n=null);var o=!1;if(n===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(n.$$typeof){case wl:case Mw:o=!0}}if(o)return o=n,r=r(o),n=i===""?"."+mh(o,0):i,Ug(r)?(t="",n!=null&&(t=n.replace(kg,"$&/")+"/"),qc(r,e,t,"",function(c){return c})):r!=null&&($p(r)&&(r=Lw(r,t+(!r.key||o&&o.key===r.key?"":(""+r.key).replace(kg,"$&/")+"/")+n)),e.push(r)),1;if(o=0,i=i===""?".":i+":",Ug(n))for(var a=0;a<n.length;a++){s=n[a];var l=i+mh(s,a);o+=qc(s,e,t,l,r)}else if(l=Nw(n),typeof l=="function")for(n=l.call(n),a=0;!(s=n.next()).done;)s=s.value,l=i+mh(s,a++),o+=qc(s,e,t,l,r);else if(s==="object")throw e=String(n),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function zl(n,e,t){if(n==null)return n;var i=[],r=0;return qc(n,i,"","",function(s){return e.call(t,s,r++)}),i}function Uw(n){if(n._status===-1){var e=n._result;e=e(),e.then(function(t){(n._status===0||n._status===-1)&&(n._status=1,n._result=t)},function(t){(n._status===0||n._status===-1)&&(n._status=2,n._result=t)}),n._status===-1&&(n._status=0,n._result=e)}if(n._status===1)return n._result.default;throw n._result}var mn={current:null},Zc={transition:null},kw={ReactCurrentDispatcher:mn,ReactCurrentBatchConfig:Zc,ReactCurrentOwner:Xp};function Yv(){throw Error("act(...) is not supported in production builds of React.")}Ke.Children={map:zl,forEach:function(n,e,t){zl(n,function(){e.apply(this,arguments)},t)},count:function(n){var e=0;return zl(n,function(){e++}),e},toArray:function(n){return zl(n,function(e){return e})||[]},only:function(n){if(!$p(n))throw Error("React.Children.only expected to receive a single React element child.");return n}};Ke.Component=Fo;Ke.Fragment=ww;Ke.Profiler=Ew;Ke.PureComponent=Wp;Ke.StrictMode=bw;Ke.Suspense=Rw;Ke.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=kw;Ke.act=Yv;Ke.cloneElement=function(n,e,t){if(n==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+n+".");var i=Hv({},n.props),r=n.key,s=n.ref,o=n._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,o=Xp.current),e.key!==void 0&&(r=""+e.key),n.type&&n.type.defaultProps)var a=n.type.defaultProps;for(l in e)jv.call(e,l)&&!Xv.hasOwnProperty(l)&&(i[l]=e[l]===void 0&&a!==void 0?a[l]:e[l])}var l=arguments.length-2;if(l===1)i.children=t;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];i.children=a}return{$$typeof:wl,type:n.type,key:r,ref:s,props:i,_owner:o}};Ke.createContext=function(n){return n={$$typeof:Aw,_currentValue:n,_currentValue2:n,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},n.Provider={$$typeof:Tw,_context:n},n.Consumer=n};Ke.createElement=$v;Ke.createFactory=function(n){var e=$v.bind(null,n);return e.type=n,e};Ke.createRef=function(){return{current:null}};Ke.forwardRef=function(n){return{$$typeof:Cw,render:n}};Ke.isValidElement=$p;Ke.lazy=function(n){return{$$typeof:Iw,_payload:{_status:-1,_result:n},_init:Uw}};Ke.memo=function(n,e){return{$$typeof:Pw,type:n,compare:e===void 0?null:e}};Ke.startTransition=function(n){var e=Zc.transition;Zc.transition={};try{n()}finally{Zc.transition=e}};Ke.unstable_act=Yv;Ke.useCallback=function(n,e){return mn.current.useCallback(n,e)};Ke.useContext=function(n){return mn.current.useContext(n)};Ke.useDebugValue=function(){};Ke.useDeferredValue=function(n){return mn.current.useDeferredValue(n)};Ke.useEffect=function(n,e){return mn.current.useEffect(n,e)};Ke.useId=function(){return mn.current.useId()};Ke.useImperativeHandle=function(n,e,t){return mn.current.useImperativeHandle(n,e,t)};Ke.useInsertionEffect=function(n,e){return mn.current.useInsertionEffect(n,e)};Ke.useLayoutEffect=function(n,e){return mn.current.useLayoutEffect(n,e)};Ke.useMemo=function(n,e){return mn.current.useMemo(n,e)};Ke.useReducer=function(n,e,t){return mn.current.useReducer(n,e,t)};Ke.useRef=function(n){return mn.current.useRef(n)};Ke.useState=function(n){return mn.current.useState(n)};Ke.useSyncExternalStore=function(n,e,t){return mn.current.useSyncExternalStore(n,e,t)};Ke.useTransition=function(){return mn.current.useTransition()};Ke.version="18.3.1";zv.exports=Ke;var Ae=zv.exports;const Ow=Fv(Ae);/**
9
+ */var wl=Symbol.for("react.element"),Mw=Symbol.for("react.portal"),ww=Symbol.for("react.fragment"),bw=Symbol.for("react.strict_mode"),Ew=Symbol.for("react.profiler"),Tw=Symbol.for("react.provider"),Aw=Symbol.for("react.context"),Cw=Symbol.for("react.forward_ref"),Rw=Symbol.for("react.suspense"),Pw=Symbol.for("react.memo"),Iw=Symbol.for("react.lazy"),Ug=Symbol.iterator;function Nw(n){return n===null||typeof n!="object"?null:(n=Ug&&n[Ug]||n["@@iterator"],typeof n=="function"?n:null)}var Hv={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Gv=Object.assign,Wv={};function Fo(n,e,t){this.props=n,this.context=e,this.refs=Wv,this.updater=t||Hv}Fo.prototype.isReactComponent={};Fo.prototype.setState=function(n,e){if(typeof n!="object"&&typeof n!="function"&&n!=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,n,e,"setState")};Fo.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function jv(){}jv.prototype=Fo.prototype;function Wp(n,e,t){this.props=n,this.context=e,this.refs=Wv,this.updater=t||Hv}var jp=Wp.prototype=new jv;jp.constructor=Wp;Gv(jp,Fo.prototype);jp.isPureReactComponent=!0;var kg=Array.isArray,Xv=Object.prototype.hasOwnProperty,Xp={current:null},$v={key:!0,ref:!0,__self:!0,__source:!0};function Yv(n,e,t){var i,r={},s=null,o=null;if(e!=null)for(i in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)Xv.call(e,i)&&!$v.hasOwnProperty(i)&&(r[i]=e[i]);var a=arguments.length-2;if(a===1)r.children=t;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];r.children=l}if(n&&n.defaultProps)for(i in a=n.defaultProps,a)r[i]===void 0&&(r[i]=a[i]);return{$$typeof:wl,type:n,key:s,ref:o,props:r,_owner:Xp.current}}function Lw(n,e){return{$$typeof:wl,type:n.type,key:e,ref:n.ref,props:n.props,_owner:n._owner}}function $p(n){return typeof n=="object"&&n!==null&&n.$$typeof===wl}function Dw(n){var e={"=":"=0",":":"=2"};return"$"+n.replace(/[=:]/g,function(t){return e[t]})}var Og=/\/+/g;function mh(n,e){return typeof n=="object"&&n!==null&&n.key!=null?Dw(""+n.key):e.toString(36)}function Zc(n,e,t,i,r){var s=typeof n;(s==="undefined"||s==="boolean")&&(n=null);var o=!1;if(n===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(n.$$typeof){case wl:case Mw:o=!0}}if(o)return o=n,r=r(o),n=i===""?"."+mh(o,0):i,kg(r)?(t="",n!=null&&(t=n.replace(Og,"$&/")+"/"),Zc(r,e,t,"",function(c){return c})):r!=null&&($p(r)&&(r=Lw(r,t+(!r.key||o&&o.key===r.key?"":(""+r.key).replace(Og,"$&/")+"/")+n)),e.push(r)),1;if(o=0,i=i===""?".":i+":",kg(n))for(var a=0;a<n.length;a++){s=n[a];var l=i+mh(s,a);o+=Zc(s,e,t,l,r)}else if(l=Nw(n),typeof l=="function")for(n=l.call(n),a=0;!(s=n.next()).done;)s=s.value,l=i+mh(s,a++),o+=Zc(s,e,t,l,r);else if(s==="object")throw e=String(n),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function Vl(n,e,t){if(n==null)return n;var i=[],r=0;return Zc(n,i,"","",function(s){return e.call(t,s,r++)}),i}function Uw(n){if(n._status===-1){var e=n._result;e=e(),e.then(function(t){(n._status===0||n._status===-1)&&(n._status=1,n._result=t)},function(t){(n._status===0||n._status===-1)&&(n._status=2,n._result=t)}),n._status===-1&&(n._status=0,n._result=e)}if(n._status===1)return n._result.default;throw n._result}var mn={current:null},Kc={transition:null},kw={ReactCurrentDispatcher:mn,ReactCurrentBatchConfig:Kc,ReactCurrentOwner:Xp};function qv(){throw Error("act(...) is not supported in production builds of React.")}Ke.Children={map:Vl,forEach:function(n,e,t){Vl(n,function(){e.apply(this,arguments)},t)},count:function(n){var e=0;return Vl(n,function(){e++}),e},toArray:function(n){return Vl(n,function(e){return e})||[]},only:function(n){if(!$p(n))throw Error("React.Children.only expected to receive a single React element child.");return n}};Ke.Component=Fo;Ke.Fragment=ww;Ke.Profiler=Ew;Ke.PureComponent=Wp;Ke.StrictMode=bw;Ke.Suspense=Rw;Ke.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=kw;Ke.act=qv;Ke.cloneElement=function(n,e,t){if(n==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+n+".");var i=Gv({},n.props),r=n.key,s=n.ref,o=n._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,o=Xp.current),e.key!==void 0&&(r=""+e.key),n.type&&n.type.defaultProps)var a=n.type.defaultProps;for(l in e)Xv.call(e,l)&&!$v.hasOwnProperty(l)&&(i[l]=e[l]===void 0&&a!==void 0?a[l]:e[l])}var l=arguments.length-2;if(l===1)i.children=t;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];i.children=a}return{$$typeof:wl,type:n.type,key:r,ref:s,props:i,_owner:o}};Ke.createContext=function(n){return n={$$typeof:Aw,_currentValue:n,_currentValue2:n,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},n.Provider={$$typeof:Tw,_context:n},n.Consumer=n};Ke.createElement=Yv;Ke.createFactory=function(n){var e=Yv.bind(null,n);return e.type=n,e};Ke.createRef=function(){return{current:null}};Ke.forwardRef=function(n){return{$$typeof:Cw,render:n}};Ke.isValidElement=$p;Ke.lazy=function(n){return{$$typeof:Iw,_payload:{_status:-1,_result:n},_init:Uw}};Ke.memo=function(n,e){return{$$typeof:Pw,type:n,compare:e===void 0?null:e}};Ke.startTransition=function(n){var e=Kc.transition;Kc.transition={};try{n()}finally{Kc.transition=e}};Ke.unstable_act=qv;Ke.useCallback=function(n,e){return mn.current.useCallback(n,e)};Ke.useContext=function(n){return mn.current.useContext(n)};Ke.useDebugValue=function(){};Ke.useDeferredValue=function(n){return mn.current.useDeferredValue(n)};Ke.useEffect=function(n,e){return mn.current.useEffect(n,e)};Ke.useId=function(){return mn.current.useId()};Ke.useImperativeHandle=function(n,e,t){return mn.current.useImperativeHandle(n,e,t)};Ke.useInsertionEffect=function(n,e){return mn.current.useInsertionEffect(n,e)};Ke.useLayoutEffect=function(n,e){return mn.current.useLayoutEffect(n,e)};Ke.useMemo=function(n,e){return mn.current.useMemo(n,e)};Ke.useReducer=function(n,e,t){return mn.current.useReducer(n,e,t)};Ke.useRef=function(n){return mn.current.useRef(n)};Ke.useState=function(n){return mn.current.useState(n)};Ke.useSyncExternalStore=function(n,e,t){return mn.current.useSyncExternalStore(n,e,t)};Ke.useTransition=function(){return mn.current.useTransition()};Ke.version="18.3.1";Vv.exports=Ke;var Ee=Vv.exports;const Ow=Bv(Ee);/**
10
10
  * @license React
11
11
  * react-jsx-runtime.production.min.js
12
12
  *
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Fw=Ae,Bw=Symbol.for("react.element"),zw=Symbol.for("react.fragment"),Vw=Object.prototype.hasOwnProperty,Hw=Fw.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Gw={key:!0,ref:!0,__self:!0,__source:!0};function qv(n,e,t){var i,r={},s=null,o=null;t!==void 0&&(s=""+t),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(i in e)Vw.call(e,i)&&!Gw.hasOwnProperty(i)&&(r[i]=e[i]);if(n&&n.defaultProps)for(i in e=n.defaultProps,e)r[i]===void 0&&(r[i]=e[i]);return{$$typeof:Bw,type:n,key:s,ref:o,props:r,_owner:Hw.current}}dd.Fragment=zw;dd.jsx=qv;dd.jsxs=qv;Bv.exports=dd;var S=Bv.exports,Zv={exports:{}},Fn={},Kv={exports:{}},Jv={};/**
17
+ */var Fw=Ee,Bw=Symbol.for("react.element"),zw=Symbol.for("react.fragment"),Vw=Object.prototype.hasOwnProperty,Hw=Fw.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Gw={key:!0,ref:!0,__self:!0,__source:!0};function Zv(n,e,t){var i,r={},s=null,o=null;t!==void 0&&(s=""+t),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(i in e)Vw.call(e,i)&&!Gw.hasOwnProperty(i)&&(r[i]=e[i]);if(n&&n.defaultProps)for(i in e=n.defaultProps,e)r[i]===void 0&&(r[i]=e[i]);return{$$typeof:Bw,type:n,key:s,ref:o,props:r,_owner:Hw.current}}hd.Fragment=zw;hd.jsx=Zv;hd.jsxs=Zv;zv.exports=hd;var S=zv.exports,Kv={exports:{}},Fn={},Jv={exports:{}},Qv={};/**
18
18
  * @license React
19
19
  * scheduler.production.min.js
20
20
  *
@@ -22,7 +22,7 @@
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */(function(n){function e(D,$){var K=D.length;D.push($);e:for(;0<K;){var se=K-1>>>1,Te=D[se];if(0<r(Te,$))D[se]=$,D[K]=Te,K=se;else break e}}function t(D){return D.length===0?null:D[0]}function i(D){if(D.length===0)return null;var $=D[0],K=D.pop();if(K!==$){D[0]=K;e:for(var se=0,Te=D.length,qe=Te>>>1;se<qe;){var X=2*(se+1)-1,oe=D[X],ve=X+1,de=D[ve];if(0>r(oe,K))ve<Te&&0>r(de,oe)?(D[se]=de,D[ve]=K,se=ve):(D[se]=oe,D[X]=K,se=X);else if(ve<Te&&0>r(de,K))D[se]=de,D[ve]=K,se=ve;else break e}}return $}function r(D,$){var K=D.sortIndex-$.sortIndex;return K!==0?K:D.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],c=[],u=1,h=null,d=3,p=!1,m=!1,x=!1,g=typeof setTimeout=="function"?setTimeout:null,f=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(D){for(var $=t(c);$!==null;){if($.callback===null)i(c);else if($.startTime<=D)i(c),$.sortIndex=$.expirationTime,e(l,$);else break;$=t(c)}}function _(D){if(x=!1,y(D),!m)if(t(l)!==null)m=!0,z(C);else{var $=t(c);$!==null&&Z(_,$.startTime-D)}}function C(D,$){m=!1,x&&(x=!1,f(A),A=-1),p=!0;var K=d;try{for(y($),h=t(l);h!==null&&(!(h.expirationTime>$)||D&&!L());){var se=h.callback;if(typeof se=="function"){h.callback=null,d=h.priorityLevel;var Te=se(h.expirationTime<=$);$=n.unstable_now(),typeof Te=="function"?h.callback=Te:h===t(l)&&i(l),y($)}else i(l);h=t(l)}if(h!==null)var qe=!0;else{var X=t(c);X!==null&&Z(_,X.startTime-$),qe=!1}return qe}finally{h=null,d=K,p=!1}}var w=!1,E=null,A=-1,b=5,M=-1;function L(){return!(n.unstable_now()-M<b)}function G(){if(E!==null){var D=n.unstable_now();M=D;var $=!0;try{$=E(!0,D)}finally{$?B():(w=!1,E=null)}}else w=!1}var B;if(typeof v=="function")B=function(){v(G)};else if(typeof MessageChannel<"u"){var j=new MessageChannel,U=j.port2;j.port1.onmessage=G,B=function(){U.postMessage(null)}}else B=function(){g(G,0)};function z(D){E=D,w||(w=!0,B())}function Z(D,$){A=g(function(){D(n.unstable_now())},$)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(D){D.callback=null},n.unstable_continueExecution=function(){m||p||(m=!0,z(C))},n.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):b=0<D?Math.floor(1e3/D):5},n.unstable_getCurrentPriorityLevel=function(){return d},n.unstable_getFirstCallbackNode=function(){return t(l)},n.unstable_next=function(D){switch(d){case 1:case 2:case 3:var $=3;break;default:$=d}var K=d;d=$;try{return D()}finally{d=K}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(D,$){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var K=d;d=D;try{return $()}finally{d=K}},n.unstable_scheduleCallback=function(D,$,K){var se=n.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?se+K:se):K=se,D){case 1:var Te=-1;break;case 2:Te=250;break;case 5:Te=1073741823;break;case 4:Te=1e4;break;default:Te=5e3}return Te=K+Te,D={id:u++,callback:$,priorityLevel:D,startTime:K,expirationTime:Te,sortIndex:-1},K>se?(D.sortIndex=K,e(c,D),t(l)===null&&D===t(c)&&(x?(f(A),A=-1):x=!0,Z(_,K-se))):(D.sortIndex=Te,e(l,D),m||p||(m=!0,z(C))),D},n.unstable_shouldYield=L,n.unstable_wrapCallback=function(D){var $=d;return function(){var K=d;d=$;try{return D.apply(this,arguments)}finally{d=K}}}})(Jv);Kv.exports=Jv;var Ww=Kv.exports;/**
25
+ */(function(n){function e(D,$){var K=D.length;D.push($);e:for(;0<K;){var se=K-1>>>1,Ae=D[se];if(0<r(Ae,$))D[se]=$,D[K]=Ae,K=se;else break e}}function t(D){return D.length===0?null:D[0]}function i(D){if(D.length===0)return null;var $=D[0],K=D.pop();if(K!==$){D[0]=K;e:for(var se=0,Ae=D.length,qe=Ae>>>1;se<qe;){var X=2*(se+1)-1,oe=D[X],ve=X+1,de=D[ve];if(0>r(oe,K))ve<Ae&&0>r(de,oe)?(D[se]=de,D[ve]=K,se=ve):(D[se]=oe,D[X]=K,se=X);else if(ve<Ae&&0>r(de,K))D[se]=de,D[ve]=K,se=ve;else break e}}return $}function r(D,$){var K=D.sortIndex-$.sortIndex;return K!==0?K:D.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],c=[],u=1,h=null,d=3,p=!1,m=!1,x=!1,g=typeof setTimeout=="function"?setTimeout:null,f=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(D){for(var $=t(c);$!==null;){if($.callback===null)i(c);else if($.startTime<=D)i(c),$.sortIndex=$.expirationTime,e(l,$);else break;$=t(c)}}function _(D){if(x=!1,y(D),!m)if(t(l)!==null)m=!0,z(R);else{var $=t(c);$!==null&&Z(_,$.startTime-D)}}function R(D,$){m=!1,x&&(x=!1,f(A),A=-1),p=!0;var K=d;try{for(y($),h=t(l);h!==null&&(!(h.expirationTime>$)||D&&!L());){var se=h.callback;if(typeof se=="function"){h.callback=null,d=h.priorityLevel;var Ae=se(h.expirationTime<=$);$=n.unstable_now(),typeof Ae=="function"?h.callback=Ae:h===t(l)&&i(l),y($)}else i(l);h=t(l)}if(h!==null)var qe=!0;else{var X=t(c);X!==null&&Z(_,X.startTime-$),qe=!1}return qe}finally{h=null,d=K,p=!1}}var w=!1,E=null,A=-1,b=5,M=-1;function L(){return!(n.unstable_now()-M<b)}function G(){if(E!==null){var D=n.unstable_now();M=D;var $=!0;try{$=E(!0,D)}finally{$?B():(w=!1,E=null)}}else w=!1}var B;if(typeof v=="function")B=function(){v(G)};else if(typeof MessageChannel<"u"){var j=new MessageChannel,U=j.port2;j.port1.onmessage=G,B=function(){U.postMessage(null)}}else B=function(){g(G,0)};function z(D){E=D,w||(w=!0,B())}function Z(D,$){A=g(function(){D(n.unstable_now())},$)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(D){D.callback=null},n.unstable_continueExecution=function(){m||p||(m=!0,z(R))},n.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):b=0<D?Math.floor(1e3/D):5},n.unstable_getCurrentPriorityLevel=function(){return d},n.unstable_getFirstCallbackNode=function(){return t(l)},n.unstable_next=function(D){switch(d){case 1:case 2:case 3:var $=3;break;default:$=d}var K=d;d=$;try{return D()}finally{d=K}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(D,$){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var K=d;d=D;try{return $()}finally{d=K}},n.unstable_scheduleCallback=function(D,$,K){var se=n.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?se+K:se):K=se,D){case 1:var Ae=-1;break;case 2:Ae=250;break;case 5:Ae=1073741823;break;case 4:Ae=1e4;break;default:Ae=5e3}return Ae=K+Ae,D={id:u++,callback:$,priorityLevel:D,startTime:K,expirationTime:Ae,sortIndex:-1},K>se?(D.sortIndex=K,e(c,D),t(l)===null&&D===t(c)&&(x?(f(A),A=-1):x=!0,Z(_,K-se))):(D.sortIndex=Ae,e(l,D),m||p||(m=!0,z(R))),D},n.unstable_shouldYield=L,n.unstable_wrapCallback=function(D){var $=d;return function(){var K=d;d=$;try{return D.apply(this,arguments)}finally{d=K}}}})(Qv);Jv.exports=Qv;var Ww=Jv.exports;/**
26
26
  * @license React
27
27
  * react-dom.production.min.js
28
28
  *
@@ -30,14 +30,14 @@
30
30
  *
31
31
  * This source code is licensed under the MIT license found in the
32
32
  * LICENSE file in the root directory of this source tree.
33
- */var jw=Ae,kn=Ww;function re(n){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+n,t=1;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t]);return"Minified React error #"+n+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Qv=new Set,Ba={};function Ts(n,e){To(n,e),To(n+"Capture",e)}function To(n,e){for(Ba[n]=e,n=0;n<e.length;n++)Qv.add(e[n])}var Xi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),kf=Object.prototype.hasOwnProperty,Xw=/^[: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]*$/,Og={},Fg={};function $w(n){return kf.call(Fg,n)?!0:kf.call(Og,n)?!1:Xw.test(n)?Fg[n]=!0:(Og[n]=!0,!1)}function Yw(n,e,t,i){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return i?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function qw(n,e,t,i){if(e===null||typeof e>"u"||Yw(n,e,t,i))return!0;if(i)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function gn(n,e,t,i,r,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Zt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){Zt[n]=new gn(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];Zt[e]=new gn(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){Zt[n]=new gn(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){Zt[n]=new gn(n,2,!1,n,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(n){Zt[n]=new gn(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){Zt[n]=new gn(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){Zt[n]=new gn(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){Zt[n]=new gn(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){Zt[n]=new gn(n,5,!1,n.toLowerCase(),null,!1,!1)});var Yp=/[\-:]([a-z])/g;function qp(n){return n[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(n){var e=n.replace(Yp,qp);Zt[e]=new gn(e,1,!1,n,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var e=n.replace(Yp,qp);Zt[e]=new gn(e,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(n){var e=n.replace(Yp,qp);Zt[e]=new gn(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){Zt[n]=new gn(n,1,!1,n.toLowerCase(),null,!1,!1)});Zt.xlinkHref=new gn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){Zt[n]=new gn(n,1,!1,n.toLowerCase(),null,!0,!0)});function Zp(n,e,t,i){var r=Zt.hasOwnProperty(e)?Zt[e]:null;(r!==null?r.type!==0:i||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(qw(e,t,r,i)&&(t=null),i||r===null?$w(e)&&(t===null?n.removeAttribute(e):n.setAttribute(e,""+t)):r.mustUseProperty?n[r.propertyName]=t===null?r.type===3?!1:"":t:(e=r.attributeName,i=r.attributeNamespace,t===null?n.removeAttribute(e):(r=r.type,t=r===3||r===4&&t===!0?"":""+t,i?n.setAttributeNS(i,e,t):n.setAttribute(e,t))))}var er=jw.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Vl=Symbol.for("react.element"),eo=Symbol.for("react.portal"),to=Symbol.for("react.fragment"),Kp=Symbol.for("react.strict_mode"),Of=Symbol.for("react.profiler"),ey=Symbol.for("react.provider"),ty=Symbol.for("react.context"),Jp=Symbol.for("react.forward_ref"),Ff=Symbol.for("react.suspense"),Bf=Symbol.for("react.suspense_list"),Qp=Symbol.for("react.memo"),fr=Symbol.for("react.lazy"),ny=Symbol.for("react.offscreen"),Bg=Symbol.iterator;function $o(n){return n===null||typeof n!="object"?null:(n=Bg&&n[Bg]||n["@@iterator"],typeof n=="function"?n:null)}var Mt=Object.assign,gh;function ma(n){if(gh===void 0)try{throw Error()}catch(t){var e=t.stack.trim().match(/\n( *(at )?)/);gh=e&&e[1]||""}return`
33
+ */var jw=Ee,kn=Ww;function re(n){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+n,t=1;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t]);return"Minified React error #"+n+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var ey=new Set,Ba={};function Ts(n,e){To(n,e),To(n+"Capture",e)}function To(n,e){for(Ba[n]=e,n=0;n<e.length;n++)ey.add(e[n])}var Xi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),kf=Object.prototype.hasOwnProperty,Xw=/^[: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]*$/,Fg={},Bg={};function $w(n){return kf.call(Bg,n)?!0:kf.call(Fg,n)?!1:Xw.test(n)?Bg[n]=!0:(Fg[n]=!0,!1)}function Yw(n,e,t,i){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return i?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function qw(n,e,t,i){if(e===null||typeof e>"u"||Yw(n,e,t,i))return!0;if(i)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function gn(n,e,t,i,r,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Zt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){Zt[n]=new gn(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];Zt[e]=new gn(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){Zt[n]=new gn(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){Zt[n]=new gn(n,2,!1,n,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(n){Zt[n]=new gn(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){Zt[n]=new gn(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){Zt[n]=new gn(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){Zt[n]=new gn(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){Zt[n]=new gn(n,5,!1,n.toLowerCase(),null,!1,!1)});var Yp=/[\-:]([a-z])/g;function qp(n){return n[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(n){var e=n.replace(Yp,qp);Zt[e]=new gn(e,1,!1,n,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var e=n.replace(Yp,qp);Zt[e]=new gn(e,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(n){var e=n.replace(Yp,qp);Zt[e]=new gn(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){Zt[n]=new gn(n,1,!1,n.toLowerCase(),null,!1,!1)});Zt.xlinkHref=new gn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){Zt[n]=new gn(n,1,!1,n.toLowerCase(),null,!0,!0)});function Zp(n,e,t,i){var r=Zt.hasOwnProperty(e)?Zt[e]:null;(r!==null?r.type!==0:i||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(qw(e,t,r,i)&&(t=null),i||r===null?$w(e)&&(t===null?n.removeAttribute(e):n.setAttribute(e,""+t)):r.mustUseProperty?n[r.propertyName]=t===null?r.type===3?!1:"":t:(e=r.attributeName,i=r.attributeNamespace,t===null?n.removeAttribute(e):(r=r.type,t=r===3||r===4&&t===!0?"":""+t,i?n.setAttributeNS(i,e,t):n.setAttribute(e,t))))}var er=jw.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Hl=Symbol.for("react.element"),eo=Symbol.for("react.portal"),to=Symbol.for("react.fragment"),Kp=Symbol.for("react.strict_mode"),Of=Symbol.for("react.profiler"),ty=Symbol.for("react.provider"),ny=Symbol.for("react.context"),Jp=Symbol.for("react.forward_ref"),Ff=Symbol.for("react.suspense"),Bf=Symbol.for("react.suspense_list"),Qp=Symbol.for("react.memo"),fr=Symbol.for("react.lazy"),iy=Symbol.for("react.offscreen"),zg=Symbol.iterator;function $o(n){return n===null||typeof n!="object"?null:(n=zg&&n[zg]||n["@@iterator"],typeof n=="function"?n:null)}var Mt=Object.assign,gh;function ma(n){if(gh===void 0)try{throw Error()}catch(t){var e=t.stack.trim().match(/\n( *(at )?)/);gh=e&&e[1]||""}return`
34
34
  `+gh+n}var xh=!1;function vh(n,e){if(!n||xh)return"";xh=!0;var t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(c){var i=c}Reflect.construct(n,[],e)}else{try{e.call()}catch(c){i=c}n.call(e.prototype)}else{try{throw Error()}catch(c){i=c}n()}}catch(c){if(c&&i&&typeof c.stack=="string"){for(var r=c.stack.split(`
35
35
  `),s=i.stack.split(`
36
36
  `),o=r.length-1,a=s.length-1;1<=o&&0<=a&&r[o]!==s[a];)a--;for(;1<=o&&0<=a;o--,a--)if(r[o]!==s[a]){if(o!==1||a!==1)do if(o--,a--,0>a||r[o]!==s[a]){var l=`
37
- `+r[o].replace(" at new "," at ");return n.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{xh=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?ma(n):""}function Zw(n){switch(n.tag){case 5:return ma(n.type);case 16:return ma("Lazy");case 13:return ma("Suspense");case 19:return ma("SuspenseList");case 0:case 2:case 15:return n=vh(n.type,!1),n;case 11:return n=vh(n.type.render,!1),n;case 1:return n=vh(n.type,!0),n;default:return""}}function zf(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case to:return"Fragment";case eo:return"Portal";case Of:return"Profiler";case Kp:return"StrictMode";case Ff:return"Suspense";case Bf:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case ty:return(n.displayName||"Context")+".Consumer";case ey:return(n._context.displayName||"Context")+".Provider";case Jp:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case Qp:return e=n.displayName||null,e!==null?e:zf(n.type)||"Memo";case fr:e=n._payload,n=n._init;try{return zf(n(e))}catch{}}return null}function Kw(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return zf(e);case 8:return e===Kp?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Rr(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function iy(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Jw(n){var e=iy(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),i=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var r=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return r.call(this)},set:function(o){i=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function Hl(n){n._valueTracker||(n._valueTracker=Jw(n))}function ry(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),i="";return n&&(i=iy(n)?n.checked?"true":"false":n.value),n=i,n!==t?(e.setValue(n),!0):!1}function cu(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function Vf(n,e){var t=e.checked;return Mt({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function zg(n,e){var t=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;t=Rr(e.value!=null?e.value:t),n._wrapperState={initialChecked:i,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function sy(n,e){e=e.checked,e!=null&&Zp(n,"checked",e,!1)}function Hf(n,e){sy(n,e);var t=Rr(e.value),i=e.type;if(t!=null)i==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(i==="submit"||i==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?Gf(n,e.type,t):e.hasOwnProperty("defaultValue")&&Gf(n,e.type,Rr(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function Vg(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function Gf(n,e,t){(e!=="number"||cu(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var ga=Array.isArray;function vo(n,e,t,i){if(n=n.options,e){e={};for(var r=0;r<t.length;r++)e["$"+t[r]]=!0;for(t=0;t<n.length;t++)r=e.hasOwnProperty("$"+n[t].value),n[t].selected!==r&&(n[t].selected=r),r&&i&&(n[t].defaultSelected=!0)}else{for(t=""+Rr(t),e=null,r=0;r<n.length;r++){if(n[r].value===t){n[r].selected=!0,i&&(n[r].defaultSelected=!0);return}e!==null||n[r].disabled||(e=n[r])}e!==null&&(e.selected=!0)}}function Wf(n,e){if(e.dangerouslySetInnerHTML!=null)throw Error(re(91));return Mt({},e,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function Hg(n,e){var t=e.value;if(t==null){if(t=e.children,e=e.defaultValue,t!=null){if(e!=null)throw Error(re(92));if(ga(t)){if(1<t.length)throw Error(re(93));t=t[0]}e=t}e==null&&(e=""),t=e}n._wrapperState={initialValue:Rr(t)}}function oy(n,e){var t=Rr(e.value),i=Rr(e.defaultValue);t!=null&&(t=""+t,t!==n.value&&(n.value=t),e.defaultValue==null&&n.defaultValue!==t&&(n.defaultValue=t)),i!=null&&(n.defaultValue=""+i)}function Gg(n){var e=n.textContent;e===n._wrapperState.initialValue&&e!==""&&e!==null&&(n.value=e)}function ay(n){switch(n){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 jf(n,e){return n==null||n==="http://www.w3.org/1999/xhtml"?ay(e):n==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var Gl,ly=function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,t,i,r){MSApp.execUnsafeLocalFunction(function(){return n(e,t,i,r)})}:n}(function(n,e){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=e;else{for(Gl=Gl||document.createElement("div"),Gl.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Gl.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function za(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var Sa={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},Qw=["Webkit","ms","Moz","O"];Object.keys(Sa).forEach(function(n){Qw.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),Sa[e]=Sa[n]})});function cy(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||Sa.hasOwnProperty(n)&&Sa[n]?(""+e).trim():e+"px"}function uy(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var i=t.indexOf("--")===0,r=cy(t,e[t],i);t==="float"&&(t="cssFloat"),i?n.setProperty(t,r):n[t]=r}}var e1=Mt({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 Xf(n,e){if(e){if(e1[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(re(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(re(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(re(61))}if(e.style!=null&&typeof e.style!="object")throw Error(re(62))}}function $f(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){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 Yf=null;function em(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var qf=null,yo=null,_o=null;function Wg(n){if(n=Tl(n)){if(typeof qf!="function")throw Error(re(280));var e=n.stateNode;e&&(e=gd(e),qf(n.stateNode,n.type,e))}}function dy(n){yo?_o?_o.push(n):_o=[n]:yo=n}function hy(){if(yo){var n=yo,e=_o;if(_o=yo=null,Wg(n),e)for(n=0;n<e.length;n++)Wg(e[n])}}function fy(n,e){return n(e)}function py(){}var yh=!1;function my(n,e,t){if(yh)return n(e,t);yh=!0;try{return fy(n,e,t)}finally{yh=!1,(yo!==null||_o!==null)&&(py(),hy())}}function Va(n,e){var t=n.stateNode;if(t===null)return null;var i=gd(t);if(i===null)return null;t=i[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(n=n.type,i=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!i;break e;default:n=!1}if(n)return null;if(t&&typeof t!="function")throw Error(re(231,e,typeof t));return t}var Zf=!1;if(Xi)try{var Yo={};Object.defineProperty(Yo,"passive",{get:function(){Zf=!0}}),window.addEventListener("test",Yo,Yo),window.removeEventListener("test",Yo,Yo)}catch{Zf=!1}function t1(n,e,t,i,r,s,o,a,l){var c=Array.prototype.slice.call(arguments,3);try{e.apply(t,c)}catch(u){this.onError(u)}}var Ma=!1,uu=null,du=!1,Kf=null,n1={onError:function(n){Ma=!0,uu=n}};function i1(n,e,t,i,r,s,o,a,l){Ma=!1,uu=null,t1.apply(n1,arguments)}function r1(n,e,t,i,r,s,o,a,l){if(i1.apply(this,arguments),Ma){if(Ma){var c=uu;Ma=!1,uu=null}else throw Error(re(198));du||(du=!0,Kf=c)}}function As(n){var e=n,t=n;if(n.alternate)for(;e.return;)e=e.return;else{n=e;do e=n,e.flags&4098&&(t=e.return),n=e.return;while(n)}return e.tag===3?t:null}function gy(n){if(n.tag===13){var e=n.memoizedState;if(e===null&&(n=n.alternate,n!==null&&(e=n.memoizedState)),e!==null)return e.dehydrated}return null}function jg(n){if(As(n)!==n)throw Error(re(188))}function s1(n){var e=n.alternate;if(!e){if(e=As(n),e===null)throw Error(re(188));return e!==n?null:n}for(var t=n,i=e;;){var r=t.return;if(r===null)break;var s=r.alternate;if(s===null){if(i=r.return,i!==null){t=i;continue}break}if(r.child===s.child){for(s=r.child;s;){if(s===t)return jg(r),n;if(s===i)return jg(r),e;s=s.sibling}throw Error(re(188))}if(t.return!==i.return)t=r,i=s;else{for(var o=!1,a=r.child;a;){if(a===t){o=!0,t=r,i=s;break}if(a===i){o=!0,i=r,t=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===t){o=!0,t=s,i=r;break}if(a===i){o=!0,i=s,t=r;break}a=a.sibling}if(!o)throw Error(re(189))}}if(t.alternate!==i)throw Error(re(190))}if(t.tag!==3)throw Error(re(188));return t.stateNode.current===t?n:e}function xy(n){return n=s1(n),n!==null?vy(n):null}function vy(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var e=vy(n);if(e!==null)return e;n=n.sibling}return null}var yy=kn.unstable_scheduleCallback,Xg=kn.unstable_cancelCallback,o1=kn.unstable_shouldYield,a1=kn.unstable_requestPaint,Pt=kn.unstable_now,l1=kn.unstable_getCurrentPriorityLevel,tm=kn.unstable_ImmediatePriority,_y=kn.unstable_UserBlockingPriority,hu=kn.unstable_NormalPriority,c1=kn.unstable_LowPriority,Sy=kn.unstable_IdlePriority,hd=null,Si=null;function u1(n){if(Si&&typeof Si.onCommitFiberRoot=="function")try{Si.onCommitFiberRoot(hd,n,void 0,(n.current.flags&128)===128)}catch{}}var si=Math.clz32?Math.clz32:f1,d1=Math.log,h1=Math.LN2;function f1(n){return n>>>=0,n===0?32:31-(d1(n)/h1|0)|0}var Wl=64,jl=4194304;function xa(n){switch(n&-n){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 n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function fu(n,e){var t=n.pendingLanes;if(t===0)return 0;var i=0,r=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~r;a!==0?i=xa(a):(s&=o,s!==0&&(i=xa(s)))}else o=t&~r,o!==0?i=xa(o):s!==0&&(i=xa(s));if(i===0)return 0;if(e!==0&&e!==i&&!(e&r)&&(r=i&-i,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if(i&4&&(i|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=i;0<e;)t=31-si(e),r=1<<t,i|=n[t],e&=~r;return i}function p1(n,e){switch(n){case 1:case 2:case 4:return e+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 e+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 m1(n,e){for(var t=n.suspendedLanes,i=n.pingedLanes,r=n.expirationTimes,s=n.pendingLanes;0<s;){var o=31-si(s),a=1<<o,l=r[o];l===-1?(!(a&t)||a&i)&&(r[o]=p1(a,e)):l<=e&&(n.expiredLanes|=a),s&=~a}}function Jf(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function My(){var n=Wl;return Wl<<=1,!(Wl&4194240)&&(Wl=64),n}function _h(n){for(var e=[],t=0;31>t;t++)e.push(n);return e}function bl(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-si(e),n[e]=t}function g1(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var i=n.eventTimes;for(n=n.expirationTimes;0<t;){var r=31-si(t),s=1<<r;e[r]=0,i[r]=-1,n[r]=-1,t&=~s}}function nm(n,e){var t=n.entangledLanes|=e;for(n=n.entanglements;t;){var i=31-si(t),r=1<<i;r&e|n[i]&e&&(n[i]|=e),t&=~r}}var dt=0;function wy(n){return n&=-n,1<n?4<n?n&268435455?16:536870912:4:1}var by,im,Ey,Ty,Ay,Qf=!1,Xl=[],Sr=null,Mr=null,wr=null,Ha=new Map,Ga=new Map,gr=[],x1="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 $g(n,e){switch(n){case"focusin":case"focusout":Sr=null;break;case"dragenter":case"dragleave":Mr=null;break;case"mouseover":case"mouseout":wr=null;break;case"pointerover":case"pointerout":Ha.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ga.delete(e.pointerId)}}function qo(n,e,t,i,r,s){return n===null||n.nativeEvent!==s?(n={blockedOn:e,domEventName:t,eventSystemFlags:i,nativeEvent:s,targetContainers:[r]},e!==null&&(e=Tl(e),e!==null&&im(e)),n):(n.eventSystemFlags|=i,e=n.targetContainers,r!==null&&e.indexOf(r)===-1&&e.push(r),n)}function v1(n,e,t,i,r){switch(e){case"focusin":return Sr=qo(Sr,n,e,t,i,r),!0;case"dragenter":return Mr=qo(Mr,n,e,t,i,r),!0;case"mouseover":return wr=qo(wr,n,e,t,i,r),!0;case"pointerover":var s=r.pointerId;return Ha.set(s,qo(Ha.get(s)||null,n,e,t,i,r)),!0;case"gotpointercapture":return s=r.pointerId,Ga.set(s,qo(Ga.get(s)||null,n,e,t,i,r)),!0}return!1}function Cy(n){var e=rs(n.target);if(e!==null){var t=As(e);if(t!==null){if(e=t.tag,e===13){if(e=gy(t),e!==null){n.blockedOn=e,Ay(n.priority,function(){Ey(t)});return}}else if(e===3&&t.stateNode.current.memoizedState.isDehydrated){n.blockedOn=t.tag===3?t.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Kc(n){if(n.blockedOn!==null)return!1;for(var e=n.targetContainers;0<e.length;){var t=ep(n.domEventName,n.eventSystemFlags,e[0],n.nativeEvent);if(t===null){t=n.nativeEvent;var i=new t.constructor(t.type,t);Yf=i,t.target.dispatchEvent(i),Yf=null}else return e=Tl(t),e!==null&&im(e),n.blockedOn=t,!1;e.shift()}return!0}function Yg(n,e,t){Kc(n)&&t.delete(e)}function y1(){Qf=!1,Sr!==null&&Kc(Sr)&&(Sr=null),Mr!==null&&Kc(Mr)&&(Mr=null),wr!==null&&Kc(wr)&&(wr=null),Ha.forEach(Yg),Ga.forEach(Yg)}function Zo(n,e){n.blockedOn===e&&(n.blockedOn=null,Qf||(Qf=!0,kn.unstable_scheduleCallback(kn.unstable_NormalPriority,y1)))}function Wa(n){function e(r){return Zo(r,n)}if(0<Xl.length){Zo(Xl[0],n);for(var t=1;t<Xl.length;t++){var i=Xl[t];i.blockedOn===n&&(i.blockedOn=null)}}for(Sr!==null&&Zo(Sr,n),Mr!==null&&Zo(Mr,n),wr!==null&&Zo(wr,n),Ha.forEach(e),Ga.forEach(e),t=0;t<gr.length;t++)i=gr[t],i.blockedOn===n&&(i.blockedOn=null);for(;0<gr.length&&(t=gr[0],t.blockedOn===null);)Cy(t),t.blockedOn===null&&gr.shift()}var So=er.ReactCurrentBatchConfig,pu=!0;function _1(n,e,t,i){var r=dt,s=So.transition;So.transition=null;try{dt=1,rm(n,e,t,i)}finally{dt=r,So.transition=s}}function S1(n,e,t,i){var r=dt,s=So.transition;So.transition=null;try{dt=4,rm(n,e,t,i)}finally{dt=r,So.transition=s}}function rm(n,e,t,i){if(pu){var r=ep(n,e,t,i);if(r===null)Ph(n,e,i,mu,t),$g(n,i);else if(v1(r,n,e,t,i))i.stopPropagation();else if($g(n,i),e&4&&-1<x1.indexOf(n)){for(;r!==null;){var s=Tl(r);if(s!==null&&by(s),s=ep(n,e,t,i),s===null&&Ph(n,e,i,mu,t),s===r)break;r=s}r!==null&&i.stopPropagation()}else Ph(n,e,i,null,t)}}var mu=null;function ep(n,e,t,i){if(mu=null,n=em(i),n=rs(n),n!==null)if(e=As(n),e===null)n=null;else if(t=e.tag,t===13){if(n=gy(e),n!==null)return n;n=null}else if(t===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;n=null}else e!==n&&(n=null);return mu=n,null}function Ry(n){switch(n){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(l1()){case tm:return 1;case _y:return 4;case hu:case c1:return 16;case Sy:return 536870912;default:return 16}default:return 16}}var yr=null,sm=null,Jc=null;function Py(){if(Jc)return Jc;var n,e=sm,t=e.length,i,r="value"in yr?yr.value:yr.textContent,s=r.length;for(n=0;n<t&&e[n]===r[n];n++);var o=t-n;for(i=1;i<=o&&e[t-i]===r[s-i];i++);return Jc=r.slice(n,1<i?1-i:void 0)}function Qc(n){var e=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&e===13&&(n=13)):n=e,n===10&&(n=13),32<=n||n===13?n:0}function $l(){return!0}function qg(){return!1}function Bn(n){function e(t,i,r,s,o){this._reactName=t,this._targetInst=r,this.type=i,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var a in n)n.hasOwnProperty(a)&&(t=n[a],this[a]=t?t(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?$l:qg,this.isPropagationStopped=qg,this}return Mt(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():typeof t.returnValue!="unknown"&&(t.returnValue=!1),this.isDefaultPrevented=$l)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():typeof t.cancelBubble!="unknown"&&(t.cancelBubble=!0),this.isPropagationStopped=$l)},persist:function(){},isPersistent:$l}),e}var Bo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},om=Bn(Bo),El=Mt({},Bo,{view:0,detail:0}),M1=Bn(El),Sh,Mh,Ko,fd=Mt({},El,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:am,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Ko&&(Ko&&n.type==="mousemove"?(Sh=n.screenX-Ko.screenX,Mh=n.screenY-Ko.screenY):Mh=Sh=0,Ko=n),Sh)},movementY:function(n){return"movementY"in n?n.movementY:Mh}}),Zg=Bn(fd),w1=Mt({},fd,{dataTransfer:0}),b1=Bn(w1),E1=Mt({},El,{relatedTarget:0}),wh=Bn(E1),T1=Mt({},Bo,{animationName:0,elapsedTime:0,pseudoElement:0}),A1=Bn(T1),C1=Mt({},Bo,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),R1=Bn(C1),P1=Mt({},Bo,{data:0}),Kg=Bn(P1),I1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},N1={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"},L1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function D1(n){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(n):(n=L1[n])?!!e[n]:!1}function am(){return D1}var U1=Mt({},El,{key:function(n){if(n.key){var e=I1[n.key]||n.key;if(e!=="Unidentified")return e}return n.type==="keypress"?(n=Qc(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?N1[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:am,charCode:function(n){return n.type==="keypress"?Qc(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Qc(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),k1=Bn(U1),O1=Mt({},fd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Jg=Bn(O1),F1=Mt({},El,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:am}),B1=Bn(F1),z1=Mt({},Bo,{propertyName:0,elapsedTime:0,pseudoElement:0}),V1=Bn(z1),H1=Mt({},fd,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),G1=Bn(H1),W1=[9,13,27,32],lm=Xi&&"CompositionEvent"in window,wa=null;Xi&&"documentMode"in document&&(wa=document.documentMode);var j1=Xi&&"TextEvent"in window&&!wa,Iy=Xi&&(!lm||wa&&8<wa&&11>=wa),Qg=" ",ex=!1;function Ny(n,e){switch(n){case"keyup":return W1.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ly(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var no=!1;function X1(n,e){switch(n){case"compositionend":return Ly(e);case"keypress":return e.which!==32?null:(ex=!0,Qg);case"textInput":return n=e.data,n===Qg&&ex?null:n;default:return null}}function $1(n,e){if(no)return n==="compositionend"||!lm&&Ny(n,e)?(n=Py(),Jc=sm=yr=null,no=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return Iy&&e.locale!=="ko"?null:e.data;default:return null}}var Y1={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 tx(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e==="input"?!!Y1[n.type]:e==="textarea"}function Dy(n,e,t,i){dy(i),e=gu(e,"onChange"),0<e.length&&(t=new om("onChange","change",null,t,i),n.push({event:t,listeners:e}))}var ba=null,ja=null;function q1(n){jy(n,0)}function pd(n){var e=so(n);if(ry(e))return n}function Z1(n,e){if(n==="change")return e}var Uy=!1;if(Xi){var bh;if(Xi){var Eh="oninput"in document;if(!Eh){var nx=document.createElement("div");nx.setAttribute("oninput","return;"),Eh=typeof nx.oninput=="function"}bh=Eh}else bh=!1;Uy=bh&&(!document.documentMode||9<document.documentMode)}function ix(){ba&&(ba.detachEvent("onpropertychange",ky),ja=ba=null)}function ky(n){if(n.propertyName==="value"&&pd(ja)){var e=[];Dy(e,ja,n,em(n)),my(q1,e)}}function K1(n,e,t){n==="focusin"?(ix(),ba=e,ja=t,ba.attachEvent("onpropertychange",ky)):n==="focusout"&&ix()}function J1(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return pd(ja)}function Q1(n,e){if(n==="click")return pd(e)}function eb(n,e){if(n==="input"||n==="change")return pd(e)}function tb(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var ai=typeof Object.is=="function"?Object.is:tb;function Xa(n,e){if(ai(n,e))return!0;if(typeof n!="object"||n===null||typeof e!="object"||e===null)return!1;var t=Object.keys(n),i=Object.keys(e);if(t.length!==i.length)return!1;for(i=0;i<t.length;i++){var r=t[i];if(!kf.call(e,r)||!ai(n[r],e[r]))return!1}return!0}function rx(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function sx(n,e){var t=rx(n);n=0;for(var i;t;){if(t.nodeType===3){if(i=n+t.textContent.length,n<=e&&i>=e)return{node:t,offset:e-n};n=i}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=rx(t)}}function Oy(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?Oy(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function Fy(){for(var n=window,e=cu();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=cu(n.document)}return e}function cm(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function nb(n){var e=Fy(),t=n.focusedElem,i=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&Oy(t.ownerDocument.documentElement,t)){if(i!==null&&cm(t)){if(e=i.start,n=i.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var r=t.textContent.length,s=Math.min(i.start,r);i=i.end===void 0?s:Math.min(i.end,r),!n.extend&&s>i&&(r=i,i=s,s=r),r=sx(t,s);var o=sx(t,i);r&&o&&(n.rangeCount!==1||n.anchorNode!==r.node||n.anchorOffset!==r.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),n.removeAllRanges(),s>i?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t<e.length;t++)n=e[t],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var ib=Xi&&"documentMode"in document&&11>=document.documentMode,io=null,tp=null,Ea=null,np=!1;function ox(n,e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;np||io==null||io!==cu(i)||(i=io,"selectionStart"in i&&cm(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Ea&&Xa(Ea,i)||(Ea=i,i=gu(tp,"onSelect"),0<i.length&&(e=new om("onSelect","select",null,e,t),n.push({event:e,listeners:i}),e.target=io)))}function Yl(n,e){var t={};return t[n.toLowerCase()]=e.toLowerCase(),t["Webkit"+n]="webkit"+e,t["Moz"+n]="moz"+e,t}var ro={animationend:Yl("Animation","AnimationEnd"),animationiteration:Yl("Animation","AnimationIteration"),animationstart:Yl("Animation","AnimationStart"),transitionend:Yl("Transition","TransitionEnd")},Th={},By={};Xi&&(By=document.createElement("div").style,"AnimationEvent"in window||(delete ro.animationend.animation,delete ro.animationiteration.animation,delete ro.animationstart.animation),"TransitionEvent"in window||delete ro.transitionend.transition);function md(n){if(Th[n])return Th[n];if(!ro[n])return n;var e=ro[n],t;for(t in e)if(e.hasOwnProperty(t)&&t in By)return Th[n]=e[t];return n}var zy=md("animationend"),Vy=md("animationiteration"),Hy=md("animationstart"),Gy=md("transitionend"),Wy=new Map,ax="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 Lr(n,e){Wy.set(n,e),Ts(e,[n])}for(var Ah=0;Ah<ax.length;Ah++){var Ch=ax[Ah],rb=Ch.toLowerCase(),sb=Ch[0].toUpperCase()+Ch.slice(1);Lr(rb,"on"+sb)}Lr(zy,"onAnimationEnd");Lr(Vy,"onAnimationIteration");Lr(Hy,"onAnimationStart");Lr("dblclick","onDoubleClick");Lr("focusin","onFocus");Lr("focusout","onBlur");Lr(Gy,"onTransitionEnd");To("onMouseEnter",["mouseout","mouseover"]);To("onMouseLeave",["mouseout","mouseover"]);To("onPointerEnter",["pointerout","pointerover"]);To("onPointerLeave",["pointerout","pointerover"]);Ts("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Ts("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Ts("onBeforeInput",["compositionend","keypress","textInput","paste"]);Ts("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Ts("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Ts("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var va="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(" "),ob=new Set("cancel close invalid load scroll toggle".split(" ").concat(va));function lx(n,e,t){var i=n.type||"unknown-event";n.currentTarget=t,r1(i,e,void 0,n),n.currentTarget=null}function jy(n,e){e=(e&4)!==0;for(var t=0;t<n.length;t++){var i=n[t],r=i.event;i=i.listeners;e:{var s=void 0;if(e)for(var o=i.length-1;0<=o;o--){var a=i[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==s&&r.isPropagationStopped())break e;lx(r,a,c),s=l}else for(o=0;o<i.length;o++){if(a=i[o],l=a.instance,c=a.currentTarget,a=a.listener,l!==s&&r.isPropagationStopped())break e;lx(r,a,c),s=l}}}if(du)throw n=Kf,du=!1,Kf=null,n}function mt(n,e){var t=e[ap];t===void 0&&(t=e[ap]=new Set);var i=n+"__bubble";t.has(i)||(Xy(e,n,2,!1),t.add(i))}function Rh(n,e,t){var i=0;e&&(i|=4),Xy(t,n,i,e)}var ql="_reactListening"+Math.random().toString(36).slice(2);function $a(n){if(!n[ql]){n[ql]=!0,Qv.forEach(function(t){t!=="selectionchange"&&(ob.has(t)||Rh(t,!1,n),Rh(t,!0,n))});var e=n.nodeType===9?n:n.ownerDocument;e===null||e[ql]||(e[ql]=!0,Rh("selectionchange",!1,e))}}function Xy(n,e,t,i){switch(Ry(e)){case 1:var r=_1;break;case 4:r=S1;break;default:r=rm}t=r.bind(null,e,t,n),r=void 0,!Zf||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(r=!0),i?r!==void 0?n.addEventListener(e,t,{capture:!0,passive:r}):n.addEventListener(e,t,!0):r!==void 0?n.addEventListener(e,t,{passive:r}):n.addEventListener(e,t,!1)}function Ph(n,e,t,i,r){var s=i;if(!(e&1)&&!(e&2)&&i!==null)e:for(;;){if(i===null)return;var o=i.tag;if(o===3||o===4){var a=i.stateNode.containerInfo;if(a===r||a.nodeType===8&&a.parentNode===r)break;if(o===4)for(o=i.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===r||l.nodeType===8&&l.parentNode===r))return;o=o.return}for(;a!==null;){if(o=rs(a),o===null)return;if(l=o.tag,l===5||l===6){i=s=o;continue e}a=a.parentNode}}i=i.return}my(function(){var c=s,u=em(t),h=[];e:{var d=Wy.get(n);if(d!==void 0){var p=om,m=n;switch(n){case"keypress":if(Qc(t)===0)break e;case"keydown":case"keyup":p=k1;break;case"focusin":m="focus",p=wh;break;case"focusout":m="blur",p=wh;break;case"beforeblur":case"afterblur":p=wh;break;case"click":if(t.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=Zg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=b1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=B1;break;case zy:case Vy:case Hy:p=A1;break;case Gy:p=V1;break;case"scroll":p=M1;break;case"wheel":p=G1;break;case"copy":case"cut":case"paste":p=R1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Jg}var x=(e&4)!==0,g=!x&&n==="scroll",f=x?d!==null?d+"Capture":null:d;x=[];for(var v=c,y;v!==null;){y=v;var _=y.stateNode;if(y.tag===5&&_!==null&&(y=_,f!==null&&(_=Va(v,f),_!=null&&x.push(Ya(v,_,y)))),g)break;v=v.return}0<x.length&&(d=new p(d,m,null,t,u),h.push({event:d,listeners:x}))}}if(!(e&7)){e:{if(d=n==="mouseover"||n==="pointerover",p=n==="mouseout"||n==="pointerout",d&&t!==Yf&&(m=t.relatedTarget||t.fromElement)&&(rs(m)||m[$i]))break e;if((p||d)&&(d=u.window===u?u:(d=u.ownerDocument)?d.defaultView||d.parentWindow:window,p?(m=t.relatedTarget||t.toElement,p=c,m=m?rs(m):null,m!==null&&(g=As(m),m!==g||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=c),p!==m)){if(x=Zg,_="onMouseLeave",f="onMouseEnter",v="mouse",(n==="pointerout"||n==="pointerover")&&(x=Jg,_="onPointerLeave",f="onPointerEnter",v="pointer"),g=p==null?d:so(p),y=m==null?d:so(m),d=new x(_,v+"leave",p,t,u),d.target=g,d.relatedTarget=y,_=null,rs(u)===c&&(x=new x(f,v+"enter",m,t,u),x.target=y,x.relatedTarget=g,_=x),g=_,p&&m)t:{for(x=p,f=m,v=0,y=x;y;y=Ns(y))v++;for(y=0,_=f;_;_=Ns(_))y++;for(;0<v-y;)x=Ns(x),v--;for(;0<y-v;)f=Ns(f),y--;for(;v--;){if(x===f||f!==null&&x===f.alternate)break t;x=Ns(x),f=Ns(f)}x=null}else x=null;p!==null&&cx(h,d,p,x,!1),m!==null&&g!==null&&cx(h,g,m,x,!0)}}e:{if(d=c?so(c):window,p=d.nodeName&&d.nodeName.toLowerCase(),p==="select"||p==="input"&&d.type==="file")var C=Z1;else if(tx(d))if(Uy)C=eb;else{C=J1;var w=K1}else(p=d.nodeName)&&p.toLowerCase()==="input"&&(d.type==="checkbox"||d.type==="radio")&&(C=Q1);if(C&&(C=C(n,c))){Dy(h,C,t,u);break e}w&&w(n,d,c),n==="focusout"&&(w=d._wrapperState)&&w.controlled&&d.type==="number"&&Gf(d,"number",d.value)}switch(w=c?so(c):window,n){case"focusin":(tx(w)||w.contentEditable==="true")&&(io=w,tp=c,Ea=null);break;case"focusout":Ea=tp=io=null;break;case"mousedown":np=!0;break;case"contextmenu":case"mouseup":case"dragend":np=!1,ox(h,t,u);break;case"selectionchange":if(ib)break;case"keydown":case"keyup":ox(h,t,u)}var E;if(lm)e:{switch(n){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else no?Ny(n,t)&&(A="onCompositionEnd"):n==="keydown"&&t.keyCode===229&&(A="onCompositionStart");A&&(Iy&&t.locale!=="ko"&&(no||A!=="onCompositionStart"?A==="onCompositionEnd"&&no&&(E=Py()):(yr=u,sm="value"in yr?yr.value:yr.textContent,no=!0)),w=gu(c,A),0<w.length&&(A=new Kg(A,n,null,t,u),h.push({event:A,listeners:w}),E?A.data=E:(E=Ly(t),E!==null&&(A.data=E)))),(E=j1?X1(n,t):$1(n,t))&&(c=gu(c,"onBeforeInput"),0<c.length&&(u=new Kg("onBeforeInput","beforeinput",null,t,u),h.push({event:u,listeners:c}),u.data=E))}jy(h,e)})}function Ya(n,e,t){return{instance:n,listener:e,currentTarget:t}}function gu(n,e){for(var t=e+"Capture",i=[];n!==null;){var r=n,s=r.stateNode;r.tag===5&&s!==null&&(r=s,s=Va(n,t),s!=null&&i.unshift(Ya(n,s,r)),s=Va(n,e),s!=null&&i.push(Ya(n,s,r))),n=n.return}return i}function Ns(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function cx(n,e,t,i,r){for(var s=e._reactName,o=[];t!==null&&t!==i;){var a=t,l=a.alternate,c=a.stateNode;if(l!==null&&l===i)break;a.tag===5&&c!==null&&(a=c,r?(l=Va(t,s),l!=null&&o.unshift(Ya(t,l,a))):r||(l=Va(t,s),l!=null&&o.push(Ya(t,l,a)))),t=t.return}o.length!==0&&n.push({event:e,listeners:o})}var ab=/\r\n?/g,lb=/\u0000|\uFFFD/g;function ux(n){return(typeof n=="string"?n:""+n).replace(ab,`
38
- `).replace(lb,"")}function Zl(n,e,t){if(e=ux(e),ux(n)!==e&&t)throw Error(re(425))}function xu(){}var ip=null,rp=null;function sp(n,e){return n==="textarea"||n==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var op=typeof setTimeout=="function"?setTimeout:void 0,cb=typeof clearTimeout=="function"?clearTimeout:void 0,dx=typeof Promise=="function"?Promise:void 0,ub=typeof queueMicrotask=="function"?queueMicrotask:typeof dx<"u"?function(n){return dx.resolve(null).then(n).catch(db)}:op;function db(n){setTimeout(function(){throw n})}function Ih(n,e){var t=e,i=0;do{var r=t.nextSibling;if(n.removeChild(t),r&&r.nodeType===8)if(t=r.data,t==="/$"){if(i===0){n.removeChild(r),Wa(e);return}i--}else t!=="$"&&t!=="$?"&&t!=="$!"||i++;t=r}while(t);Wa(e)}function br(n){for(;n!=null;n=n.nextSibling){var e=n.nodeType;if(e===1||e===3)break;if(e===8){if(e=n.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return n}function hx(n){n=n.previousSibling;for(var e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="$"||t==="$!"||t==="$?"){if(e===0)return n;e--}else t==="/$"&&e++}n=n.previousSibling}return null}var zo=Math.random().toString(36).slice(2),xi="__reactFiber$"+zo,qa="__reactProps$"+zo,$i="__reactContainer$"+zo,ap="__reactEvents$"+zo,hb="__reactListeners$"+zo,fb="__reactHandles$"+zo;function rs(n){var e=n[xi];if(e)return e;for(var t=n.parentNode;t;){if(e=t[$i]||t[xi]){if(t=e.alternate,e.child!==null||t!==null&&t.child!==null)for(n=hx(n);n!==null;){if(t=n[xi])return t;n=hx(n)}return e}n=t,t=n.parentNode}return null}function Tl(n){return n=n[xi]||n[$i],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function so(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(re(33))}function gd(n){return n[qa]||null}var lp=[],oo=-1;function Dr(n){return{current:n}}function gt(n){0>oo||(n.current=lp[oo],lp[oo]=null,oo--)}function pt(n,e){oo++,lp[oo]=n.current,n.current=e}var Pr={},sn=Dr(Pr),Mn=Dr(!1),xs=Pr;function Ao(n,e){var t=n.type.contextTypes;if(!t)return Pr;var i=n.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in t)r[s]=e[s];return i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=r),r}function wn(n){return n=n.childContextTypes,n!=null}function vu(){gt(Mn),gt(sn)}function fx(n,e,t){if(sn.current!==Pr)throw Error(re(168));pt(sn,e),pt(Mn,t)}function $y(n,e,t){var i=n.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return t;i=i.getChildContext();for(var r in i)if(!(r in e))throw Error(re(108,Kw(n)||"Unknown",r));return Mt({},t,i)}function yu(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||Pr,xs=sn.current,pt(sn,n),pt(Mn,Mn.current),!0}function px(n,e,t){var i=n.stateNode;if(!i)throw Error(re(169));t?(n=$y(n,e,xs),i.__reactInternalMemoizedMergedChildContext=n,gt(Mn),gt(sn),pt(sn,n)):gt(Mn),pt(Mn,t)}var Oi=null,xd=!1,Nh=!1;function Yy(n){Oi===null?Oi=[n]:Oi.push(n)}function pb(n){xd=!0,Yy(n)}function Ur(){if(!Nh&&Oi!==null){Nh=!0;var n=0,e=dt;try{var t=Oi;for(dt=1;n<t.length;n++){var i=t[n];do i=i(!0);while(i!==null)}Oi=null,xd=!1}catch(r){throw Oi!==null&&(Oi=Oi.slice(n+1)),yy(tm,Ur),r}finally{dt=e,Nh=!1}}return null}var ao=[],lo=0,_u=null,Su=0,Gn=[],Wn=0,vs=null,zi=1,Vi="";function Qr(n,e){ao[lo++]=Su,ao[lo++]=_u,_u=n,Su=e}function qy(n,e,t){Gn[Wn++]=zi,Gn[Wn++]=Vi,Gn[Wn++]=vs,vs=n;var i=zi;n=Vi;var r=32-si(i)-1;i&=~(1<<r),t+=1;var s=32-si(e)+r;if(30<s){var o=r-r%5;s=(i&(1<<o)-1).toString(32),i>>=o,r-=o,zi=1<<32-si(e)+r|t<<r|i,Vi=s+n}else zi=1<<s|t<<r|i,Vi=n}function um(n){n.return!==null&&(Qr(n,1),qy(n,1,0))}function dm(n){for(;n===_u;)_u=ao[--lo],ao[lo]=null,Su=ao[--lo],ao[lo]=null;for(;n===vs;)vs=Gn[--Wn],Gn[Wn]=null,Vi=Gn[--Wn],Gn[Wn]=null,zi=Gn[--Wn],Gn[Wn]=null}var Dn=null,Ln=null,xt=!1,ii=null;function Zy(n,e){var t=jn(5,null,null,0);t.elementType="DELETED",t.stateNode=e,t.return=n,e=n.deletions,e===null?(n.deletions=[t],n.flags|=16):e.push(t)}function mx(n,e){switch(n.tag){case 5:var t=n.type;return e=e.nodeType!==1||t.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(n.stateNode=e,Dn=n,Ln=br(e.firstChild),!0):!1;case 6:return e=n.pendingProps===""||e.nodeType!==3?null:e,e!==null?(n.stateNode=e,Dn=n,Ln=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(t=vs!==null?{id:zi,overflow:Vi}:null,n.memoizedState={dehydrated:e,treeContext:t,retryLane:1073741824},t=jn(18,null,null,0),t.stateNode=e,t.return=n,n.child=t,Dn=n,Ln=null,!0):!1;default:return!1}}function cp(n){return(n.mode&1)!==0&&(n.flags&128)===0}function up(n){if(xt){var e=Ln;if(e){var t=e;if(!mx(n,e)){if(cp(n))throw Error(re(418));e=br(t.nextSibling);var i=Dn;e&&mx(n,e)?Zy(i,t):(n.flags=n.flags&-4097|2,xt=!1,Dn=n)}}else{if(cp(n))throw Error(re(418));n.flags=n.flags&-4097|2,xt=!1,Dn=n}}}function gx(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;Dn=n}function Kl(n){if(n!==Dn)return!1;if(!xt)return gx(n),xt=!0,!1;var e;if((e=n.tag!==3)&&!(e=n.tag!==5)&&(e=n.type,e=e!=="head"&&e!=="body"&&!sp(n.type,n.memoizedProps)),e&&(e=Ln)){if(cp(n))throw Ky(),Error(re(418));for(;e;)Zy(n,e),e=br(e.nextSibling)}if(gx(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(re(317));e:{for(n=n.nextSibling,e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="/$"){if(e===0){Ln=br(n.nextSibling);break e}e--}else t!=="$"&&t!=="$!"&&t!=="$?"||e++}n=n.nextSibling}Ln=null}}else Ln=Dn?br(n.stateNode.nextSibling):null;return!0}function Ky(){for(var n=Ln;n;)n=br(n.nextSibling)}function Co(){Ln=Dn=null,xt=!1}function hm(n){ii===null?ii=[n]:ii.push(n)}var mb=er.ReactCurrentBatchConfig;function Jo(n,e,t){if(n=t.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(t._owner){if(t=t._owner,t){if(t.tag!==1)throw Error(re(309));var i=t.stateNode}if(!i)throw Error(re(147,n));var r=i,s=""+n;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===s?e.ref:(e=function(o){var a=r.refs;o===null?delete a[s]:a[s]=o},e._stringRef=s,e)}if(typeof n!="string")throw Error(re(284));if(!t._owner)throw Error(re(290,n))}return n}function Jl(n,e){throw n=Object.prototype.toString.call(e),Error(re(31,n==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":n))}function xx(n){var e=n._init;return e(n._payload)}function Jy(n){function e(f,v){if(n){var y=f.deletions;y===null?(f.deletions=[v],f.flags|=16):y.push(v)}}function t(f,v){if(!n)return null;for(;v!==null;)e(f,v),v=v.sibling;return null}function i(f,v){for(f=new Map;v!==null;)v.key!==null?f.set(v.key,v):f.set(v.index,v),v=v.sibling;return f}function r(f,v){return f=Cr(f,v),f.index=0,f.sibling=null,f}function s(f,v,y){return f.index=y,n?(y=f.alternate,y!==null?(y=y.index,y<v?(f.flags|=2,v):y):(f.flags|=2,v)):(f.flags|=1048576,v)}function o(f){return n&&f.alternate===null&&(f.flags|=2),f}function a(f,v,y,_){return v===null||v.tag!==6?(v=Bh(y,f.mode,_),v.return=f,v):(v=r(v,y),v.return=f,v)}function l(f,v,y,_){var C=y.type;return C===to?u(f,v,y.props.children,_,y.key):v!==null&&(v.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===fr&&xx(C)===v.type)?(_=r(v,y.props),_.ref=Jo(f,v,y),_.return=f,_):(_=ou(y.type,y.key,y.props,null,f.mode,_),_.ref=Jo(f,v,y),_.return=f,_)}function c(f,v,y,_){return v===null||v.tag!==4||v.stateNode.containerInfo!==y.containerInfo||v.stateNode.implementation!==y.implementation?(v=zh(y,f.mode,_),v.return=f,v):(v=r(v,y.children||[]),v.return=f,v)}function u(f,v,y,_,C){return v===null||v.tag!==7?(v=hs(y,f.mode,_,C),v.return=f,v):(v=r(v,y),v.return=f,v)}function h(f,v,y){if(typeof v=="string"&&v!==""||typeof v=="number")return v=Bh(""+v,f.mode,y),v.return=f,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Vl:return y=ou(v.type,v.key,v.props,null,f.mode,y),y.ref=Jo(f,null,v),y.return=f,y;case eo:return v=zh(v,f.mode,y),v.return=f,v;case fr:var _=v._init;return h(f,_(v._payload),y)}if(ga(v)||$o(v))return v=hs(v,f.mode,y,null),v.return=f,v;Jl(f,v)}return null}function d(f,v,y,_){var C=v!==null?v.key:null;if(typeof y=="string"&&y!==""||typeof y=="number")return C!==null?null:a(f,v,""+y,_);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Vl:return y.key===C?l(f,v,y,_):null;case eo:return y.key===C?c(f,v,y,_):null;case fr:return C=y._init,d(f,v,C(y._payload),_)}if(ga(y)||$o(y))return C!==null?null:u(f,v,y,_,null);Jl(f,y)}return null}function p(f,v,y,_,C){if(typeof _=="string"&&_!==""||typeof _=="number")return f=f.get(y)||null,a(v,f,""+_,C);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case Vl:return f=f.get(_.key===null?y:_.key)||null,l(v,f,_,C);case eo:return f=f.get(_.key===null?y:_.key)||null,c(v,f,_,C);case fr:var w=_._init;return p(f,v,y,w(_._payload),C)}if(ga(_)||$o(_))return f=f.get(y)||null,u(v,f,_,C,null);Jl(v,_)}return null}function m(f,v,y,_){for(var C=null,w=null,E=v,A=v=0,b=null;E!==null&&A<y.length;A++){E.index>A?(b=E,E=null):b=E.sibling;var M=d(f,E,y[A],_);if(M===null){E===null&&(E=b);break}n&&E&&M.alternate===null&&e(f,E),v=s(M,v,A),w===null?C=M:w.sibling=M,w=M,E=b}if(A===y.length)return t(f,E),xt&&Qr(f,A),C;if(E===null){for(;A<y.length;A++)E=h(f,y[A],_),E!==null&&(v=s(E,v,A),w===null?C=E:w.sibling=E,w=E);return xt&&Qr(f,A),C}for(E=i(f,E);A<y.length;A++)b=p(E,f,A,y[A],_),b!==null&&(n&&b.alternate!==null&&E.delete(b.key===null?A:b.key),v=s(b,v,A),w===null?C=b:w.sibling=b,w=b);return n&&E.forEach(function(L){return e(f,L)}),xt&&Qr(f,A),C}function x(f,v,y,_){var C=$o(y);if(typeof C!="function")throw Error(re(150));if(y=C.call(y),y==null)throw Error(re(151));for(var w=C=null,E=v,A=v=0,b=null,M=y.next();E!==null&&!M.done;A++,M=y.next()){E.index>A?(b=E,E=null):b=E.sibling;var L=d(f,E,M.value,_);if(L===null){E===null&&(E=b);break}n&&E&&L.alternate===null&&e(f,E),v=s(L,v,A),w===null?C=L:w.sibling=L,w=L,E=b}if(M.done)return t(f,E),xt&&Qr(f,A),C;if(E===null){for(;!M.done;A++,M=y.next())M=h(f,M.value,_),M!==null&&(v=s(M,v,A),w===null?C=M:w.sibling=M,w=M);return xt&&Qr(f,A),C}for(E=i(f,E);!M.done;A++,M=y.next())M=p(E,f,A,M.value,_),M!==null&&(n&&M.alternate!==null&&E.delete(M.key===null?A:M.key),v=s(M,v,A),w===null?C=M:w.sibling=M,w=M);return n&&E.forEach(function(G){return e(f,G)}),xt&&Qr(f,A),C}function g(f,v,y,_){if(typeof y=="object"&&y!==null&&y.type===to&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case Vl:e:{for(var C=y.key,w=v;w!==null;){if(w.key===C){if(C=y.type,C===to){if(w.tag===7){t(f,w.sibling),v=r(w,y.props.children),v.return=f,f=v;break e}}else if(w.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===fr&&xx(C)===w.type){t(f,w.sibling),v=r(w,y.props),v.ref=Jo(f,w,y),v.return=f,f=v;break e}t(f,w);break}else e(f,w);w=w.sibling}y.type===to?(v=hs(y.props.children,f.mode,_,y.key),v.return=f,f=v):(_=ou(y.type,y.key,y.props,null,f.mode,_),_.ref=Jo(f,v,y),_.return=f,f=_)}return o(f);case eo:e:{for(w=y.key;v!==null;){if(v.key===w)if(v.tag===4&&v.stateNode.containerInfo===y.containerInfo&&v.stateNode.implementation===y.implementation){t(f,v.sibling),v=r(v,y.children||[]),v.return=f,f=v;break e}else{t(f,v);break}else e(f,v);v=v.sibling}v=zh(y,f.mode,_),v.return=f,f=v}return o(f);case fr:return w=y._init,g(f,v,w(y._payload),_)}if(ga(y))return m(f,v,y,_);if($o(y))return x(f,v,y,_);Jl(f,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,v!==null&&v.tag===6?(t(f,v.sibling),v=r(v,y),v.return=f,f=v):(t(f,v),v=Bh(y,f.mode,_),v.return=f,f=v),o(f)):t(f,v)}return g}var Ro=Jy(!0),Qy=Jy(!1),Mu=Dr(null),wu=null,co=null,fm=null;function pm(){fm=co=wu=null}function mm(n){var e=Mu.current;gt(Mu),n._currentValue=e}function dp(n,e,t){for(;n!==null;){var i=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),n===t)break;n=n.return}}function Mo(n,e){wu=n,fm=co=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&e&&(_n=!0),n.firstContext=null)}function Yn(n){var e=n._currentValue;if(fm!==n)if(n={context:n,memoizedValue:e,next:null},co===null){if(wu===null)throw Error(re(308));co=n,wu.dependencies={lanes:0,firstContext:n}}else co=co.next=n;return e}var ss=null;function gm(n){ss===null?ss=[n]:ss.push(n)}function e_(n,e,t,i){var r=e.interleaved;return r===null?(t.next=t,gm(e)):(t.next=r.next,r.next=t),e.interleaved=t,Yi(n,i)}function Yi(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var pr=!1;function xm(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function t_(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function Gi(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function Er(n,e,t){var i=n.updateQueue;if(i===null)return null;if(i=i.shared,tt&2){var r=i.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),i.pending=e,Yi(n,t)}return r=i.interleaved,r===null?(e.next=e,gm(i)):(e.next=r.next,r.next=e),i.interleaved=e,Yi(n,t)}function eu(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,nm(n,t)}}function vx(n,e){var t=n.updateQueue,i=n.alternate;if(i!==null&&(i=i.updateQueue,t===i)){var r=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?r=s=o:s=s.next=o,t=t.next}while(t!==null);s===null?r=s=e:s=s.next=e}else r=s=e;t={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,effects:i.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function bu(n,e,t,i){var r=n.updateQueue;pr=!1;var s=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?s=c:o.next=c,o=l;var u=n.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==o&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(s!==null){var h=r.baseState;o=0,u=c=l=null,a=s;do{var d=a.lane,p=a.eventTime;if((i&d)===d){u!==null&&(u=u.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var m=n,x=a;switch(d=e,p=t,x.tag){case 1:if(m=x.payload,typeof m=="function"){h=m.call(p,h,d);break e}h=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=x.payload,d=typeof m=="function"?m.call(p,h,d):m,d==null)break e;h=Mt({},h,d);break e;case 2:pr=!0}}a.callback!==null&&a.lane!==0&&(n.flags|=64,d=r.effects,d===null?r.effects=[a]:d.push(a))}else p={eventTime:p,lane:d,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=p,l=h):u=u.next=p,o|=d;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;d=a,a=d.next,d.next=null,r.lastBaseUpdate=d,r.shared.pending=null}}while(!0);if(u===null&&(l=h),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=u,e=r.shared.interleaved,e!==null){r=e;do o|=r.lane,r=r.next;while(r!==e)}else s===null&&(r.shared.lanes=0);_s|=o,n.lanes=o,n.memoizedState=h}}function yx(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;e<n.length;e++){var i=n[e],r=i.callback;if(r!==null){if(i.callback=null,i=t,typeof r!="function")throw Error(re(191,r));r.call(i)}}}var Al={},Mi=Dr(Al),Za=Dr(Al),Ka=Dr(Al);function os(n){if(n===Al)throw Error(re(174));return n}function vm(n,e){switch(pt(Ka,e),pt(Za,n),pt(Mi,Al),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:jf(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=jf(e,n)}gt(Mi),pt(Mi,e)}function Po(){gt(Mi),gt(Za),gt(Ka)}function n_(n){os(Ka.current);var e=os(Mi.current),t=jf(e,n.type);e!==t&&(pt(Za,n),pt(Mi,t))}function ym(n){Za.current===n&&(gt(Mi),gt(Za))}var yt=Dr(0);function Eu(n){for(var e=n;e!==null;){if(e.tag===13){var t=e.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Lh=[];function _m(){for(var n=0;n<Lh.length;n++)Lh[n]._workInProgressVersionPrimary=null;Lh.length=0}var tu=er.ReactCurrentDispatcher,Dh=er.ReactCurrentBatchConfig,ys=0,St=null,Ot=null,Ht=null,Tu=!1,Ta=!1,Ja=0,gb=0;function Kt(){throw Error(re(321))}function Sm(n,e){if(e===null)return!1;for(var t=0;t<e.length&&t<n.length;t++)if(!ai(n[t],e[t]))return!1;return!0}function Mm(n,e,t,i,r,s){if(ys=s,St=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,tu.current=n===null||n.memoizedState===null?_b:Sb,n=t(i,r),Ta){s=0;do{if(Ta=!1,Ja=0,25<=s)throw Error(re(301));s+=1,Ht=Ot=null,e.updateQueue=null,tu.current=Mb,n=t(i,r)}while(Ta)}if(tu.current=Au,e=Ot!==null&&Ot.next!==null,ys=0,Ht=Ot=St=null,Tu=!1,e)throw Error(re(300));return n}function wm(){var n=Ja!==0;return Ja=0,n}function mi(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ht===null?St.memoizedState=Ht=n:Ht=Ht.next=n,Ht}function qn(){if(Ot===null){var n=St.alternate;n=n!==null?n.memoizedState:null}else n=Ot.next;var e=Ht===null?St.memoizedState:Ht.next;if(e!==null)Ht=e,Ot=n;else{if(n===null)throw Error(re(310));Ot=n,n={memoizedState:Ot.memoizedState,baseState:Ot.baseState,baseQueue:Ot.baseQueue,queue:Ot.queue,next:null},Ht===null?St.memoizedState=Ht=n:Ht=Ht.next=n}return Ht}function Qa(n,e){return typeof e=="function"?e(n):e}function Uh(n){var e=qn(),t=e.queue;if(t===null)throw Error(re(311));t.lastRenderedReducer=n;var i=Ot,r=i.baseQueue,s=t.pending;if(s!==null){if(r!==null){var o=r.next;r.next=s.next,s.next=o}i.baseQueue=r=s,t.pending=null}if(r!==null){s=r.next,i=i.baseState;var a=o=null,l=null,c=s;do{var u=c.lane;if((ys&u)===u)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),i=c.hasEagerState?c.eagerState:n(i,c.action);else{var h={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=h,o=i):l=l.next=h,St.lanes|=u,_s|=u}c=c.next}while(c!==null&&c!==s);l===null?o=i:l.next=a,ai(i,e.memoizedState)||(_n=!0),e.memoizedState=i,e.baseState=o,e.baseQueue=l,t.lastRenderedState=i}if(n=t.interleaved,n!==null){r=n;do s=r.lane,St.lanes|=s,_s|=s,r=r.next;while(r!==n)}else r===null&&(t.lanes=0);return[e.memoizedState,t.dispatch]}function kh(n){var e=qn(),t=e.queue;if(t===null)throw Error(re(311));t.lastRenderedReducer=n;var i=t.dispatch,r=t.pending,s=e.memoizedState;if(r!==null){t.pending=null;var o=r=r.next;do s=n(s,o.action),o=o.next;while(o!==r);ai(s,e.memoizedState)||(_n=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),t.lastRenderedState=s}return[s,i]}function i_(){}function r_(n,e){var t=St,i=qn(),r=e(),s=!ai(i.memoizedState,r);if(s&&(i.memoizedState=r,_n=!0),i=i.queue,bm(a_.bind(null,t,i,n),[n]),i.getSnapshot!==e||s||Ht!==null&&Ht.memoizedState.tag&1){if(t.flags|=2048,el(9,o_.bind(null,t,i,r,e),void 0,null),Wt===null)throw Error(re(349));ys&30||s_(t,e,r)}return r}function s_(n,e,t){n.flags|=16384,n={getSnapshot:e,value:t},e=St.updateQueue,e===null?(e={lastEffect:null,stores:null},St.updateQueue=e,e.stores=[n]):(t=e.stores,t===null?e.stores=[n]:t.push(n))}function o_(n,e,t,i){e.value=t,e.getSnapshot=i,l_(e)&&c_(n)}function a_(n,e,t){return t(function(){l_(e)&&c_(n)})}function l_(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!ai(n,t)}catch{return!0}}function c_(n){var e=Yi(n,1);e!==null&&oi(e,n,1,-1)}function _x(n){var e=mi();return typeof n=="function"&&(n=n()),e.memoizedState=e.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Qa,lastRenderedState:n},e.queue=n,n=n.dispatch=yb.bind(null,St,n),[e.memoizedState,n]}function el(n,e,t,i){return n={tag:n,create:e,destroy:t,deps:i,next:null},e=St.updateQueue,e===null?(e={lastEffect:null,stores:null},St.updateQueue=e,e.lastEffect=n.next=n):(t=e.lastEffect,t===null?e.lastEffect=n.next=n:(i=t.next,t.next=n,n.next=i,e.lastEffect=n)),n}function u_(){return qn().memoizedState}function nu(n,e,t,i){var r=mi();St.flags|=n,r.memoizedState=el(1|e,t,void 0,i===void 0?null:i)}function vd(n,e,t,i){var r=qn();i=i===void 0?null:i;var s=void 0;if(Ot!==null){var o=Ot.memoizedState;if(s=o.destroy,i!==null&&Sm(i,o.deps)){r.memoizedState=el(e,t,s,i);return}}St.flags|=n,r.memoizedState=el(1|e,t,s,i)}function Sx(n,e){return nu(8390656,8,n,e)}function bm(n,e){return vd(2048,8,n,e)}function d_(n,e){return vd(4,2,n,e)}function h_(n,e){return vd(4,4,n,e)}function f_(n,e){if(typeof e=="function")return n=n(),e(n),function(){e(null)};if(e!=null)return n=n(),e.current=n,function(){e.current=null}}function p_(n,e,t){return t=t!=null?t.concat([n]):null,vd(4,4,f_.bind(null,e,n),t)}function Em(){}function m_(n,e){var t=qn();e=e===void 0?null:e;var i=t.memoizedState;return i!==null&&e!==null&&Sm(e,i[1])?i[0]:(t.memoizedState=[n,e],n)}function g_(n,e){var t=qn();e=e===void 0?null:e;var i=t.memoizedState;return i!==null&&e!==null&&Sm(e,i[1])?i[0]:(n=n(),t.memoizedState=[n,e],n)}function x_(n,e,t){return ys&21?(ai(t,e)||(t=My(),St.lanes|=t,_s|=t,n.baseState=!0),e):(n.baseState&&(n.baseState=!1,_n=!0),n.memoizedState=t)}function xb(n,e){var t=dt;dt=t!==0&&4>t?t:4,n(!0);var i=Dh.transition;Dh.transition={};try{n(!1),e()}finally{dt=t,Dh.transition=i}}function v_(){return qn().memoizedState}function vb(n,e,t){var i=Ar(n);if(t={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null},y_(n))__(e,t);else if(t=e_(n,e,t,i),t!==null){var r=hn();oi(t,n,i,r),S_(t,e,i)}}function yb(n,e,t){var i=Ar(n),r={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null};if(y_(n))__(e,r);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,t);if(r.hasEagerState=!0,r.eagerState=a,ai(a,o)){var l=e.interleaved;l===null?(r.next=r,gm(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch{}finally{}t=e_(n,e,r,i),t!==null&&(r=hn(),oi(t,n,i,r),S_(t,e,i))}}function y_(n){var e=n.alternate;return n===St||e!==null&&e===St}function __(n,e){Ta=Tu=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function S_(n,e,t){if(t&4194240){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,nm(n,t)}}var Au={readContext:Yn,useCallback:Kt,useContext:Kt,useEffect:Kt,useImperativeHandle:Kt,useInsertionEffect:Kt,useLayoutEffect:Kt,useMemo:Kt,useReducer:Kt,useRef:Kt,useState:Kt,useDebugValue:Kt,useDeferredValue:Kt,useTransition:Kt,useMutableSource:Kt,useSyncExternalStore:Kt,useId:Kt,unstable_isNewReconciler:!1},_b={readContext:Yn,useCallback:function(n,e){return mi().memoizedState=[n,e===void 0?null:e],n},useContext:Yn,useEffect:Sx,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,nu(4194308,4,f_.bind(null,e,n),t)},useLayoutEffect:function(n,e){return nu(4194308,4,n,e)},useInsertionEffect:function(n,e){return nu(4,2,n,e)},useMemo:function(n,e){var t=mi();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var i=mi();return e=t!==void 0?t(e):e,i.memoizedState=i.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},i.queue=n,n=n.dispatch=vb.bind(null,St,n),[i.memoizedState,n]},useRef:function(n){var e=mi();return n={current:n},e.memoizedState=n},useState:_x,useDebugValue:Em,useDeferredValue:function(n){return mi().memoizedState=n},useTransition:function(){var n=_x(!1),e=n[0];return n=xb.bind(null,n[1]),mi().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var i=St,r=mi();if(xt){if(t===void 0)throw Error(re(407));t=t()}else{if(t=e(),Wt===null)throw Error(re(349));ys&30||s_(i,e,t)}r.memoizedState=t;var s={value:t,getSnapshot:e};return r.queue=s,Sx(a_.bind(null,i,s,n),[n]),i.flags|=2048,el(9,o_.bind(null,i,s,t,e),void 0,null),t},useId:function(){var n=mi(),e=Wt.identifierPrefix;if(xt){var t=Vi,i=zi;t=(i&~(1<<32-si(i)-1)).toString(32)+t,e=":"+e+"R"+t,t=Ja++,0<t&&(e+="H"+t.toString(32)),e+=":"}else t=gb++,e=":"+e+"r"+t.toString(32)+":";return n.memoizedState=e},unstable_isNewReconciler:!1},Sb={readContext:Yn,useCallback:m_,useContext:Yn,useEffect:bm,useImperativeHandle:p_,useInsertionEffect:d_,useLayoutEffect:h_,useMemo:g_,useReducer:Uh,useRef:u_,useState:function(){return Uh(Qa)},useDebugValue:Em,useDeferredValue:function(n){var e=qn();return x_(e,Ot.memoizedState,n)},useTransition:function(){var n=Uh(Qa)[0],e=qn().memoizedState;return[n,e]},useMutableSource:i_,useSyncExternalStore:r_,useId:v_,unstable_isNewReconciler:!1},Mb={readContext:Yn,useCallback:m_,useContext:Yn,useEffect:bm,useImperativeHandle:p_,useInsertionEffect:d_,useLayoutEffect:h_,useMemo:g_,useReducer:kh,useRef:u_,useState:function(){return kh(Qa)},useDebugValue:Em,useDeferredValue:function(n){var e=qn();return Ot===null?e.memoizedState=n:x_(e,Ot.memoizedState,n)},useTransition:function(){var n=kh(Qa)[0],e=qn().memoizedState;return[n,e]},useMutableSource:i_,useSyncExternalStore:r_,useId:v_,unstable_isNewReconciler:!1};function ti(n,e){if(n&&n.defaultProps){e=Mt({},e),n=n.defaultProps;for(var t in n)e[t]===void 0&&(e[t]=n[t]);return e}return e}function hp(n,e,t,i){e=n.memoizedState,t=t(i,e),t=t==null?e:Mt({},e,t),n.memoizedState=t,n.lanes===0&&(n.updateQueue.baseState=t)}var yd={isMounted:function(n){return(n=n._reactInternals)?As(n)===n:!1},enqueueSetState:function(n,e,t){n=n._reactInternals;var i=hn(),r=Ar(n),s=Gi(i,r);s.payload=e,t!=null&&(s.callback=t),e=Er(n,s,r),e!==null&&(oi(e,n,r,i),eu(e,n,r))},enqueueReplaceState:function(n,e,t){n=n._reactInternals;var i=hn(),r=Ar(n),s=Gi(i,r);s.tag=1,s.payload=e,t!=null&&(s.callback=t),e=Er(n,s,r),e!==null&&(oi(e,n,r,i),eu(e,n,r))},enqueueForceUpdate:function(n,e){n=n._reactInternals;var t=hn(),i=Ar(n),r=Gi(t,i);r.tag=2,e!=null&&(r.callback=e),e=Er(n,r,i),e!==null&&(oi(e,n,i,t),eu(e,n,i))}};function Mx(n,e,t,i,r,s,o){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(i,s,o):e.prototype&&e.prototype.isPureReactComponent?!Xa(t,i)||!Xa(r,s):!0}function M_(n,e,t){var i=!1,r=Pr,s=e.contextType;return typeof s=="object"&&s!==null?s=Yn(s):(r=wn(e)?xs:sn.current,i=e.contextTypes,s=(i=i!=null)?Ao(n,r):Pr),e=new e(t,s),n.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=yd,n.stateNode=e,e._reactInternals=n,i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=r,n.__reactInternalMemoizedMaskedChildContext=s),e}function wx(n,e,t,i){n=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(t,i),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(t,i),e.state!==n&&yd.enqueueReplaceState(e,e.state,null)}function fp(n,e,t,i){var r=n.stateNode;r.props=t,r.state=n.memoizedState,r.refs={},xm(n);var s=e.contextType;typeof s=="object"&&s!==null?r.context=Yn(s):(s=wn(e)?xs:sn.current,r.context=Ao(n,s)),r.state=n.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(hp(n,e,s,t),r.state=n.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(e=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),e!==r.state&&yd.enqueueReplaceState(r,r.state,null),bu(n,t,r,i),r.state=n.memoizedState),typeof r.componentDidMount=="function"&&(n.flags|=4194308)}function Io(n,e){try{var t="",i=e;do t+=Zw(i),i=i.return;while(i);var r=t}catch(s){r=`
37
+ `+r[o].replace(" at new "," at ");return n.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{xh=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?ma(n):""}function Zw(n){switch(n.tag){case 5:return ma(n.type);case 16:return ma("Lazy");case 13:return ma("Suspense");case 19:return ma("SuspenseList");case 0:case 2:case 15:return n=vh(n.type,!1),n;case 11:return n=vh(n.type.render,!1),n;case 1:return n=vh(n.type,!0),n;default:return""}}function zf(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case to:return"Fragment";case eo:return"Portal";case Of:return"Profiler";case Kp:return"StrictMode";case Ff:return"Suspense";case Bf:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case ny:return(n.displayName||"Context")+".Consumer";case ty:return(n._context.displayName||"Context")+".Provider";case Jp:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case Qp:return e=n.displayName||null,e!==null?e:zf(n.type)||"Memo";case fr:e=n._payload,n=n._init;try{return zf(n(e))}catch{}}return null}function Kw(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return zf(e);case 8:return e===Kp?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Rr(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function ry(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Jw(n){var e=ry(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),i=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var r=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return r.call(this)},set:function(o){i=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function Gl(n){n._valueTracker||(n._valueTracker=Jw(n))}function sy(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),i="";return n&&(i=ry(n)?n.checked?"true":"false":n.value),n=i,n!==t?(e.setValue(n),!0):!1}function uu(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function Vf(n,e){var t=e.checked;return Mt({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function Vg(n,e){var t=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;t=Rr(e.value!=null?e.value:t),n._wrapperState={initialChecked:i,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function oy(n,e){e=e.checked,e!=null&&Zp(n,"checked",e,!1)}function Hf(n,e){oy(n,e);var t=Rr(e.value),i=e.type;if(t!=null)i==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(i==="submit"||i==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?Gf(n,e.type,t):e.hasOwnProperty("defaultValue")&&Gf(n,e.type,Rr(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function Hg(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function Gf(n,e,t){(e!=="number"||uu(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var ga=Array.isArray;function vo(n,e,t,i){if(n=n.options,e){e={};for(var r=0;r<t.length;r++)e["$"+t[r]]=!0;for(t=0;t<n.length;t++)r=e.hasOwnProperty("$"+n[t].value),n[t].selected!==r&&(n[t].selected=r),r&&i&&(n[t].defaultSelected=!0)}else{for(t=""+Rr(t),e=null,r=0;r<n.length;r++){if(n[r].value===t){n[r].selected=!0,i&&(n[r].defaultSelected=!0);return}e!==null||n[r].disabled||(e=n[r])}e!==null&&(e.selected=!0)}}function Wf(n,e){if(e.dangerouslySetInnerHTML!=null)throw Error(re(91));return Mt({},e,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function Gg(n,e){var t=e.value;if(t==null){if(t=e.children,e=e.defaultValue,t!=null){if(e!=null)throw Error(re(92));if(ga(t)){if(1<t.length)throw Error(re(93));t=t[0]}e=t}e==null&&(e=""),t=e}n._wrapperState={initialValue:Rr(t)}}function ay(n,e){var t=Rr(e.value),i=Rr(e.defaultValue);t!=null&&(t=""+t,t!==n.value&&(n.value=t),e.defaultValue==null&&n.defaultValue!==t&&(n.defaultValue=t)),i!=null&&(n.defaultValue=""+i)}function Wg(n){var e=n.textContent;e===n._wrapperState.initialValue&&e!==""&&e!==null&&(n.value=e)}function ly(n){switch(n){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 jf(n,e){return n==null||n==="http://www.w3.org/1999/xhtml"?ly(e):n==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var Wl,cy=function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,t,i,r){MSApp.execUnsafeLocalFunction(function(){return n(e,t,i,r)})}:n}(function(n,e){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=e;else{for(Wl=Wl||document.createElement("div"),Wl.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Wl.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function za(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var Sa={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},Qw=["Webkit","ms","Moz","O"];Object.keys(Sa).forEach(function(n){Qw.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),Sa[e]=Sa[n]})});function uy(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||Sa.hasOwnProperty(n)&&Sa[n]?(""+e).trim():e+"px"}function dy(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var i=t.indexOf("--")===0,r=uy(t,e[t],i);t==="float"&&(t="cssFloat"),i?n.setProperty(t,r):n[t]=r}}var e1=Mt({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 Xf(n,e){if(e){if(e1[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(re(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(re(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(re(61))}if(e.style!=null&&typeof e.style!="object")throw Error(re(62))}}function $f(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){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 Yf=null;function em(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var qf=null,yo=null,_o=null;function jg(n){if(n=Tl(n)){if(typeof qf!="function")throw Error(re(280));var e=n.stateNode;e&&(e=xd(e),qf(n.stateNode,n.type,e))}}function hy(n){yo?_o?_o.push(n):_o=[n]:yo=n}function fy(){if(yo){var n=yo,e=_o;if(_o=yo=null,jg(n),e)for(n=0;n<e.length;n++)jg(e[n])}}function py(n,e){return n(e)}function my(){}var yh=!1;function gy(n,e,t){if(yh)return n(e,t);yh=!0;try{return py(n,e,t)}finally{yh=!1,(yo!==null||_o!==null)&&(my(),fy())}}function Va(n,e){var t=n.stateNode;if(t===null)return null;var i=xd(t);if(i===null)return null;t=i[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(n=n.type,i=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!i;break e;default:n=!1}if(n)return null;if(t&&typeof t!="function")throw Error(re(231,e,typeof t));return t}var Zf=!1;if(Xi)try{var Yo={};Object.defineProperty(Yo,"passive",{get:function(){Zf=!0}}),window.addEventListener("test",Yo,Yo),window.removeEventListener("test",Yo,Yo)}catch{Zf=!1}function t1(n,e,t,i,r,s,o,a,l){var c=Array.prototype.slice.call(arguments,3);try{e.apply(t,c)}catch(u){this.onError(u)}}var Ma=!1,du=null,hu=!1,Kf=null,n1={onError:function(n){Ma=!0,du=n}};function i1(n,e,t,i,r,s,o,a,l){Ma=!1,du=null,t1.apply(n1,arguments)}function r1(n,e,t,i,r,s,o,a,l){if(i1.apply(this,arguments),Ma){if(Ma){var c=du;Ma=!1,du=null}else throw Error(re(198));hu||(hu=!0,Kf=c)}}function As(n){var e=n,t=n;if(n.alternate)for(;e.return;)e=e.return;else{n=e;do e=n,e.flags&4098&&(t=e.return),n=e.return;while(n)}return e.tag===3?t:null}function xy(n){if(n.tag===13){var e=n.memoizedState;if(e===null&&(n=n.alternate,n!==null&&(e=n.memoizedState)),e!==null)return e.dehydrated}return null}function Xg(n){if(As(n)!==n)throw Error(re(188))}function s1(n){var e=n.alternate;if(!e){if(e=As(n),e===null)throw Error(re(188));return e!==n?null:n}for(var t=n,i=e;;){var r=t.return;if(r===null)break;var s=r.alternate;if(s===null){if(i=r.return,i!==null){t=i;continue}break}if(r.child===s.child){for(s=r.child;s;){if(s===t)return Xg(r),n;if(s===i)return Xg(r),e;s=s.sibling}throw Error(re(188))}if(t.return!==i.return)t=r,i=s;else{for(var o=!1,a=r.child;a;){if(a===t){o=!0,t=r,i=s;break}if(a===i){o=!0,i=r,t=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===t){o=!0,t=s,i=r;break}if(a===i){o=!0,i=s,t=r;break}a=a.sibling}if(!o)throw Error(re(189))}}if(t.alternate!==i)throw Error(re(190))}if(t.tag!==3)throw Error(re(188));return t.stateNode.current===t?n:e}function vy(n){return n=s1(n),n!==null?yy(n):null}function yy(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var e=yy(n);if(e!==null)return e;n=n.sibling}return null}var _y=kn.unstable_scheduleCallback,$g=kn.unstable_cancelCallback,o1=kn.unstable_shouldYield,a1=kn.unstable_requestPaint,Pt=kn.unstable_now,l1=kn.unstable_getCurrentPriorityLevel,tm=kn.unstable_ImmediatePriority,Sy=kn.unstable_UserBlockingPriority,fu=kn.unstable_NormalPriority,c1=kn.unstable_LowPriority,My=kn.unstable_IdlePriority,fd=null,Si=null;function u1(n){if(Si&&typeof Si.onCommitFiberRoot=="function")try{Si.onCommitFiberRoot(fd,n,void 0,(n.current.flags&128)===128)}catch{}}var si=Math.clz32?Math.clz32:f1,d1=Math.log,h1=Math.LN2;function f1(n){return n>>>=0,n===0?32:31-(d1(n)/h1|0)|0}var jl=64,Xl=4194304;function xa(n){switch(n&-n){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 n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function pu(n,e){var t=n.pendingLanes;if(t===0)return 0;var i=0,r=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~r;a!==0?i=xa(a):(s&=o,s!==0&&(i=xa(s)))}else o=t&~r,o!==0?i=xa(o):s!==0&&(i=xa(s));if(i===0)return 0;if(e!==0&&e!==i&&!(e&r)&&(r=i&-i,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if(i&4&&(i|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=i;0<e;)t=31-si(e),r=1<<t,i|=n[t],e&=~r;return i}function p1(n,e){switch(n){case 1:case 2:case 4:return e+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 e+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 m1(n,e){for(var t=n.suspendedLanes,i=n.pingedLanes,r=n.expirationTimes,s=n.pendingLanes;0<s;){var o=31-si(s),a=1<<o,l=r[o];l===-1?(!(a&t)||a&i)&&(r[o]=p1(a,e)):l<=e&&(n.expiredLanes|=a),s&=~a}}function Jf(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function wy(){var n=jl;return jl<<=1,!(jl&4194240)&&(jl=64),n}function _h(n){for(var e=[],t=0;31>t;t++)e.push(n);return e}function bl(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-si(e),n[e]=t}function g1(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var i=n.eventTimes;for(n=n.expirationTimes;0<t;){var r=31-si(t),s=1<<r;e[r]=0,i[r]=-1,n[r]=-1,t&=~s}}function nm(n,e){var t=n.entangledLanes|=e;for(n=n.entanglements;t;){var i=31-si(t),r=1<<i;r&e|n[i]&e&&(n[i]|=e),t&=~r}}var dt=0;function by(n){return n&=-n,1<n?4<n?n&268435455?16:536870912:4:1}var Ey,im,Ty,Ay,Cy,Qf=!1,$l=[],Sr=null,Mr=null,wr=null,Ha=new Map,Ga=new Map,gr=[],x1="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 Yg(n,e){switch(n){case"focusin":case"focusout":Sr=null;break;case"dragenter":case"dragleave":Mr=null;break;case"mouseover":case"mouseout":wr=null;break;case"pointerover":case"pointerout":Ha.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ga.delete(e.pointerId)}}function qo(n,e,t,i,r,s){return n===null||n.nativeEvent!==s?(n={blockedOn:e,domEventName:t,eventSystemFlags:i,nativeEvent:s,targetContainers:[r]},e!==null&&(e=Tl(e),e!==null&&im(e)),n):(n.eventSystemFlags|=i,e=n.targetContainers,r!==null&&e.indexOf(r)===-1&&e.push(r),n)}function v1(n,e,t,i,r){switch(e){case"focusin":return Sr=qo(Sr,n,e,t,i,r),!0;case"dragenter":return Mr=qo(Mr,n,e,t,i,r),!0;case"mouseover":return wr=qo(wr,n,e,t,i,r),!0;case"pointerover":var s=r.pointerId;return Ha.set(s,qo(Ha.get(s)||null,n,e,t,i,r)),!0;case"gotpointercapture":return s=r.pointerId,Ga.set(s,qo(Ga.get(s)||null,n,e,t,i,r)),!0}return!1}function Ry(n){var e=rs(n.target);if(e!==null){var t=As(e);if(t!==null){if(e=t.tag,e===13){if(e=xy(t),e!==null){n.blockedOn=e,Cy(n.priority,function(){Ty(t)});return}}else if(e===3&&t.stateNode.current.memoizedState.isDehydrated){n.blockedOn=t.tag===3?t.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Jc(n){if(n.blockedOn!==null)return!1;for(var e=n.targetContainers;0<e.length;){var t=ep(n.domEventName,n.eventSystemFlags,e[0],n.nativeEvent);if(t===null){t=n.nativeEvent;var i=new t.constructor(t.type,t);Yf=i,t.target.dispatchEvent(i),Yf=null}else return e=Tl(t),e!==null&&im(e),n.blockedOn=t,!1;e.shift()}return!0}function qg(n,e,t){Jc(n)&&t.delete(e)}function y1(){Qf=!1,Sr!==null&&Jc(Sr)&&(Sr=null),Mr!==null&&Jc(Mr)&&(Mr=null),wr!==null&&Jc(wr)&&(wr=null),Ha.forEach(qg),Ga.forEach(qg)}function Zo(n,e){n.blockedOn===e&&(n.blockedOn=null,Qf||(Qf=!0,kn.unstable_scheduleCallback(kn.unstable_NormalPriority,y1)))}function Wa(n){function e(r){return Zo(r,n)}if(0<$l.length){Zo($l[0],n);for(var t=1;t<$l.length;t++){var i=$l[t];i.blockedOn===n&&(i.blockedOn=null)}}for(Sr!==null&&Zo(Sr,n),Mr!==null&&Zo(Mr,n),wr!==null&&Zo(wr,n),Ha.forEach(e),Ga.forEach(e),t=0;t<gr.length;t++)i=gr[t],i.blockedOn===n&&(i.blockedOn=null);for(;0<gr.length&&(t=gr[0],t.blockedOn===null);)Ry(t),t.blockedOn===null&&gr.shift()}var So=er.ReactCurrentBatchConfig,mu=!0;function _1(n,e,t,i){var r=dt,s=So.transition;So.transition=null;try{dt=1,rm(n,e,t,i)}finally{dt=r,So.transition=s}}function S1(n,e,t,i){var r=dt,s=So.transition;So.transition=null;try{dt=4,rm(n,e,t,i)}finally{dt=r,So.transition=s}}function rm(n,e,t,i){if(mu){var r=ep(n,e,t,i);if(r===null)Ph(n,e,i,gu,t),Yg(n,i);else if(v1(r,n,e,t,i))i.stopPropagation();else if(Yg(n,i),e&4&&-1<x1.indexOf(n)){for(;r!==null;){var s=Tl(r);if(s!==null&&Ey(s),s=ep(n,e,t,i),s===null&&Ph(n,e,i,gu,t),s===r)break;r=s}r!==null&&i.stopPropagation()}else Ph(n,e,i,null,t)}}var gu=null;function ep(n,e,t,i){if(gu=null,n=em(i),n=rs(n),n!==null)if(e=As(n),e===null)n=null;else if(t=e.tag,t===13){if(n=xy(e),n!==null)return n;n=null}else if(t===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;n=null}else e!==n&&(n=null);return gu=n,null}function Py(n){switch(n){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(l1()){case tm:return 1;case Sy:return 4;case fu:case c1:return 16;case My:return 536870912;default:return 16}default:return 16}}var yr=null,sm=null,Qc=null;function Iy(){if(Qc)return Qc;var n,e=sm,t=e.length,i,r="value"in yr?yr.value:yr.textContent,s=r.length;for(n=0;n<t&&e[n]===r[n];n++);var o=t-n;for(i=1;i<=o&&e[t-i]===r[s-i];i++);return Qc=r.slice(n,1<i?1-i:void 0)}function eu(n){var e=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&e===13&&(n=13)):n=e,n===10&&(n=13),32<=n||n===13?n:0}function Yl(){return!0}function Zg(){return!1}function Bn(n){function e(t,i,r,s,o){this._reactName=t,this._targetInst=r,this.type=i,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var a in n)n.hasOwnProperty(a)&&(t=n[a],this[a]=t?t(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Yl:Zg,this.isPropagationStopped=Zg,this}return Mt(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():typeof t.returnValue!="unknown"&&(t.returnValue=!1),this.isDefaultPrevented=Yl)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():typeof t.cancelBubble!="unknown"&&(t.cancelBubble=!0),this.isPropagationStopped=Yl)},persist:function(){},isPersistent:Yl}),e}var Bo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},om=Bn(Bo),El=Mt({},Bo,{view:0,detail:0}),M1=Bn(El),Sh,Mh,Ko,pd=Mt({},El,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:am,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Ko&&(Ko&&n.type==="mousemove"?(Sh=n.screenX-Ko.screenX,Mh=n.screenY-Ko.screenY):Mh=Sh=0,Ko=n),Sh)},movementY:function(n){return"movementY"in n?n.movementY:Mh}}),Kg=Bn(pd),w1=Mt({},pd,{dataTransfer:0}),b1=Bn(w1),E1=Mt({},El,{relatedTarget:0}),wh=Bn(E1),T1=Mt({},Bo,{animationName:0,elapsedTime:0,pseudoElement:0}),A1=Bn(T1),C1=Mt({},Bo,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),R1=Bn(C1),P1=Mt({},Bo,{data:0}),Jg=Bn(P1),I1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},N1={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"},L1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function D1(n){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(n):(n=L1[n])?!!e[n]:!1}function am(){return D1}var U1=Mt({},El,{key:function(n){if(n.key){var e=I1[n.key]||n.key;if(e!=="Unidentified")return e}return n.type==="keypress"?(n=eu(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?N1[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:am,charCode:function(n){return n.type==="keypress"?eu(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?eu(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),k1=Bn(U1),O1=Mt({},pd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Qg=Bn(O1),F1=Mt({},El,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:am}),B1=Bn(F1),z1=Mt({},Bo,{propertyName:0,elapsedTime:0,pseudoElement:0}),V1=Bn(z1),H1=Mt({},pd,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),G1=Bn(H1),W1=[9,13,27,32],lm=Xi&&"CompositionEvent"in window,wa=null;Xi&&"documentMode"in document&&(wa=document.documentMode);var j1=Xi&&"TextEvent"in window&&!wa,Ny=Xi&&(!lm||wa&&8<wa&&11>=wa),ex=" ",tx=!1;function Ly(n,e){switch(n){case"keyup":return W1.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Dy(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var no=!1;function X1(n,e){switch(n){case"compositionend":return Dy(e);case"keypress":return e.which!==32?null:(tx=!0,ex);case"textInput":return n=e.data,n===ex&&tx?null:n;default:return null}}function $1(n,e){if(no)return n==="compositionend"||!lm&&Ly(n,e)?(n=Iy(),Qc=sm=yr=null,no=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return Ny&&e.locale!=="ko"?null:e.data;default:return null}}var Y1={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 nx(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e==="input"?!!Y1[n.type]:e==="textarea"}function Uy(n,e,t,i){hy(i),e=xu(e,"onChange"),0<e.length&&(t=new om("onChange","change",null,t,i),n.push({event:t,listeners:e}))}var ba=null,ja=null;function q1(n){Xy(n,0)}function md(n){var e=so(n);if(sy(e))return n}function Z1(n,e){if(n==="change")return e}var ky=!1;if(Xi){var bh;if(Xi){var Eh="oninput"in document;if(!Eh){var ix=document.createElement("div");ix.setAttribute("oninput","return;"),Eh=typeof ix.oninput=="function"}bh=Eh}else bh=!1;ky=bh&&(!document.documentMode||9<document.documentMode)}function rx(){ba&&(ba.detachEvent("onpropertychange",Oy),ja=ba=null)}function Oy(n){if(n.propertyName==="value"&&md(ja)){var e=[];Uy(e,ja,n,em(n)),gy(q1,e)}}function K1(n,e,t){n==="focusin"?(rx(),ba=e,ja=t,ba.attachEvent("onpropertychange",Oy)):n==="focusout"&&rx()}function J1(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return md(ja)}function Q1(n,e){if(n==="click")return md(e)}function eb(n,e){if(n==="input"||n==="change")return md(e)}function tb(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var ai=typeof Object.is=="function"?Object.is:tb;function Xa(n,e){if(ai(n,e))return!0;if(typeof n!="object"||n===null||typeof e!="object"||e===null)return!1;var t=Object.keys(n),i=Object.keys(e);if(t.length!==i.length)return!1;for(i=0;i<t.length;i++){var r=t[i];if(!kf.call(e,r)||!ai(n[r],e[r]))return!1}return!0}function sx(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function ox(n,e){var t=sx(n);n=0;for(var i;t;){if(t.nodeType===3){if(i=n+t.textContent.length,n<=e&&i>=e)return{node:t,offset:e-n};n=i}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=sx(t)}}function Fy(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?Fy(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function By(){for(var n=window,e=uu();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=uu(n.document)}return e}function cm(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function nb(n){var e=By(),t=n.focusedElem,i=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&Fy(t.ownerDocument.documentElement,t)){if(i!==null&&cm(t)){if(e=i.start,n=i.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var r=t.textContent.length,s=Math.min(i.start,r);i=i.end===void 0?s:Math.min(i.end,r),!n.extend&&s>i&&(r=i,i=s,s=r),r=ox(t,s);var o=ox(t,i);r&&o&&(n.rangeCount!==1||n.anchorNode!==r.node||n.anchorOffset!==r.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),n.removeAllRanges(),s>i?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t<e.length;t++)n=e[t],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var ib=Xi&&"documentMode"in document&&11>=document.documentMode,io=null,tp=null,Ea=null,np=!1;function ax(n,e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;np||io==null||io!==uu(i)||(i=io,"selectionStart"in i&&cm(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Ea&&Xa(Ea,i)||(Ea=i,i=xu(tp,"onSelect"),0<i.length&&(e=new om("onSelect","select",null,e,t),n.push({event:e,listeners:i}),e.target=io)))}function ql(n,e){var t={};return t[n.toLowerCase()]=e.toLowerCase(),t["Webkit"+n]="webkit"+e,t["Moz"+n]="moz"+e,t}var ro={animationend:ql("Animation","AnimationEnd"),animationiteration:ql("Animation","AnimationIteration"),animationstart:ql("Animation","AnimationStart"),transitionend:ql("Transition","TransitionEnd")},Th={},zy={};Xi&&(zy=document.createElement("div").style,"AnimationEvent"in window||(delete ro.animationend.animation,delete ro.animationiteration.animation,delete ro.animationstart.animation),"TransitionEvent"in window||delete ro.transitionend.transition);function gd(n){if(Th[n])return Th[n];if(!ro[n])return n;var e=ro[n],t;for(t in e)if(e.hasOwnProperty(t)&&t in zy)return Th[n]=e[t];return n}var Vy=gd("animationend"),Hy=gd("animationiteration"),Gy=gd("animationstart"),Wy=gd("transitionend"),jy=new Map,lx="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 Lr(n,e){jy.set(n,e),Ts(e,[n])}for(var Ah=0;Ah<lx.length;Ah++){var Ch=lx[Ah],rb=Ch.toLowerCase(),sb=Ch[0].toUpperCase()+Ch.slice(1);Lr(rb,"on"+sb)}Lr(Vy,"onAnimationEnd");Lr(Hy,"onAnimationIteration");Lr(Gy,"onAnimationStart");Lr("dblclick","onDoubleClick");Lr("focusin","onFocus");Lr("focusout","onBlur");Lr(Wy,"onTransitionEnd");To("onMouseEnter",["mouseout","mouseover"]);To("onMouseLeave",["mouseout","mouseover"]);To("onPointerEnter",["pointerout","pointerover"]);To("onPointerLeave",["pointerout","pointerover"]);Ts("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Ts("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Ts("onBeforeInput",["compositionend","keypress","textInput","paste"]);Ts("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Ts("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Ts("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var va="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(" "),ob=new Set("cancel close invalid load scroll toggle".split(" ").concat(va));function cx(n,e,t){var i=n.type||"unknown-event";n.currentTarget=t,r1(i,e,void 0,n),n.currentTarget=null}function Xy(n,e){e=(e&4)!==0;for(var t=0;t<n.length;t++){var i=n[t],r=i.event;i=i.listeners;e:{var s=void 0;if(e)for(var o=i.length-1;0<=o;o--){var a=i[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==s&&r.isPropagationStopped())break e;cx(r,a,c),s=l}else for(o=0;o<i.length;o++){if(a=i[o],l=a.instance,c=a.currentTarget,a=a.listener,l!==s&&r.isPropagationStopped())break e;cx(r,a,c),s=l}}}if(hu)throw n=Kf,hu=!1,Kf=null,n}function mt(n,e){var t=e[ap];t===void 0&&(t=e[ap]=new Set);var i=n+"__bubble";t.has(i)||($y(e,n,2,!1),t.add(i))}function Rh(n,e,t){var i=0;e&&(i|=4),$y(t,n,i,e)}var Zl="_reactListening"+Math.random().toString(36).slice(2);function $a(n){if(!n[Zl]){n[Zl]=!0,ey.forEach(function(t){t!=="selectionchange"&&(ob.has(t)||Rh(t,!1,n),Rh(t,!0,n))});var e=n.nodeType===9?n:n.ownerDocument;e===null||e[Zl]||(e[Zl]=!0,Rh("selectionchange",!1,e))}}function $y(n,e,t,i){switch(Py(e)){case 1:var r=_1;break;case 4:r=S1;break;default:r=rm}t=r.bind(null,e,t,n),r=void 0,!Zf||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(r=!0),i?r!==void 0?n.addEventListener(e,t,{capture:!0,passive:r}):n.addEventListener(e,t,!0):r!==void 0?n.addEventListener(e,t,{passive:r}):n.addEventListener(e,t,!1)}function Ph(n,e,t,i,r){var s=i;if(!(e&1)&&!(e&2)&&i!==null)e:for(;;){if(i===null)return;var o=i.tag;if(o===3||o===4){var a=i.stateNode.containerInfo;if(a===r||a.nodeType===8&&a.parentNode===r)break;if(o===4)for(o=i.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===r||l.nodeType===8&&l.parentNode===r))return;o=o.return}for(;a!==null;){if(o=rs(a),o===null)return;if(l=o.tag,l===5||l===6){i=s=o;continue e}a=a.parentNode}}i=i.return}gy(function(){var c=s,u=em(t),h=[];e:{var d=jy.get(n);if(d!==void 0){var p=om,m=n;switch(n){case"keypress":if(eu(t)===0)break e;case"keydown":case"keyup":p=k1;break;case"focusin":m="focus",p=wh;break;case"focusout":m="blur",p=wh;break;case"beforeblur":case"afterblur":p=wh;break;case"click":if(t.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=Kg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=b1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=B1;break;case Vy:case Hy:case Gy:p=A1;break;case Wy:p=V1;break;case"scroll":p=M1;break;case"wheel":p=G1;break;case"copy":case"cut":case"paste":p=R1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Qg}var x=(e&4)!==0,g=!x&&n==="scroll",f=x?d!==null?d+"Capture":null:d;x=[];for(var v=c,y;v!==null;){y=v;var _=y.stateNode;if(y.tag===5&&_!==null&&(y=_,f!==null&&(_=Va(v,f),_!=null&&x.push(Ya(v,_,y)))),g)break;v=v.return}0<x.length&&(d=new p(d,m,null,t,u),h.push({event:d,listeners:x}))}}if(!(e&7)){e:{if(d=n==="mouseover"||n==="pointerover",p=n==="mouseout"||n==="pointerout",d&&t!==Yf&&(m=t.relatedTarget||t.fromElement)&&(rs(m)||m[$i]))break e;if((p||d)&&(d=u.window===u?u:(d=u.ownerDocument)?d.defaultView||d.parentWindow:window,p?(m=t.relatedTarget||t.toElement,p=c,m=m?rs(m):null,m!==null&&(g=As(m),m!==g||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=c),p!==m)){if(x=Kg,_="onMouseLeave",f="onMouseEnter",v="mouse",(n==="pointerout"||n==="pointerover")&&(x=Qg,_="onPointerLeave",f="onPointerEnter",v="pointer"),g=p==null?d:so(p),y=m==null?d:so(m),d=new x(_,v+"leave",p,t,u),d.target=g,d.relatedTarget=y,_=null,rs(u)===c&&(x=new x(f,v+"enter",m,t,u),x.target=y,x.relatedTarget=g,_=x),g=_,p&&m)t:{for(x=p,f=m,v=0,y=x;y;y=Ns(y))v++;for(y=0,_=f;_;_=Ns(_))y++;for(;0<v-y;)x=Ns(x),v--;for(;0<y-v;)f=Ns(f),y--;for(;v--;){if(x===f||f!==null&&x===f.alternate)break t;x=Ns(x),f=Ns(f)}x=null}else x=null;p!==null&&ux(h,d,p,x,!1),m!==null&&g!==null&&ux(h,g,m,x,!0)}}e:{if(d=c?so(c):window,p=d.nodeName&&d.nodeName.toLowerCase(),p==="select"||p==="input"&&d.type==="file")var R=Z1;else if(nx(d))if(ky)R=eb;else{R=J1;var w=K1}else(p=d.nodeName)&&p.toLowerCase()==="input"&&(d.type==="checkbox"||d.type==="radio")&&(R=Q1);if(R&&(R=R(n,c))){Uy(h,R,t,u);break e}w&&w(n,d,c),n==="focusout"&&(w=d._wrapperState)&&w.controlled&&d.type==="number"&&Gf(d,"number",d.value)}switch(w=c?so(c):window,n){case"focusin":(nx(w)||w.contentEditable==="true")&&(io=w,tp=c,Ea=null);break;case"focusout":Ea=tp=io=null;break;case"mousedown":np=!0;break;case"contextmenu":case"mouseup":case"dragend":np=!1,ax(h,t,u);break;case"selectionchange":if(ib)break;case"keydown":case"keyup":ax(h,t,u)}var E;if(lm)e:{switch(n){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else no?Ly(n,t)&&(A="onCompositionEnd"):n==="keydown"&&t.keyCode===229&&(A="onCompositionStart");A&&(Ny&&t.locale!=="ko"&&(no||A!=="onCompositionStart"?A==="onCompositionEnd"&&no&&(E=Iy()):(yr=u,sm="value"in yr?yr.value:yr.textContent,no=!0)),w=xu(c,A),0<w.length&&(A=new Jg(A,n,null,t,u),h.push({event:A,listeners:w}),E?A.data=E:(E=Dy(t),E!==null&&(A.data=E)))),(E=j1?X1(n,t):$1(n,t))&&(c=xu(c,"onBeforeInput"),0<c.length&&(u=new Jg("onBeforeInput","beforeinput",null,t,u),h.push({event:u,listeners:c}),u.data=E))}Xy(h,e)})}function Ya(n,e,t){return{instance:n,listener:e,currentTarget:t}}function xu(n,e){for(var t=e+"Capture",i=[];n!==null;){var r=n,s=r.stateNode;r.tag===5&&s!==null&&(r=s,s=Va(n,t),s!=null&&i.unshift(Ya(n,s,r)),s=Va(n,e),s!=null&&i.push(Ya(n,s,r))),n=n.return}return i}function Ns(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function ux(n,e,t,i,r){for(var s=e._reactName,o=[];t!==null&&t!==i;){var a=t,l=a.alternate,c=a.stateNode;if(l!==null&&l===i)break;a.tag===5&&c!==null&&(a=c,r?(l=Va(t,s),l!=null&&o.unshift(Ya(t,l,a))):r||(l=Va(t,s),l!=null&&o.push(Ya(t,l,a)))),t=t.return}o.length!==0&&n.push({event:e,listeners:o})}var ab=/\r\n?/g,lb=/\u0000|\uFFFD/g;function dx(n){return(typeof n=="string"?n:""+n).replace(ab,`
38
+ `).replace(lb,"")}function Kl(n,e,t){if(e=dx(e),dx(n)!==e&&t)throw Error(re(425))}function vu(){}var ip=null,rp=null;function sp(n,e){return n==="textarea"||n==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var op=typeof setTimeout=="function"?setTimeout:void 0,cb=typeof clearTimeout=="function"?clearTimeout:void 0,hx=typeof Promise=="function"?Promise:void 0,ub=typeof queueMicrotask=="function"?queueMicrotask:typeof hx<"u"?function(n){return hx.resolve(null).then(n).catch(db)}:op;function db(n){setTimeout(function(){throw n})}function Ih(n,e){var t=e,i=0;do{var r=t.nextSibling;if(n.removeChild(t),r&&r.nodeType===8)if(t=r.data,t==="/$"){if(i===0){n.removeChild(r),Wa(e);return}i--}else t!=="$"&&t!=="$?"&&t!=="$!"||i++;t=r}while(t);Wa(e)}function br(n){for(;n!=null;n=n.nextSibling){var e=n.nodeType;if(e===1||e===3)break;if(e===8){if(e=n.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return n}function fx(n){n=n.previousSibling;for(var e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="$"||t==="$!"||t==="$?"){if(e===0)return n;e--}else t==="/$"&&e++}n=n.previousSibling}return null}var zo=Math.random().toString(36).slice(2),xi="__reactFiber$"+zo,qa="__reactProps$"+zo,$i="__reactContainer$"+zo,ap="__reactEvents$"+zo,hb="__reactListeners$"+zo,fb="__reactHandles$"+zo;function rs(n){var e=n[xi];if(e)return e;for(var t=n.parentNode;t;){if(e=t[$i]||t[xi]){if(t=e.alternate,e.child!==null||t!==null&&t.child!==null)for(n=fx(n);n!==null;){if(t=n[xi])return t;n=fx(n)}return e}n=t,t=n.parentNode}return null}function Tl(n){return n=n[xi]||n[$i],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function so(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(re(33))}function xd(n){return n[qa]||null}var lp=[],oo=-1;function Dr(n){return{current:n}}function gt(n){0>oo||(n.current=lp[oo],lp[oo]=null,oo--)}function pt(n,e){oo++,lp[oo]=n.current,n.current=e}var Pr={},sn=Dr(Pr),Mn=Dr(!1),xs=Pr;function Ao(n,e){var t=n.type.contextTypes;if(!t)return Pr;var i=n.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in t)r[s]=e[s];return i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=r),r}function wn(n){return n=n.childContextTypes,n!=null}function yu(){gt(Mn),gt(sn)}function px(n,e,t){if(sn.current!==Pr)throw Error(re(168));pt(sn,e),pt(Mn,t)}function Yy(n,e,t){var i=n.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return t;i=i.getChildContext();for(var r in i)if(!(r in e))throw Error(re(108,Kw(n)||"Unknown",r));return Mt({},t,i)}function _u(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||Pr,xs=sn.current,pt(sn,n),pt(Mn,Mn.current),!0}function mx(n,e,t){var i=n.stateNode;if(!i)throw Error(re(169));t?(n=Yy(n,e,xs),i.__reactInternalMemoizedMergedChildContext=n,gt(Mn),gt(sn),pt(sn,n)):gt(Mn),pt(Mn,t)}var Oi=null,vd=!1,Nh=!1;function qy(n){Oi===null?Oi=[n]:Oi.push(n)}function pb(n){vd=!0,qy(n)}function Ur(){if(!Nh&&Oi!==null){Nh=!0;var n=0,e=dt;try{var t=Oi;for(dt=1;n<t.length;n++){var i=t[n];do i=i(!0);while(i!==null)}Oi=null,vd=!1}catch(r){throw Oi!==null&&(Oi=Oi.slice(n+1)),_y(tm,Ur),r}finally{dt=e,Nh=!1}}return null}var ao=[],lo=0,Su=null,Mu=0,Gn=[],Wn=0,vs=null,zi=1,Vi="";function Qr(n,e){ao[lo++]=Mu,ao[lo++]=Su,Su=n,Mu=e}function Zy(n,e,t){Gn[Wn++]=zi,Gn[Wn++]=Vi,Gn[Wn++]=vs,vs=n;var i=zi;n=Vi;var r=32-si(i)-1;i&=~(1<<r),t+=1;var s=32-si(e)+r;if(30<s){var o=r-r%5;s=(i&(1<<o)-1).toString(32),i>>=o,r-=o,zi=1<<32-si(e)+r|t<<r|i,Vi=s+n}else zi=1<<s|t<<r|i,Vi=n}function um(n){n.return!==null&&(Qr(n,1),Zy(n,1,0))}function dm(n){for(;n===Su;)Su=ao[--lo],ao[lo]=null,Mu=ao[--lo],ao[lo]=null;for(;n===vs;)vs=Gn[--Wn],Gn[Wn]=null,Vi=Gn[--Wn],Gn[Wn]=null,zi=Gn[--Wn],Gn[Wn]=null}var Dn=null,Ln=null,xt=!1,ii=null;function Ky(n,e){var t=jn(5,null,null,0);t.elementType="DELETED",t.stateNode=e,t.return=n,e=n.deletions,e===null?(n.deletions=[t],n.flags|=16):e.push(t)}function gx(n,e){switch(n.tag){case 5:var t=n.type;return e=e.nodeType!==1||t.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(n.stateNode=e,Dn=n,Ln=br(e.firstChild),!0):!1;case 6:return e=n.pendingProps===""||e.nodeType!==3?null:e,e!==null?(n.stateNode=e,Dn=n,Ln=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(t=vs!==null?{id:zi,overflow:Vi}:null,n.memoizedState={dehydrated:e,treeContext:t,retryLane:1073741824},t=jn(18,null,null,0),t.stateNode=e,t.return=n,n.child=t,Dn=n,Ln=null,!0):!1;default:return!1}}function cp(n){return(n.mode&1)!==0&&(n.flags&128)===0}function up(n){if(xt){var e=Ln;if(e){var t=e;if(!gx(n,e)){if(cp(n))throw Error(re(418));e=br(t.nextSibling);var i=Dn;e&&gx(n,e)?Ky(i,t):(n.flags=n.flags&-4097|2,xt=!1,Dn=n)}}else{if(cp(n))throw Error(re(418));n.flags=n.flags&-4097|2,xt=!1,Dn=n}}}function xx(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;Dn=n}function Jl(n){if(n!==Dn)return!1;if(!xt)return xx(n),xt=!0,!1;var e;if((e=n.tag!==3)&&!(e=n.tag!==5)&&(e=n.type,e=e!=="head"&&e!=="body"&&!sp(n.type,n.memoizedProps)),e&&(e=Ln)){if(cp(n))throw Jy(),Error(re(418));for(;e;)Ky(n,e),e=br(e.nextSibling)}if(xx(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(re(317));e:{for(n=n.nextSibling,e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="/$"){if(e===0){Ln=br(n.nextSibling);break e}e--}else t!=="$"&&t!=="$!"&&t!=="$?"||e++}n=n.nextSibling}Ln=null}}else Ln=Dn?br(n.stateNode.nextSibling):null;return!0}function Jy(){for(var n=Ln;n;)n=br(n.nextSibling)}function Co(){Ln=Dn=null,xt=!1}function hm(n){ii===null?ii=[n]:ii.push(n)}var mb=er.ReactCurrentBatchConfig;function Jo(n,e,t){if(n=t.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(t._owner){if(t=t._owner,t){if(t.tag!==1)throw Error(re(309));var i=t.stateNode}if(!i)throw Error(re(147,n));var r=i,s=""+n;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===s?e.ref:(e=function(o){var a=r.refs;o===null?delete a[s]:a[s]=o},e._stringRef=s,e)}if(typeof n!="string")throw Error(re(284));if(!t._owner)throw Error(re(290,n))}return n}function Ql(n,e){throw n=Object.prototype.toString.call(e),Error(re(31,n==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":n))}function vx(n){var e=n._init;return e(n._payload)}function Qy(n){function e(f,v){if(n){var y=f.deletions;y===null?(f.deletions=[v],f.flags|=16):y.push(v)}}function t(f,v){if(!n)return null;for(;v!==null;)e(f,v),v=v.sibling;return null}function i(f,v){for(f=new Map;v!==null;)v.key!==null?f.set(v.key,v):f.set(v.index,v),v=v.sibling;return f}function r(f,v){return f=Cr(f,v),f.index=0,f.sibling=null,f}function s(f,v,y){return f.index=y,n?(y=f.alternate,y!==null?(y=y.index,y<v?(f.flags|=2,v):y):(f.flags|=2,v)):(f.flags|=1048576,v)}function o(f){return n&&f.alternate===null&&(f.flags|=2),f}function a(f,v,y,_){return v===null||v.tag!==6?(v=Bh(y,f.mode,_),v.return=f,v):(v=r(v,y),v.return=f,v)}function l(f,v,y,_){var R=y.type;return R===to?u(f,v,y.props.children,_,y.key):v!==null&&(v.elementType===R||typeof R=="object"&&R!==null&&R.$$typeof===fr&&vx(R)===v.type)?(_=r(v,y.props),_.ref=Jo(f,v,y),_.return=f,_):(_=au(y.type,y.key,y.props,null,f.mode,_),_.ref=Jo(f,v,y),_.return=f,_)}function c(f,v,y,_){return v===null||v.tag!==4||v.stateNode.containerInfo!==y.containerInfo||v.stateNode.implementation!==y.implementation?(v=zh(y,f.mode,_),v.return=f,v):(v=r(v,y.children||[]),v.return=f,v)}function u(f,v,y,_,R){return v===null||v.tag!==7?(v=hs(y,f.mode,_,R),v.return=f,v):(v=r(v,y),v.return=f,v)}function h(f,v,y){if(typeof v=="string"&&v!==""||typeof v=="number")return v=Bh(""+v,f.mode,y),v.return=f,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Hl:return y=au(v.type,v.key,v.props,null,f.mode,y),y.ref=Jo(f,null,v),y.return=f,y;case eo:return v=zh(v,f.mode,y),v.return=f,v;case fr:var _=v._init;return h(f,_(v._payload),y)}if(ga(v)||$o(v))return v=hs(v,f.mode,y,null),v.return=f,v;Ql(f,v)}return null}function d(f,v,y,_){var R=v!==null?v.key:null;if(typeof y=="string"&&y!==""||typeof y=="number")return R!==null?null:a(f,v,""+y,_);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Hl:return y.key===R?l(f,v,y,_):null;case eo:return y.key===R?c(f,v,y,_):null;case fr:return R=y._init,d(f,v,R(y._payload),_)}if(ga(y)||$o(y))return R!==null?null:u(f,v,y,_,null);Ql(f,y)}return null}function p(f,v,y,_,R){if(typeof _=="string"&&_!==""||typeof _=="number")return f=f.get(y)||null,a(v,f,""+_,R);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case Hl:return f=f.get(_.key===null?y:_.key)||null,l(v,f,_,R);case eo:return f=f.get(_.key===null?y:_.key)||null,c(v,f,_,R);case fr:var w=_._init;return p(f,v,y,w(_._payload),R)}if(ga(_)||$o(_))return f=f.get(y)||null,u(v,f,_,R,null);Ql(v,_)}return null}function m(f,v,y,_){for(var R=null,w=null,E=v,A=v=0,b=null;E!==null&&A<y.length;A++){E.index>A?(b=E,E=null):b=E.sibling;var M=d(f,E,y[A],_);if(M===null){E===null&&(E=b);break}n&&E&&M.alternate===null&&e(f,E),v=s(M,v,A),w===null?R=M:w.sibling=M,w=M,E=b}if(A===y.length)return t(f,E),xt&&Qr(f,A),R;if(E===null){for(;A<y.length;A++)E=h(f,y[A],_),E!==null&&(v=s(E,v,A),w===null?R=E:w.sibling=E,w=E);return xt&&Qr(f,A),R}for(E=i(f,E);A<y.length;A++)b=p(E,f,A,y[A],_),b!==null&&(n&&b.alternate!==null&&E.delete(b.key===null?A:b.key),v=s(b,v,A),w===null?R=b:w.sibling=b,w=b);return n&&E.forEach(function(L){return e(f,L)}),xt&&Qr(f,A),R}function x(f,v,y,_){var R=$o(y);if(typeof R!="function")throw Error(re(150));if(y=R.call(y),y==null)throw Error(re(151));for(var w=R=null,E=v,A=v=0,b=null,M=y.next();E!==null&&!M.done;A++,M=y.next()){E.index>A?(b=E,E=null):b=E.sibling;var L=d(f,E,M.value,_);if(L===null){E===null&&(E=b);break}n&&E&&L.alternate===null&&e(f,E),v=s(L,v,A),w===null?R=L:w.sibling=L,w=L,E=b}if(M.done)return t(f,E),xt&&Qr(f,A),R;if(E===null){for(;!M.done;A++,M=y.next())M=h(f,M.value,_),M!==null&&(v=s(M,v,A),w===null?R=M:w.sibling=M,w=M);return xt&&Qr(f,A),R}for(E=i(f,E);!M.done;A++,M=y.next())M=p(E,f,A,M.value,_),M!==null&&(n&&M.alternate!==null&&E.delete(M.key===null?A:M.key),v=s(M,v,A),w===null?R=M:w.sibling=M,w=M);return n&&E.forEach(function(G){return e(f,G)}),xt&&Qr(f,A),R}function g(f,v,y,_){if(typeof y=="object"&&y!==null&&y.type===to&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case Hl:e:{for(var R=y.key,w=v;w!==null;){if(w.key===R){if(R=y.type,R===to){if(w.tag===7){t(f,w.sibling),v=r(w,y.props.children),v.return=f,f=v;break e}}else if(w.elementType===R||typeof R=="object"&&R!==null&&R.$$typeof===fr&&vx(R)===w.type){t(f,w.sibling),v=r(w,y.props),v.ref=Jo(f,w,y),v.return=f,f=v;break e}t(f,w);break}else e(f,w);w=w.sibling}y.type===to?(v=hs(y.props.children,f.mode,_,y.key),v.return=f,f=v):(_=au(y.type,y.key,y.props,null,f.mode,_),_.ref=Jo(f,v,y),_.return=f,f=_)}return o(f);case eo:e:{for(w=y.key;v!==null;){if(v.key===w)if(v.tag===4&&v.stateNode.containerInfo===y.containerInfo&&v.stateNode.implementation===y.implementation){t(f,v.sibling),v=r(v,y.children||[]),v.return=f,f=v;break e}else{t(f,v);break}else e(f,v);v=v.sibling}v=zh(y,f.mode,_),v.return=f,f=v}return o(f);case fr:return w=y._init,g(f,v,w(y._payload),_)}if(ga(y))return m(f,v,y,_);if($o(y))return x(f,v,y,_);Ql(f,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,v!==null&&v.tag===6?(t(f,v.sibling),v=r(v,y),v.return=f,f=v):(t(f,v),v=Bh(y,f.mode,_),v.return=f,f=v),o(f)):t(f,v)}return g}var Ro=Qy(!0),e_=Qy(!1),wu=Dr(null),bu=null,co=null,fm=null;function pm(){fm=co=bu=null}function mm(n){var e=wu.current;gt(wu),n._currentValue=e}function dp(n,e,t){for(;n!==null;){var i=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),n===t)break;n=n.return}}function Mo(n,e){bu=n,fm=co=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&e&&(_n=!0),n.firstContext=null)}function Yn(n){var e=n._currentValue;if(fm!==n)if(n={context:n,memoizedValue:e,next:null},co===null){if(bu===null)throw Error(re(308));co=n,bu.dependencies={lanes:0,firstContext:n}}else co=co.next=n;return e}var ss=null;function gm(n){ss===null?ss=[n]:ss.push(n)}function t_(n,e,t,i){var r=e.interleaved;return r===null?(t.next=t,gm(e)):(t.next=r.next,r.next=t),e.interleaved=t,Yi(n,i)}function Yi(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var pr=!1;function xm(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function n_(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function Gi(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function Er(n,e,t){var i=n.updateQueue;if(i===null)return null;if(i=i.shared,tt&2){var r=i.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),i.pending=e,Yi(n,t)}return r=i.interleaved,r===null?(e.next=e,gm(i)):(e.next=r.next,r.next=e),i.interleaved=e,Yi(n,t)}function tu(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,nm(n,t)}}function yx(n,e){var t=n.updateQueue,i=n.alternate;if(i!==null&&(i=i.updateQueue,t===i)){var r=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?r=s=o:s=s.next=o,t=t.next}while(t!==null);s===null?r=s=e:s=s.next=e}else r=s=e;t={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,effects:i.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function Eu(n,e,t,i){var r=n.updateQueue;pr=!1;var s=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?s=c:o.next=c,o=l;var u=n.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==o&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(s!==null){var h=r.baseState;o=0,u=c=l=null,a=s;do{var d=a.lane,p=a.eventTime;if((i&d)===d){u!==null&&(u=u.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var m=n,x=a;switch(d=e,p=t,x.tag){case 1:if(m=x.payload,typeof m=="function"){h=m.call(p,h,d);break e}h=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=x.payload,d=typeof m=="function"?m.call(p,h,d):m,d==null)break e;h=Mt({},h,d);break e;case 2:pr=!0}}a.callback!==null&&a.lane!==0&&(n.flags|=64,d=r.effects,d===null?r.effects=[a]:d.push(a))}else p={eventTime:p,lane:d,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=p,l=h):u=u.next=p,o|=d;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;d=a,a=d.next,d.next=null,r.lastBaseUpdate=d,r.shared.pending=null}}while(!0);if(u===null&&(l=h),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=u,e=r.shared.interleaved,e!==null){r=e;do o|=r.lane,r=r.next;while(r!==e)}else s===null&&(r.shared.lanes=0);_s|=o,n.lanes=o,n.memoizedState=h}}function _x(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;e<n.length;e++){var i=n[e],r=i.callback;if(r!==null){if(i.callback=null,i=t,typeof r!="function")throw Error(re(191,r));r.call(i)}}}var Al={},Mi=Dr(Al),Za=Dr(Al),Ka=Dr(Al);function os(n){if(n===Al)throw Error(re(174));return n}function vm(n,e){switch(pt(Ka,e),pt(Za,n),pt(Mi,Al),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:jf(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=jf(e,n)}gt(Mi),pt(Mi,e)}function Po(){gt(Mi),gt(Za),gt(Ka)}function i_(n){os(Ka.current);var e=os(Mi.current),t=jf(e,n.type);e!==t&&(pt(Za,n),pt(Mi,t))}function ym(n){Za.current===n&&(gt(Mi),gt(Za))}var yt=Dr(0);function Tu(n){for(var e=n;e!==null;){if(e.tag===13){var t=e.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Lh=[];function _m(){for(var n=0;n<Lh.length;n++)Lh[n]._workInProgressVersionPrimary=null;Lh.length=0}var nu=er.ReactCurrentDispatcher,Dh=er.ReactCurrentBatchConfig,ys=0,St=null,Ot=null,Ht=null,Au=!1,Ta=!1,Ja=0,gb=0;function Kt(){throw Error(re(321))}function Sm(n,e){if(e===null)return!1;for(var t=0;t<e.length&&t<n.length;t++)if(!ai(n[t],e[t]))return!1;return!0}function Mm(n,e,t,i,r,s){if(ys=s,St=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,nu.current=n===null||n.memoizedState===null?_b:Sb,n=t(i,r),Ta){s=0;do{if(Ta=!1,Ja=0,25<=s)throw Error(re(301));s+=1,Ht=Ot=null,e.updateQueue=null,nu.current=Mb,n=t(i,r)}while(Ta)}if(nu.current=Cu,e=Ot!==null&&Ot.next!==null,ys=0,Ht=Ot=St=null,Au=!1,e)throw Error(re(300));return n}function wm(){var n=Ja!==0;return Ja=0,n}function mi(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ht===null?St.memoizedState=Ht=n:Ht=Ht.next=n,Ht}function qn(){if(Ot===null){var n=St.alternate;n=n!==null?n.memoizedState:null}else n=Ot.next;var e=Ht===null?St.memoizedState:Ht.next;if(e!==null)Ht=e,Ot=n;else{if(n===null)throw Error(re(310));Ot=n,n={memoizedState:Ot.memoizedState,baseState:Ot.baseState,baseQueue:Ot.baseQueue,queue:Ot.queue,next:null},Ht===null?St.memoizedState=Ht=n:Ht=Ht.next=n}return Ht}function Qa(n,e){return typeof e=="function"?e(n):e}function Uh(n){var e=qn(),t=e.queue;if(t===null)throw Error(re(311));t.lastRenderedReducer=n;var i=Ot,r=i.baseQueue,s=t.pending;if(s!==null){if(r!==null){var o=r.next;r.next=s.next,s.next=o}i.baseQueue=r=s,t.pending=null}if(r!==null){s=r.next,i=i.baseState;var a=o=null,l=null,c=s;do{var u=c.lane;if((ys&u)===u)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),i=c.hasEagerState?c.eagerState:n(i,c.action);else{var h={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=h,o=i):l=l.next=h,St.lanes|=u,_s|=u}c=c.next}while(c!==null&&c!==s);l===null?o=i:l.next=a,ai(i,e.memoizedState)||(_n=!0),e.memoizedState=i,e.baseState=o,e.baseQueue=l,t.lastRenderedState=i}if(n=t.interleaved,n!==null){r=n;do s=r.lane,St.lanes|=s,_s|=s,r=r.next;while(r!==n)}else r===null&&(t.lanes=0);return[e.memoizedState,t.dispatch]}function kh(n){var e=qn(),t=e.queue;if(t===null)throw Error(re(311));t.lastRenderedReducer=n;var i=t.dispatch,r=t.pending,s=e.memoizedState;if(r!==null){t.pending=null;var o=r=r.next;do s=n(s,o.action),o=o.next;while(o!==r);ai(s,e.memoizedState)||(_n=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),t.lastRenderedState=s}return[s,i]}function r_(){}function s_(n,e){var t=St,i=qn(),r=e(),s=!ai(i.memoizedState,r);if(s&&(i.memoizedState=r,_n=!0),i=i.queue,bm(l_.bind(null,t,i,n),[n]),i.getSnapshot!==e||s||Ht!==null&&Ht.memoizedState.tag&1){if(t.flags|=2048,el(9,a_.bind(null,t,i,r,e),void 0,null),Wt===null)throw Error(re(349));ys&30||o_(t,e,r)}return r}function o_(n,e,t){n.flags|=16384,n={getSnapshot:e,value:t},e=St.updateQueue,e===null?(e={lastEffect:null,stores:null},St.updateQueue=e,e.stores=[n]):(t=e.stores,t===null?e.stores=[n]:t.push(n))}function a_(n,e,t,i){e.value=t,e.getSnapshot=i,c_(e)&&u_(n)}function l_(n,e,t){return t(function(){c_(e)&&u_(n)})}function c_(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!ai(n,t)}catch{return!0}}function u_(n){var e=Yi(n,1);e!==null&&oi(e,n,1,-1)}function Sx(n){var e=mi();return typeof n=="function"&&(n=n()),e.memoizedState=e.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Qa,lastRenderedState:n},e.queue=n,n=n.dispatch=yb.bind(null,St,n),[e.memoizedState,n]}function el(n,e,t,i){return n={tag:n,create:e,destroy:t,deps:i,next:null},e=St.updateQueue,e===null?(e={lastEffect:null,stores:null},St.updateQueue=e,e.lastEffect=n.next=n):(t=e.lastEffect,t===null?e.lastEffect=n.next=n:(i=t.next,t.next=n,n.next=i,e.lastEffect=n)),n}function d_(){return qn().memoizedState}function iu(n,e,t,i){var r=mi();St.flags|=n,r.memoizedState=el(1|e,t,void 0,i===void 0?null:i)}function yd(n,e,t,i){var r=qn();i=i===void 0?null:i;var s=void 0;if(Ot!==null){var o=Ot.memoizedState;if(s=o.destroy,i!==null&&Sm(i,o.deps)){r.memoizedState=el(e,t,s,i);return}}St.flags|=n,r.memoizedState=el(1|e,t,s,i)}function Mx(n,e){return iu(8390656,8,n,e)}function bm(n,e){return yd(2048,8,n,e)}function h_(n,e){return yd(4,2,n,e)}function f_(n,e){return yd(4,4,n,e)}function p_(n,e){if(typeof e=="function")return n=n(),e(n),function(){e(null)};if(e!=null)return n=n(),e.current=n,function(){e.current=null}}function m_(n,e,t){return t=t!=null?t.concat([n]):null,yd(4,4,p_.bind(null,e,n),t)}function Em(){}function g_(n,e){var t=qn();e=e===void 0?null:e;var i=t.memoizedState;return i!==null&&e!==null&&Sm(e,i[1])?i[0]:(t.memoizedState=[n,e],n)}function x_(n,e){var t=qn();e=e===void 0?null:e;var i=t.memoizedState;return i!==null&&e!==null&&Sm(e,i[1])?i[0]:(n=n(),t.memoizedState=[n,e],n)}function v_(n,e,t){return ys&21?(ai(t,e)||(t=wy(),St.lanes|=t,_s|=t,n.baseState=!0),e):(n.baseState&&(n.baseState=!1,_n=!0),n.memoizedState=t)}function xb(n,e){var t=dt;dt=t!==0&&4>t?t:4,n(!0);var i=Dh.transition;Dh.transition={};try{n(!1),e()}finally{dt=t,Dh.transition=i}}function y_(){return qn().memoizedState}function vb(n,e,t){var i=Ar(n);if(t={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null},__(n))S_(e,t);else if(t=t_(n,e,t,i),t!==null){var r=hn();oi(t,n,i,r),M_(t,e,i)}}function yb(n,e,t){var i=Ar(n),r={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null};if(__(n))S_(e,r);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,t);if(r.hasEagerState=!0,r.eagerState=a,ai(a,o)){var l=e.interleaved;l===null?(r.next=r,gm(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch{}finally{}t=t_(n,e,r,i),t!==null&&(r=hn(),oi(t,n,i,r),M_(t,e,i))}}function __(n){var e=n.alternate;return n===St||e!==null&&e===St}function S_(n,e){Ta=Au=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function M_(n,e,t){if(t&4194240){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,nm(n,t)}}var Cu={readContext:Yn,useCallback:Kt,useContext:Kt,useEffect:Kt,useImperativeHandle:Kt,useInsertionEffect:Kt,useLayoutEffect:Kt,useMemo:Kt,useReducer:Kt,useRef:Kt,useState:Kt,useDebugValue:Kt,useDeferredValue:Kt,useTransition:Kt,useMutableSource:Kt,useSyncExternalStore:Kt,useId:Kt,unstable_isNewReconciler:!1},_b={readContext:Yn,useCallback:function(n,e){return mi().memoizedState=[n,e===void 0?null:e],n},useContext:Yn,useEffect:Mx,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,iu(4194308,4,p_.bind(null,e,n),t)},useLayoutEffect:function(n,e){return iu(4194308,4,n,e)},useInsertionEffect:function(n,e){return iu(4,2,n,e)},useMemo:function(n,e){var t=mi();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var i=mi();return e=t!==void 0?t(e):e,i.memoizedState=i.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},i.queue=n,n=n.dispatch=vb.bind(null,St,n),[i.memoizedState,n]},useRef:function(n){var e=mi();return n={current:n},e.memoizedState=n},useState:Sx,useDebugValue:Em,useDeferredValue:function(n){return mi().memoizedState=n},useTransition:function(){var n=Sx(!1),e=n[0];return n=xb.bind(null,n[1]),mi().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var i=St,r=mi();if(xt){if(t===void 0)throw Error(re(407));t=t()}else{if(t=e(),Wt===null)throw Error(re(349));ys&30||o_(i,e,t)}r.memoizedState=t;var s={value:t,getSnapshot:e};return r.queue=s,Mx(l_.bind(null,i,s,n),[n]),i.flags|=2048,el(9,a_.bind(null,i,s,t,e),void 0,null),t},useId:function(){var n=mi(),e=Wt.identifierPrefix;if(xt){var t=Vi,i=zi;t=(i&~(1<<32-si(i)-1)).toString(32)+t,e=":"+e+"R"+t,t=Ja++,0<t&&(e+="H"+t.toString(32)),e+=":"}else t=gb++,e=":"+e+"r"+t.toString(32)+":";return n.memoizedState=e},unstable_isNewReconciler:!1},Sb={readContext:Yn,useCallback:g_,useContext:Yn,useEffect:bm,useImperativeHandle:m_,useInsertionEffect:h_,useLayoutEffect:f_,useMemo:x_,useReducer:Uh,useRef:d_,useState:function(){return Uh(Qa)},useDebugValue:Em,useDeferredValue:function(n){var e=qn();return v_(e,Ot.memoizedState,n)},useTransition:function(){var n=Uh(Qa)[0],e=qn().memoizedState;return[n,e]},useMutableSource:r_,useSyncExternalStore:s_,useId:y_,unstable_isNewReconciler:!1},Mb={readContext:Yn,useCallback:g_,useContext:Yn,useEffect:bm,useImperativeHandle:m_,useInsertionEffect:h_,useLayoutEffect:f_,useMemo:x_,useReducer:kh,useRef:d_,useState:function(){return kh(Qa)},useDebugValue:Em,useDeferredValue:function(n){var e=qn();return Ot===null?e.memoizedState=n:v_(e,Ot.memoizedState,n)},useTransition:function(){var n=kh(Qa)[0],e=qn().memoizedState;return[n,e]},useMutableSource:r_,useSyncExternalStore:s_,useId:y_,unstable_isNewReconciler:!1};function ti(n,e){if(n&&n.defaultProps){e=Mt({},e),n=n.defaultProps;for(var t in n)e[t]===void 0&&(e[t]=n[t]);return e}return e}function hp(n,e,t,i){e=n.memoizedState,t=t(i,e),t=t==null?e:Mt({},e,t),n.memoizedState=t,n.lanes===0&&(n.updateQueue.baseState=t)}var _d={isMounted:function(n){return(n=n._reactInternals)?As(n)===n:!1},enqueueSetState:function(n,e,t){n=n._reactInternals;var i=hn(),r=Ar(n),s=Gi(i,r);s.payload=e,t!=null&&(s.callback=t),e=Er(n,s,r),e!==null&&(oi(e,n,r,i),tu(e,n,r))},enqueueReplaceState:function(n,e,t){n=n._reactInternals;var i=hn(),r=Ar(n),s=Gi(i,r);s.tag=1,s.payload=e,t!=null&&(s.callback=t),e=Er(n,s,r),e!==null&&(oi(e,n,r,i),tu(e,n,r))},enqueueForceUpdate:function(n,e){n=n._reactInternals;var t=hn(),i=Ar(n),r=Gi(t,i);r.tag=2,e!=null&&(r.callback=e),e=Er(n,r,i),e!==null&&(oi(e,n,i,t),tu(e,n,i))}};function wx(n,e,t,i,r,s,o){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(i,s,o):e.prototype&&e.prototype.isPureReactComponent?!Xa(t,i)||!Xa(r,s):!0}function w_(n,e,t){var i=!1,r=Pr,s=e.contextType;return typeof s=="object"&&s!==null?s=Yn(s):(r=wn(e)?xs:sn.current,i=e.contextTypes,s=(i=i!=null)?Ao(n,r):Pr),e=new e(t,s),n.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=_d,n.stateNode=e,e._reactInternals=n,i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=r,n.__reactInternalMemoizedMaskedChildContext=s),e}function bx(n,e,t,i){n=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(t,i),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(t,i),e.state!==n&&_d.enqueueReplaceState(e,e.state,null)}function fp(n,e,t,i){var r=n.stateNode;r.props=t,r.state=n.memoizedState,r.refs={},xm(n);var s=e.contextType;typeof s=="object"&&s!==null?r.context=Yn(s):(s=wn(e)?xs:sn.current,r.context=Ao(n,s)),r.state=n.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(hp(n,e,s,t),r.state=n.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(e=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),e!==r.state&&_d.enqueueReplaceState(r,r.state,null),Eu(n,t,r,i),r.state=n.memoizedState),typeof r.componentDidMount=="function"&&(n.flags|=4194308)}function Io(n,e){try{var t="",i=e;do t+=Zw(i),i=i.return;while(i);var r=t}catch(s){r=`
39
39
  Error generating stack: `+s.message+`
40
- `+s.stack}return{value:n,source:e,stack:r,digest:null}}function Oh(n,e,t){return{value:n,source:null,stack:t??null,digest:e??null}}function pp(n,e){try{console.error(e.value)}catch(t){setTimeout(function(){throw t})}}var wb=typeof WeakMap=="function"?WeakMap:Map;function w_(n,e,t){t=Gi(-1,t),t.tag=3,t.payload={element:null};var i=e.value;return t.callback=function(){Ru||(Ru=!0,bp=i),pp(n,e)},t}function b_(n,e,t){t=Gi(-1,t),t.tag=3;var i=n.type.getDerivedStateFromError;if(typeof i=="function"){var r=e.value;t.payload=function(){return i(r)},t.callback=function(){pp(n,e)}}var s=n.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){pp(n,e),typeof i!="function"&&(Tr===null?Tr=new Set([this]):Tr.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),t}function bx(n,e,t){var i=n.pingCache;if(i===null){i=n.pingCache=new wb;var r=new Set;i.set(e,r)}else r=i.get(e),r===void 0&&(r=new Set,i.set(e,r));r.has(t)||(r.add(t),n=Ob.bind(null,n,e,t),e.then(n,n))}function Ex(n){do{var e;if((e=n.tag===13)&&(e=n.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return n;n=n.return}while(n!==null);return null}function Tx(n,e,t,i,r){return n.mode&1?(n.flags|=65536,n.lanes=r,n):(n===e?n.flags|=65536:(n.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(e=Gi(-1,1),e.tag=2,Er(t,e,1))),t.lanes|=1),n)}var bb=er.ReactCurrentOwner,_n=!1;function cn(n,e,t,i){e.child=n===null?Qy(e,null,t,i):Ro(e,n.child,t,i)}function Ax(n,e,t,i,r){t=t.render;var s=e.ref;return Mo(e,r),i=Mm(n,e,t,i,s,r),t=wm(),n!==null&&!_n?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~r,qi(n,e,r)):(xt&&t&&um(e),e.flags|=1,cn(n,e,i,r),e.child)}function Cx(n,e,t,i,r){if(n===null){var s=t.type;return typeof s=="function"&&!Lm(s)&&s.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(e.tag=15,e.type=s,E_(n,e,s,i,r)):(n=ou(t.type,null,i,e,e.mode,r),n.ref=e.ref,n.return=e,e.child=n)}if(s=n.child,!(n.lanes&r)){var o=s.memoizedProps;if(t=t.compare,t=t!==null?t:Xa,t(o,i)&&n.ref===e.ref)return qi(n,e,r)}return e.flags|=1,n=Cr(s,i),n.ref=e.ref,n.return=e,e.child=n}function E_(n,e,t,i,r){if(n!==null){var s=n.memoizedProps;if(Xa(s,i)&&n.ref===e.ref)if(_n=!1,e.pendingProps=i=s,(n.lanes&r)!==0)n.flags&131072&&(_n=!0);else return e.lanes=n.lanes,qi(n,e,r)}return mp(n,e,t,i,r)}function T_(n,e,t){var i=e.pendingProps,r=i.children,s=n!==null?n.memoizedState:null;if(i.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},pt(ho,In),In|=t;else{if(!(t&1073741824))return n=s!==null?s.baseLanes|t:t,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:n,cachePool:null,transitions:null},e.updateQueue=null,pt(ho,In),In|=n,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},i=s!==null?s.baseLanes:t,pt(ho,In),In|=i}else s!==null?(i=s.baseLanes|t,e.memoizedState=null):i=t,pt(ho,In),In|=i;return cn(n,e,r,t),e.child}function A_(n,e){var t=e.ref;(n===null&&t!==null||n!==null&&n.ref!==t)&&(e.flags|=512,e.flags|=2097152)}function mp(n,e,t,i,r){var s=wn(t)?xs:sn.current;return s=Ao(e,s),Mo(e,r),t=Mm(n,e,t,i,s,r),i=wm(),n!==null&&!_n?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~r,qi(n,e,r)):(xt&&i&&um(e),e.flags|=1,cn(n,e,t,r),e.child)}function Rx(n,e,t,i,r){if(wn(t)){var s=!0;yu(e)}else s=!1;if(Mo(e,r),e.stateNode===null)iu(n,e),M_(e,t,i),fp(e,t,i,r),i=!0;else if(n===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,c=t.contextType;typeof c=="object"&&c!==null?c=Yn(c):(c=wn(t)?xs:sn.current,c=Ao(e,c));var u=t.getDerivedStateFromProps,h=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==i||l!==c)&&wx(e,o,i,c),pr=!1;var d=e.memoizedState;o.state=d,bu(e,i,o,r),l=e.memoizedState,a!==i||d!==l||Mn.current||pr?(typeof u=="function"&&(hp(e,t,u,i),l=e.memoizedState),(a=pr||Mx(e,t,a,i,d,l,c))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=i,e.memoizedState=l),o.props=i,o.state=l,o.context=c,i=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),i=!1)}else{o=e.stateNode,t_(n,e),a=e.memoizedProps,c=e.type===e.elementType?a:ti(e.type,a),o.props=c,h=e.pendingProps,d=o.context,l=t.contextType,typeof l=="object"&&l!==null?l=Yn(l):(l=wn(t)?xs:sn.current,l=Ao(e,l));var p=t.getDerivedStateFromProps;(u=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==h||d!==l)&&wx(e,o,i,l),pr=!1,d=e.memoizedState,o.state=d,bu(e,i,o,r);var m=e.memoizedState;a!==h||d!==m||Mn.current||pr?(typeof p=="function"&&(hp(e,t,p,i),m=e.memoizedState),(c=pr||Mx(e,t,c,i,d,m,l)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(i,m,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(i,m,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&d===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&d===n.memoizedState||(e.flags|=1024),e.memoizedProps=i,e.memoizedState=m),o.props=i,o.state=m,o.context=l,i=c):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&d===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&d===n.memoizedState||(e.flags|=1024),i=!1)}return gp(n,e,t,i,s,r)}function gp(n,e,t,i,r,s){A_(n,e);var o=(e.flags&128)!==0;if(!i&&!o)return r&&px(e,t,!1),qi(n,e,s);i=e.stateNode,bb.current=e;var a=o&&typeof t.getDerivedStateFromError!="function"?null:i.render();return e.flags|=1,n!==null&&o?(e.child=Ro(e,n.child,null,s),e.child=Ro(e,null,a,s)):cn(n,e,a,s),e.memoizedState=i.state,r&&px(e,t,!0),e.child}function C_(n){var e=n.stateNode;e.pendingContext?fx(n,e.pendingContext,e.pendingContext!==e.context):e.context&&fx(n,e.context,!1),vm(n,e.containerInfo)}function Px(n,e,t,i,r){return Co(),hm(r),e.flags|=256,cn(n,e,t,i),e.child}var xp={dehydrated:null,treeContext:null,retryLane:0};function vp(n){return{baseLanes:n,cachePool:null,transitions:null}}function R_(n,e,t){var i=e.pendingProps,r=yt.current,s=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=n!==null&&n.memoizedState===null?!1:(r&2)!==0),a?(s=!0,e.flags&=-129):(n===null||n.memoizedState!==null)&&(r|=1),pt(yt,r&1),n===null)return up(e),n=e.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?(e.mode&1?n.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=i.children,n=i.fallback,s?(i=e.mode,s=e.child,o={mode:"hidden",children:o},!(i&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=Md(o,i,0,null),n=hs(n,i,t,null),s.return=e,n.return=e,s.sibling=n,e.child=s,e.child.memoizedState=vp(t),e.memoizedState=xp,n):Tm(e,o));if(r=n.memoizedState,r!==null&&(a=r.dehydrated,a!==null))return Eb(n,e,o,i,a,r,t);if(s){s=i.fallback,o=e.mode,r=n.child,a=r.sibling;var l={mode:"hidden",children:i.children};return!(o&1)&&e.child!==r?(i=e.child,i.childLanes=0,i.pendingProps=l,e.deletions=null):(i=Cr(r,l),i.subtreeFlags=r.subtreeFlags&14680064),a!==null?s=Cr(a,s):(s=hs(s,o,t,null),s.flags|=2),s.return=e,i.return=e,i.sibling=s,e.child=i,i=s,s=e.child,o=n.child.memoizedState,o=o===null?vp(t):{baseLanes:o.baseLanes|t,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=n.childLanes&~t,e.memoizedState=xp,i}return s=n.child,n=s.sibling,i=Cr(s,{mode:"visible",children:i.children}),!(e.mode&1)&&(i.lanes=t),i.return=e,i.sibling=null,n!==null&&(t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)),e.child=i,e.memoizedState=null,i}function Tm(n,e){return e=Md({mode:"visible",children:e},n.mode,0,null),e.return=n,n.child=e}function Ql(n,e,t,i){return i!==null&&hm(i),Ro(e,n.child,null,t),n=Tm(e,e.pendingProps.children),n.flags|=2,e.memoizedState=null,n}function Eb(n,e,t,i,r,s,o){if(t)return e.flags&256?(e.flags&=-257,i=Oh(Error(re(422))),Ql(n,e,o,i)):e.memoizedState!==null?(e.child=n.child,e.flags|=128,null):(s=i.fallback,r=e.mode,i=Md({mode:"visible",children:i.children},r,0,null),s=hs(s,r,o,null),s.flags|=2,i.return=e,s.return=e,i.sibling=s,e.child=i,e.mode&1&&Ro(e,n.child,null,o),e.child.memoizedState=vp(o),e.memoizedState=xp,s);if(!(e.mode&1))return Ql(n,e,o,null);if(r.data==="$!"){if(i=r.nextSibling&&r.nextSibling.dataset,i)var a=i.dgst;return i=a,s=Error(re(419)),i=Oh(s,i,void 0),Ql(n,e,o,i)}if(a=(o&n.childLanes)!==0,_n||a){if(i=Wt,i!==null){switch(o&-o){case 4:r=2;break;case 16:r=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:r=32;break;case 536870912:r=268435456;break;default:r=0}r=r&(i.suspendedLanes|o)?0:r,r!==0&&r!==s.retryLane&&(s.retryLane=r,Yi(n,r),oi(i,n,r,-1))}return Nm(),i=Oh(Error(re(421))),Ql(n,e,o,i)}return r.data==="$?"?(e.flags|=128,e.child=n.child,e=Fb.bind(null,n),r._reactRetry=e,null):(n=s.treeContext,Ln=br(r.nextSibling),Dn=e,xt=!0,ii=null,n!==null&&(Gn[Wn++]=zi,Gn[Wn++]=Vi,Gn[Wn++]=vs,zi=n.id,Vi=n.overflow,vs=e),e=Tm(e,i.children),e.flags|=4096,e)}function Ix(n,e,t){n.lanes|=e;var i=n.alternate;i!==null&&(i.lanes|=e),dp(n.return,e,t)}function Fh(n,e,t,i,r){var s=n.memoizedState;s===null?n.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:i,tail:t,tailMode:r}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=i,s.tail=t,s.tailMode=r)}function P_(n,e,t){var i=e.pendingProps,r=i.revealOrder,s=i.tail;if(cn(n,e,i.children,t),i=yt.current,i&2)i=i&1|2,e.flags|=128;else{if(n!==null&&n.flags&128)e:for(n=e.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&Ix(n,t,e);else if(n.tag===19)Ix(n,t,e);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}i&=1}if(pt(yt,i),!(e.mode&1))e.memoizedState=null;else switch(r){case"forwards":for(t=e.child,r=null;t!==null;)n=t.alternate,n!==null&&Eu(n)===null&&(r=t),t=t.sibling;t=r,t===null?(r=e.child,e.child=null):(r=t.sibling,t.sibling=null),Fh(e,!1,r,t,s);break;case"backwards":for(t=null,r=e.child,e.child=null;r!==null;){if(n=r.alternate,n!==null&&Eu(n)===null){e.child=r;break}n=r.sibling,r.sibling=t,t=r,r=n}Fh(e,!0,t,null,s);break;case"together":Fh(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function iu(n,e){!(e.mode&1)&&n!==null&&(n.alternate=null,e.alternate=null,e.flags|=2)}function qi(n,e,t){if(n!==null&&(e.dependencies=n.dependencies),_s|=e.lanes,!(t&e.childLanes))return null;if(n!==null&&e.child!==n.child)throw Error(re(153));if(e.child!==null){for(n=e.child,t=Cr(n,n.pendingProps),e.child=t,t.return=e;n.sibling!==null;)n=n.sibling,t=t.sibling=Cr(n,n.pendingProps),t.return=e;t.sibling=null}return e.child}function Tb(n,e,t){switch(e.tag){case 3:C_(e),Co();break;case 5:n_(e);break;case 1:wn(e.type)&&yu(e);break;case 4:vm(e,e.stateNode.containerInfo);break;case 10:var i=e.type._context,r=e.memoizedProps.value;pt(Mu,i._currentValue),i._currentValue=r;break;case 13:if(i=e.memoizedState,i!==null)return i.dehydrated!==null?(pt(yt,yt.current&1),e.flags|=128,null):t&e.child.childLanes?R_(n,e,t):(pt(yt,yt.current&1),n=qi(n,e,t),n!==null?n.sibling:null);pt(yt,yt.current&1);break;case 19:if(i=(t&e.childLanes)!==0,n.flags&128){if(i)return P_(n,e,t);e.flags|=128}if(r=e.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),pt(yt,yt.current),i)break;return null;case 22:case 23:return e.lanes=0,T_(n,e,t)}return qi(n,e,t)}var I_,yp,N_,L_;I_=function(n,e){for(var t=e.child;t!==null;){if(t.tag===5||t.tag===6)n.appendChild(t.stateNode);else if(t.tag!==4&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return;t=t.return}t.sibling.return=t.return,t=t.sibling}};yp=function(){};N_=function(n,e,t,i){var r=n.memoizedProps;if(r!==i){n=e.stateNode,os(Mi.current);var s=null;switch(t){case"input":r=Vf(n,r),i=Vf(n,i),s=[];break;case"select":r=Mt({},r,{value:void 0}),i=Mt({},i,{value:void 0}),s=[];break;case"textarea":r=Wf(n,r),i=Wf(n,i),s=[];break;default:typeof r.onClick!="function"&&typeof i.onClick=="function"&&(n.onclick=xu)}Xf(t,i);var o;t=null;for(c in r)if(!i.hasOwnProperty(c)&&r.hasOwnProperty(c)&&r[c]!=null)if(c==="style"){var a=r[c];for(o in a)a.hasOwnProperty(o)&&(t||(t={}),t[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Ba.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in i){var l=i[c];if(a=r!=null?r[c]:void 0,i.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(t||(t={}),t[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(t||(t={}),t[o]=l[o])}else t||(s||(s=[]),s.push(c,t)),t=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Ba.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&mt("scroll",n),s||a===l||(s=[])):(s=s||[]).push(c,l))}t&&(s=s||[]).push("style",t);var c=s;(e.updateQueue=c)&&(e.flags|=4)}};L_=function(n,e,t,i){t!==i&&(e.flags|=4)};function Qo(n,e){if(!xt)switch(n.tailMode){case"hidden":e=n.tail;for(var t=null;e!==null;)e.alternate!==null&&(t=e),e=e.sibling;t===null?n.tail=null:t.sibling=null;break;case"collapsed":t=n.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e||n.tail===null?n.tail=null:n.tail.sibling=null:i.sibling=null}}function Jt(n){var e=n.alternate!==null&&n.alternate.child===n.child,t=0,i=0;if(e)for(var r=n.child;r!==null;)t|=r.lanes|r.childLanes,i|=r.subtreeFlags&14680064,i|=r.flags&14680064,r.return=n,r=r.sibling;else for(r=n.child;r!==null;)t|=r.lanes|r.childLanes,i|=r.subtreeFlags,i|=r.flags,r.return=n,r=r.sibling;return n.subtreeFlags|=i,n.childLanes=t,e}function Ab(n,e,t){var i=e.pendingProps;switch(dm(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Jt(e),null;case 1:return wn(e.type)&&vu(),Jt(e),null;case 3:return i=e.stateNode,Po(),gt(Mn),gt(sn),_m(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(Kl(e)?e.flags|=4:n===null||n.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,ii!==null&&(Ap(ii),ii=null))),yp(n,e),Jt(e),null;case 5:ym(e);var r=os(Ka.current);if(t=e.type,n!==null&&e.stateNode!=null)N_(n,e,t,i,r),n.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!i){if(e.stateNode===null)throw Error(re(166));return Jt(e),null}if(n=os(Mi.current),Kl(e)){i=e.stateNode,t=e.type;var s=e.memoizedProps;switch(i[xi]=e,i[qa]=s,n=(e.mode&1)!==0,t){case"dialog":mt("cancel",i),mt("close",i);break;case"iframe":case"object":case"embed":mt("load",i);break;case"video":case"audio":for(r=0;r<va.length;r++)mt(va[r],i);break;case"source":mt("error",i);break;case"img":case"image":case"link":mt("error",i),mt("load",i);break;case"details":mt("toggle",i);break;case"input":zg(i,s),mt("invalid",i);break;case"select":i._wrapperState={wasMultiple:!!s.multiple},mt("invalid",i);break;case"textarea":Hg(i,s),mt("invalid",i)}Xf(t,s),r=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?i.textContent!==a&&(s.suppressHydrationWarning!==!0&&Zl(i.textContent,a,n),r=["children",a]):typeof a=="number"&&i.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&Zl(i.textContent,a,n),r=["children",""+a]):Ba.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&mt("scroll",i)}switch(t){case"input":Hl(i),Vg(i,s,!0);break;case"textarea":Hl(i),Gg(i);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(i.onclick=xu)}i=r,e.updateQueue=i,i!==null&&(e.flags|=4)}else{o=r.nodeType===9?r:r.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=ay(t)),n==="http://www.w3.org/1999/xhtml"?t==="script"?(n=o.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof i.is=="string"?n=o.createElement(t,{is:i.is}):(n=o.createElement(t),t==="select"&&(o=n,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):n=o.createElementNS(n,t),n[xi]=e,n[qa]=i,I_(n,e,!1,!1),e.stateNode=n;e:{switch(o=$f(t,i),t){case"dialog":mt("cancel",n),mt("close",n),r=i;break;case"iframe":case"object":case"embed":mt("load",n),r=i;break;case"video":case"audio":for(r=0;r<va.length;r++)mt(va[r],n);r=i;break;case"source":mt("error",n),r=i;break;case"img":case"image":case"link":mt("error",n),mt("load",n),r=i;break;case"details":mt("toggle",n),r=i;break;case"input":zg(n,i),r=Vf(n,i),mt("invalid",n);break;case"option":r=i;break;case"select":n._wrapperState={wasMultiple:!!i.multiple},r=Mt({},i,{value:void 0}),mt("invalid",n);break;case"textarea":Hg(n,i),r=Wf(n,i),mt("invalid",n);break;default:r=i}Xf(t,r),a=r;for(s in a)if(a.hasOwnProperty(s)){var l=a[s];s==="style"?uy(n,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&ly(n,l)):s==="children"?typeof l=="string"?(t!=="textarea"||l!=="")&&za(n,l):typeof l=="number"&&za(n,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Ba.hasOwnProperty(s)?l!=null&&s==="onScroll"&&mt("scroll",n):l!=null&&Zp(n,s,l,o))}switch(t){case"input":Hl(n),Vg(n,i,!1);break;case"textarea":Hl(n),Gg(n);break;case"option":i.value!=null&&n.setAttribute("value",""+Rr(i.value));break;case"select":n.multiple=!!i.multiple,s=i.value,s!=null?vo(n,!!i.multiple,s,!1):i.defaultValue!=null&&vo(n,!!i.multiple,i.defaultValue,!0);break;default:typeof r.onClick=="function"&&(n.onclick=xu)}switch(t){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}}i&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Jt(e),null;case 6:if(n&&e.stateNode!=null)L_(n,e,n.memoizedProps,i);else{if(typeof i!="string"&&e.stateNode===null)throw Error(re(166));if(t=os(Ka.current),os(Mi.current),Kl(e)){if(i=e.stateNode,t=e.memoizedProps,i[xi]=e,(s=i.nodeValue!==t)&&(n=Dn,n!==null))switch(n.tag){case 3:Zl(i.nodeValue,t,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&Zl(i.nodeValue,t,(n.mode&1)!==0)}s&&(e.flags|=4)}else i=(t.nodeType===9?t:t.ownerDocument).createTextNode(i),i[xi]=e,e.stateNode=i}return Jt(e),null;case 13:if(gt(yt),i=e.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(xt&&Ln!==null&&e.mode&1&&!(e.flags&128))Ky(),Co(),e.flags|=98560,s=!1;else if(s=Kl(e),i!==null&&i.dehydrated!==null){if(n===null){if(!s)throw Error(re(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(re(317));s[xi]=e}else Co(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Jt(e),s=!1}else ii!==null&&(Ap(ii),ii=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=t,e):(i=i!==null,i!==(n!==null&&n.memoizedState!==null)&&i&&(e.child.flags|=8192,e.mode&1&&(n===null||yt.current&1?Ft===0&&(Ft=3):Nm())),e.updateQueue!==null&&(e.flags|=4),Jt(e),null);case 4:return Po(),yp(n,e),n===null&&$a(e.stateNode.containerInfo),Jt(e),null;case 10:return mm(e.type._context),Jt(e),null;case 17:return wn(e.type)&&vu(),Jt(e),null;case 19:if(gt(yt),s=e.memoizedState,s===null)return Jt(e),null;if(i=(e.flags&128)!==0,o=s.rendering,o===null)if(i)Qo(s,!1);else{if(Ft!==0||n!==null&&n.flags&128)for(n=e.child;n!==null;){if(o=Eu(n),o!==null){for(e.flags|=128,Qo(s,!1),i=o.updateQueue,i!==null&&(e.updateQueue=i,e.flags|=4),e.subtreeFlags=0,i=t,t=e.child;t!==null;)s=t,n=i,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=n,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,n=o.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t=t.sibling;return pt(yt,yt.current&1|2),e.child}n=n.sibling}s.tail!==null&&Pt()>No&&(e.flags|=128,i=!0,Qo(s,!1),e.lanes=4194304)}else{if(!i)if(n=Eu(o),n!==null){if(e.flags|=128,i=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Qo(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!xt)return Jt(e),null}else 2*Pt()-s.renderingStartTime>No&&t!==1073741824&&(e.flags|=128,i=!0,Qo(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(t=s.last,t!==null?t.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Pt(),e.sibling=null,t=yt.current,pt(yt,i?t&1|2:t&1),e):(Jt(e),null);case 22:case 23:return Im(),i=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?In&1073741824&&(Jt(e),e.subtreeFlags&6&&(e.flags|=8192)):Jt(e),null;case 24:return null;case 25:return null}throw Error(re(156,e.tag))}function Cb(n,e){switch(dm(e),e.tag){case 1:return wn(e.type)&&vu(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return Po(),gt(Mn),gt(sn),_m(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return ym(e),null;case 13:if(gt(yt),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(re(340));Co()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return gt(yt),null;case 4:return Po(),null;case 10:return mm(e.type._context),null;case 22:case 23:return Im(),null;case 24:return null;default:return null}}var ec=!1,nn=!1,Rb=typeof WeakSet=="function"?WeakSet:Set,we=null;function uo(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){Tt(n,e,i)}else t.current=null}function _p(n,e,t){try{t()}catch(i){Tt(n,e,i)}}var Nx=!1;function Pb(n,e){if(ip=pu,n=Fy(),cm(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var i=t.getSelection&&t.getSelection();if(i&&i.rangeCount!==0){t=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,c=0,u=0,h=n,d=null;t:for(;;){for(var p;h!==t||r!==0&&h.nodeType!==3||(a=o+r),h!==s||i!==0&&h.nodeType!==3||(l=o+i),h.nodeType===3&&(o+=h.nodeValue.length),(p=h.firstChild)!==null;)d=h,h=p;for(;;){if(h===n)break t;if(d===t&&++c===r&&(a=o),d===s&&++u===i&&(l=o),(p=h.nextSibling)!==null)break;h=d,d=h.parentNode}h=p}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(rp={focusedElem:n,selectionRange:t},pu=!1,we=e;we!==null;)if(e=we,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,we=n;else for(;we!==null;){e=we;try{var m=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var x=m.memoizedProps,g=m.memoizedState,f=e.stateNode,v=f.getSnapshotBeforeUpdate(e.elementType===e.type?x:ti(e.type,x),g);f.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var y=e.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(re(163))}}catch(_){Tt(e,e.return,_)}if(n=e.sibling,n!==null){n.return=e.return,we=n;break}we=e.return}return m=Nx,Nx=!1,m}function Aa(n,e,t){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var r=i=i.next;do{if((r.tag&n)===n){var s=r.destroy;r.destroy=void 0,s!==void 0&&_p(e,t,s)}r=r.next}while(r!==i)}}function _d(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var i=t.create;t.destroy=i()}t=t.next}while(t!==e)}}function Sp(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function D_(n){var e=n.alternate;e!==null&&(n.alternate=null,D_(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[xi],delete e[qa],delete e[ap],delete e[hb],delete e[fb])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function U_(n){return n.tag===5||n.tag===3||n.tag===4}function Lx(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||U_(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Mp(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=xu));else if(i!==4&&(n=n.child,n!==null))for(Mp(n,e,t),n=n.sibling;n!==null;)Mp(n,e,t),n=n.sibling}function wp(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(i!==4&&(n=n.child,n!==null))for(wp(n,e,t),n=n.sibling;n!==null;)wp(n,e,t),n=n.sibling}var $t=null,ni=!1;function ir(n,e,t){for(t=t.child;t!==null;)k_(n,e,t),t=t.sibling}function k_(n,e,t){if(Si&&typeof Si.onCommitFiberUnmount=="function")try{Si.onCommitFiberUnmount(hd,t)}catch{}switch(t.tag){case 5:nn||uo(t,e);case 6:var i=$t,r=ni;$t=null,ir(n,e,t),$t=i,ni=r,$t!==null&&(ni?(n=$t,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):$t.removeChild(t.stateNode));break;case 18:$t!==null&&(ni?(n=$t,t=t.stateNode,n.nodeType===8?Ih(n.parentNode,t):n.nodeType===1&&Ih(n,t),Wa(n)):Ih($t,t.stateNode));break;case 4:i=$t,r=ni,$t=t.stateNode.containerInfo,ni=!0,ir(n,e,t),$t=i,ni=r;break;case 0:case 11:case 14:case 15:if(!nn&&(i=t.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){r=i=i.next;do{var s=r,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&_p(t,e,o),r=r.next}while(r!==i)}ir(n,e,t);break;case 1:if(!nn&&(uo(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=t.memoizedProps,i.state=t.memoizedState,i.componentWillUnmount()}catch(a){Tt(t,e,a)}ir(n,e,t);break;case 21:ir(n,e,t);break;case 22:t.mode&1?(nn=(i=nn)||t.memoizedState!==null,ir(n,e,t),nn=i):ir(n,e,t);break;default:ir(n,e,t)}}function Dx(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new Rb),e.forEach(function(i){var r=Bb.bind(null,n,i);t.has(i)||(t.add(i),i.then(r,r))})}}function Kn(n,e){var t=e.deletions;if(t!==null)for(var i=0;i<t.length;i++){var r=t[i];try{var s=n,o=e,a=o;e:for(;a!==null;){switch(a.tag){case 5:$t=a.stateNode,ni=!1;break e;case 3:$t=a.stateNode.containerInfo,ni=!0;break e;case 4:$t=a.stateNode.containerInfo,ni=!0;break e}a=a.return}if($t===null)throw Error(re(160));k_(s,o,r),$t=null,ni=!1;var l=r.alternate;l!==null&&(l.return=null),r.return=null}catch(c){Tt(r,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)O_(e,n),e=e.sibling}function O_(n,e){var t=n.alternate,i=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(Kn(e,n),fi(n),i&4){try{Aa(3,n,n.return),_d(3,n)}catch(x){Tt(n,n.return,x)}try{Aa(5,n,n.return)}catch(x){Tt(n,n.return,x)}}break;case 1:Kn(e,n),fi(n),i&512&&t!==null&&uo(t,t.return);break;case 5:if(Kn(e,n),fi(n),i&512&&t!==null&&uo(t,t.return),n.flags&32){var r=n.stateNode;try{za(r,"")}catch(x){Tt(n,n.return,x)}}if(i&4&&(r=n.stateNode,r!=null)){var s=n.memoizedProps,o=t!==null?t.memoizedProps:s,a=n.type,l=n.updateQueue;if(n.updateQueue=null,l!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&sy(r,s),$f(a,o);var c=$f(a,s);for(o=0;o<l.length;o+=2){var u=l[o],h=l[o+1];u==="style"?uy(r,h):u==="dangerouslySetInnerHTML"?ly(r,h):u==="children"?za(r,h):Zp(r,u,h,c)}switch(a){case"input":Hf(r,s);break;case"textarea":oy(r,s);break;case"select":var d=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!s.multiple;var p=s.value;p!=null?vo(r,!!s.multiple,p,!1):d!==!!s.multiple&&(s.defaultValue!=null?vo(r,!!s.multiple,s.defaultValue,!0):vo(r,!!s.multiple,s.multiple?[]:"",!1))}r[qa]=s}catch(x){Tt(n,n.return,x)}}break;case 6:if(Kn(e,n),fi(n),i&4){if(n.stateNode===null)throw Error(re(162));r=n.stateNode,s=n.memoizedProps;try{r.nodeValue=s}catch(x){Tt(n,n.return,x)}}break;case 3:if(Kn(e,n),fi(n),i&4&&t!==null&&t.memoizedState.isDehydrated)try{Wa(e.containerInfo)}catch(x){Tt(n,n.return,x)}break;case 4:Kn(e,n),fi(n);break;case 13:Kn(e,n),fi(n),r=n.child,r.flags&8192&&(s=r.memoizedState!==null,r.stateNode.isHidden=s,!s||r.alternate!==null&&r.alternate.memoizedState!==null||(Rm=Pt())),i&4&&Dx(n);break;case 22:if(u=t!==null&&t.memoizedState!==null,n.mode&1?(nn=(c=nn)||u,Kn(e,n),nn=c):Kn(e,n),fi(n),i&8192){if(c=n.memoizedState!==null,(n.stateNode.isHidden=c)&&!u&&n.mode&1)for(we=n,u=n.child;u!==null;){for(h=we=u;we!==null;){switch(d=we,p=d.child,d.tag){case 0:case 11:case 14:case 15:Aa(4,d,d.return);break;case 1:uo(d,d.return);var m=d.stateNode;if(typeof m.componentWillUnmount=="function"){i=d,t=d.return;try{e=i,m.props=e.memoizedProps,m.state=e.memoizedState,m.componentWillUnmount()}catch(x){Tt(i,t,x)}}break;case 5:uo(d,d.return);break;case 22:if(d.memoizedState!==null){kx(h);continue}}p!==null?(p.return=d,we=p):kx(h)}u=u.sibling}e:for(u=null,h=n;;){if(h.tag===5){if(u===null){u=h;try{r=h.stateNode,c?(s=r.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=h.stateNode,l=h.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=cy("display",o))}catch(x){Tt(n,n.return,x)}}}else if(h.tag===6){if(u===null)try{h.stateNode.nodeValue=c?"":h.memoizedProps}catch(x){Tt(n,n.return,x)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===n)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===n)break e;for(;h.sibling===null;){if(h.return===null||h.return===n)break e;u===h&&(u=null),h=h.return}u===h&&(u=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:Kn(e,n),fi(n),i&4&&Dx(n);break;case 21:break;default:Kn(e,n),fi(n)}}function fi(n){var e=n.flags;if(e&2){try{e:{for(var t=n.return;t!==null;){if(U_(t)){var i=t;break e}t=t.return}throw Error(re(160))}switch(i.tag){case 5:var r=i.stateNode;i.flags&32&&(za(r,""),i.flags&=-33);var s=Lx(n);wp(n,s,r);break;case 3:case 4:var o=i.stateNode.containerInfo,a=Lx(n);Mp(n,a,o);break;default:throw Error(re(161))}}catch(l){Tt(n,n.return,l)}n.flags&=-3}e&4096&&(n.flags&=-4097)}function Ib(n,e,t){we=n,F_(n)}function F_(n,e,t){for(var i=(n.mode&1)!==0;we!==null;){var r=we,s=r.child;if(r.tag===22&&i){var o=r.memoizedState!==null||ec;if(!o){var a=r.alternate,l=a!==null&&a.memoizedState!==null||nn;a=ec;var c=nn;if(ec=o,(nn=l)&&!c)for(we=r;we!==null;)o=we,l=o.child,o.tag===22&&o.memoizedState!==null?Ox(r):l!==null?(l.return=o,we=l):Ox(r);for(;s!==null;)we=s,F_(s),s=s.sibling;we=r,ec=a,nn=c}Ux(n)}else r.subtreeFlags&8772&&s!==null?(s.return=r,we=s):Ux(n)}}function Ux(n){for(;we!==null;){var e=we;if(e.flags&8772){var t=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:nn||_d(5,e);break;case 1:var i=e.stateNode;if(e.flags&4&&!nn)if(t===null)i.componentDidMount();else{var r=e.elementType===e.type?t.memoizedProps:ti(e.type,t.memoizedProps);i.componentDidUpdate(r,t.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&yx(e,s,i);break;case 3:var o=e.updateQueue;if(o!==null){if(t=null,e.child!==null)switch(e.child.tag){case 5:t=e.child.stateNode;break;case 1:t=e.child.stateNode}yx(e,o,t)}break;case 5:var a=e.stateNode;if(t===null&&e.flags&4){t=a;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&t.focus();break;case"img":l.src&&(t.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var c=e.alternate;if(c!==null){var u=c.memoizedState;if(u!==null){var h=u.dehydrated;h!==null&&Wa(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(re(163))}nn||e.flags&512&&Sp(e)}catch(d){Tt(e,e.return,d)}}if(e===n){we=null;break}if(t=e.sibling,t!==null){t.return=e.return,we=t;break}we=e.return}}function kx(n){for(;we!==null;){var e=we;if(e===n){we=null;break}var t=e.sibling;if(t!==null){t.return=e.return,we=t;break}we=e.return}}function Ox(n){for(;we!==null;){var e=we;try{switch(e.tag){case 0:case 11:case 15:var t=e.return;try{_d(4,e)}catch(l){Tt(e,t,l)}break;case 1:var i=e.stateNode;if(typeof i.componentDidMount=="function"){var r=e.return;try{i.componentDidMount()}catch(l){Tt(e,r,l)}}var s=e.return;try{Sp(e)}catch(l){Tt(e,s,l)}break;case 5:var o=e.return;try{Sp(e)}catch(l){Tt(e,o,l)}}}catch(l){Tt(e,e.return,l)}if(e===n){we=null;break}var a=e.sibling;if(a!==null){a.return=e.return,we=a;break}we=e.return}}var Nb=Math.ceil,Cu=er.ReactCurrentDispatcher,Am=er.ReactCurrentOwner,$n=er.ReactCurrentBatchConfig,tt=0,Wt=null,Dt=null,qt=0,In=0,ho=Dr(0),Ft=0,tl=null,_s=0,Sd=0,Cm=0,Ca=null,yn=null,Rm=0,No=1/0,ki=null,Ru=!1,bp=null,Tr=null,tc=!1,_r=null,Pu=0,Ra=0,Ep=null,ru=-1,su=0;function hn(){return tt&6?Pt():ru!==-1?ru:ru=Pt()}function Ar(n){return n.mode&1?tt&2&&qt!==0?qt&-qt:mb.transition!==null?(su===0&&(su=My()),su):(n=dt,n!==0||(n=window.event,n=n===void 0?16:Ry(n.type)),n):1}function oi(n,e,t,i){if(50<Ra)throw Ra=0,Ep=null,Error(re(185));bl(n,t,i),(!(tt&2)||n!==Wt)&&(n===Wt&&(!(tt&2)&&(Sd|=t),Ft===4&&xr(n,qt)),bn(n,i),t===1&&tt===0&&!(e.mode&1)&&(No=Pt()+500,xd&&Ur()))}function bn(n,e){var t=n.callbackNode;m1(n,e);var i=fu(n,n===Wt?qt:0);if(i===0)t!==null&&Xg(t),n.callbackNode=null,n.callbackPriority=0;else if(e=i&-i,n.callbackPriority!==e){if(t!=null&&Xg(t),e===1)n.tag===0?pb(Fx.bind(null,n)):Yy(Fx.bind(null,n)),ub(function(){!(tt&6)&&Ur()}),t=null;else{switch(wy(i)){case 1:t=tm;break;case 4:t=_y;break;case 16:t=hu;break;case 536870912:t=Sy;break;default:t=hu}t=X_(t,B_.bind(null,n))}n.callbackPriority=e,n.callbackNode=t}}function B_(n,e){if(ru=-1,su=0,tt&6)throw Error(re(327));var t=n.callbackNode;if(wo()&&n.callbackNode!==t)return null;var i=fu(n,n===Wt?qt:0);if(i===0)return null;if(i&30||i&n.expiredLanes||e)e=Iu(n,i);else{e=i;var r=tt;tt|=2;var s=V_();(Wt!==n||qt!==e)&&(ki=null,No=Pt()+500,ds(n,e));do try{Ub();break}catch(a){z_(n,a)}while(!0);pm(),Cu.current=s,tt=r,Dt!==null?e=0:(Wt=null,qt=0,e=Ft)}if(e!==0){if(e===2&&(r=Jf(n),r!==0&&(i=r,e=Tp(n,r))),e===1)throw t=tl,ds(n,0),xr(n,i),bn(n,Pt()),t;if(e===6)xr(n,i);else{if(r=n.current.alternate,!(i&30)&&!Lb(r)&&(e=Iu(n,i),e===2&&(s=Jf(n),s!==0&&(i=s,e=Tp(n,s))),e===1))throw t=tl,ds(n,0),xr(n,i),bn(n,Pt()),t;switch(n.finishedWork=r,n.finishedLanes=i,e){case 0:case 1:throw Error(re(345));case 2:es(n,yn,ki);break;case 3:if(xr(n,i),(i&130023424)===i&&(e=Rm+500-Pt(),10<e)){if(fu(n,0)!==0)break;if(r=n.suspendedLanes,(r&i)!==i){hn(),n.pingedLanes|=n.suspendedLanes&r;break}n.timeoutHandle=op(es.bind(null,n,yn,ki),e);break}es(n,yn,ki);break;case 4:if(xr(n,i),(i&4194240)===i)break;for(e=n.eventTimes,r=-1;0<i;){var o=31-si(i);s=1<<o,o=e[o],o>r&&(r=o),i&=~s}if(i=r,i=Pt()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Nb(i/1960))-i,10<i){n.timeoutHandle=op(es.bind(null,n,yn,ki),i);break}es(n,yn,ki);break;case 5:es(n,yn,ki);break;default:throw Error(re(329))}}}return bn(n,Pt()),n.callbackNode===t?B_.bind(null,n):null}function Tp(n,e){var t=Ca;return n.current.memoizedState.isDehydrated&&(ds(n,e).flags|=256),n=Iu(n,e),n!==2&&(e=yn,yn=t,e!==null&&Ap(e)),n}function Ap(n){yn===null?yn=n:yn.push.apply(yn,n)}function Lb(n){for(var e=n;;){if(e.flags&16384){var t=e.updateQueue;if(t!==null&&(t=t.stores,t!==null))for(var i=0;i<t.length;i++){var r=t[i],s=r.getSnapshot;r=r.value;try{if(!ai(s(),r))return!1}catch{return!1}}}if(t=e.child,e.subtreeFlags&16384&&t!==null)t.return=e,e=t;else{if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function xr(n,e){for(e&=~Cm,e&=~Sd,n.suspendedLanes|=e,n.pingedLanes&=~e,n=n.expirationTimes;0<e;){var t=31-si(e),i=1<<t;n[t]=-1,e&=~i}}function Fx(n){if(tt&6)throw Error(re(327));wo();var e=fu(n,0);if(!(e&1))return bn(n,Pt()),null;var t=Iu(n,e);if(n.tag!==0&&t===2){var i=Jf(n);i!==0&&(e=i,t=Tp(n,i))}if(t===1)throw t=tl,ds(n,0),xr(n,e),bn(n,Pt()),t;if(t===6)throw Error(re(345));return n.finishedWork=n.current.alternate,n.finishedLanes=e,es(n,yn,ki),bn(n,Pt()),null}function Pm(n,e){var t=tt;tt|=1;try{return n(e)}finally{tt=t,tt===0&&(No=Pt()+500,xd&&Ur())}}function Ss(n){_r!==null&&_r.tag===0&&!(tt&6)&&wo();var e=tt;tt|=1;var t=$n.transition,i=dt;try{if($n.transition=null,dt=1,n)return n()}finally{dt=i,$n.transition=t,tt=e,!(tt&6)&&Ur()}}function Im(){In=ho.current,gt(ho)}function ds(n,e){n.finishedWork=null,n.finishedLanes=0;var t=n.timeoutHandle;if(t!==-1&&(n.timeoutHandle=-1,cb(t)),Dt!==null)for(t=Dt.return;t!==null;){var i=t;switch(dm(i),i.tag){case 1:i=i.type.childContextTypes,i!=null&&vu();break;case 3:Po(),gt(Mn),gt(sn),_m();break;case 5:ym(i);break;case 4:Po();break;case 13:gt(yt);break;case 19:gt(yt);break;case 10:mm(i.type._context);break;case 22:case 23:Im()}t=t.return}if(Wt=n,Dt=n=Cr(n.current,null),qt=In=e,Ft=0,tl=null,Cm=Sd=_s=0,yn=Ca=null,ss!==null){for(e=0;e<ss.length;e++)if(t=ss[e],i=t.interleaved,i!==null){t.interleaved=null;var r=i.next,s=t.pending;if(s!==null){var o=s.next;s.next=r,i.next=o}t.pending=i}ss=null}return n}function z_(n,e){do{var t=Dt;try{if(pm(),tu.current=Au,Tu){for(var i=St.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}Tu=!1}if(ys=0,Ht=Ot=St=null,Ta=!1,Ja=0,Am.current=null,t===null||t.return===null){Ft=1,tl=e,Dt=null;break}e:{var s=n,o=t.return,a=t,l=e;if(e=qt,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,u=a,h=u.tag;if(!(u.mode&1)&&(h===0||h===11||h===15)){var d=u.alternate;d?(u.updateQueue=d.updateQueue,u.memoizedState=d.memoizedState,u.lanes=d.lanes):(u.updateQueue=null,u.memoizedState=null)}var p=Ex(o);if(p!==null){p.flags&=-257,Tx(p,o,a,s,e),p.mode&1&&bx(s,c,e),e=p,l=c;var m=e.updateQueue;if(m===null){var x=new Set;x.add(l),e.updateQueue=x}else m.add(l);break e}else{if(!(e&1)){bx(s,c,e),Nm();break e}l=Error(re(426))}}else if(xt&&a.mode&1){var g=Ex(o);if(g!==null){!(g.flags&65536)&&(g.flags|=256),Tx(g,o,a,s,e),hm(Io(l,a));break e}}s=l=Io(l,a),Ft!==4&&(Ft=2),Ca===null?Ca=[s]:Ca.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var f=w_(s,l,e);vx(s,f);break e;case 1:a=l;var v=s.type,y=s.stateNode;if(!(s.flags&128)&&(typeof v.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Tr===null||!Tr.has(y)))){s.flags|=65536,e&=-e,s.lanes|=e;var _=b_(s,a,e);vx(s,_);break e}}s=s.return}while(s!==null)}G_(t)}catch(C){e=C,Dt===t&&t!==null&&(Dt=t=t.return);continue}break}while(!0)}function V_(){var n=Cu.current;return Cu.current=Au,n===null?Au:n}function Nm(){(Ft===0||Ft===3||Ft===2)&&(Ft=4),Wt===null||!(_s&268435455)&&!(Sd&268435455)||xr(Wt,qt)}function Iu(n,e){var t=tt;tt|=2;var i=V_();(Wt!==n||qt!==e)&&(ki=null,ds(n,e));do try{Db();break}catch(r){z_(n,r)}while(!0);if(pm(),tt=t,Cu.current=i,Dt!==null)throw Error(re(261));return Wt=null,qt=0,Ft}function Db(){for(;Dt!==null;)H_(Dt)}function Ub(){for(;Dt!==null&&!o1();)H_(Dt)}function H_(n){var e=j_(n.alternate,n,In);n.memoizedProps=n.pendingProps,e===null?G_(n):Dt=e,Am.current=null}function G_(n){var e=n;do{var t=e.alternate;if(n=e.return,e.flags&32768){if(t=Cb(t,e),t!==null){t.flags&=32767,Dt=t;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{Ft=6,Dt=null;return}}else if(t=Ab(t,e,In),t!==null){Dt=t;return}if(e=e.sibling,e!==null){Dt=e;return}Dt=e=n}while(e!==null);Ft===0&&(Ft=5)}function es(n,e,t){var i=dt,r=$n.transition;try{$n.transition=null,dt=1,kb(n,e,t,i)}finally{$n.transition=r,dt=i}return null}function kb(n,e,t,i){do wo();while(_r!==null);if(tt&6)throw Error(re(327));t=n.finishedWork;var r=n.finishedLanes;if(t===null)return null;if(n.finishedWork=null,n.finishedLanes=0,t===n.current)throw Error(re(177));n.callbackNode=null,n.callbackPriority=0;var s=t.lanes|t.childLanes;if(g1(n,s),n===Wt&&(Dt=Wt=null,qt=0),!(t.subtreeFlags&2064)&&!(t.flags&2064)||tc||(tc=!0,X_(hu,function(){return wo(),null})),s=(t.flags&15990)!==0,t.subtreeFlags&15990||s){s=$n.transition,$n.transition=null;var o=dt;dt=1;var a=tt;tt|=4,Am.current=null,Pb(n,t),O_(t,n),nb(rp),pu=!!ip,rp=ip=null,n.current=t,Ib(t),a1(),tt=a,dt=o,$n.transition=s}else n.current=t;if(tc&&(tc=!1,_r=n,Pu=r),s=n.pendingLanes,s===0&&(Tr=null),u1(t.stateNode),bn(n,Pt()),e!==null)for(i=n.onRecoverableError,t=0;t<e.length;t++)r=e[t],i(r.value,{componentStack:r.stack,digest:r.digest});if(Ru)throw Ru=!1,n=bp,bp=null,n;return Pu&1&&n.tag!==0&&wo(),s=n.pendingLanes,s&1?n===Ep?Ra++:(Ra=0,Ep=n):Ra=0,Ur(),null}function wo(){if(_r!==null){var n=wy(Pu),e=$n.transition,t=dt;try{if($n.transition=null,dt=16>n?16:n,_r===null)var i=!1;else{if(n=_r,_r=null,Pu=0,tt&6)throw Error(re(331));var r=tt;for(tt|=4,we=n.current;we!==null;){var s=we,o=s.child;if(we.flags&16){var a=s.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(we=c;we!==null;){var u=we;switch(u.tag){case 0:case 11:case 15:Aa(8,u,s)}var h=u.child;if(h!==null)h.return=u,we=h;else for(;we!==null;){u=we;var d=u.sibling,p=u.return;if(D_(u),u===c){we=null;break}if(d!==null){d.return=p,we=d;break}we=p}}}var m=s.alternate;if(m!==null){var x=m.child;if(x!==null){m.child=null;do{var g=x.sibling;x.sibling=null,x=g}while(x!==null)}}we=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,we=o;else e:for(;we!==null;){if(s=we,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Aa(9,s,s.return)}var f=s.sibling;if(f!==null){f.return=s.return,we=f;break e}we=s.return}}var v=n.current;for(we=v;we!==null;){o=we;var y=o.child;if(o.subtreeFlags&2064&&y!==null)y.return=o,we=y;else e:for(o=v;we!==null;){if(a=we,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:_d(9,a)}}catch(C){Tt(a,a.return,C)}if(a===o){we=null;break e}var _=a.sibling;if(_!==null){_.return=a.return,we=_;break e}we=a.return}}if(tt=r,Ur(),Si&&typeof Si.onPostCommitFiberRoot=="function")try{Si.onPostCommitFiberRoot(hd,n)}catch{}i=!0}return i}finally{dt=t,$n.transition=e}}return!1}function Bx(n,e,t){e=Io(t,e),e=w_(n,e,1),n=Er(n,e,1),e=hn(),n!==null&&(bl(n,1,e),bn(n,e))}function Tt(n,e,t){if(n.tag===3)Bx(n,n,t);else for(;e!==null;){if(e.tag===3){Bx(e,n,t);break}else if(e.tag===1){var i=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Tr===null||!Tr.has(i))){n=Io(t,n),n=b_(e,n,1),e=Er(e,n,1),n=hn(),e!==null&&(bl(e,1,n),bn(e,n));break}}e=e.return}}function Ob(n,e,t){var i=n.pingCache;i!==null&&i.delete(e),e=hn(),n.pingedLanes|=n.suspendedLanes&t,Wt===n&&(qt&t)===t&&(Ft===4||Ft===3&&(qt&130023424)===qt&&500>Pt()-Rm?ds(n,0):Cm|=t),bn(n,e)}function W_(n,e){e===0&&(n.mode&1?(e=jl,jl<<=1,!(jl&130023424)&&(jl=4194304)):e=1);var t=hn();n=Yi(n,e),n!==null&&(bl(n,e,t),bn(n,t))}function Fb(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),W_(n,t)}function Bb(n,e){var t=0;switch(n.tag){case 13:var i=n.stateNode,r=n.memoizedState;r!==null&&(t=r.retryLane);break;case 19:i=n.stateNode;break;default:throw Error(re(314))}i!==null&&i.delete(e),W_(n,t)}var j_;j_=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Mn.current)_n=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return _n=!1,Tb(n,e,t);_n=!!(n.flags&131072)}else _n=!1,xt&&e.flags&1048576&&qy(e,Su,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;iu(n,e),n=e.pendingProps;var r=Ao(e,sn.current);Mo(e,t),r=Mm(null,e,i,n,r,t);var s=wm();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,wn(i)?(s=!0,yu(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,xm(e),r.updater=yd,e.stateNode=r,r._reactInternals=e,fp(e,i,n,t),e=gp(null,e,i,!0,s,t)):(e.tag=0,xt&&s&&um(e),cn(null,e,r,t),e=e.child),e;case 16:i=e.elementType;e:{switch(iu(n,e),n=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=Vb(i),n=ti(i,n),r){case 0:e=mp(null,e,i,n,t);break e;case 1:e=Rx(null,e,i,n,t);break e;case 11:e=Ax(null,e,i,n,t);break e;case 14:e=Cx(null,e,i,ti(i.type,n),t);break e}throw Error(re(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ti(i,r),mp(n,e,i,r,t);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ti(i,r),Rx(n,e,i,r,t);case 3:e:{if(C_(e),n===null)throw Error(re(387));i=e.pendingProps,s=e.memoizedState,r=s.element,t_(n,e),bu(e,i,null,t);var o=e.memoizedState;if(i=o.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=Io(Error(re(423)),e),e=Px(n,e,i,t,r);break e}else if(i!==r){r=Io(Error(re(424)),e),e=Px(n,e,i,t,r);break e}else for(Ln=br(e.stateNode.containerInfo.firstChild),Dn=e,xt=!0,ii=null,t=Qy(e,null,i,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(Co(),i===r){e=qi(n,e,t);break e}cn(n,e,i,t)}e=e.child}return e;case 5:return n_(e),n===null&&up(e),i=e.type,r=e.pendingProps,s=n!==null?n.memoizedProps:null,o=r.children,sp(i,r)?o=null:s!==null&&sp(i,s)&&(e.flags|=32),A_(n,e),cn(n,e,o,t),e.child;case 6:return n===null&&up(e),null;case 13:return R_(n,e,t);case 4:return vm(e,e.stateNode.containerInfo),i=e.pendingProps,n===null?e.child=Ro(e,null,i,t):cn(n,e,i,t),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ti(i,r),Ax(n,e,i,r,t);case 7:return cn(n,e,e.pendingProps,t),e.child;case 8:return cn(n,e,e.pendingProps.children,t),e.child;case 12:return cn(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(i=e.type._context,r=e.pendingProps,s=e.memoizedProps,o=r.value,pt(Mu,i._currentValue),i._currentValue=o,s!==null)if(ai(s.value,o)){if(s.children===r.children&&!Mn.current){e=qi(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===i){if(s.tag===1){l=Gi(-1,t&-t),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),dp(s.return,t,e),a.lanes|=t;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(re(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),dp(o,t,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}cn(n,e,r.children,t),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,Mo(e,t),r=Yn(r),i=i(r),e.flags|=1,cn(n,e,i,t),e.child;case 14:return i=e.type,r=ti(i,e.pendingProps),r=ti(i.type,r),Cx(n,e,i,r,t);case 15:return E_(n,e,e.type,e.pendingProps,t);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ti(i,r),iu(n,e),e.tag=1,wn(i)?(n=!0,yu(e)):n=!1,Mo(e,t),M_(e,i,r),fp(e,i,r,t),gp(null,e,i,!0,n,t);case 19:return P_(n,e,t);case 22:return T_(n,e,t)}throw Error(re(156,e.tag))};function X_(n,e){return yy(n,e)}function zb(n,e,t,i){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function jn(n,e,t,i){return new zb(n,e,t,i)}function Lm(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Vb(n){if(typeof n=="function")return Lm(n)?1:0;if(n!=null){if(n=n.$$typeof,n===Jp)return 11;if(n===Qp)return 14}return 2}function Cr(n,e){var t=n.alternate;return t===null?(t=jn(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function ou(n,e,t,i,r,s){var o=2;if(i=n,typeof n=="function")Lm(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case to:return hs(t.children,r,s,e);case Kp:o=8,r|=8;break;case Of:return n=jn(12,t,e,r|2),n.elementType=Of,n.lanes=s,n;case Ff:return n=jn(13,t,e,r),n.elementType=Ff,n.lanes=s,n;case Bf:return n=jn(19,t,e,r),n.elementType=Bf,n.lanes=s,n;case ny:return Md(t,r,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case ey:o=10;break e;case ty:o=9;break e;case Jp:o=11;break e;case Qp:o=14;break e;case fr:o=16,i=null;break e}throw Error(re(130,n==null?n:typeof n,""))}return e=jn(o,t,e,r),e.elementType=n,e.type=i,e.lanes=s,e}function hs(n,e,t,i){return n=jn(7,n,i,e),n.lanes=t,n}function Md(n,e,t,i){return n=jn(22,n,i,e),n.elementType=ny,n.lanes=t,n.stateNode={isHidden:!1},n}function Bh(n,e,t){return n=jn(6,n,null,e),n.lanes=t,n}function zh(n,e,t){return e=jn(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function Hb(n,e,t,i,r){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=_h(0),this.expirationTimes=_h(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=_h(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function Dm(n,e,t,i,r,s,o,a,l){return n=new Hb(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=jn(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:i,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},xm(s),n}function Gb(n,e,t){var i=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:eo,key:i==null?null:""+i,children:n,containerInfo:e,implementation:t}}function $_(n){if(!n)return Pr;n=n._reactInternals;e:{if(As(n)!==n||n.tag!==1)throw Error(re(170));var e=n;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(wn(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(re(171))}if(n.tag===1){var t=n.type;if(wn(t))return $y(n,t,e)}return e}function Y_(n,e,t,i,r,s,o,a,l){return n=Dm(t,i,!0,n,r,s,o,a,l),n.context=$_(null),t=n.current,i=hn(),r=Ar(t),s=Gi(i,r),s.callback=e??null,Er(t,s,r),n.current.lanes=r,bl(n,r,i),bn(n,i),n}function wd(n,e,t,i){var r=e.current,s=hn(),o=Ar(r);return t=$_(t),e.context===null?e.context=t:e.pendingContext=t,e=Gi(s,o),e.payload={element:n},i=i===void 0?null:i,i!==null&&(e.callback=i),n=Er(r,e,o),n!==null&&(oi(n,r,o,s),eu(n,r,o)),o}function Nu(n){if(n=n.current,!n.child)return null;switch(n.child.tag){case 5:return n.child.stateNode;default:return n.child.stateNode}}function zx(n,e){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var t=n.retryLane;n.retryLane=t!==0&&t<e?t:e}}function Um(n,e){zx(n,e),(n=n.alternate)&&zx(n,e)}function Wb(){return null}var q_=typeof reportError=="function"?reportError:function(n){console.error(n)};function km(n){this._internalRoot=n}bd.prototype.render=km.prototype.render=function(n){var e=this._internalRoot;if(e===null)throw Error(re(409));wd(n,e,null,null)};bd.prototype.unmount=km.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var e=n.containerInfo;Ss(function(){wd(null,n,null,null)}),e[$i]=null}};function bd(n){this._internalRoot=n}bd.prototype.unstable_scheduleHydration=function(n){if(n){var e=Ty();n={blockedOn:null,target:n,priority:e};for(var t=0;t<gr.length&&e!==0&&e<gr[t].priority;t++);gr.splice(t,0,n),t===0&&Cy(n)}};function Om(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function Ed(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function Vx(){}function jb(n,e,t,i,r){if(r){if(typeof i=="function"){var s=i;i=function(){var c=Nu(o);s.call(c)}}var o=Y_(e,i,n,0,null,!1,!1,"",Vx);return n._reactRootContainer=o,n[$i]=o.current,$a(n.nodeType===8?n.parentNode:n),Ss(),o}for(;r=n.lastChild;)n.removeChild(r);if(typeof i=="function"){var a=i;i=function(){var c=Nu(l);a.call(c)}}var l=Dm(n,0,!1,null,null,!1,!1,"",Vx);return n._reactRootContainer=l,n[$i]=l.current,$a(n.nodeType===8?n.parentNode:n),Ss(function(){wd(e,l,t,i)}),l}function Td(n,e,t,i,r){var s=t._reactRootContainer;if(s){var o=s;if(typeof r=="function"){var a=r;r=function(){var l=Nu(o);a.call(l)}}wd(e,o,n,r)}else o=jb(t,e,n,r,i);return Nu(o)}by=function(n){switch(n.tag){case 3:var e=n.stateNode;if(e.current.memoizedState.isDehydrated){var t=xa(e.pendingLanes);t!==0&&(nm(e,t|1),bn(e,Pt()),!(tt&6)&&(No=Pt()+500,Ur()))}break;case 13:Ss(function(){var i=Yi(n,1);if(i!==null){var r=hn();oi(i,n,1,r)}}),Um(n,1)}};im=function(n){if(n.tag===13){var e=Yi(n,134217728);if(e!==null){var t=hn();oi(e,n,134217728,t)}Um(n,134217728)}};Ey=function(n){if(n.tag===13){var e=Ar(n),t=Yi(n,e);if(t!==null){var i=hn();oi(t,n,e,i)}Um(n,e)}};Ty=function(){return dt};Ay=function(n,e){var t=dt;try{return dt=n,e()}finally{dt=t}};qf=function(n,e,t){switch(e){case"input":if(Hf(n,t),e=t.name,t.type==="radio"&&e!=null){for(t=n;t.parentNode;)t=t.parentNode;for(t=t.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<t.length;e++){var i=t[e];if(i!==n&&i.form===n.form){var r=gd(i);if(!r)throw Error(re(90));ry(i),Hf(i,r)}}}break;case"textarea":oy(n,t);break;case"select":e=t.value,e!=null&&vo(n,!!t.multiple,e,!1)}};fy=Pm;py=Ss;var Xb={usingClientEntryPoint:!1,Events:[Tl,so,gd,dy,hy,Pm]},ea={findFiberByHostInstance:rs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},$b={bundleType:ea.bundleType,version:ea.version,rendererPackageName:ea.rendererPackageName,rendererConfig:ea.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:er.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=xy(n),n===null?null:n.stateNode},findFiberByHostInstance:ea.findFiberByHostInstance||Wb,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 nc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nc.isDisabled&&nc.supportsFiber)try{hd=nc.inject($b),Si=nc}catch{}}Fn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Xb;Fn.createPortal=function(n,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Om(e))throw Error(re(200));return Gb(n,e,null,t)};Fn.createRoot=function(n,e){if(!Om(n))throw Error(re(299));var t=!1,i="",r=q_;return e!=null&&(e.unstable_strictMode===!0&&(t=!0),e.identifierPrefix!==void 0&&(i=e.identifierPrefix),e.onRecoverableError!==void 0&&(r=e.onRecoverableError)),e=Dm(n,1,!1,null,null,t,!1,i,r),n[$i]=e.current,$a(n.nodeType===8?n.parentNode:n),new km(e)};Fn.findDOMNode=function(n){if(n==null)return null;if(n.nodeType===1)return n;var e=n._reactInternals;if(e===void 0)throw typeof n.render=="function"?Error(re(188)):(n=Object.keys(n).join(","),Error(re(268,n)));return n=xy(e),n=n===null?null:n.stateNode,n};Fn.flushSync=function(n){return Ss(n)};Fn.hydrate=function(n,e,t){if(!Ed(e))throw Error(re(200));return Td(null,n,e,!0,t)};Fn.hydrateRoot=function(n,e,t){if(!Om(n))throw Error(re(405));var i=t!=null&&t.hydratedSources||null,r=!1,s="",o=q_;if(t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),e=Y_(e,null,n,1,t??null,r,!1,s,o),n[$i]=e.current,$a(n),i)for(n=0;n<i.length;n++)t=i[n],r=t._getVersion,r=r(t._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[t,r]:e.mutableSourceEagerHydrationData.push(t,r);return new bd(e)};Fn.render=function(n,e,t){if(!Ed(e))throw Error(re(200));return Td(null,n,e,!1,t)};Fn.unmountComponentAtNode=function(n){if(!Ed(n))throw Error(re(40));return n._reactRootContainer?(Ss(function(){Td(null,null,n,!1,function(){n._reactRootContainer=null,n[$i]=null})}),!0):!1};Fn.unstable_batchedUpdates=Pm;Fn.unstable_renderSubtreeIntoContainer=function(n,e,t,i){if(!Ed(t))throw Error(re(200));if(n==null||n._reactInternals===void 0)throw Error(re(38));return Td(n,e,t,!1,i)};Fn.version="18.3.1-next-f1338f8080-20240426";function Z_(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Z_)}catch(n){console.error(n)}}Z_(),Zv.exports=Fn;var Yb=Zv.exports,K_,Hx=Yb;K_=Hx.createRoot,Hx.hydrateRoot;const qb="modulepreload",Zb=function(n){return"/"+n},Gx={},Ad=function(e,t,i){let r=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));r=Promise.allSettled(t.map(l=>{if(l=Zb(l),l in Gx)return;Gx[l]=!0;const c=l.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const h=document.createElement("link");if(h.rel=c?"stylesheet":qb,c||(h.as="script"),h.crossOrigin="",h.href=l,a&&h.setAttribute("nonce",a),document.head.appendChild(h),c)return new Promise((d,p)=>{h.addEventListener("load",d),h.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return r.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})},Kb={},Wx=n=>{let e;const t=new Set,i=(u,h)=>{const d=typeof u=="function"?u(e):u;if(!Object.is(d,e)){const p=e;e=h??(typeof d!="object"||d===null)?d:Object.assign({},e,d),t.forEach(m=>m(e,p))}},r=()=>e,l={setState:i,getState:r,getInitialState:()=>c,subscribe:u=>(t.add(u),()=>t.delete(u)),destroy:()=>{(Kb?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),t.clear()}},c=e=n(i,r,l);return l},Jb=n=>n?Wx(n):Wx;var J_={exports:{}},Q_={},eS={exports:{}},tS={};/**
40
+ `+s.stack}return{value:n,source:e,stack:r,digest:null}}function Oh(n,e,t){return{value:n,source:null,stack:t??null,digest:e??null}}function pp(n,e){try{console.error(e.value)}catch(t){setTimeout(function(){throw t})}}var wb=typeof WeakMap=="function"?WeakMap:Map;function b_(n,e,t){t=Gi(-1,t),t.tag=3,t.payload={element:null};var i=e.value;return t.callback=function(){Pu||(Pu=!0,bp=i),pp(n,e)},t}function E_(n,e,t){t=Gi(-1,t),t.tag=3;var i=n.type.getDerivedStateFromError;if(typeof i=="function"){var r=e.value;t.payload=function(){return i(r)},t.callback=function(){pp(n,e)}}var s=n.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){pp(n,e),typeof i!="function"&&(Tr===null?Tr=new Set([this]):Tr.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),t}function Ex(n,e,t){var i=n.pingCache;if(i===null){i=n.pingCache=new wb;var r=new Set;i.set(e,r)}else r=i.get(e),r===void 0&&(r=new Set,i.set(e,r));r.has(t)||(r.add(t),n=Ob.bind(null,n,e,t),e.then(n,n))}function Tx(n){do{var e;if((e=n.tag===13)&&(e=n.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return n;n=n.return}while(n!==null);return null}function Ax(n,e,t,i,r){return n.mode&1?(n.flags|=65536,n.lanes=r,n):(n===e?n.flags|=65536:(n.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(e=Gi(-1,1),e.tag=2,Er(t,e,1))),t.lanes|=1),n)}var bb=er.ReactCurrentOwner,_n=!1;function cn(n,e,t,i){e.child=n===null?e_(e,null,t,i):Ro(e,n.child,t,i)}function Cx(n,e,t,i,r){t=t.render;var s=e.ref;return Mo(e,r),i=Mm(n,e,t,i,s,r),t=wm(),n!==null&&!_n?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~r,qi(n,e,r)):(xt&&t&&um(e),e.flags|=1,cn(n,e,i,r),e.child)}function Rx(n,e,t,i,r){if(n===null){var s=t.type;return typeof s=="function"&&!Lm(s)&&s.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(e.tag=15,e.type=s,T_(n,e,s,i,r)):(n=au(t.type,null,i,e,e.mode,r),n.ref=e.ref,n.return=e,e.child=n)}if(s=n.child,!(n.lanes&r)){var o=s.memoizedProps;if(t=t.compare,t=t!==null?t:Xa,t(o,i)&&n.ref===e.ref)return qi(n,e,r)}return e.flags|=1,n=Cr(s,i),n.ref=e.ref,n.return=e,e.child=n}function T_(n,e,t,i,r){if(n!==null){var s=n.memoizedProps;if(Xa(s,i)&&n.ref===e.ref)if(_n=!1,e.pendingProps=i=s,(n.lanes&r)!==0)n.flags&131072&&(_n=!0);else return e.lanes=n.lanes,qi(n,e,r)}return mp(n,e,t,i,r)}function A_(n,e,t){var i=e.pendingProps,r=i.children,s=n!==null?n.memoizedState:null;if(i.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},pt(ho,In),In|=t;else{if(!(t&1073741824))return n=s!==null?s.baseLanes|t:t,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:n,cachePool:null,transitions:null},e.updateQueue=null,pt(ho,In),In|=n,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},i=s!==null?s.baseLanes:t,pt(ho,In),In|=i}else s!==null?(i=s.baseLanes|t,e.memoizedState=null):i=t,pt(ho,In),In|=i;return cn(n,e,r,t),e.child}function C_(n,e){var t=e.ref;(n===null&&t!==null||n!==null&&n.ref!==t)&&(e.flags|=512,e.flags|=2097152)}function mp(n,e,t,i,r){var s=wn(t)?xs:sn.current;return s=Ao(e,s),Mo(e,r),t=Mm(n,e,t,i,s,r),i=wm(),n!==null&&!_n?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~r,qi(n,e,r)):(xt&&i&&um(e),e.flags|=1,cn(n,e,t,r),e.child)}function Px(n,e,t,i,r){if(wn(t)){var s=!0;_u(e)}else s=!1;if(Mo(e,r),e.stateNode===null)ru(n,e),w_(e,t,i),fp(e,t,i,r),i=!0;else if(n===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,c=t.contextType;typeof c=="object"&&c!==null?c=Yn(c):(c=wn(t)?xs:sn.current,c=Ao(e,c));var u=t.getDerivedStateFromProps,h=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==i||l!==c)&&bx(e,o,i,c),pr=!1;var d=e.memoizedState;o.state=d,Eu(e,i,o,r),l=e.memoizedState,a!==i||d!==l||Mn.current||pr?(typeof u=="function"&&(hp(e,t,u,i),l=e.memoizedState),(a=pr||wx(e,t,a,i,d,l,c))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=i,e.memoizedState=l),o.props=i,o.state=l,o.context=c,i=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),i=!1)}else{o=e.stateNode,n_(n,e),a=e.memoizedProps,c=e.type===e.elementType?a:ti(e.type,a),o.props=c,h=e.pendingProps,d=o.context,l=t.contextType,typeof l=="object"&&l!==null?l=Yn(l):(l=wn(t)?xs:sn.current,l=Ao(e,l));var p=t.getDerivedStateFromProps;(u=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==h||d!==l)&&bx(e,o,i,l),pr=!1,d=e.memoizedState,o.state=d,Eu(e,i,o,r);var m=e.memoizedState;a!==h||d!==m||Mn.current||pr?(typeof p=="function"&&(hp(e,t,p,i),m=e.memoizedState),(c=pr||wx(e,t,c,i,d,m,l)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(i,m,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(i,m,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&d===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&d===n.memoizedState||(e.flags|=1024),e.memoizedProps=i,e.memoizedState=m),o.props=i,o.state=m,o.context=l,i=c):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&d===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&d===n.memoizedState||(e.flags|=1024),i=!1)}return gp(n,e,t,i,s,r)}function gp(n,e,t,i,r,s){C_(n,e);var o=(e.flags&128)!==0;if(!i&&!o)return r&&mx(e,t,!1),qi(n,e,s);i=e.stateNode,bb.current=e;var a=o&&typeof t.getDerivedStateFromError!="function"?null:i.render();return e.flags|=1,n!==null&&o?(e.child=Ro(e,n.child,null,s),e.child=Ro(e,null,a,s)):cn(n,e,a,s),e.memoizedState=i.state,r&&mx(e,t,!0),e.child}function R_(n){var e=n.stateNode;e.pendingContext?px(n,e.pendingContext,e.pendingContext!==e.context):e.context&&px(n,e.context,!1),vm(n,e.containerInfo)}function Ix(n,e,t,i,r){return Co(),hm(r),e.flags|=256,cn(n,e,t,i),e.child}var xp={dehydrated:null,treeContext:null,retryLane:0};function vp(n){return{baseLanes:n,cachePool:null,transitions:null}}function P_(n,e,t){var i=e.pendingProps,r=yt.current,s=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=n!==null&&n.memoizedState===null?!1:(r&2)!==0),a?(s=!0,e.flags&=-129):(n===null||n.memoizedState!==null)&&(r|=1),pt(yt,r&1),n===null)return up(e),n=e.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?(e.mode&1?n.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=i.children,n=i.fallback,s?(i=e.mode,s=e.child,o={mode:"hidden",children:o},!(i&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=wd(o,i,0,null),n=hs(n,i,t,null),s.return=e,n.return=e,s.sibling=n,e.child=s,e.child.memoizedState=vp(t),e.memoizedState=xp,n):Tm(e,o));if(r=n.memoizedState,r!==null&&(a=r.dehydrated,a!==null))return Eb(n,e,o,i,a,r,t);if(s){s=i.fallback,o=e.mode,r=n.child,a=r.sibling;var l={mode:"hidden",children:i.children};return!(o&1)&&e.child!==r?(i=e.child,i.childLanes=0,i.pendingProps=l,e.deletions=null):(i=Cr(r,l),i.subtreeFlags=r.subtreeFlags&14680064),a!==null?s=Cr(a,s):(s=hs(s,o,t,null),s.flags|=2),s.return=e,i.return=e,i.sibling=s,e.child=i,i=s,s=e.child,o=n.child.memoizedState,o=o===null?vp(t):{baseLanes:o.baseLanes|t,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=n.childLanes&~t,e.memoizedState=xp,i}return s=n.child,n=s.sibling,i=Cr(s,{mode:"visible",children:i.children}),!(e.mode&1)&&(i.lanes=t),i.return=e,i.sibling=null,n!==null&&(t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)),e.child=i,e.memoizedState=null,i}function Tm(n,e){return e=wd({mode:"visible",children:e},n.mode,0,null),e.return=n,n.child=e}function ec(n,e,t,i){return i!==null&&hm(i),Ro(e,n.child,null,t),n=Tm(e,e.pendingProps.children),n.flags|=2,e.memoizedState=null,n}function Eb(n,e,t,i,r,s,o){if(t)return e.flags&256?(e.flags&=-257,i=Oh(Error(re(422))),ec(n,e,o,i)):e.memoizedState!==null?(e.child=n.child,e.flags|=128,null):(s=i.fallback,r=e.mode,i=wd({mode:"visible",children:i.children},r,0,null),s=hs(s,r,o,null),s.flags|=2,i.return=e,s.return=e,i.sibling=s,e.child=i,e.mode&1&&Ro(e,n.child,null,o),e.child.memoizedState=vp(o),e.memoizedState=xp,s);if(!(e.mode&1))return ec(n,e,o,null);if(r.data==="$!"){if(i=r.nextSibling&&r.nextSibling.dataset,i)var a=i.dgst;return i=a,s=Error(re(419)),i=Oh(s,i,void 0),ec(n,e,o,i)}if(a=(o&n.childLanes)!==0,_n||a){if(i=Wt,i!==null){switch(o&-o){case 4:r=2;break;case 16:r=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:r=32;break;case 536870912:r=268435456;break;default:r=0}r=r&(i.suspendedLanes|o)?0:r,r!==0&&r!==s.retryLane&&(s.retryLane=r,Yi(n,r),oi(i,n,r,-1))}return Nm(),i=Oh(Error(re(421))),ec(n,e,o,i)}return r.data==="$?"?(e.flags|=128,e.child=n.child,e=Fb.bind(null,n),r._reactRetry=e,null):(n=s.treeContext,Ln=br(r.nextSibling),Dn=e,xt=!0,ii=null,n!==null&&(Gn[Wn++]=zi,Gn[Wn++]=Vi,Gn[Wn++]=vs,zi=n.id,Vi=n.overflow,vs=e),e=Tm(e,i.children),e.flags|=4096,e)}function Nx(n,e,t){n.lanes|=e;var i=n.alternate;i!==null&&(i.lanes|=e),dp(n.return,e,t)}function Fh(n,e,t,i,r){var s=n.memoizedState;s===null?n.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:i,tail:t,tailMode:r}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=i,s.tail=t,s.tailMode=r)}function I_(n,e,t){var i=e.pendingProps,r=i.revealOrder,s=i.tail;if(cn(n,e,i.children,t),i=yt.current,i&2)i=i&1|2,e.flags|=128;else{if(n!==null&&n.flags&128)e:for(n=e.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&Nx(n,t,e);else if(n.tag===19)Nx(n,t,e);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}i&=1}if(pt(yt,i),!(e.mode&1))e.memoizedState=null;else switch(r){case"forwards":for(t=e.child,r=null;t!==null;)n=t.alternate,n!==null&&Tu(n)===null&&(r=t),t=t.sibling;t=r,t===null?(r=e.child,e.child=null):(r=t.sibling,t.sibling=null),Fh(e,!1,r,t,s);break;case"backwards":for(t=null,r=e.child,e.child=null;r!==null;){if(n=r.alternate,n!==null&&Tu(n)===null){e.child=r;break}n=r.sibling,r.sibling=t,t=r,r=n}Fh(e,!0,t,null,s);break;case"together":Fh(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function ru(n,e){!(e.mode&1)&&n!==null&&(n.alternate=null,e.alternate=null,e.flags|=2)}function qi(n,e,t){if(n!==null&&(e.dependencies=n.dependencies),_s|=e.lanes,!(t&e.childLanes))return null;if(n!==null&&e.child!==n.child)throw Error(re(153));if(e.child!==null){for(n=e.child,t=Cr(n,n.pendingProps),e.child=t,t.return=e;n.sibling!==null;)n=n.sibling,t=t.sibling=Cr(n,n.pendingProps),t.return=e;t.sibling=null}return e.child}function Tb(n,e,t){switch(e.tag){case 3:R_(e),Co();break;case 5:i_(e);break;case 1:wn(e.type)&&_u(e);break;case 4:vm(e,e.stateNode.containerInfo);break;case 10:var i=e.type._context,r=e.memoizedProps.value;pt(wu,i._currentValue),i._currentValue=r;break;case 13:if(i=e.memoizedState,i!==null)return i.dehydrated!==null?(pt(yt,yt.current&1),e.flags|=128,null):t&e.child.childLanes?P_(n,e,t):(pt(yt,yt.current&1),n=qi(n,e,t),n!==null?n.sibling:null);pt(yt,yt.current&1);break;case 19:if(i=(t&e.childLanes)!==0,n.flags&128){if(i)return I_(n,e,t);e.flags|=128}if(r=e.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),pt(yt,yt.current),i)break;return null;case 22:case 23:return e.lanes=0,A_(n,e,t)}return qi(n,e,t)}var N_,yp,L_,D_;N_=function(n,e){for(var t=e.child;t!==null;){if(t.tag===5||t.tag===6)n.appendChild(t.stateNode);else if(t.tag!==4&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return;t=t.return}t.sibling.return=t.return,t=t.sibling}};yp=function(){};L_=function(n,e,t,i){var r=n.memoizedProps;if(r!==i){n=e.stateNode,os(Mi.current);var s=null;switch(t){case"input":r=Vf(n,r),i=Vf(n,i),s=[];break;case"select":r=Mt({},r,{value:void 0}),i=Mt({},i,{value:void 0}),s=[];break;case"textarea":r=Wf(n,r),i=Wf(n,i),s=[];break;default:typeof r.onClick!="function"&&typeof i.onClick=="function"&&(n.onclick=vu)}Xf(t,i);var o;t=null;for(c in r)if(!i.hasOwnProperty(c)&&r.hasOwnProperty(c)&&r[c]!=null)if(c==="style"){var a=r[c];for(o in a)a.hasOwnProperty(o)&&(t||(t={}),t[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Ba.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in i){var l=i[c];if(a=r!=null?r[c]:void 0,i.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(t||(t={}),t[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(t||(t={}),t[o]=l[o])}else t||(s||(s=[]),s.push(c,t)),t=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Ba.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&mt("scroll",n),s||a===l||(s=[])):(s=s||[]).push(c,l))}t&&(s=s||[]).push("style",t);var c=s;(e.updateQueue=c)&&(e.flags|=4)}};D_=function(n,e,t,i){t!==i&&(e.flags|=4)};function Qo(n,e){if(!xt)switch(n.tailMode){case"hidden":e=n.tail;for(var t=null;e!==null;)e.alternate!==null&&(t=e),e=e.sibling;t===null?n.tail=null:t.sibling=null;break;case"collapsed":t=n.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e||n.tail===null?n.tail=null:n.tail.sibling=null:i.sibling=null}}function Jt(n){var e=n.alternate!==null&&n.alternate.child===n.child,t=0,i=0;if(e)for(var r=n.child;r!==null;)t|=r.lanes|r.childLanes,i|=r.subtreeFlags&14680064,i|=r.flags&14680064,r.return=n,r=r.sibling;else for(r=n.child;r!==null;)t|=r.lanes|r.childLanes,i|=r.subtreeFlags,i|=r.flags,r.return=n,r=r.sibling;return n.subtreeFlags|=i,n.childLanes=t,e}function Ab(n,e,t){var i=e.pendingProps;switch(dm(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Jt(e),null;case 1:return wn(e.type)&&yu(),Jt(e),null;case 3:return i=e.stateNode,Po(),gt(Mn),gt(sn),_m(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(Jl(e)?e.flags|=4:n===null||n.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,ii!==null&&(Ap(ii),ii=null))),yp(n,e),Jt(e),null;case 5:ym(e);var r=os(Ka.current);if(t=e.type,n!==null&&e.stateNode!=null)L_(n,e,t,i,r),n.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!i){if(e.stateNode===null)throw Error(re(166));return Jt(e),null}if(n=os(Mi.current),Jl(e)){i=e.stateNode,t=e.type;var s=e.memoizedProps;switch(i[xi]=e,i[qa]=s,n=(e.mode&1)!==0,t){case"dialog":mt("cancel",i),mt("close",i);break;case"iframe":case"object":case"embed":mt("load",i);break;case"video":case"audio":for(r=0;r<va.length;r++)mt(va[r],i);break;case"source":mt("error",i);break;case"img":case"image":case"link":mt("error",i),mt("load",i);break;case"details":mt("toggle",i);break;case"input":Vg(i,s),mt("invalid",i);break;case"select":i._wrapperState={wasMultiple:!!s.multiple},mt("invalid",i);break;case"textarea":Gg(i,s),mt("invalid",i)}Xf(t,s),r=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?i.textContent!==a&&(s.suppressHydrationWarning!==!0&&Kl(i.textContent,a,n),r=["children",a]):typeof a=="number"&&i.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&Kl(i.textContent,a,n),r=["children",""+a]):Ba.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&mt("scroll",i)}switch(t){case"input":Gl(i),Hg(i,s,!0);break;case"textarea":Gl(i),Wg(i);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(i.onclick=vu)}i=r,e.updateQueue=i,i!==null&&(e.flags|=4)}else{o=r.nodeType===9?r:r.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=ly(t)),n==="http://www.w3.org/1999/xhtml"?t==="script"?(n=o.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof i.is=="string"?n=o.createElement(t,{is:i.is}):(n=o.createElement(t),t==="select"&&(o=n,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):n=o.createElementNS(n,t),n[xi]=e,n[qa]=i,N_(n,e,!1,!1),e.stateNode=n;e:{switch(o=$f(t,i),t){case"dialog":mt("cancel",n),mt("close",n),r=i;break;case"iframe":case"object":case"embed":mt("load",n),r=i;break;case"video":case"audio":for(r=0;r<va.length;r++)mt(va[r],n);r=i;break;case"source":mt("error",n),r=i;break;case"img":case"image":case"link":mt("error",n),mt("load",n),r=i;break;case"details":mt("toggle",n),r=i;break;case"input":Vg(n,i),r=Vf(n,i),mt("invalid",n);break;case"option":r=i;break;case"select":n._wrapperState={wasMultiple:!!i.multiple},r=Mt({},i,{value:void 0}),mt("invalid",n);break;case"textarea":Gg(n,i),r=Wf(n,i),mt("invalid",n);break;default:r=i}Xf(t,r),a=r;for(s in a)if(a.hasOwnProperty(s)){var l=a[s];s==="style"?dy(n,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&cy(n,l)):s==="children"?typeof l=="string"?(t!=="textarea"||l!=="")&&za(n,l):typeof l=="number"&&za(n,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Ba.hasOwnProperty(s)?l!=null&&s==="onScroll"&&mt("scroll",n):l!=null&&Zp(n,s,l,o))}switch(t){case"input":Gl(n),Hg(n,i,!1);break;case"textarea":Gl(n),Wg(n);break;case"option":i.value!=null&&n.setAttribute("value",""+Rr(i.value));break;case"select":n.multiple=!!i.multiple,s=i.value,s!=null?vo(n,!!i.multiple,s,!1):i.defaultValue!=null&&vo(n,!!i.multiple,i.defaultValue,!0);break;default:typeof r.onClick=="function"&&(n.onclick=vu)}switch(t){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}}i&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Jt(e),null;case 6:if(n&&e.stateNode!=null)D_(n,e,n.memoizedProps,i);else{if(typeof i!="string"&&e.stateNode===null)throw Error(re(166));if(t=os(Ka.current),os(Mi.current),Jl(e)){if(i=e.stateNode,t=e.memoizedProps,i[xi]=e,(s=i.nodeValue!==t)&&(n=Dn,n!==null))switch(n.tag){case 3:Kl(i.nodeValue,t,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&Kl(i.nodeValue,t,(n.mode&1)!==0)}s&&(e.flags|=4)}else i=(t.nodeType===9?t:t.ownerDocument).createTextNode(i),i[xi]=e,e.stateNode=i}return Jt(e),null;case 13:if(gt(yt),i=e.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(xt&&Ln!==null&&e.mode&1&&!(e.flags&128))Jy(),Co(),e.flags|=98560,s=!1;else if(s=Jl(e),i!==null&&i.dehydrated!==null){if(n===null){if(!s)throw Error(re(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(re(317));s[xi]=e}else Co(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Jt(e),s=!1}else ii!==null&&(Ap(ii),ii=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=t,e):(i=i!==null,i!==(n!==null&&n.memoizedState!==null)&&i&&(e.child.flags|=8192,e.mode&1&&(n===null||yt.current&1?Ft===0&&(Ft=3):Nm())),e.updateQueue!==null&&(e.flags|=4),Jt(e),null);case 4:return Po(),yp(n,e),n===null&&$a(e.stateNode.containerInfo),Jt(e),null;case 10:return mm(e.type._context),Jt(e),null;case 17:return wn(e.type)&&yu(),Jt(e),null;case 19:if(gt(yt),s=e.memoizedState,s===null)return Jt(e),null;if(i=(e.flags&128)!==0,o=s.rendering,o===null)if(i)Qo(s,!1);else{if(Ft!==0||n!==null&&n.flags&128)for(n=e.child;n!==null;){if(o=Tu(n),o!==null){for(e.flags|=128,Qo(s,!1),i=o.updateQueue,i!==null&&(e.updateQueue=i,e.flags|=4),e.subtreeFlags=0,i=t,t=e.child;t!==null;)s=t,n=i,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=n,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,n=o.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t=t.sibling;return pt(yt,yt.current&1|2),e.child}n=n.sibling}s.tail!==null&&Pt()>No&&(e.flags|=128,i=!0,Qo(s,!1),e.lanes=4194304)}else{if(!i)if(n=Tu(o),n!==null){if(e.flags|=128,i=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Qo(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!xt)return Jt(e),null}else 2*Pt()-s.renderingStartTime>No&&t!==1073741824&&(e.flags|=128,i=!0,Qo(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(t=s.last,t!==null?t.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Pt(),e.sibling=null,t=yt.current,pt(yt,i?t&1|2:t&1),e):(Jt(e),null);case 22:case 23:return Im(),i=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?In&1073741824&&(Jt(e),e.subtreeFlags&6&&(e.flags|=8192)):Jt(e),null;case 24:return null;case 25:return null}throw Error(re(156,e.tag))}function Cb(n,e){switch(dm(e),e.tag){case 1:return wn(e.type)&&yu(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return Po(),gt(Mn),gt(sn),_m(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return ym(e),null;case 13:if(gt(yt),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(re(340));Co()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return gt(yt),null;case 4:return Po(),null;case 10:return mm(e.type._context),null;case 22:case 23:return Im(),null;case 24:return null;default:return null}}var tc=!1,nn=!1,Rb=typeof WeakSet=="function"?WeakSet:Set,we=null;function uo(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){Tt(n,e,i)}else t.current=null}function _p(n,e,t){try{t()}catch(i){Tt(n,e,i)}}var Lx=!1;function Pb(n,e){if(ip=mu,n=By(),cm(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var i=t.getSelection&&t.getSelection();if(i&&i.rangeCount!==0){t=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,c=0,u=0,h=n,d=null;t:for(;;){for(var p;h!==t||r!==0&&h.nodeType!==3||(a=o+r),h!==s||i!==0&&h.nodeType!==3||(l=o+i),h.nodeType===3&&(o+=h.nodeValue.length),(p=h.firstChild)!==null;)d=h,h=p;for(;;){if(h===n)break t;if(d===t&&++c===r&&(a=o),d===s&&++u===i&&(l=o),(p=h.nextSibling)!==null)break;h=d,d=h.parentNode}h=p}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(rp={focusedElem:n,selectionRange:t},mu=!1,we=e;we!==null;)if(e=we,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,we=n;else for(;we!==null;){e=we;try{var m=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var x=m.memoizedProps,g=m.memoizedState,f=e.stateNode,v=f.getSnapshotBeforeUpdate(e.elementType===e.type?x:ti(e.type,x),g);f.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var y=e.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(re(163))}}catch(_){Tt(e,e.return,_)}if(n=e.sibling,n!==null){n.return=e.return,we=n;break}we=e.return}return m=Lx,Lx=!1,m}function Aa(n,e,t){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var r=i=i.next;do{if((r.tag&n)===n){var s=r.destroy;r.destroy=void 0,s!==void 0&&_p(e,t,s)}r=r.next}while(r!==i)}}function Sd(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var i=t.create;t.destroy=i()}t=t.next}while(t!==e)}}function Sp(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function U_(n){var e=n.alternate;e!==null&&(n.alternate=null,U_(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[xi],delete e[qa],delete e[ap],delete e[hb],delete e[fb])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function k_(n){return n.tag===5||n.tag===3||n.tag===4}function Dx(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||k_(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Mp(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=vu));else if(i!==4&&(n=n.child,n!==null))for(Mp(n,e,t),n=n.sibling;n!==null;)Mp(n,e,t),n=n.sibling}function wp(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(i!==4&&(n=n.child,n!==null))for(wp(n,e,t),n=n.sibling;n!==null;)wp(n,e,t),n=n.sibling}var $t=null,ni=!1;function ir(n,e,t){for(t=t.child;t!==null;)O_(n,e,t),t=t.sibling}function O_(n,e,t){if(Si&&typeof Si.onCommitFiberUnmount=="function")try{Si.onCommitFiberUnmount(fd,t)}catch{}switch(t.tag){case 5:nn||uo(t,e);case 6:var i=$t,r=ni;$t=null,ir(n,e,t),$t=i,ni=r,$t!==null&&(ni?(n=$t,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):$t.removeChild(t.stateNode));break;case 18:$t!==null&&(ni?(n=$t,t=t.stateNode,n.nodeType===8?Ih(n.parentNode,t):n.nodeType===1&&Ih(n,t),Wa(n)):Ih($t,t.stateNode));break;case 4:i=$t,r=ni,$t=t.stateNode.containerInfo,ni=!0,ir(n,e,t),$t=i,ni=r;break;case 0:case 11:case 14:case 15:if(!nn&&(i=t.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){r=i=i.next;do{var s=r,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&_p(t,e,o),r=r.next}while(r!==i)}ir(n,e,t);break;case 1:if(!nn&&(uo(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=t.memoizedProps,i.state=t.memoizedState,i.componentWillUnmount()}catch(a){Tt(t,e,a)}ir(n,e,t);break;case 21:ir(n,e,t);break;case 22:t.mode&1?(nn=(i=nn)||t.memoizedState!==null,ir(n,e,t),nn=i):ir(n,e,t);break;default:ir(n,e,t)}}function Ux(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new Rb),e.forEach(function(i){var r=Bb.bind(null,n,i);t.has(i)||(t.add(i),i.then(r,r))})}}function Kn(n,e){var t=e.deletions;if(t!==null)for(var i=0;i<t.length;i++){var r=t[i];try{var s=n,o=e,a=o;e:for(;a!==null;){switch(a.tag){case 5:$t=a.stateNode,ni=!1;break e;case 3:$t=a.stateNode.containerInfo,ni=!0;break e;case 4:$t=a.stateNode.containerInfo,ni=!0;break e}a=a.return}if($t===null)throw Error(re(160));O_(s,o,r),$t=null,ni=!1;var l=r.alternate;l!==null&&(l.return=null),r.return=null}catch(c){Tt(r,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)F_(e,n),e=e.sibling}function F_(n,e){var t=n.alternate,i=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(Kn(e,n),fi(n),i&4){try{Aa(3,n,n.return),Sd(3,n)}catch(x){Tt(n,n.return,x)}try{Aa(5,n,n.return)}catch(x){Tt(n,n.return,x)}}break;case 1:Kn(e,n),fi(n),i&512&&t!==null&&uo(t,t.return);break;case 5:if(Kn(e,n),fi(n),i&512&&t!==null&&uo(t,t.return),n.flags&32){var r=n.stateNode;try{za(r,"")}catch(x){Tt(n,n.return,x)}}if(i&4&&(r=n.stateNode,r!=null)){var s=n.memoizedProps,o=t!==null?t.memoizedProps:s,a=n.type,l=n.updateQueue;if(n.updateQueue=null,l!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&oy(r,s),$f(a,o);var c=$f(a,s);for(o=0;o<l.length;o+=2){var u=l[o],h=l[o+1];u==="style"?dy(r,h):u==="dangerouslySetInnerHTML"?cy(r,h):u==="children"?za(r,h):Zp(r,u,h,c)}switch(a){case"input":Hf(r,s);break;case"textarea":ay(r,s);break;case"select":var d=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!s.multiple;var p=s.value;p!=null?vo(r,!!s.multiple,p,!1):d!==!!s.multiple&&(s.defaultValue!=null?vo(r,!!s.multiple,s.defaultValue,!0):vo(r,!!s.multiple,s.multiple?[]:"",!1))}r[qa]=s}catch(x){Tt(n,n.return,x)}}break;case 6:if(Kn(e,n),fi(n),i&4){if(n.stateNode===null)throw Error(re(162));r=n.stateNode,s=n.memoizedProps;try{r.nodeValue=s}catch(x){Tt(n,n.return,x)}}break;case 3:if(Kn(e,n),fi(n),i&4&&t!==null&&t.memoizedState.isDehydrated)try{Wa(e.containerInfo)}catch(x){Tt(n,n.return,x)}break;case 4:Kn(e,n),fi(n);break;case 13:Kn(e,n),fi(n),r=n.child,r.flags&8192&&(s=r.memoizedState!==null,r.stateNode.isHidden=s,!s||r.alternate!==null&&r.alternate.memoizedState!==null||(Rm=Pt())),i&4&&Ux(n);break;case 22:if(u=t!==null&&t.memoizedState!==null,n.mode&1?(nn=(c=nn)||u,Kn(e,n),nn=c):Kn(e,n),fi(n),i&8192){if(c=n.memoizedState!==null,(n.stateNode.isHidden=c)&&!u&&n.mode&1)for(we=n,u=n.child;u!==null;){for(h=we=u;we!==null;){switch(d=we,p=d.child,d.tag){case 0:case 11:case 14:case 15:Aa(4,d,d.return);break;case 1:uo(d,d.return);var m=d.stateNode;if(typeof m.componentWillUnmount=="function"){i=d,t=d.return;try{e=i,m.props=e.memoizedProps,m.state=e.memoizedState,m.componentWillUnmount()}catch(x){Tt(i,t,x)}}break;case 5:uo(d,d.return);break;case 22:if(d.memoizedState!==null){Ox(h);continue}}p!==null?(p.return=d,we=p):Ox(h)}u=u.sibling}e:for(u=null,h=n;;){if(h.tag===5){if(u===null){u=h;try{r=h.stateNode,c?(s=r.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=h.stateNode,l=h.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=uy("display",o))}catch(x){Tt(n,n.return,x)}}}else if(h.tag===6){if(u===null)try{h.stateNode.nodeValue=c?"":h.memoizedProps}catch(x){Tt(n,n.return,x)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===n)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===n)break e;for(;h.sibling===null;){if(h.return===null||h.return===n)break e;u===h&&(u=null),h=h.return}u===h&&(u=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:Kn(e,n),fi(n),i&4&&Ux(n);break;case 21:break;default:Kn(e,n),fi(n)}}function fi(n){var e=n.flags;if(e&2){try{e:{for(var t=n.return;t!==null;){if(k_(t)){var i=t;break e}t=t.return}throw Error(re(160))}switch(i.tag){case 5:var r=i.stateNode;i.flags&32&&(za(r,""),i.flags&=-33);var s=Dx(n);wp(n,s,r);break;case 3:case 4:var o=i.stateNode.containerInfo,a=Dx(n);Mp(n,a,o);break;default:throw Error(re(161))}}catch(l){Tt(n,n.return,l)}n.flags&=-3}e&4096&&(n.flags&=-4097)}function Ib(n,e,t){we=n,B_(n)}function B_(n,e,t){for(var i=(n.mode&1)!==0;we!==null;){var r=we,s=r.child;if(r.tag===22&&i){var o=r.memoizedState!==null||tc;if(!o){var a=r.alternate,l=a!==null&&a.memoizedState!==null||nn;a=tc;var c=nn;if(tc=o,(nn=l)&&!c)for(we=r;we!==null;)o=we,l=o.child,o.tag===22&&o.memoizedState!==null?Fx(r):l!==null?(l.return=o,we=l):Fx(r);for(;s!==null;)we=s,B_(s),s=s.sibling;we=r,tc=a,nn=c}kx(n)}else r.subtreeFlags&8772&&s!==null?(s.return=r,we=s):kx(n)}}function kx(n){for(;we!==null;){var e=we;if(e.flags&8772){var t=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:nn||Sd(5,e);break;case 1:var i=e.stateNode;if(e.flags&4&&!nn)if(t===null)i.componentDidMount();else{var r=e.elementType===e.type?t.memoizedProps:ti(e.type,t.memoizedProps);i.componentDidUpdate(r,t.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&_x(e,s,i);break;case 3:var o=e.updateQueue;if(o!==null){if(t=null,e.child!==null)switch(e.child.tag){case 5:t=e.child.stateNode;break;case 1:t=e.child.stateNode}_x(e,o,t)}break;case 5:var a=e.stateNode;if(t===null&&e.flags&4){t=a;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&t.focus();break;case"img":l.src&&(t.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var c=e.alternate;if(c!==null){var u=c.memoizedState;if(u!==null){var h=u.dehydrated;h!==null&&Wa(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(re(163))}nn||e.flags&512&&Sp(e)}catch(d){Tt(e,e.return,d)}}if(e===n){we=null;break}if(t=e.sibling,t!==null){t.return=e.return,we=t;break}we=e.return}}function Ox(n){for(;we!==null;){var e=we;if(e===n){we=null;break}var t=e.sibling;if(t!==null){t.return=e.return,we=t;break}we=e.return}}function Fx(n){for(;we!==null;){var e=we;try{switch(e.tag){case 0:case 11:case 15:var t=e.return;try{Sd(4,e)}catch(l){Tt(e,t,l)}break;case 1:var i=e.stateNode;if(typeof i.componentDidMount=="function"){var r=e.return;try{i.componentDidMount()}catch(l){Tt(e,r,l)}}var s=e.return;try{Sp(e)}catch(l){Tt(e,s,l)}break;case 5:var o=e.return;try{Sp(e)}catch(l){Tt(e,o,l)}}}catch(l){Tt(e,e.return,l)}if(e===n){we=null;break}var a=e.sibling;if(a!==null){a.return=e.return,we=a;break}we=e.return}}var Nb=Math.ceil,Ru=er.ReactCurrentDispatcher,Am=er.ReactCurrentOwner,$n=er.ReactCurrentBatchConfig,tt=0,Wt=null,Dt=null,qt=0,In=0,ho=Dr(0),Ft=0,tl=null,_s=0,Md=0,Cm=0,Ca=null,yn=null,Rm=0,No=1/0,ki=null,Pu=!1,bp=null,Tr=null,nc=!1,_r=null,Iu=0,Ra=0,Ep=null,su=-1,ou=0;function hn(){return tt&6?Pt():su!==-1?su:su=Pt()}function Ar(n){return n.mode&1?tt&2&&qt!==0?qt&-qt:mb.transition!==null?(ou===0&&(ou=wy()),ou):(n=dt,n!==0||(n=window.event,n=n===void 0?16:Py(n.type)),n):1}function oi(n,e,t,i){if(50<Ra)throw Ra=0,Ep=null,Error(re(185));bl(n,t,i),(!(tt&2)||n!==Wt)&&(n===Wt&&(!(tt&2)&&(Md|=t),Ft===4&&xr(n,qt)),bn(n,i),t===1&&tt===0&&!(e.mode&1)&&(No=Pt()+500,vd&&Ur()))}function bn(n,e){var t=n.callbackNode;m1(n,e);var i=pu(n,n===Wt?qt:0);if(i===0)t!==null&&$g(t),n.callbackNode=null,n.callbackPriority=0;else if(e=i&-i,n.callbackPriority!==e){if(t!=null&&$g(t),e===1)n.tag===0?pb(Bx.bind(null,n)):qy(Bx.bind(null,n)),ub(function(){!(tt&6)&&Ur()}),t=null;else{switch(by(i)){case 1:t=tm;break;case 4:t=Sy;break;case 16:t=fu;break;case 536870912:t=My;break;default:t=fu}t=$_(t,z_.bind(null,n))}n.callbackPriority=e,n.callbackNode=t}}function z_(n,e){if(su=-1,ou=0,tt&6)throw Error(re(327));var t=n.callbackNode;if(wo()&&n.callbackNode!==t)return null;var i=pu(n,n===Wt?qt:0);if(i===0)return null;if(i&30||i&n.expiredLanes||e)e=Nu(n,i);else{e=i;var r=tt;tt|=2;var s=H_();(Wt!==n||qt!==e)&&(ki=null,No=Pt()+500,ds(n,e));do try{Ub();break}catch(a){V_(n,a)}while(!0);pm(),Ru.current=s,tt=r,Dt!==null?e=0:(Wt=null,qt=0,e=Ft)}if(e!==0){if(e===2&&(r=Jf(n),r!==0&&(i=r,e=Tp(n,r))),e===1)throw t=tl,ds(n,0),xr(n,i),bn(n,Pt()),t;if(e===6)xr(n,i);else{if(r=n.current.alternate,!(i&30)&&!Lb(r)&&(e=Nu(n,i),e===2&&(s=Jf(n),s!==0&&(i=s,e=Tp(n,s))),e===1))throw t=tl,ds(n,0),xr(n,i),bn(n,Pt()),t;switch(n.finishedWork=r,n.finishedLanes=i,e){case 0:case 1:throw Error(re(345));case 2:es(n,yn,ki);break;case 3:if(xr(n,i),(i&130023424)===i&&(e=Rm+500-Pt(),10<e)){if(pu(n,0)!==0)break;if(r=n.suspendedLanes,(r&i)!==i){hn(),n.pingedLanes|=n.suspendedLanes&r;break}n.timeoutHandle=op(es.bind(null,n,yn,ki),e);break}es(n,yn,ki);break;case 4:if(xr(n,i),(i&4194240)===i)break;for(e=n.eventTimes,r=-1;0<i;){var o=31-si(i);s=1<<o,o=e[o],o>r&&(r=o),i&=~s}if(i=r,i=Pt()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Nb(i/1960))-i,10<i){n.timeoutHandle=op(es.bind(null,n,yn,ki),i);break}es(n,yn,ki);break;case 5:es(n,yn,ki);break;default:throw Error(re(329))}}}return bn(n,Pt()),n.callbackNode===t?z_.bind(null,n):null}function Tp(n,e){var t=Ca;return n.current.memoizedState.isDehydrated&&(ds(n,e).flags|=256),n=Nu(n,e),n!==2&&(e=yn,yn=t,e!==null&&Ap(e)),n}function Ap(n){yn===null?yn=n:yn.push.apply(yn,n)}function Lb(n){for(var e=n;;){if(e.flags&16384){var t=e.updateQueue;if(t!==null&&(t=t.stores,t!==null))for(var i=0;i<t.length;i++){var r=t[i],s=r.getSnapshot;r=r.value;try{if(!ai(s(),r))return!1}catch{return!1}}}if(t=e.child,e.subtreeFlags&16384&&t!==null)t.return=e,e=t;else{if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function xr(n,e){for(e&=~Cm,e&=~Md,n.suspendedLanes|=e,n.pingedLanes&=~e,n=n.expirationTimes;0<e;){var t=31-si(e),i=1<<t;n[t]=-1,e&=~i}}function Bx(n){if(tt&6)throw Error(re(327));wo();var e=pu(n,0);if(!(e&1))return bn(n,Pt()),null;var t=Nu(n,e);if(n.tag!==0&&t===2){var i=Jf(n);i!==0&&(e=i,t=Tp(n,i))}if(t===1)throw t=tl,ds(n,0),xr(n,e),bn(n,Pt()),t;if(t===6)throw Error(re(345));return n.finishedWork=n.current.alternate,n.finishedLanes=e,es(n,yn,ki),bn(n,Pt()),null}function Pm(n,e){var t=tt;tt|=1;try{return n(e)}finally{tt=t,tt===0&&(No=Pt()+500,vd&&Ur())}}function Ss(n){_r!==null&&_r.tag===0&&!(tt&6)&&wo();var e=tt;tt|=1;var t=$n.transition,i=dt;try{if($n.transition=null,dt=1,n)return n()}finally{dt=i,$n.transition=t,tt=e,!(tt&6)&&Ur()}}function Im(){In=ho.current,gt(ho)}function ds(n,e){n.finishedWork=null,n.finishedLanes=0;var t=n.timeoutHandle;if(t!==-1&&(n.timeoutHandle=-1,cb(t)),Dt!==null)for(t=Dt.return;t!==null;){var i=t;switch(dm(i),i.tag){case 1:i=i.type.childContextTypes,i!=null&&yu();break;case 3:Po(),gt(Mn),gt(sn),_m();break;case 5:ym(i);break;case 4:Po();break;case 13:gt(yt);break;case 19:gt(yt);break;case 10:mm(i.type._context);break;case 22:case 23:Im()}t=t.return}if(Wt=n,Dt=n=Cr(n.current,null),qt=In=e,Ft=0,tl=null,Cm=Md=_s=0,yn=Ca=null,ss!==null){for(e=0;e<ss.length;e++)if(t=ss[e],i=t.interleaved,i!==null){t.interleaved=null;var r=i.next,s=t.pending;if(s!==null){var o=s.next;s.next=r,i.next=o}t.pending=i}ss=null}return n}function V_(n,e){do{var t=Dt;try{if(pm(),nu.current=Cu,Au){for(var i=St.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}Au=!1}if(ys=0,Ht=Ot=St=null,Ta=!1,Ja=0,Am.current=null,t===null||t.return===null){Ft=1,tl=e,Dt=null;break}e:{var s=n,o=t.return,a=t,l=e;if(e=qt,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,u=a,h=u.tag;if(!(u.mode&1)&&(h===0||h===11||h===15)){var d=u.alternate;d?(u.updateQueue=d.updateQueue,u.memoizedState=d.memoizedState,u.lanes=d.lanes):(u.updateQueue=null,u.memoizedState=null)}var p=Tx(o);if(p!==null){p.flags&=-257,Ax(p,o,a,s,e),p.mode&1&&Ex(s,c,e),e=p,l=c;var m=e.updateQueue;if(m===null){var x=new Set;x.add(l),e.updateQueue=x}else m.add(l);break e}else{if(!(e&1)){Ex(s,c,e),Nm();break e}l=Error(re(426))}}else if(xt&&a.mode&1){var g=Tx(o);if(g!==null){!(g.flags&65536)&&(g.flags|=256),Ax(g,o,a,s,e),hm(Io(l,a));break e}}s=l=Io(l,a),Ft!==4&&(Ft=2),Ca===null?Ca=[s]:Ca.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var f=b_(s,l,e);yx(s,f);break e;case 1:a=l;var v=s.type,y=s.stateNode;if(!(s.flags&128)&&(typeof v.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Tr===null||!Tr.has(y)))){s.flags|=65536,e&=-e,s.lanes|=e;var _=E_(s,a,e);yx(s,_);break e}}s=s.return}while(s!==null)}W_(t)}catch(R){e=R,Dt===t&&t!==null&&(Dt=t=t.return);continue}break}while(!0)}function H_(){var n=Ru.current;return Ru.current=Cu,n===null?Cu:n}function Nm(){(Ft===0||Ft===3||Ft===2)&&(Ft=4),Wt===null||!(_s&268435455)&&!(Md&268435455)||xr(Wt,qt)}function Nu(n,e){var t=tt;tt|=2;var i=H_();(Wt!==n||qt!==e)&&(ki=null,ds(n,e));do try{Db();break}catch(r){V_(n,r)}while(!0);if(pm(),tt=t,Ru.current=i,Dt!==null)throw Error(re(261));return Wt=null,qt=0,Ft}function Db(){for(;Dt!==null;)G_(Dt)}function Ub(){for(;Dt!==null&&!o1();)G_(Dt)}function G_(n){var e=X_(n.alternate,n,In);n.memoizedProps=n.pendingProps,e===null?W_(n):Dt=e,Am.current=null}function W_(n){var e=n;do{var t=e.alternate;if(n=e.return,e.flags&32768){if(t=Cb(t,e),t!==null){t.flags&=32767,Dt=t;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{Ft=6,Dt=null;return}}else if(t=Ab(t,e,In),t!==null){Dt=t;return}if(e=e.sibling,e!==null){Dt=e;return}Dt=e=n}while(e!==null);Ft===0&&(Ft=5)}function es(n,e,t){var i=dt,r=$n.transition;try{$n.transition=null,dt=1,kb(n,e,t,i)}finally{$n.transition=r,dt=i}return null}function kb(n,e,t,i){do wo();while(_r!==null);if(tt&6)throw Error(re(327));t=n.finishedWork;var r=n.finishedLanes;if(t===null)return null;if(n.finishedWork=null,n.finishedLanes=0,t===n.current)throw Error(re(177));n.callbackNode=null,n.callbackPriority=0;var s=t.lanes|t.childLanes;if(g1(n,s),n===Wt&&(Dt=Wt=null,qt=0),!(t.subtreeFlags&2064)&&!(t.flags&2064)||nc||(nc=!0,$_(fu,function(){return wo(),null})),s=(t.flags&15990)!==0,t.subtreeFlags&15990||s){s=$n.transition,$n.transition=null;var o=dt;dt=1;var a=tt;tt|=4,Am.current=null,Pb(n,t),F_(t,n),nb(rp),mu=!!ip,rp=ip=null,n.current=t,Ib(t),a1(),tt=a,dt=o,$n.transition=s}else n.current=t;if(nc&&(nc=!1,_r=n,Iu=r),s=n.pendingLanes,s===0&&(Tr=null),u1(t.stateNode),bn(n,Pt()),e!==null)for(i=n.onRecoverableError,t=0;t<e.length;t++)r=e[t],i(r.value,{componentStack:r.stack,digest:r.digest});if(Pu)throw Pu=!1,n=bp,bp=null,n;return Iu&1&&n.tag!==0&&wo(),s=n.pendingLanes,s&1?n===Ep?Ra++:(Ra=0,Ep=n):Ra=0,Ur(),null}function wo(){if(_r!==null){var n=by(Iu),e=$n.transition,t=dt;try{if($n.transition=null,dt=16>n?16:n,_r===null)var i=!1;else{if(n=_r,_r=null,Iu=0,tt&6)throw Error(re(331));var r=tt;for(tt|=4,we=n.current;we!==null;){var s=we,o=s.child;if(we.flags&16){var a=s.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(we=c;we!==null;){var u=we;switch(u.tag){case 0:case 11:case 15:Aa(8,u,s)}var h=u.child;if(h!==null)h.return=u,we=h;else for(;we!==null;){u=we;var d=u.sibling,p=u.return;if(U_(u),u===c){we=null;break}if(d!==null){d.return=p,we=d;break}we=p}}}var m=s.alternate;if(m!==null){var x=m.child;if(x!==null){m.child=null;do{var g=x.sibling;x.sibling=null,x=g}while(x!==null)}}we=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,we=o;else e:for(;we!==null;){if(s=we,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Aa(9,s,s.return)}var f=s.sibling;if(f!==null){f.return=s.return,we=f;break e}we=s.return}}var v=n.current;for(we=v;we!==null;){o=we;var y=o.child;if(o.subtreeFlags&2064&&y!==null)y.return=o,we=y;else e:for(o=v;we!==null;){if(a=we,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Sd(9,a)}}catch(R){Tt(a,a.return,R)}if(a===o){we=null;break e}var _=a.sibling;if(_!==null){_.return=a.return,we=_;break e}we=a.return}}if(tt=r,Ur(),Si&&typeof Si.onPostCommitFiberRoot=="function")try{Si.onPostCommitFiberRoot(fd,n)}catch{}i=!0}return i}finally{dt=t,$n.transition=e}}return!1}function zx(n,e,t){e=Io(t,e),e=b_(n,e,1),n=Er(n,e,1),e=hn(),n!==null&&(bl(n,1,e),bn(n,e))}function Tt(n,e,t){if(n.tag===3)zx(n,n,t);else for(;e!==null;){if(e.tag===3){zx(e,n,t);break}else if(e.tag===1){var i=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Tr===null||!Tr.has(i))){n=Io(t,n),n=E_(e,n,1),e=Er(e,n,1),n=hn(),e!==null&&(bl(e,1,n),bn(e,n));break}}e=e.return}}function Ob(n,e,t){var i=n.pingCache;i!==null&&i.delete(e),e=hn(),n.pingedLanes|=n.suspendedLanes&t,Wt===n&&(qt&t)===t&&(Ft===4||Ft===3&&(qt&130023424)===qt&&500>Pt()-Rm?ds(n,0):Cm|=t),bn(n,e)}function j_(n,e){e===0&&(n.mode&1?(e=Xl,Xl<<=1,!(Xl&130023424)&&(Xl=4194304)):e=1);var t=hn();n=Yi(n,e),n!==null&&(bl(n,e,t),bn(n,t))}function Fb(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),j_(n,t)}function Bb(n,e){var t=0;switch(n.tag){case 13:var i=n.stateNode,r=n.memoizedState;r!==null&&(t=r.retryLane);break;case 19:i=n.stateNode;break;default:throw Error(re(314))}i!==null&&i.delete(e),j_(n,t)}var X_;X_=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Mn.current)_n=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return _n=!1,Tb(n,e,t);_n=!!(n.flags&131072)}else _n=!1,xt&&e.flags&1048576&&Zy(e,Mu,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;ru(n,e),n=e.pendingProps;var r=Ao(e,sn.current);Mo(e,t),r=Mm(null,e,i,n,r,t);var s=wm();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,wn(i)?(s=!0,_u(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,xm(e),r.updater=_d,e.stateNode=r,r._reactInternals=e,fp(e,i,n,t),e=gp(null,e,i,!0,s,t)):(e.tag=0,xt&&s&&um(e),cn(null,e,r,t),e=e.child),e;case 16:i=e.elementType;e:{switch(ru(n,e),n=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=Vb(i),n=ti(i,n),r){case 0:e=mp(null,e,i,n,t);break e;case 1:e=Px(null,e,i,n,t);break e;case 11:e=Cx(null,e,i,n,t);break e;case 14:e=Rx(null,e,i,ti(i.type,n),t);break e}throw Error(re(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ti(i,r),mp(n,e,i,r,t);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ti(i,r),Px(n,e,i,r,t);case 3:e:{if(R_(e),n===null)throw Error(re(387));i=e.pendingProps,s=e.memoizedState,r=s.element,n_(n,e),Eu(e,i,null,t);var o=e.memoizedState;if(i=o.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=Io(Error(re(423)),e),e=Ix(n,e,i,t,r);break e}else if(i!==r){r=Io(Error(re(424)),e),e=Ix(n,e,i,t,r);break e}else for(Ln=br(e.stateNode.containerInfo.firstChild),Dn=e,xt=!0,ii=null,t=e_(e,null,i,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(Co(),i===r){e=qi(n,e,t);break e}cn(n,e,i,t)}e=e.child}return e;case 5:return i_(e),n===null&&up(e),i=e.type,r=e.pendingProps,s=n!==null?n.memoizedProps:null,o=r.children,sp(i,r)?o=null:s!==null&&sp(i,s)&&(e.flags|=32),C_(n,e),cn(n,e,o,t),e.child;case 6:return n===null&&up(e),null;case 13:return P_(n,e,t);case 4:return vm(e,e.stateNode.containerInfo),i=e.pendingProps,n===null?e.child=Ro(e,null,i,t):cn(n,e,i,t),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ti(i,r),Cx(n,e,i,r,t);case 7:return cn(n,e,e.pendingProps,t),e.child;case 8:return cn(n,e,e.pendingProps.children,t),e.child;case 12:return cn(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(i=e.type._context,r=e.pendingProps,s=e.memoizedProps,o=r.value,pt(wu,i._currentValue),i._currentValue=o,s!==null)if(ai(s.value,o)){if(s.children===r.children&&!Mn.current){e=qi(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===i){if(s.tag===1){l=Gi(-1,t&-t),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),dp(s.return,t,e),a.lanes|=t;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(re(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),dp(o,t,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}cn(n,e,r.children,t),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,Mo(e,t),r=Yn(r),i=i(r),e.flags|=1,cn(n,e,i,t),e.child;case 14:return i=e.type,r=ti(i,e.pendingProps),r=ti(i.type,r),Rx(n,e,i,r,t);case 15:return T_(n,e,e.type,e.pendingProps,t);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ti(i,r),ru(n,e),e.tag=1,wn(i)?(n=!0,_u(e)):n=!1,Mo(e,t),w_(e,i,r),fp(e,i,r,t),gp(null,e,i,!0,n,t);case 19:return I_(n,e,t);case 22:return A_(n,e,t)}throw Error(re(156,e.tag))};function $_(n,e){return _y(n,e)}function zb(n,e,t,i){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function jn(n,e,t,i){return new zb(n,e,t,i)}function Lm(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Vb(n){if(typeof n=="function")return Lm(n)?1:0;if(n!=null){if(n=n.$$typeof,n===Jp)return 11;if(n===Qp)return 14}return 2}function Cr(n,e){var t=n.alternate;return t===null?(t=jn(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function au(n,e,t,i,r,s){var o=2;if(i=n,typeof n=="function")Lm(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case to:return hs(t.children,r,s,e);case Kp:o=8,r|=8;break;case Of:return n=jn(12,t,e,r|2),n.elementType=Of,n.lanes=s,n;case Ff:return n=jn(13,t,e,r),n.elementType=Ff,n.lanes=s,n;case Bf:return n=jn(19,t,e,r),n.elementType=Bf,n.lanes=s,n;case iy:return wd(t,r,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case ty:o=10;break e;case ny:o=9;break e;case Jp:o=11;break e;case Qp:o=14;break e;case fr:o=16,i=null;break e}throw Error(re(130,n==null?n:typeof n,""))}return e=jn(o,t,e,r),e.elementType=n,e.type=i,e.lanes=s,e}function hs(n,e,t,i){return n=jn(7,n,i,e),n.lanes=t,n}function wd(n,e,t,i){return n=jn(22,n,i,e),n.elementType=iy,n.lanes=t,n.stateNode={isHidden:!1},n}function Bh(n,e,t){return n=jn(6,n,null,e),n.lanes=t,n}function zh(n,e,t){return e=jn(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function Hb(n,e,t,i,r){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=_h(0),this.expirationTimes=_h(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=_h(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function Dm(n,e,t,i,r,s,o,a,l){return n=new Hb(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=jn(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:i,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},xm(s),n}function Gb(n,e,t){var i=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:eo,key:i==null?null:""+i,children:n,containerInfo:e,implementation:t}}function Y_(n){if(!n)return Pr;n=n._reactInternals;e:{if(As(n)!==n||n.tag!==1)throw Error(re(170));var e=n;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(wn(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(re(171))}if(n.tag===1){var t=n.type;if(wn(t))return Yy(n,t,e)}return e}function q_(n,e,t,i,r,s,o,a,l){return n=Dm(t,i,!0,n,r,s,o,a,l),n.context=Y_(null),t=n.current,i=hn(),r=Ar(t),s=Gi(i,r),s.callback=e??null,Er(t,s,r),n.current.lanes=r,bl(n,r,i),bn(n,i),n}function bd(n,e,t,i){var r=e.current,s=hn(),o=Ar(r);return t=Y_(t),e.context===null?e.context=t:e.pendingContext=t,e=Gi(s,o),e.payload={element:n},i=i===void 0?null:i,i!==null&&(e.callback=i),n=Er(r,e,o),n!==null&&(oi(n,r,o,s),tu(n,r,o)),o}function Lu(n){if(n=n.current,!n.child)return null;switch(n.child.tag){case 5:return n.child.stateNode;default:return n.child.stateNode}}function Vx(n,e){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var t=n.retryLane;n.retryLane=t!==0&&t<e?t:e}}function Um(n,e){Vx(n,e),(n=n.alternate)&&Vx(n,e)}function Wb(){return null}var Z_=typeof reportError=="function"?reportError:function(n){console.error(n)};function km(n){this._internalRoot=n}Ed.prototype.render=km.prototype.render=function(n){var e=this._internalRoot;if(e===null)throw Error(re(409));bd(n,e,null,null)};Ed.prototype.unmount=km.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var e=n.containerInfo;Ss(function(){bd(null,n,null,null)}),e[$i]=null}};function Ed(n){this._internalRoot=n}Ed.prototype.unstable_scheduleHydration=function(n){if(n){var e=Ay();n={blockedOn:null,target:n,priority:e};for(var t=0;t<gr.length&&e!==0&&e<gr[t].priority;t++);gr.splice(t,0,n),t===0&&Ry(n)}};function Om(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function Td(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function Hx(){}function jb(n,e,t,i,r){if(r){if(typeof i=="function"){var s=i;i=function(){var c=Lu(o);s.call(c)}}var o=q_(e,i,n,0,null,!1,!1,"",Hx);return n._reactRootContainer=o,n[$i]=o.current,$a(n.nodeType===8?n.parentNode:n),Ss(),o}for(;r=n.lastChild;)n.removeChild(r);if(typeof i=="function"){var a=i;i=function(){var c=Lu(l);a.call(c)}}var l=Dm(n,0,!1,null,null,!1,!1,"",Hx);return n._reactRootContainer=l,n[$i]=l.current,$a(n.nodeType===8?n.parentNode:n),Ss(function(){bd(e,l,t,i)}),l}function Ad(n,e,t,i,r){var s=t._reactRootContainer;if(s){var o=s;if(typeof r=="function"){var a=r;r=function(){var l=Lu(o);a.call(l)}}bd(e,o,n,r)}else o=jb(t,e,n,r,i);return Lu(o)}Ey=function(n){switch(n.tag){case 3:var e=n.stateNode;if(e.current.memoizedState.isDehydrated){var t=xa(e.pendingLanes);t!==0&&(nm(e,t|1),bn(e,Pt()),!(tt&6)&&(No=Pt()+500,Ur()))}break;case 13:Ss(function(){var i=Yi(n,1);if(i!==null){var r=hn();oi(i,n,1,r)}}),Um(n,1)}};im=function(n){if(n.tag===13){var e=Yi(n,134217728);if(e!==null){var t=hn();oi(e,n,134217728,t)}Um(n,134217728)}};Ty=function(n){if(n.tag===13){var e=Ar(n),t=Yi(n,e);if(t!==null){var i=hn();oi(t,n,e,i)}Um(n,e)}};Ay=function(){return dt};Cy=function(n,e){var t=dt;try{return dt=n,e()}finally{dt=t}};qf=function(n,e,t){switch(e){case"input":if(Hf(n,t),e=t.name,t.type==="radio"&&e!=null){for(t=n;t.parentNode;)t=t.parentNode;for(t=t.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<t.length;e++){var i=t[e];if(i!==n&&i.form===n.form){var r=xd(i);if(!r)throw Error(re(90));sy(i),Hf(i,r)}}}break;case"textarea":ay(n,t);break;case"select":e=t.value,e!=null&&vo(n,!!t.multiple,e,!1)}};py=Pm;my=Ss;var Xb={usingClientEntryPoint:!1,Events:[Tl,so,xd,hy,fy,Pm]},ea={findFiberByHostInstance:rs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},$b={bundleType:ea.bundleType,version:ea.version,rendererPackageName:ea.rendererPackageName,rendererConfig:ea.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:er.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=vy(n),n===null?null:n.stateNode},findFiberByHostInstance:ea.findFiberByHostInstance||Wb,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 ic=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ic.isDisabled&&ic.supportsFiber)try{fd=ic.inject($b),Si=ic}catch{}}Fn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Xb;Fn.createPortal=function(n,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Om(e))throw Error(re(200));return Gb(n,e,null,t)};Fn.createRoot=function(n,e){if(!Om(n))throw Error(re(299));var t=!1,i="",r=Z_;return e!=null&&(e.unstable_strictMode===!0&&(t=!0),e.identifierPrefix!==void 0&&(i=e.identifierPrefix),e.onRecoverableError!==void 0&&(r=e.onRecoverableError)),e=Dm(n,1,!1,null,null,t,!1,i,r),n[$i]=e.current,$a(n.nodeType===8?n.parentNode:n),new km(e)};Fn.findDOMNode=function(n){if(n==null)return null;if(n.nodeType===1)return n;var e=n._reactInternals;if(e===void 0)throw typeof n.render=="function"?Error(re(188)):(n=Object.keys(n).join(","),Error(re(268,n)));return n=vy(e),n=n===null?null:n.stateNode,n};Fn.flushSync=function(n){return Ss(n)};Fn.hydrate=function(n,e,t){if(!Td(e))throw Error(re(200));return Ad(null,n,e,!0,t)};Fn.hydrateRoot=function(n,e,t){if(!Om(n))throw Error(re(405));var i=t!=null&&t.hydratedSources||null,r=!1,s="",o=Z_;if(t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),e=q_(e,null,n,1,t??null,r,!1,s,o),n[$i]=e.current,$a(n),i)for(n=0;n<i.length;n++)t=i[n],r=t._getVersion,r=r(t._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[t,r]:e.mutableSourceEagerHydrationData.push(t,r);return new Ed(e)};Fn.render=function(n,e,t){if(!Td(e))throw Error(re(200));return Ad(null,n,e,!1,t)};Fn.unmountComponentAtNode=function(n){if(!Td(n))throw Error(re(40));return n._reactRootContainer?(Ss(function(){Ad(null,null,n,!1,function(){n._reactRootContainer=null,n[$i]=null})}),!0):!1};Fn.unstable_batchedUpdates=Pm;Fn.unstable_renderSubtreeIntoContainer=function(n,e,t,i){if(!Td(t))throw Error(re(200));if(n==null||n._reactInternals===void 0)throw Error(re(38));return Ad(n,e,t,!1,i)};Fn.version="18.3.1-next-f1338f8080-20240426";function K_(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(K_)}catch(n){console.error(n)}}K_(),Kv.exports=Fn;var Yb=Kv.exports,J_,Gx=Yb;J_=Gx.createRoot,Gx.hydrateRoot;const qb="modulepreload",Zb=function(n){return"/"+n},Wx={},Cl=function(e,t,i){let r=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));r=Promise.allSettled(t.map(l=>{if(l=Zb(l),l in Wx)return;Wx[l]=!0;const c=l.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const h=document.createElement("link");if(h.rel=c?"stylesheet":qb,c||(h.as="script"),h.crossOrigin="",h.href=l,a&&h.setAttribute("nonce",a),document.head.appendChild(h),c)return new Promise((d,p)=>{h.addEventListener("load",d),h.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return r.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})},Kb={},jx=n=>{let e;const t=new Set,i=(u,h)=>{const d=typeof u=="function"?u(e):u;if(!Object.is(d,e)){const p=e;e=h??(typeof d!="object"||d===null)?d:Object.assign({},e,d),t.forEach(m=>m(e,p))}},r=()=>e,l={setState:i,getState:r,getInitialState:()=>c,subscribe:u=>(t.add(u),()=>t.delete(u)),destroy:()=>{(Kb?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),t.clear()}},c=e=n(i,r,l);return l},Jb=n=>n?jx(n):jx;var Q_={exports:{}},eS={},tS={exports:{}},nS={};/**
41
41
  * @license React
42
42
  * use-sync-external-store-shim.production.js
43
43
  *
@@ -45,7 +45,7 @@ Error generating stack: `+s.message+`
45
45
  *
46
46
  * This source code is licensed under the MIT license found in the
47
47
  * LICENSE file in the root directory of this source tree.
48
- */var Lo=Ae;function Qb(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var eE=typeof Object.is=="function"?Object.is:Qb,tE=Lo.useState,nE=Lo.useEffect,iE=Lo.useLayoutEffect,rE=Lo.useDebugValue;function sE(n,e){var t=e(),i=tE({inst:{value:t,getSnapshot:e}}),r=i[0].inst,s=i[1];return iE(function(){r.value=t,r.getSnapshot=e,Vh(r)&&s({inst:r})},[n,t,e]),nE(function(){return Vh(r)&&s({inst:r}),n(function(){Vh(r)&&s({inst:r})})},[n]),rE(t),t}function Vh(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!eE(n,t)}catch{return!0}}function oE(n,e){return e()}var aE=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?oE:sE;tS.useSyncExternalStore=Lo.useSyncExternalStore!==void 0?Lo.useSyncExternalStore:aE;eS.exports=tS;var lE=eS.exports;/**
48
+ */var Lo=Ee;function Qb(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var eE=typeof Object.is=="function"?Object.is:Qb,tE=Lo.useState,nE=Lo.useEffect,iE=Lo.useLayoutEffect,rE=Lo.useDebugValue;function sE(n,e){var t=e(),i=tE({inst:{value:t,getSnapshot:e}}),r=i[0].inst,s=i[1];return iE(function(){r.value=t,r.getSnapshot=e,Vh(r)&&s({inst:r})},[n,t,e]),nE(function(){return Vh(r)&&s({inst:r}),n(function(){Vh(r)&&s({inst:r})})},[n]),rE(t),t}function Vh(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!eE(n,t)}catch{return!0}}function oE(n,e){return e()}var aE=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?oE:sE;nS.useSyncExternalStore=Lo.useSyncExternalStore!==void 0?Lo.useSyncExternalStore:aE;tS.exports=nS;var lE=tS.exports;/**
49
49
  * @license React
50
50
  * use-sync-external-store-shim/with-selector.production.js
51
51
  *
@@ -53,17 +53,17 @@ Error generating stack: `+s.message+`
53
53
  *
54
54
  * This source code is licensed under the MIT license found in the
55
55
  * LICENSE file in the root directory of this source tree.
56
- */var Cd=Ae,cE=lE;function uE(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var dE=typeof Object.is=="function"?Object.is:uE,hE=cE.useSyncExternalStore,fE=Cd.useRef,pE=Cd.useEffect,mE=Cd.useMemo,gE=Cd.useDebugValue;Q_.useSyncExternalStoreWithSelector=function(n,e,t,i,r){var s=fE(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=mE(function(){function l(p){if(!c){if(c=!0,u=p,p=i(p),r!==void 0&&o.hasValue){var m=o.value;if(r(m,p))return h=m}return h=p}if(m=h,dE(u,p))return m;var x=i(p);return r!==void 0&&r(m,x)?(u=p,m):(u=p,h=x)}var c=!1,u,h,d=t===void 0?null:t;return[function(){return l(e())},d===null?void 0:function(){return l(d())}]},[e,t,i,r]);var a=hE(n,s[0],s[1]);return pE(function(){o.hasValue=!0,o.value=a},[a]),gE(a),a};J_.exports=Q_;var xE=J_.exports;const vE=Fv(xE),nS={},{useDebugValue:yE}=Ow,{useSyncExternalStoreWithSelector:_E}=vE;let jx=!1;const SE=n=>n;function ME(n,e=SE,t){(nS?"production":void 0)!=="production"&&t&&!jx&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),jx=!0);const i=_E(n.subscribe,n.getState,n.getServerState||n.getInitialState,e,t);return yE(i),i}const Xx=n=>{(nS?"production":void 0)!=="production"&&typeof n!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof n=="function"?Jb(n):n,t=(i,r)=>ME(e,i,r);return Object.assign(t,e),t},wE=n=>n?Xx(n):Xx,bE="solix.notifications.v1";function EE(){try{return localStorage.getItem(bE)==="off"?"off":"on"}catch{return"on"}}let $x=!1;async function TE(){if(typeof Notification>"u")return"denied";if(Notification.permission!=="default"||$x)return Notification.permission;$x=!0;try{return await Notification.requestPermission()}catch{return"denied"}}async function Yx(n){if(!(EE()==="off"||typeof Notification>"u"||n.whenHidden&&typeof document<"u"&&!document.hidden||await TE()!=="granted"))try{new Notification(n.title,{body:n.body,tag:n.tag})}catch{}}const AE="solix.sound.v1";let Hh=null;function qx(){try{if(localStorage.getItem(AE)!=="on"||typeof window>"u")return;if(!Hh){const r=window.AudioContext||window.webkitAudioContext;if(!r)return;Hh=new r}const n=Hh,e=n.createOscillator(),t=n.createGain();e.connect(t),t.connect(n.destination),e.type="sine",e.frequency.value=880,t.gain.value=1e-4;const i=n.currentTime;t.gain.exponentialRampToValueAtTime(.06,i+.01),t.gain.exponentialRampToValueAtTime(1e-4,i+.35),e.start(i),e.stop(i+.4)}catch{}}function Zx(n,e,t,i){const r={},s={},a=[];for(const l of n){if(l.ts>e)break;switch(l.type){case"session_started":{const c=t[l.sessionId];if(!c)continue;r[l.sessionId]={...c,status:"idle"};break}case"session_terminated":{delete r[l.sessionId];break}case"mission_started":{if(!l.missionId)continue;const c=i[l.missionId],u=r[l.sessionId];u&&(r[l.sessionId]={...u,status:"active",currentMissionId:l.missionId}),c&&(s[l.missionId]={...c,status:"active"});break}case"mission_completed":{if(!l.missionId)continue;const c=r[l.sessionId],u=i[l.missionId];c&&c.currentMissionId===l.missionId&&(r[l.sessionId]={...c,status:"idle",currentMissionId:void 0,lastCompletedMissionId:l.missionId}),u&&(s[l.missionId]={...u,status:"completed"});break}case"tool_call":{e-l.ts<=2e3&&a.push({id:`tc-${l.ts}-${l.sessionId}`,sessionId:l.sessionId,tool:l.toolName??"tool",args:{},startedAt:l.ts,status:"ok",receivedAt:l.ts});break}}}return{derivedSessions:r,derivedMissions:s,derivedToolCalls:a}}const Kx={active:!1,loading:!1,events:[],earliestMs:0,latestMs:0,currentMs:0,playing:!1,speed:4,derivedSessions:{},derivedMissions:{},derivedToolCalls:[]},Jx=2e3,iS="solix.motion.v1",rS="solix.viewMode.v1";function CE(){try{return localStorage.getItem(iS)==="1"}catch{return!1}}function Qx(n){try{localStorage.setItem(iS,n?"1":"0")}catch{}}function RE(){try{const n=localStorage.getItem(rS);return n==="list"||n==="missions"||n==="galaxy"?n:"galaxy"}catch{return"galaxy"}}function e0(n){try{localStorage.setItem(rS,n)}catch{}}const xe=wE((n,e)=>({connected:!1,projects:{},sessions:{},missions:{},advisors:{},skills:{},schedules:{},goals:{},budgetAlerts:{},chatBySessionId:{},recentToolCalls:[],pendingPermissions:{},selectedSessionId:null,selectedAdvisorId:null,selectedSkillId:null,motionEnabled:CE(),viewMode:RE(),playback:Kx,toasts:[],setConnected:t=>n({connected:t}),applyMessage:t=>{switch(t.type){case"snapshot":{const i={};for(const u of t.projects)i[u.id]=u;const r={};for(const u of t.sessions)r[u.id]=u;const s={};for(const u of t.missions)s[u.id]=u;const o={};for(const u of t.advisors)o[u.id]=u;const a={};for(const u of t.skills)a[u.id]=u;const l={};for(const u of t.schedules)l[u.id]=u;const c={};for(const u of t.goals)c[u.id]=u;n({projects:i,sessions:r,missions:s,advisors:o,skills:a,schedules:l,goals:c});break}case"advisor_upsert":{n(i=>({advisors:{...i.advisors,[t.advisor.id]:t.advisor}}));break}case"skill_upsert":{n(i=>({skills:{...i.skills,[t.skill.id]:t.skill}}));break}case"galaxy_imported":{const i=`${Date.now()}-galaxy`;n(r=>({toasts:[...r.toasts,{id:i,level:"info",message:`Imported galaxy: ${t.manifest.name}`}].slice(-6)})),setTimeout(()=>e().dismissToast(i),5e3);break}case"session_upsert":{n(i=>({sessions:{...i.sessions,[t.session.id]:t.session}}));break}case"session_remove":{n(i=>{const r={...i.sessions};return delete r[t.sessionId],{sessions:r}});break}case"mission_upsert":{n(i=>({missions:{...i.missions,[t.mission.id]:t.mission}}));break}case"tool_call":{const i={...t.toolCall,receivedAt:Date.now()};n(r=>({recentToolCalls:[...r.recentToolCalls,i].slice(-200)})),setTimeout(()=>{n(r=>({recentToolCalls:r.recentToolCalls.filter(s=>Date.now()-s.receivedAt<Jx)}))},Jx+50);break}case"permission_request":{const i={requestId:t.requestId,sessionId:t.sessionId,tool:t.tool,args:t.args,receivedAt:Date.now()};n(a=>({pendingPermissions:{...a.pendingPermissions,[t.requestId]:i}}));const r=e().sessions[t.sessionId],s=(r==null?void 0:r.name)??t.sessionId.slice(0,8),o=(()=>{const a=Object.keys(t.args)[0];if(!a)return"";const l=t.args[a],c=typeof l=="string"?l:JSON.stringify(l);return`: ${c.length>60?c.slice(0,60)+"…":c}`})();Yx({title:`${s} needs you`,body:`${t.tool}${o}`,tag:`solix-perm-${t.sessionId}`,whenHidden:!0}),qx();break}case"context_update":{n(i=>{const r=i.sessions[t.sessionId];return r?{sessions:{...i.sessions,[t.sessionId]:{...r,contextUsagePct:t.usagePct}}}:i});break}case"cost_update":{n(i=>{const r=i.sessions[t.sessionId];return r?{sessions:{...i.sessions,[t.sessionId]:{...r,costUsd:t.costUsd,budgetUsd:t.budgetUsd??r.budgetUsd}}}:i});break}case"budget_alert":{const i={sessionId:t.sessionId,costUsd:t.costUsd,budgetUsd:t.budgetUsd,receivedAt:Date.now()};n(s=>({budgetAlerts:{...s.budgetAlerts,[t.sessionId]:i}}));const r=e().sessions[t.sessionId];Yx({title:`${(r==null?void 0:r.name)??t.sessionId.slice(0,8)} hit its budget`,body:`$${t.costUsd.toFixed(2)} / $${t.budgetUsd.toFixed(2)}`,tag:`solix-budget-${t.sessionId}`,whenHidden:!0}),qx();break}case"schedule_upsert":{n(i=>({schedules:{...i.schedules,[t.schedule.id]:t.schedule}}));break}case"schedule_remove":{n(i=>{const r={...i.schedules};return delete r[t.scheduleId],{schedules:r}});break}case"goal_upsert":{n(i=>({goals:{...i.goals,[t.goal.id]:t.goal}}));break}case"goal_remove":{n(i=>{const r={...i.goals};return delete r[t.goalId],{goals:r}});break}case"chat_delta":{const i={...t.delta,receivedAt:Date.now()};n(r=>{const a=[...(r.chatBySessionId[t.sessionId]??[]).filter(l=>l.messageId!==i.messageId),i].slice(-200);return{chatBySessionId:{...r.chatBySessionId,[t.sessionId]:a}}});break}case"toast":{const i=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;n(r=>({toasts:[...r.toasts,{id:i,level:t.level,message:t.message}].slice(-6)})),setTimeout(()=>e().dismissToast(i),5e3);break}}},selectSession:t=>n({selectedSessionId:t,selectedAdvisorId:t?null:e().selectedAdvisorId,selectedSkillId:t?null:e().selectedSkillId}),selectAdvisor:t=>n({selectedAdvisorId:t,selectedSessionId:t?null:e().selectedSessionId,selectedSkillId:t?null:e().selectedSkillId}),selectSkill:t=>n({selectedSkillId:t,selectedSessionId:t?null:e().selectedSessionId,selectedAdvisorId:t?null:e().selectedAdvisorId}),dismissToast:t=>n(i=>({toasts:i.toasts.filter(r=>r.id!==t)})),resolvePermission:(t,i)=>{const r=e().send;r({type:"permission_response",requestId:t,approved:i}),n(s=>{const o={...s.pendingPermissions};return delete o[t],{pendingPermissions:o}})},invokeAdvisor:(t,i)=>{const r=e().send,s=e().selectedSessionId??void 0;r({type:"invoke_advisor",advisorId:t,targetSessionId:s,prompt:i})},pinAdvisor:t=>{e().send({type:"pin_advisor",advisorId:t})},unpinAdvisor:t=>{e().send({type:"unpin_advisor",advisorId:t})},enableAdvisor:t=>{e().send({type:"set_advisor_enabled",advisorId:t,enabled:!0})},disableAdvisor:t=>{e().send({type:"set_advisor_enabled",advisorId:t,enabled:!1})},sendPromptTo:(t,i)=>{if(!i.trim())return;e().send({type:"send_prompt",sessionId:t,text:i});const r={messageId:`pending-${Date.now()}`,role:"user",content:i,ts:Date.now(),done:!0,receivedAt:Date.now()};n(s=>({chatBySessionId:{...s.chatBySessionId,[t]:[...s.chatBySessionId[t]??[],r].slice(-200)}}))},launchTask:(t,i,r,s)=>{e().send({type:"launch_session",cwd:t,model:i,initialPrompt:r,worktreeBranch:s==null?void 0:s.worktreeBranch,worktreeBaseRef:s==null?void 0:s.worktreeBaseRef,useAgentView:s==null?void 0:s.useAgentView,agentName:s==null?void 0:s.agentName,budgetUsd:s==null?void 0:s.budgetUsd,goalId:s==null?void 0:s.goalId})},raiseBudget:(t,i)=>{e().send({type:"raise_budget",sessionId:t,budgetUsd:i}),n(r=>{const s={...r.budgetAlerts};return delete s[t],{budgetAlerts:s}})},dismissBudgetAlert:t=>{e().send({type:"dismiss_budget_alert",sessionId:t}),n(i=>{const r={...i.budgetAlerts};return delete r[t],{budgetAlerts:r}})},selectedSessionIds:new Set,toggleSessionSelection:t=>{n(i=>{const r=new Set(i.selectedSessionIds);return r.has(t)?r.delete(t):r.add(t),{selectedSessionIds:r}})},clearSessionSelection:()=>{n({selectedSessionIds:new Set})},terminateSessions:t=>{const i=e().send;for(const r of t)i({type:"terminate_session",sessionId:r});n({selectedSessionIds:new Set})},setMotionEnabled:t=>{Qx(t),n({motionEnabled:t})},toggleMotion:()=>{const t=!e().motionEnabled;Qx(t),n({motionEnabled:t})},setViewMode:t=>{e0(t),n({viewMode:t})},toggleViewMode:()=>{const t=["galaxy","list","missions"],i=e().viewMode,r=t.indexOf(i),s=t[(r+1)%t.length]??"galaxy";e0(s),n({viewMode:s})},enterPlayback:(t,i,r)=>{const s=i;n(o=>({playback:{...o.playback,active:!0,loading:!1,events:t,earliestMs:i,latestMs:r,currentMs:s,playing:!1,...Zx(t,s,e().sessions,e().missions)}}))},exitPlayback:()=>n({playback:Kx}),setPlaybackTime:t=>{n(i=>{const r=Math.max(i.playback.earliestMs,Math.min(t,i.playback.latestMs));return{playback:{...i.playback,currentMs:r,...Zx(i.playback.events,r,e().sessions,e().missions)}}})},setPlaybackSpeed:t=>n(i=>({playback:{...i.playback,speed:t}})),setPlaybackPlaying:t=>n(i=>({playback:{...i.playback,playing:t}})),setPlaybackLoading:t=>n(i=>({playback:{...i.playback,loading:t}})),send:()=>{},attachSocket:t=>n({send:t})}));function Fm(n){return n.playback.active?n.playback.derivedSessions:n.sessions}function sS(n){return Object.values(Fm(n)).filter(e=>!e.parentSessionId&&e.kind!=="advisor")}function PE(n){return Object.values(Fm(n)).filter(e=>!e.parentSessionId&&e.kind==="advisor")}function H3(n,e){return Object.values(Fm(n)).filter(t=>t.parentSessionId===e)}function G3(n){return Object.values(n.advisors).filter(e=>e.enabled)}function W3(n){return Object.values(n.advisors).filter(e=>!e.enabled)}function j3(n){return Object.values(n.advisors).sort((e,t)=>e.enabled!==t.enabled?e.enabled?-1:1:e.codename.localeCompare(t.codename))}function X3(n){return Object.values(n.skills)}function $3(n){return Object.values(n.schedules).filter(e=>e.enabled)}function Y3(n){return Object.values(n.goals)}function IE(n){switch(n){case"opus":return"#a855f7";case"sonnet":return"#3b82f6";case"haiku":return"#06b6d4";case"default":return"#94a3b8";default:return"#94a3b8"}}function q3(n){switch(n){case"active":return{color:"#fde68a",intensity:.3};case"awaiting_permission":return{color:"#ef4444",intensity:.5};case"awaiting_input":return{color:"#f59e0b",intensity:.25};case"plan_review":return{color:"#a78bfa",intensity:.2};case"error":return{color:"#dc2626",intensity:.3};case"spawning":return{color:"#ffffff",intensity:.2};case"idle":default:return{color:"#1e293b",intensity:.05}}}function Z3(n){return n>=100?"#dc2626":n>=75?"#f59e0b":"#38bdf8"}function oS(n){switch(n){case"active":return"Active";case"awaiting_permission":return"Permission";case"awaiting_input":return"Awaiting input";case"plan_review":return"Plan review";case"error":return"Error";case"spawning":return"Spawning";case"terminated":return"Terminated";case"idle":default:return"Idle"}}function NE(n,e,t){const i=[];let r=30;switch(n.status){case"error":r=0,i.push("In error state");break;case"plan_review":case"awaiting_input":r=15,i.push(`Status: ${n.status}`);break;case"awaiting_permission":r=12,i.push("Awaiting permission");break;case"terminated":r=5,i.push("Terminated");break;default:r=30}const s=Math.max(0,30-t*15);t>0&&i.push(`${t} pending permission${t===1?"":"s"}`);const a=25*Math.max(0,1-n.contextUsagePct/100);n.contextUsagePct>=90?i.push(`Context at ${n.contextUsagePct.toFixed(0)}%`):n.contextUsagePct>=80&&i.push(`Context warm (${n.contextUsagePct.toFixed(0)}%)`);let l=0;if(e&&e.status==="active"){const u=e.metrics.toolCallCount;l=Math.min(15,u*2)}else e&&e.status==="completed"&&(l=15);return{score:Math.round(Math.max(0,Math.min(100,r+s+a+l))),reasons:i}}function LE(n){return n>=75?"#10b981":n>=50?"#fbbf24":n>=25?"#f97316":"#ef4444"}const Bm={active:"The agent is currently working — emitting tool calls or generating output.",idle:"No mission running. The agent is waiting for the next prompt or has been quiet for a while.",spawning:"The agent process just started. It will transition to active within a second or two.",awaiting_permission:"The agent paused to ask permission for a sensitive tool call. Approve or deny in the Decision Queue.",awaiting_input:"The agent finished what it could and is waiting for your next prompt.",plan_review:"The agent produced a plan and is waiting for your approval before executing.",error:"The agent crashed or hit an unrecoverable error. Look at the SidePanel transcript for details.",terminated:"The agent process exited. No more activity will come from this session.",subagent:"A child agent spawned by another session (typically via the Task tool). Rendered as a moon orbiting the parent planet.",advisor:"A long-lived specialist agent (Compass, Forge, Lumen, Argus, Sentinel, …) with its own AGENT.md describing its role.",pinned:"An advisor that's always running. Pinned advisors orbit close to the sun in the inner ring."},t0={awaiting_permission:0,awaiting_input:1,plan_review:2,error:3,active:4,spawning:5,idle:6,terminated:7};function DE(){const n=xe(sS),e=xe(PE),t=xe(_=>_.projects),i=xe(_=>_.missions),r=xe(_=>_.pendingPermissions),s=xe(_=>_.selectSession),o=xe(_=>_.selectedSessionIds),a=xe(_=>_.toggleSessionSelection),l=xe(_=>_.clearSessionSelection),c=xe(_=>_.terminateSessions),[u,h]=Ae.useState("needs"),[d,p]=Ae.useState("asc"),m=Ae.useMemo(()=>{const _=[...n,...e],C=new Set(Object.values(r).map(w=>w.sessionId));return _.map(w=>{const E=w.currentMissionId?i[w.currentMissionId]:void 0,A=Object.values(r).filter(L=>L.sessionId===w.id).length,{score:b,reasons:M}=NE(w,E,A);return{session:w,project:t[w.projectId],mission:E,needsAttention:C.has(w.id)||w.status==="awaiting_permission"||w.status==="awaiting_input"||w.status==="plan_review",health:b,healthReasons:M}})},[n,e,t,i,r]),x=Ae.useMemo(()=>{var C;const _=new Map;for(const w of m){const E=((C=w.project)==null?void 0:C.id)??"_",A=_.get(E);A?A.rows.push(w):_.set(E,{project:w.project,rows:[w]})}return[..._.values()].sort((w,E)=>{var A,b;return(((A=E.project)==null?void 0:A.lastActiveAt)??0)-(((b=w.project)==null?void 0:b.lastActiveAt)??0)})},[m]),g=(_,C)=>{var E,A;const w=d==="asc"?1:-1;switch(u){case"name":return((_.session.name??_.session.id)>(C.session.name??C.session.id)?1:-1)*w;case"status":return((t0[_.session.status]??99)-(t0[C.session.status]??99))*w;case"progress":return((((E=_.mission)==null?void 0:E.metrics.toolCallCount)??0)-(((A=C.mission)==null?void 0:A.metrics.toolCallCount)??0))*w;case"context":return(_.session.contextUsagePct-C.session.contextUsagePct)*w;case"lastActivity":return(_.session.updatedAt-C.session.updatedAt)*w;case"needs":return _.needsAttention===C.needsAttention?0:_.needsAttention?-1*w:1*w;case"health":return(_.health-C.health)*w}},f=_=>{u===_?p(d==="asc"?"desc":"asc"):(h(_),p(_==="lastActivity"?"desc":"asc"))},v=_=>u!==_?"":d==="asc"?" ▲":" ▼",y=o.size;return S.jsxs("div",{className:"absolute inset-0 overflow-y-auto bg-solix-bg pt-20 pb-20 px-6 z-0",children:[y>0&&S.jsx("div",{className:"fixed bottom-4 left-1/2 -translate-x-1/2 z-30 pointer-events-auto",children:S.jsxs("div",{className:"rounded-full border border-solix-accent/60 bg-solix-panel/95 backdrop-blur shadow-2xl px-4 py-2 flex items-center gap-3",children:[S.jsxs("span",{className:"text-xs text-slate-200 font-mono",children:[y," selected"]}),S.jsx("button",{onClick:()=>c([...o]),className:"text-xs px-3 py-1 rounded border border-solix-danger text-solix-danger hover:bg-solix-danger/15",children:"Terminate"}),S.jsx("button",{onClick:l,className:"text-xs text-slate-400 hover:text-slate-200",children:"Clear"})]})}),S.jsxs("div",{className:"max-w-6xl mx-auto",children:[S.jsxs("div",{className:"text-xs text-slate-500 uppercase tracking-widest mb-3",children:["List view · ",m.length," agent",m.length===1?"":"s"]}),m.length===0?S.jsxs("div",{className:"text-sm text-slate-500 italic py-12 text-center border border-solix-border rounded",children:["No agents yet. Run ",S.jsx("code",{children:"claude"})," in any terminal — a row will appear here within a second."]}):x.map(({project:_,rows:C})=>{const w=[...C].sort(g),E=(_==null?void 0:_.name)??"(unassigned)";return S.jsxs("section",{className:"mb-8 rounded border border-solix-border overflow-hidden",children:[S.jsxs("header",{className:"bg-solix-panel/60 px-4 py-2 flex items-center justify-between",children:[S.jsxs("div",{children:[S.jsx("span",{className:"text-sm font-semibold text-slate-100",children:E}),S.jsxs("span",{className:"ml-2 text-[10px] uppercase tracking-wide text-slate-500",children:[C.length," agent",C.length===1?"":"s"]})]}),(_==null?void 0:_.cwd)&&S.jsx("span",{className:"text-[10px] font-mono text-slate-500 truncate max-w-[55%]",children:_.cwd})]}),S.jsxs("table",{className:"w-full text-sm",children:[S.jsx("thead",{className:"bg-black/30 text-[10px] uppercase tracking-wide text-slate-500",children:S.jsxs("tr",{children:[S.jsx(Ri,{children:S.jsx("input",{type:"checkbox","aria-label":"Select all in project",checked:w.length>0&&w.every(A=>o.has(A.session.id)),onChange:A=>{A.stopPropagation();const b=w.every(M=>o.has(M.session.id));for(const M of w){const L=o.has(M.session.id);(b&&L||!b&&!L)&&a(M.session.id)}},className:"cursor-pointer"})}),S.jsxs(Ri,{onClick:()=>f("needs"),children:["● ",v("needs")]}),S.jsxs(Ri,{onClick:()=>f("name"),children:["Agent",v("name")]}),S.jsx(Ri,{children:"Advisor"}),S.jsxs(Ri,{onClick:()=>f("status"),children:["Status",v("status")]}),S.jsxs(Ri,{onClick:()=>f("health"),numeric:!0,children:["Health",v("health")]}),S.jsxs(Ri,{onClick:()=>f("progress"),children:["Mission · tools",v("progress")]}),S.jsxs(Ri,{onClick:()=>f("context"),numeric:!0,children:["Context",v("context")]}),S.jsxs(Ri,{onClick:()=>f("lastActivity"),numeric:!0,children:["Last activity",v("lastActivity")]})]})}),S.jsx("tbody",{children:w.map(A=>{var b;return S.jsxs("tr",{onClick:()=>s(A.session.id),className:`border-t border-solix-border hover:bg-solix-border/20 cursor-pointer ${A.needsAttention?"bg-solix-danger/5":""} ${o.has(A.session.id)?"bg-solix-accent/5":""}`,children:[S.jsx("td",{className:"px-3 py-2",onClick:M=>M.stopPropagation(),children:S.jsx("input",{type:"checkbox","aria-label":"Select agent",checked:o.has(A.session.id),onChange:()=>a(A.session.id),className:"cursor-pointer"})}),S.jsx("td",{className:"px-3 py-2",children:A.needsAttention?S.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-solix-danger solix-pulse"}):A.session.status==="active"?S.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-solix-ok"}):S.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-slate-600"})}),S.jsx("td",{className:"px-3 py-2",children:S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"inline-block w-2 h-2 rounded-full",style:{background:IE(A.session.model)},title:String(A.session.model)}),S.jsx("span",{className:"text-slate-100 font-medium",children:A.session.name??A.session.id.slice(0,8)}),A.session.kind==="advisor"&&S.jsx("span",{className:"text-[9px] uppercase tracking-wide text-amber-300",children:"advisor"}),A.session.origin==="agentview"&&S.jsx("span",{className:"text-[9px] uppercase tracking-wide text-cyan-300",title:"Background session managed by Anthropic's Agent View",children:"agent"}),A.session.wrapperSocketPath&&S.jsx("span",{className:"text-[9px] uppercase tracking-wide text-solix-accent",title:"Wrapped by `solix run` — UI composer is enabled",children:"wrapped"}),A.session.worktreePath&&S.jsxs("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded border border-solix-accent/40 text-solix-accent",title:A.session.worktreePath,children:["⌥",UE(A.session.worktreePath)]})]})}),S.jsx("td",{className:"px-3 py-2 text-xs",children:S.jsx(OE,{session:A.session,mission:A.mission})}),S.jsx("td",{className:"px-3 py-2 text-xs text-slate-300",title:Bm[A.session.status]??void 0,children:oS(A.session.status)}),S.jsx("td",{className:"px-3 py-2 text-right",children:S.jsx(FE,{score:A.health,reasons:A.healthReasons})}),S.jsx("td",{className:"px-3 py-2 text-xs text-slate-300 truncate max-w-xs",title:A.session.agentViewSummary??((b=A.mission)==null?void 0:b.shortName)??void 0,children:A.session.agentViewSummary?S.jsx("span",{className:"text-slate-100 italic",children:A.session.agentViewSummary}):A.mission?S.jsxs(S.Fragment,{children:[S.jsx("span",{className:"text-slate-100",children:A.mission.shortName}),S.jsxs("span",{className:"text-slate-500 ml-1",children:["· ",A.mission.metrics.toolCallCount," tools"]})]}):S.jsx("span",{className:"text-slate-500 italic",children:"idle"})}),S.jsx("td",{className:"px-3 py-2 text-right",children:S.jsx(BE,{pct:A.session.contextUsagePct})}),S.jsx("td",{className:"px-3 py-2 text-right text-[11px] text-slate-500 font-mono",children:zE(A.session.updatedAt)})]},A.session.id)})})]})]},(_==null?void 0:_.id)??"_")})]})]})}function UE(n){const e=n.split("/").filter(Boolean);return e[e.length-1]??n}const kE=/^\[Acting as ([^\s—]+)/;function OE({session:n,mission:e}){var s;const t=xe(o=>o.advisors);let i,r=!1;if(n.advisorRole)i=Object.values(t).find(o=>o.id===n.advisorRole);else if(e!=null&&e.prompt){const o=e.prompt.match(kE),a=(s=o==null?void 0:o[1])==null?void 0:s.toLowerCase();a&&(i=Object.values(t).find(l=>l.codename.toLowerCase()===a),r=!0)}return i?S.jsxs("span",{className:`inline-flex items-center gap-1 ${r?"opacity-60":""}`,title:i.description,children:[S.jsx("span",{style:{color:i.color},children:i.glyph}),S.jsx("span",{className:"text-slate-200",children:i.codename})]}):S.jsx("span",{className:"text-slate-700",children:"—"})}function Ri({children:n,onClick:e,numeric:t}){return S.jsx("th",{onClick:e,className:`px-3 py-2 select-none ${t?"text-right":"text-left"} ${e?"cursor-pointer hover:text-slate-300":""}`,children:n})}function FE({score:n,reasons:e}){const t=LE(n);return S.jsxs("div",{className:"relative inline-flex items-center gap-2 group",children:[S.jsx("span",{className:"text-[11px] font-mono font-bold",style:{color:t},children:n}),S.jsx("div",{className:"w-16 h-1.5 rounded-full bg-slate-800 overflow-hidden",children:S.jsx("div",{className:"h-full",style:{width:`${Math.max(2,n)}%`,background:t}})}),S.jsxs("div",{className:"pointer-events-none absolute right-0 top-full mt-1 z-50 hidden group-hover:block w-64 rounded border border-solix-border bg-solix-panel/95 backdrop-blur p-2 text-left shadow-xl",children:[S.jsxs("div",{className:"flex items-center justify-between mb-1",children:[S.jsx("span",{className:"text-[10px] uppercase tracking-wide text-slate-400",children:"Health"}),S.jsxs("span",{className:"text-xs font-bold",style:{color:t},children:[n,"/100"]})]}),e.length===0?S.jsx("div",{className:"text-[11px] text-slate-400 italic",children:"All four bands healthy: stable status, no pending decisions, context budget, mission progress."}):S.jsx("ul",{className:"space-y-0.5",children:e.map(i=>S.jsxs("li",{className:"text-[11px] text-slate-200 leading-snug",children:["· ",i]},i))})]})]})}function BE({pct:n}){const e=n>=90?"bg-solix-danger":n>=80?"bg-solix-warn":"bg-solix-accent";return S.jsxs("div",{className:"inline-flex items-center gap-2",children:[S.jsxs("span",{className:"text-[11px] text-slate-400 font-mono",children:[n.toFixed(0),"%"]}),S.jsx("div",{className:"w-20 h-1.5 rounded-full bg-slate-800 overflow-hidden",children:S.jsx("div",{className:`h-full ${e}`,style:{width:`${Math.min(100,n)}%`}})})]})}function zE(n){const e=Date.now()-n;if(e<0)return"now";const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const i=Math.floor(t/60);if(i<60)return`${i}m`;const r=Math.floor(i/60);return r<24?`${r}h`:new Date(n).toLocaleDateString()}function VE(){const n=xe(l=>l.missions),e=xe(l=>l.sessions),t=xe(l=>l.projects),i=xe(l=>l.selectSession),[r,s]=Ae.useState("all"),o=Ae.useMemo(()=>{const l=Object.values(n).sort((c,u)=>u.startedAt-c.startedAt);return r==="all"?l:l.filter(c=>c.status===r)},[n,r]),a=Ae.useMemo(()=>{const l=new Map;for(const c of o){const u=e[c.sessionId],h=u?t[u.projectId]:void 0,d=(h==null?void 0:h.id)??"_",p=l.get(d);p?p.missions.push(c):l.set(d,{project:h,missions:[c]})}return[...l.values()].sort((c,u)=>{var h,d;return(((h=u.missions[0])==null?void 0:h.startedAt)??0)-(((d=c.missions[0])==null?void 0:d.startedAt)??0)})},[o,e,t]);return S.jsx("div",{className:"absolute inset-0 overflow-y-auto bg-solix-bg pt-20 pb-8 px-6 z-0",children:S.jsxs("div",{className:"max-w-4xl mx-auto",children:[S.jsxs("div",{className:"flex items-center justify-between mb-3",children:[S.jsxs("div",{className:"text-xs text-slate-500 uppercase tracking-widest",children:["Missions · ",o.length]}),S.jsx("div",{className:"flex items-center gap-1.5",children:["all","active","completed","failed","cancelled"].map(l=>S.jsx("button",{onClick:()=>s(l),className:`text-[10px] px-2 py-0.5 rounded border ${r===l?"bg-solix-accent/15 border-solix-accent text-solix-accent":"border-solix-border text-slate-400 hover:text-slate-200"}`,children:l},l))})]}),o.length===0?S.jsx("div",{className:"text-sm text-slate-500 italic py-12 text-center border border-solix-border rounded",children:"No missions yet. Send a prompt to a Claude Code session and a mission card will appear here."}):a.map(({project:l,missions:c})=>{const u=(l==null?void 0:l.name)??"(unassigned)";return S.jsxs("section",{className:"mb-6 rounded border border-solix-border overflow-hidden",children:[S.jsxs("header",{className:"bg-solix-panel/60 px-4 py-2 flex items-center justify-between",children:[S.jsxs("div",{children:[S.jsx("span",{className:"text-sm font-semibold text-slate-100",children:u}),S.jsxs("span",{className:"ml-2 text-[10px] uppercase tracking-wide text-slate-500",children:[c.length," mission",c.length===1?"":"s"]})]}),(l==null?void 0:l.cwd)&&S.jsx("span",{className:"text-[10px] font-mono text-slate-500 truncate max-w-[55%]",children:l.cwd})]}),S.jsx("ul",{className:"divide-y divide-solix-border",children:c.map(h=>{const d=e[h.sessionId];return S.jsx("li",{children:S.jsxs("button",{onClick:()=>i(h.sessionId),className:"w-full text-left p-4 hover:bg-solix-border/20 cursor-pointer block",children:[S.jsxs("div",{className:"flex items-start justify-between gap-3",children:[S.jsxs("div",{className:"min-w-0 flex-1",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"text-sm font-semibold text-slate-100",children:h.shortName}),S.jsx(HE,{status:h.status})]}),S.jsx("div",{className:"mt-1 text-xs text-slate-400 line-clamp-2",children:h.prompt}),h.longSummary&&S.jsx("div",{className:"mt-1 text-xs text-slate-300 italic",children:h.longSummary}),h.status==="failed"&&h.errorSummary&&S.jsxs("div",{className:"mt-1 text-xs text-solix-danger italic line-clamp-2",children:["error: ",h.errorSummary]})]}),S.jsxs("div",{className:"text-right text-[10px] text-slate-500 font-mono whitespace-nowrap",children:[WE(h.startedAt),h.metrics.durationMs!==void 0&&S.jsxs("div",{children:[(h.metrics.durationMs/1e3).toFixed(1),"s"]})]})]}),S.jsxs("div",{className:"mt-2 flex items-center gap-3 text-[10px] text-slate-500",children:[d&&S.jsxs("span",{children:["agent:"," ",S.jsx("span",{className:"text-slate-300",children:d.name??d.id.slice(0,8)})]}),S.jsxs("span",{children:[h.metrics.toolCallCount," tools"]}),S.jsxs("span",{title:Bm.subagent,children:[h.metrics.subagentCount," subagents"]}),S.jsxs("span",{children:[h.filesTouched.length," files"]})]}),h.filesTouched.length>0&&S.jsxs("div",{className:"mt-2 flex flex-wrap gap-1",children:[h.filesTouched.slice(0,6).map(p=>S.jsx("span",{className:"text-[10px] font-mono text-slate-400 bg-black/30 border border-solix-border rounded px-1.5 py-0.5",children:GE(p)},p)),h.filesTouched.length>6&&S.jsxs("span",{className:"text-[10px] text-slate-500",children:["+",h.filesTouched.length-6]})]})]})},h.id)})})]},(l==null?void 0:l.id)??"_")})]})})}function HE({status:n}){const e=n==="active"?"border-solix-warn text-solix-warn":n==="completed"?"border-solix-ok text-solix-ok":n==="failed"?"border-solix-danger text-solix-danger":"border-solix-border text-slate-400";return S.jsx("span",{className:`text-[9px] uppercase tracking-wide px-1.5 py-0.5 rounded border ${e}`,children:n})}function GE(n){const e=n.match(/[^/\\]+\/?$/);return e?e[0].replace(/\/$/,""):n}function WE(n){const e=Date.now()-n;if(e<0)return"now";const t=Math.floor(e/1e3);if(t<60)return`${t}s ago`;const i=Math.floor(t/60);if(i<60)return`${i}m ago`;const r=Math.floor(i/60);return r<24?`${r}h ago`:new Date(n).toLocaleDateString()}function jE({onOpenGalaxy:n,onNewTask:e,onOpenTimeline:t,onOpenHelp:i,onOpenCrew:r}={}){const s=xe(h=>h.connected),o=xe(sS),a=xe(h=>h.viewMode),l=xe(h=>h.playback.active),c=xe(h=>h.exitPlayback),u=o.reduce((h,d)=>(d.status==="active"?h.active+=1:d.status==="awaiting_permission"||d.status==="awaiting_input"||d.status==="plan_review"?h.attention+=1:d.status==="idle"&&(h.idle+=1),h),{active:0,idle:0,attention:0});return S.jsxs("div",{className:"pointer-events-none absolute inset-x-0 top-0 flex items-start justify-between p-4 z-40",children:[S.jsxs("div",{className:"pointer-events-auto flex items-center gap-2 sm:gap-3",children:[S.jsxs("div",{className:"flex items-baseline gap-1.5",children:[S.jsx("div",{className:"text-xl font-bold tracking-widest text-solix-accent",children:"SOLIX"}),S.jsxs("span",{className:"text-[10px] font-mono text-slate-500",title:"Solix v1.9.2 — built into this UI bundle",children:["v","1.9.2"]})]}),S.jsx("div",{className:"hidden md:block text-xs text-slate-400",children:"a solar-system command center"}),S.jsx("div",{className:`ml-1 sm:ml-3 px-2 py-1 rounded text-[10px] border ${s?"border-solix-ok text-solix-ok":"border-solix-danger text-solix-danger solix-pulse"}`,children:s?"CONNECTED":"OFFLINE"}),l&&S.jsxs("button",{onClick:c,className:"ml-2 px-2 py-1 rounded text-[10px] border border-solix-accent text-solix-accent solix-pulse hover:bg-solix-accent/15 cursor-pointer flex items-center gap-1.5",title:"Exit Timeline Playback (Esc)","aria-label":"Exit playback",children:[S.jsx("span",{children:"▸ PLAYBACK"}),S.jsx("span",{className:"opacity-70",children:"· exit ✕"})]})]}),S.jsxs("div",{className:"pointer-events-auto flex items-center gap-2 sm:gap-3 text-xs",children:[S.jsxs("div",{className:"hidden sm:flex items-center gap-2",children:[S.jsx(Gh,{label:"active",value:u.active,color:"text-solix-ok"}),S.jsx(Gh,{label:"attention",value:u.attention,color:"text-solix-warn"}),S.jsx(Gh,{label:"idle",value:u.idle,color:"text-slate-400"})]}),S.jsx(XE,{viewMode:a}),t&&S.jsx("button",{onClick:t,className:"hidden sm:inline-block px-2 py-1 rounded bg-solix-panel border border-solix-border text-slate-300 hover:text-white hover:bg-solix-border/30",title:"Timeline playback (T)",children:"⏱ Timeline"}),e&&S.jsx("button",{onClick:e,className:"px-2 py-1 rounded bg-solix-ok/15 border border-solix-ok/40 text-solix-ok hover:bg-solix-ok/25",title:"Launch a new Claude Code task (L)",children:"+ Task"}),r&&S.jsx("button",{onClick:r,className:"px-2 py-1 rounded bg-amber-500/15 border border-amber-400/40 text-amber-200 hover:bg-amber-500/25",title:"Crew: view and enable advisors (C)",children:"✦ Crew"}),n&&S.jsx("button",{onClick:n,className:"px-2 py-1 rounded bg-solix-accent/15 border border-solix-accent/40 text-solix-accent hover:bg-solix-accent/25",title:"Galaxy: export and import (G)",children:"⌬ Galaxy"}),i&&S.jsx("button",{onClick:i,className:"w-7 h-7 rounded-full bg-solix-panel border border-solix-border text-slate-300 hover:text-white hover:bg-solix-border/30 text-sm",title:"Help (?)","aria-label":"Help",children:"?"})]})]})}function XE({viewMode:n}){const e=xe(i=>i.setViewMode),t=[{mode:"galaxy",label:"🪐"},{mode:"list",label:"☰"},{mode:"missions",label:"◎"}];return S.jsx("div",{className:"inline-flex rounded border border-solix-border bg-solix-panel overflow-hidden",children:t.map(i=>S.jsxs("button",{onClick:()=>e(i.mode),className:`px-2 py-1 text-xs ${n===i.mode?"bg-solix-border/50 text-white":"text-slate-400 hover:text-slate-100"}`,title:`${i.mode} view (V)`,children:[i.label," ",S.jsx("span",{className:"hidden sm:inline capitalize",children:i.mode})]},i.mode))})}function Gh({label:n,value:e,color:t}){return S.jsxs("div",{className:"px-2 py-1 rounded bg-solix-panel border border-solix-border",children:[S.jsx("span",{className:`font-bold ${t}`,children:e}),S.jsx("span",{className:"ml-1 opacity-60 uppercase tracking-wide",children:n})]})}function $E(){const n=xe(t=>t.toasts),e=xe(t=>t.dismissToast);return S.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 flex flex-col gap-2 z-30",children:n.map(t=>S.jsx("button",{onClick:()=>e(t.id),className:`pointer-events-auto px-3 py-2 rounded text-xs border max-w-md text-left ${t.level==="error"?"bg-solix-danger/10 border-solix-danger text-solix-danger":t.level==="warn"?"bg-solix-warn/10 border-solix-warn text-solix-warn":"bg-solix-panel border-solix-border text-slate-200"}`,children:t.message},t.id))})}const n0="solix.welcome.dismissed.v1";function YE({onOpenGalaxy:n,forceOpen:e=!1,onClose:t}){const[i,r]=Ae.useState(!1),s=xe(u=>u.advisors),o=xe(u=>Object.keys(u.skills).length),a=xe(u=>Object.keys(u.sessions).length);if(Ae.useEffect(()=>{try{r(localStorage.getItem(n0)==="1")}catch{}},[]),!e&&(i||a>0))return null;const l=()=>{try{localStorage.setItem(n0,"1")}catch{}r(!0),t==null||t()},c=Object.values(s).filter(u=>u.enabled).sort((u,h)=>u.codename.localeCompare(h.codename));return S.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center pointer-events-none",children:S.jsxs("div",{className:"pointer-events-auto max-w-xl w-full mx-4 rounded-xl border border-solix-accent/40 bg-solix-panel/95 backdrop-blur-md shadow-2xl",children:[S.jsxs("div",{className:"px-6 pt-5 pb-3 border-b border-solix-border",children:[S.jsx("div",{className:"text-xs uppercase tracking-widest text-solix-accent",children:"welcome"}),S.jsx("div",{className:"text-2xl font-bold mt-1",children:"Solix — your agent solar system"}),S.jsx("div",{className:"text-sm text-slate-400 mt-1",children:"Mission control for Claude Code. Each agent orbits the sun; each click is a conversation with one of your planets."})]}),S.jsxs("div",{className:"px-6 py-4 space-y-3 text-sm text-slate-300",children:[S.jsx(ta,{n:1,title:"Run a Claude Code session",body:S.jsxs(S.Fragment,{children:["Open a terminal anywhere and run"," ",S.jsx("code",{className:"bg-black/40 px-1 rounded",children:"claude"}),". A planet will appear here within a second."]})}),S.jsx(ta,{n:2,title:"Or seed the demo state",body:S.jsxs(S.Fragment,{children:["In another terminal:"," ",S.jsx("code",{className:"bg-black/40 px-1 rounded",children:"solix demo"}),". You'll get a fully populated galaxy — ~30 sessions across 8 projects, all 14 advisors, moons, and live permission flares — without running Claude Code."]})}),S.jsx(ta,{n:3,title:"Meet the advisor crew",body:S.jsxs(S.Fragment,{children:[c.length>0?`${c.length} crew members loaded. Click any in the inner ring to read their role and invoke them on the focused planet.`:"Crew loading…",c.length>0&&S.jsx("ul",{className:"mt-2 space-y-1",children:c.map(u=>S.jsxs("li",{className:"flex items-baseline gap-2",children:[S.jsxs("span",{className:"font-mono text-xs",style:{color:u.color},children:[u.glyph," ",u.codename]}),S.jsx("span",{className:"text-slate-500 text-xs",children:"—"}),S.jsx("span",{className:"text-slate-300 text-xs",children:u.name})]},u.id))})]})}),S.jsx(ta,{n:4,title:"Browse the asteroid belt",body:S.jsxs(S.Fragment,{children:["Each asteroid is a Skill (",o," discovered). Click one to read its SKILL.md and see which advisors require it."]})}),S.jsx(ta,{n:5,title:"Share your galaxy",body:S.jsxs(S.Fragment,{children:["Press"," ",S.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-black/50 border border-solix-border text-[10px]",children:"G"})," ","or click ",S.jsx("span",{className:"text-solix-accent",children:"⌬ Galaxy"})," ","in the top bar to export, import, publish, or install a galaxy from a registry."]})})]}),S.jsxs("div",{className:"px-6 pb-3 pt-1",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-widest text-slate-500 mb-1.5",children:"Keyboard shortcuts"}),S.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-[11px] text-slate-400",children:[S.jsx(pi,{k:"V",children:"cycle Galaxy → List → Missions"}),S.jsx(pi,{k:"G",children:"toggle Galaxy panel"}),S.jsx(pi,{k:"L",children:"new task"}),S.jsx(pi,{k:"T",children:"timeline"}),S.jsx(pi,{k:"M",children:"jump to Missions"}),S.jsx(pi,{k:"Y",children:"approve top decision"}),S.jsx(pi,{k:"N",children:"deny top decision"}),S.jsx(pi,{k:"Space",children:"play / pause orbits"}),S.jsx(pi,{k:"?",children:"re-open this help"}),S.jsx(pi,{k:"Esc",children:"close panels / exit playback"})]}),S.jsx("div",{className:"text-[10px] text-slate-500 italic mt-2",children:"If clicks feel stuck, a third-party screen overlay (note-taker, recorder) may be intercepting. Quit it temporarily, or use the shortcuts above."})]}),S.jsxs("div",{className:"px-6 py-3 border-t border-solix-border flex items-center gap-2",children:[S.jsx("button",{onClick:()=>{n(),l()},className:"px-3 py-1.5 rounded bg-solix-accent/15 border border-solix-accent/40 text-solix-accent text-xs hover:bg-solix-accent/25",children:"Open Galaxy panel"}),S.jsx("div",{className:"flex-1"}),S.jsxs("span",{className:"text-[10px] font-mono text-slate-500 mr-2",children:["Solix v","1.9.2"]}),S.jsx("button",{onClick:l,className:"px-3 py-1.5 rounded border border-solix-border text-xs text-slate-300 hover:text-white",children:"Got it"})]})]})})}function pi({k:n,children:e}){return S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("kbd",{className:"shrink-0 px-1.5 py-0.5 rounded bg-black/50 border border-solix-border text-[10px] font-mono text-slate-300",children:n}),S.jsx("span",{className:"truncate",children:e})]})}function ta({n,title:e,body:t}){return S.jsxs("div",{className:"flex gap-3",children:[S.jsx("div",{className:"shrink-0 w-6 h-6 rounded-full bg-solix-accent/20 border border-solix-accent/40 text-solix-accent text-xs flex items-center justify-center",children:n}),S.jsxs("div",{children:[S.jsx("div",{className:"text-slate-100 font-medium text-sm",children:e}),S.jsx("div",{className:"text-slate-400 text-xs mt-0.5 leading-relaxed",children:t})]})]})}function qE(n,e,t,i){const r=Wh(i,"command"),s=Wh(i,"file_path"),o=Wh(i,"url");if(t==="Bash"&&r){if(/\brm\s+-rf\b/i.test(r)||/\bsudo\b/i.test(r))return{severity:"danger",text:"Destructive command. Deny unless you have already confirmed the diff."};if(/--no-verify\b/.test(r))return{severity:"warn",text:"Skipping pre-commit hooks. Investigate the failure first."};if(/git\s+push.*--force\b/.test(r))return{severity:"danger",text:"Force-push. Confirm no one else has pushed since."};if(/git\s+push/.test(r)&&/\b(main|master|prod|production)\b/.test(r))return{severity:"warn",text:"Pushing to main/prod. Confirm the diff first."};if(/git\s+reset\s+--hard\b/.test(r))return{severity:"warn",text:"Hard reset will discard uncommitted changes. Stash first if unsure."}}if((t==="Edit"||t==="Write"||t==="MultiEdit")&&s){if(/\.env(\b|\.|\/)|credentials\.json|\.pem$|\.key$/i.test(s))return{severity:"danger",text:"Editing a secrets file. Make sure the agent really needs to."};if(/(^|\/)\.git\//.test(s))return{severity:"warn",text:"Editing inside .git/. Almost certainly a mistake."}}if(t==="WebFetch"&&o){if(/^https?:\/\/(localhost|127\.0\.0\.1|0\.0\.0\.0)/.test(o))return null;if(/^http:\/\//.test(o))return{severity:"info",text:"Plain HTTP fetch. OK for known internal hosts."}}return n.contextUsagePct>=90?{severity:"warn",text:`Context at ${n.contextUsagePct.toFixed(0)}%. Run /compact before continuing.`}:null}function ZE(n,e){return n.status==="error"?{severity:"danger",text:"Session is in error state. Check the chat tab and consider restarting."}:n.contextUsagePct>=90?{severity:"warn",text:`Context at ${n.contextUsagePct.toFixed(0)}%. Compact the conversation before the next prompt.`}:n.contextUsagePct>=80?{severity:"info",text:`Context at ${n.contextUsagePct.toFixed(0)}%. Watch out — output quality drops past 90.`}:e&&e.status==="active"&&e.metrics.toolCallCount===0&&Date.now()-e.startedAt>5*60*1e3?{severity:"info",text:"Active mission with no tool calls in 5+ minutes. Agent may be stuck."}:null}function Wh(n,e){const t=n[e];return typeof t=="string"?t:null}function KE({panelOffsetPx:n=0}={}){const e=xe(x=>x.pendingPermissions),t=xe(x=>x.budgetAlerts),i=xe(x=>x.sessions),r=xe(x=>x.missions),s=xe(x=>x.resolvePermission),o=xe(x=>x.raiseBudget),a=xe(x=>x.dismissBudgetAlert),l=xe(x=>x.selectSession),c=Object.values(e).sort((x,g)=>g.receivedAt-x.receivedAt),u=Object.values(t).sort((x,g)=>g.receivedAt-x.receivedAt),[h,d]=Ae.useState(!1),p=c.length+u.length;Ae.useEffect(()=>{p>0&&d(!1)},[p]);const m=x=>{l(x),d(!0)};return p===0?S.jsx("div",{className:"absolute top-20 z-30 pointer-events-none",style:{right:`${n+16}px`},children:S.jsxs("div",{className:"pointer-events-auto rounded-full border border-solix-border bg-solix-panel/60 backdrop-blur px-3 py-1 text-[10px] text-slate-500 flex items-center gap-2",children:[S.jsx("span",{className:"uppercase tracking-widest",children:"decisions"}),S.jsx("span",{className:"font-bold",children:"0"}),S.jsx("span",{className:"italic opacity-80",children:"— all clear"})]})}):S.jsxs("div",{className:"absolute top-20 z-30 w-80 flex flex-col gap-2 pointer-events-none",style:{right:`${n+16}px`},children:[S.jsxs("div",{className:"pointer-events-auto rounded border border-solix-border bg-solix-panel/85 backdrop-blur px-3 py-2 flex items-center justify-between",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"text-[10px] uppercase tracking-widest text-slate-400",children:"Decisions"}),S.jsx("span",{className:"text-xs font-bold text-solix-danger",children:p})]}),S.jsx("button",{onClick:()=>d(x=>!x),className:"text-[10px] text-slate-400 hover:text-slate-100",children:h?"show":"hide"})]}),!h&&u.map(x=>{var g;return S.jsx(JE,{name:((g=i[x.sessionId])==null?void 0:g.name)??x.sessionId.slice(0,8),costUsd:x.costUsd,budgetUsd:x.budgetUsd,onRaise:()=>{const f=window.prompt(`New budget cap (USD) for this agent — current $${x.budgetUsd.toFixed(2)}, spent $${x.costUsd.toFixed(2)}:`,(x.budgetUsd*2).toFixed(2)),v=f?parseFloat(f):NaN;Number.isFinite(v)&&v>0&&o(x.sessionId,v)},onDismiss:()=>a(x.sessionId)},`budget-${x.sessionId}`)}),!h&&c.map(x=>{const g=i[x.sessionId],f=g!=null&&g.currentMissionId?r[g.currentMissionId]:void 0;return S.jsx(QE,{session:g,mission:f,tool:x.tool,args:x.args,onApprove:()=>s(x.requestId,!0),onDeny:()=>s(x.requestId,!1),onAsk:()=>m(x.sessionId)},x.requestId)})]})}function JE({name:n,costUsd:e,budgetUsd:t,onRaise:i,onDismiss:r}){return S.jsxs("div",{className:"pointer-events-auto rounded border border-solix-danger bg-solix-danger/10 p-3 backdrop-blur shadow-lg",children:[S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsx("div",{className:"text-xs uppercase tracking-wide text-solix-danger",children:n}),S.jsx("div",{className:"text-[10px] uppercase tracking-widest text-solix-danger/80",children:"budget"})]}),S.jsxs("div",{className:"mt-2 text-sm text-slate-100",children:["Budget reached",S.jsxs("span",{className:"ml-1 font-mono text-xs text-slate-300",children:["$",e.toFixed(2)," / $",t.toFixed(2)]})]}),S.jsx("div",{className:"mt-1 text-[11px] text-slate-400 leading-snug",children:"Solix-launched agents won't be sent more prompts until you raise the cap."}),S.jsxs("div",{className:"mt-3 flex gap-1.5",children:[S.jsx("button",{onClick:i,className:"flex-1 py-1.5 rounded bg-solix-ok/20 border border-solix-ok text-solix-ok text-xs hover:bg-solix-ok/30",children:"Raise cap"}),S.jsx("button",{onClick:r,className:"px-2.5 py-1.5 rounded border border-solix-border text-slate-300 text-xs hover:text-white hover:bg-solix-border/30",children:"Dismiss"})]})]})}function QE({session:n,mission:e,tool:t,args:i,onApprove:r,onDeny:s,onAsk:o}){const a=(n==null?void 0:n.name)??(n==null?void 0:n.id.slice(0,8))??"unknown agent",l=n!=null&&n.cwd?iT(n.cwd):"",c=n?qE(n,e,t,i):null;return S.jsxs("div",{className:"pointer-events-auto rounded border border-solix-danger bg-solix-danger/10 p-3 backdrop-blur shadow-lg",children:[S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsx("div",{className:"text-xs uppercase tracking-wide text-solix-danger",children:a}),l&&S.jsx("div",{className:"text-[10px] text-slate-500 truncate ml-2 max-w-[55%]",children:l})]}),e&&S.jsxs("div",{className:"mt-1 text-[11px] text-slate-400 italic truncate",children:["mission: ",e.shortName]}),S.jsxs("div",{className:"mt-2 text-sm text-slate-100",children:[S.jsx("span",{className:"font-semibold",children:t}),S.jsx("span",{className:"ml-1 text-slate-300 text-xs break-words",children:rT(i)})]}),S.jsx(eT,{tool:t,args:i}),c&&S.jsx(nT,{suggestion:c}),S.jsxs("div",{className:"mt-3 flex gap-1.5",children:[S.jsx("button",{onClick:r,className:"flex-1 py-1.5 rounded bg-solix-ok/20 border border-solix-ok text-solix-ok text-xs hover:bg-solix-ok/30",children:"Approve · Y"}),S.jsx("button",{onClick:s,className:"flex-1 py-1.5 rounded bg-solix-danger/20 border border-solix-danger text-solix-danger text-xs hover:bg-solix-danger/30",children:"Deny · N"}),S.jsx("button",{onClick:o,className:"px-2.5 py-1.5 rounded border border-solix-border text-slate-300 text-xs hover:text-white hover:bg-solix-border/30",title:"Open chat with this agent for context",children:"Ask"})]})]})}function eT({tool:n,args:e}){const[t,i]=Ae.useState(!1);if(n==="Bash"){const r=rr(e,"command")??"",s=rr(e,"description");return r?S.jsxs(jh,{label:"will run",children:[S.jsx("pre",{className:"whitespace-pre-wrap break-words font-mono text-[11px] text-slate-100",children:r}),s&&S.jsx("div",{className:"mt-1 text-[10px] text-slate-500 italic",children:s})]}):null}if(n==="Edit"||n==="NotebookEdit"){const r=rr(e,"file_path")??rr(e,"notebook_path"),s=rr(e,"old_string"),o=rr(e,"new_string");return!r&&!s&&!o?null:S.jsxs(jh,{label:"patch",children:[r&&S.jsx("div",{className:"font-mono text-[11px] text-solix-accent break-all",children:r}),s&&S.jsx(Xh,{sign:"-",text:s,expanded:t,colorClass:"text-solix-danger bg-solix-danger/10"}),o&&S.jsx(Xh,{sign:"+",text:o,expanded:t,colorClass:"text-solix-ok bg-solix-ok/10"}),($h(s)||$h(o))&&S.jsx("button",{onClick:()=>i(a=>!a),className:"mt-1 text-[10px] text-slate-400 hover:text-slate-100",children:t?"collapse":"expand"})]})}if(n==="Write"){const r=rr(e,"file_path"),s=rr(e,"content")??"";return r?S.jsxs(jh,{label:"will write",children:[S.jsx("div",{className:"font-mono text-[11px] text-solix-accent break-all",children:r}),s&&S.jsx(Xh,{sign:"+",text:s,expanded:t,colorClass:"text-solix-ok bg-solix-ok/10"}),$h(s)&&S.jsx("button",{onClick:()=>i(o=>!o),className:"mt-1 text-[10px] text-slate-400 hover:text-slate-100",children:t?"collapse":"expand"})]}):null}return null}function jh({label:n,children:e}){return S.jsxs("div",{className:"mt-2 rounded border border-solix-border bg-black/30 px-2 py-1.5",children:[S.jsx("div",{className:"text-[9px] uppercase tracking-wider text-slate-500 mb-1",children:n}),e]})}function Xh({sign:n,text:e,expanded:t,colorClass:i}){const r=t?e:tT(e,240);return S.jsxs("pre",{className:`mt-1 px-1.5 py-1 rounded text-[11px] font-mono whitespace-pre-wrap break-words ${i}`,children:[S.jsx("span",{className:"opacity-50 mr-1",children:n}),r]})}function rr(n,e){const t=n[e];return typeof t=="string"?t:void 0}function $h(n){return!!(n&&n.length>240)}function tT(n,e){if(n.length<=e)return n;const t=Math.floor((e-3)/2);return`${n.slice(0,t)}
56
+ */var Cd=Ee,cE=lE;function uE(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var dE=typeof Object.is=="function"?Object.is:uE,hE=cE.useSyncExternalStore,fE=Cd.useRef,pE=Cd.useEffect,mE=Cd.useMemo,gE=Cd.useDebugValue;eS.useSyncExternalStoreWithSelector=function(n,e,t,i,r){var s=fE(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=mE(function(){function l(p){if(!c){if(c=!0,u=p,p=i(p),r!==void 0&&o.hasValue){var m=o.value;if(r(m,p))return h=m}return h=p}if(m=h,dE(u,p))return m;var x=i(p);return r!==void 0&&r(m,x)?(u=p,m):(u=p,h=x)}var c=!1,u,h,d=t===void 0?null:t;return[function(){return l(e())},d===null?void 0:function(){return l(d())}]},[e,t,i,r]);var a=hE(n,s[0],s[1]);return pE(function(){o.hasValue=!0,o.value=a},[a]),gE(a),a};Q_.exports=eS;var xE=Q_.exports;const vE=Bv(xE),iS={},{useDebugValue:yE}=Ow,{useSyncExternalStoreWithSelector:_E}=vE;let Xx=!1;const SE=n=>n;function ME(n,e=SE,t){(iS?"production":void 0)!=="production"&&t&&!Xx&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Xx=!0);const i=_E(n.subscribe,n.getState,n.getServerState||n.getInitialState,e,t);return yE(i),i}const $x=n=>{(iS?"production":void 0)!=="production"&&typeof n!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof n=="function"?Jb(n):n,t=(i,r)=>ME(e,i,r);return Object.assign(t,e),t},wE=n=>n?$x(n):$x,bE="solix.notifications.v1";function EE(){try{return localStorage.getItem(bE)==="off"?"off":"on"}catch{return"on"}}let Yx=!1;async function TE(){if(typeof Notification>"u")return"denied";if(Notification.permission!=="default"||Yx)return Notification.permission;Yx=!0;try{return await Notification.requestPermission()}catch{return"denied"}}async function qx(n){if(!(EE()==="off"||typeof Notification>"u"||n.whenHidden&&typeof document<"u"&&!document.hidden||await TE()!=="granted"))try{new Notification(n.title,{body:n.body,tag:n.tag})}catch{}}const AE="solix.sound.v1";let Hh=null;function Zx(){try{if(localStorage.getItem(AE)!=="on"||typeof window>"u")return;if(!Hh){const r=window.AudioContext||window.webkitAudioContext;if(!r)return;Hh=new r}const n=Hh,e=n.createOscillator(),t=n.createGain();e.connect(t),t.connect(n.destination),e.type="sine",e.frequency.value=880,t.gain.value=1e-4;const i=n.currentTime;t.gain.exponentialRampToValueAtTime(.06,i+.01),t.gain.exponentialRampToValueAtTime(1e-4,i+.35),e.start(i),e.stop(i+.4)}catch{}}function Kx(n,e,t,i){const r={},s={},a=[];for(const l of n){if(l.ts>e)break;switch(l.type){case"session_started":{const c=t[l.sessionId];if(!c)continue;r[l.sessionId]={...c,status:"idle"};break}case"session_terminated":{delete r[l.sessionId];break}case"mission_started":{if(!l.missionId)continue;const c=i[l.missionId],u=r[l.sessionId];u&&(r[l.sessionId]={...u,status:"active",currentMissionId:l.missionId}),c&&(s[l.missionId]={...c,status:"active"});break}case"mission_completed":{if(!l.missionId)continue;const c=r[l.sessionId],u=i[l.missionId];c&&c.currentMissionId===l.missionId&&(r[l.sessionId]={...c,status:"idle",currentMissionId:void 0,lastCompletedMissionId:l.missionId}),u&&(s[l.missionId]={...u,status:"completed"});break}case"tool_call":{e-l.ts<=2e3&&a.push({id:`tc-${l.ts}-${l.sessionId}`,sessionId:l.sessionId,tool:l.toolName??"tool",args:{},startedAt:l.ts,status:"ok",receivedAt:l.ts});break}}}return{derivedSessions:r,derivedMissions:s,derivedToolCalls:a}}const Jx={active:!1,loading:!1,events:[],earliestMs:0,latestMs:0,currentMs:0,playing:!1,speed:4,derivedSessions:{},derivedMissions:{},derivedToolCalls:[]},Qx=2e3,rS="solix.motion.v1",sS="solix.viewMode.v1";function CE(){try{return localStorage.getItem(rS)==="1"}catch{return!1}}function e0(n){try{localStorage.setItem(rS,n?"1":"0")}catch{}}function RE(){try{const n=localStorage.getItem(sS);return n==="list"||n==="missions"||n==="galaxy"?n:"galaxy"}catch{return"galaxy"}}function t0(n){try{localStorage.setItem(sS,n)}catch{}}const ge=wE((n,e)=>({connected:!1,projects:{},sessions:{},missions:{},advisors:{},skills:{},schedules:{},goals:{},budgetAlerts:{},chatBySessionId:{},recentToolCalls:[],pendingPermissions:{},selectedSessionId:null,selectedAdvisorId:null,selectedSkillId:null,workspaceOpen:!1,motionEnabled:CE(),viewMode:RE(),playback:Jx,toasts:[],setConnected:t=>n({connected:t}),applyMessage:t=>{switch(t.type){case"snapshot":{const i={};for(const u of t.projects)i[u.id]=u;const r={};for(const u of t.sessions)r[u.id]=u;const s={};for(const u of t.missions)s[u.id]=u;const o={};for(const u of t.advisors)o[u.id]=u;const a={};for(const u of t.skills)a[u.id]=u;const l={};for(const u of t.schedules)l[u.id]=u;const c={};for(const u of t.goals)c[u.id]=u;n({projects:i,sessions:r,missions:s,advisors:o,skills:a,schedules:l,goals:c});break}case"advisor_upsert":{n(i=>({advisors:{...i.advisors,[t.advisor.id]:t.advisor}}));break}case"skill_upsert":{n(i=>({skills:{...i.skills,[t.skill.id]:t.skill}}));break}case"galaxy_imported":{const i=`${Date.now()}-galaxy`;n(r=>({toasts:[...r.toasts,{id:i,level:"info",message:`Imported galaxy: ${t.manifest.name}`}].slice(-6)})),setTimeout(()=>e().dismissToast(i),5e3);break}case"session_upsert":{n(i=>({sessions:{...i.sessions,[t.session.id]:t.session}}));break}case"session_remove":{n(i=>{const r={...i.sessions};return delete r[t.sessionId],{sessions:r}});break}case"mission_upsert":{n(i=>({missions:{...i.missions,[t.mission.id]:t.mission}}));break}case"tool_call":{const i={...t.toolCall,receivedAt:Date.now()};n(r=>({recentToolCalls:[...r.recentToolCalls,i].slice(-200)})),setTimeout(()=>{n(r=>({recentToolCalls:r.recentToolCalls.filter(s=>Date.now()-s.receivedAt<Qx)}))},Qx+50);break}case"permission_request":{const i={requestId:t.requestId,sessionId:t.sessionId,tool:t.tool,args:t.args,receivedAt:Date.now()};n(a=>({pendingPermissions:{...a.pendingPermissions,[t.requestId]:i}}));const r=e().sessions[t.sessionId],s=(r==null?void 0:r.name)??t.sessionId.slice(0,8),o=(()=>{const a=Object.keys(t.args)[0];if(!a)return"";const l=t.args[a],c=typeof l=="string"?l:JSON.stringify(l);return`: ${c.length>60?c.slice(0,60)+"…":c}`})();qx({title:`${s} needs you`,body:`${t.tool}${o}`,tag:`solix-perm-${t.sessionId}`,whenHidden:!0}),Zx();break}case"context_update":{n(i=>{const r=i.sessions[t.sessionId];return r?{sessions:{...i.sessions,[t.sessionId]:{...r,contextUsagePct:t.usagePct}}}:i});break}case"cost_update":{n(i=>{const r=i.sessions[t.sessionId];return r?{sessions:{...i.sessions,[t.sessionId]:{...r,costUsd:t.costUsd,budgetUsd:t.budgetUsd??r.budgetUsd}}}:i});break}case"budget_alert":{const i={sessionId:t.sessionId,costUsd:t.costUsd,budgetUsd:t.budgetUsd,receivedAt:Date.now()};n(s=>({budgetAlerts:{...s.budgetAlerts,[t.sessionId]:i}}));const r=e().sessions[t.sessionId];qx({title:`${(r==null?void 0:r.name)??t.sessionId.slice(0,8)} hit its budget`,body:`$${t.costUsd.toFixed(2)} / $${t.budgetUsd.toFixed(2)}`,tag:`solix-budget-${t.sessionId}`,whenHidden:!0}),Zx();break}case"schedule_upsert":{n(i=>({schedules:{...i.schedules,[t.schedule.id]:t.schedule}}));break}case"schedule_remove":{n(i=>{const r={...i.schedules};return delete r[t.scheduleId],{schedules:r}});break}case"goal_upsert":{n(i=>({goals:{...i.goals,[t.goal.id]:t.goal}}));break}case"goal_remove":{n(i=>{const r={...i.goals};return delete r[t.goalId],{goals:r}});break}case"chat_delta":{const i={...t.delta,receivedAt:Date.now()};n(r=>{const a=[...(r.chatBySessionId[t.sessionId]??[]).filter(l=>l.messageId!==i.messageId),i].slice(-200);return{chatBySessionId:{...r.chatBySessionId,[t.sessionId]:a}}});break}case"toast":{const i=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;n(r=>({toasts:[...r.toasts,{id:i,level:t.level,message:t.message}].slice(-6)})),setTimeout(()=>e().dismissToast(i),5e3);break}}},selectSession:t=>n({selectedSessionId:t,selectedAdvisorId:t?null:e().selectedAdvisorId,selectedSkillId:t?null:e().selectedSkillId,workspaceOpen:t?!1:e().workspaceOpen}),selectAdvisor:t=>n({selectedAdvisorId:t,selectedSessionId:t?null:e().selectedSessionId,selectedSkillId:t?null:e().selectedSkillId,workspaceOpen:t?!1:e().workspaceOpen}),selectSkill:t=>n({selectedSkillId:t,selectedSessionId:t?null:e().selectedSessionId,selectedAdvisorId:t?null:e().selectedAdvisorId,workspaceOpen:t?!1:e().workspaceOpen}),openWorkspace:()=>n({workspaceOpen:!0,selectedSessionId:null,selectedAdvisorId:null,selectedSkillId:null}),closeWorkspace:()=>n({workspaceOpen:!1}),dismissToast:t=>n(i=>({toasts:i.toasts.filter(r=>r.id!==t)})),resolvePermission:(t,i)=>{const r=e().send;r({type:"permission_response",requestId:t,approved:i}),n(s=>{const o={...s.pendingPermissions};return delete o[t],{pendingPermissions:o}})},invokeAdvisor:(t,i)=>{const r=e().send,s=e().selectedSessionId??void 0;r({type:"invoke_advisor",advisorId:t,targetSessionId:s,prompt:i})},pinAdvisor:t=>{e().send({type:"pin_advisor",advisorId:t})},unpinAdvisor:t=>{e().send({type:"unpin_advisor",advisorId:t})},enableAdvisor:t=>{e().send({type:"set_advisor_enabled",advisorId:t,enabled:!0})},disableAdvisor:t=>{e().send({type:"set_advisor_enabled",advisorId:t,enabled:!1})},sendPromptTo:(t,i)=>{if(!i.trim())return;e().send({type:"send_prompt",sessionId:t,text:i});const r={messageId:`pending-${Date.now()}`,role:"user",content:i,ts:Date.now(),done:!0,receivedAt:Date.now()};n(s=>({chatBySessionId:{...s.chatBySessionId,[t]:[...s.chatBySessionId[t]??[],r].slice(-200)}}))},launchTask:(t,i,r,s)=>{e().send({type:"launch_session",cwd:t,model:i,initialPrompt:r,worktreeBranch:s==null?void 0:s.worktreeBranch,worktreeBaseRef:s==null?void 0:s.worktreeBaseRef,useAgentView:s==null?void 0:s.useAgentView,agentName:s==null?void 0:s.agentName,budgetUsd:s==null?void 0:s.budgetUsd,goalId:s==null?void 0:s.goalId})},raiseBudget:(t,i)=>{e().send({type:"raise_budget",sessionId:t,budgetUsd:i}),n(r=>{const s={...r.budgetAlerts};return delete s[t],{budgetAlerts:s}})},dismissBudgetAlert:t=>{e().send({type:"dismiss_budget_alert",sessionId:t}),n(i=>{const r={...i.budgetAlerts};return delete r[t],{budgetAlerts:r}})},selectedSessionIds:new Set,toggleSessionSelection:t=>{n(i=>{const r=new Set(i.selectedSessionIds);return r.has(t)?r.delete(t):r.add(t),{selectedSessionIds:r}})},clearSessionSelection:()=>{n({selectedSessionIds:new Set})},terminateSessions:t=>{const i=e().send;for(const r of t)i({type:"terminate_session",sessionId:r});n({selectedSessionIds:new Set})},setMotionEnabled:t=>{e0(t),n({motionEnabled:t})},toggleMotion:()=>{const t=!e().motionEnabled;e0(t),n({motionEnabled:t})},setViewMode:t=>{t0(t),n({viewMode:t})},toggleViewMode:()=>{const t=["galaxy","list","missions"],i=e().viewMode,r=t.indexOf(i),s=t[(r+1)%t.length]??"galaxy";t0(s),n({viewMode:s})},enterPlayback:(t,i,r)=>{const s=i;n(o=>({playback:{...o.playback,active:!0,loading:!1,events:t,earliestMs:i,latestMs:r,currentMs:s,playing:!1,...Kx(t,s,e().sessions,e().missions)}}))},exitPlayback:()=>n({playback:Jx}),setPlaybackTime:t=>{n(i=>{const r=Math.max(i.playback.earliestMs,Math.min(t,i.playback.latestMs));return{playback:{...i.playback,currentMs:r,...Kx(i.playback.events,r,e().sessions,e().missions)}}})},setPlaybackSpeed:t=>n(i=>({playback:{...i.playback,speed:t}})),setPlaybackPlaying:t=>n(i=>({playback:{...i.playback,playing:t}})),setPlaybackLoading:t=>n(i=>({playback:{...i.playback,loading:t}})),send:()=>{},attachSocket:t=>n({send:t})}));function Fm(n){return n.playback.active?n.playback.derivedSessions:n.sessions}function Bm(n){return Object.values(Fm(n)).filter(e=>!e.parentSessionId&&e.kind!=="advisor")}function PE(n){return Object.values(Fm(n)).filter(e=>!e.parentSessionId&&e.kind==="advisor")}function G3(n,e){return Object.values(Fm(n)).filter(t=>t.parentSessionId===e)}function W3(n){var x;const e=Bm(n);let t=0,i=0,r=0,s=0,o=0,a=0,l=0;const c=[];for(const g of e)t+=g.costUsd??0,g.status==="active"?i++:g.status==="awaiting_permission"||g.status==="awaiting_input"||g.status==="plan_review"?r++:g.status==="idle"&&s++,(g.status==="awaiting_permission"||g.status==="awaiting_input"||g.status==="error")&&c.push(g),typeof g.contextUsagePct=="number"&&(o+=g.contextUsagePct,a=Math.max(a,g.contextUsagePct),l++);let u=0,h=0,d=0,p=0,m=0;for(const g of Object.values(n.missions))u+=((x=g.metrics)==null?void 0:x.totalTokens)??0,g.status==="completed"?h++:g.status==="failed"?d++:g.status==="active"?p++:g.status==="cancelled"&&m++;return{totalSpendUsd:t,totalTokens:u,completedMissions:h,costPerCompletedMission:h>0?t/h:0,interventions:0,pendingPermissions:Object.keys(n.pendingPermissions).length,activeCount:i,attentionCount:r,idleCount:s,missions:{completed:h,failed:d,active:p,cancelled:m},sessionCount:e.length,projectCount:Object.keys(n.projects).length,advisorCount:Object.keys(n.advisors).length,skillCount:Object.keys(n.skills).length,needsYou:c,contextAvgPct:l>0?o/l:0,contextMaxPct:a}}function j3(n){return Object.values(n.advisors).filter(e=>e.enabled)}function X3(n){return Object.values(n.advisors).filter(e=>!e.enabled)}function $3(n){return Object.values(n.advisors).sort((e,t)=>e.enabled!==t.enabled?e.enabled?-1:1:e.codename.localeCompare(t.codename))}function Y3(n){return Object.values(n.skills)}function q3(n){return Object.values(n.schedules).filter(e=>e.enabled)}function Z3(n){return Object.values(n.goals)}function IE(n){switch(n){case"opus":return"#a855f7";case"sonnet":return"#3b82f6";case"haiku":return"#06b6d4";case"default":return"#94a3b8";default:return"#94a3b8"}}function K3(n){switch(n){case"active":return{color:"#fde68a",intensity:.3};case"awaiting_permission":return{color:"#ef4444",intensity:.5};case"awaiting_input":return{color:"#f59e0b",intensity:.25};case"plan_review":return{color:"#a78bfa",intensity:.2};case"error":return{color:"#dc2626",intensity:.3};case"spawning":return{color:"#ffffff",intensity:.2};case"idle":default:return{color:"#1e293b",intensity:.05}}}function J3(n){return n>=100?"#dc2626":n>=75?"#f59e0b":"#38bdf8"}function oS(n){switch(n){case"active":return"Active";case"awaiting_permission":return"Permission";case"awaiting_input":return"Awaiting input";case"plan_review":return"Plan review";case"error":return"Error";case"spawning":return"Spawning";case"terminated":return"Terminated";case"idle":default:return"Idle"}}function NE(n,e,t){const i=[];let r=30;switch(n.status){case"error":r=0,i.push("In error state");break;case"plan_review":case"awaiting_input":r=15,i.push(`Status: ${n.status}`);break;case"awaiting_permission":r=12,i.push("Awaiting permission");break;case"terminated":r=5,i.push("Terminated");break;default:r=30}const s=Math.max(0,30-t*15);t>0&&i.push(`${t} pending permission${t===1?"":"s"}`);const a=25*Math.max(0,1-n.contextUsagePct/100);n.contextUsagePct>=90?i.push(`Context at ${n.contextUsagePct.toFixed(0)}%`):n.contextUsagePct>=80&&i.push(`Context warm (${n.contextUsagePct.toFixed(0)}%)`);let l=0;if(e&&e.status==="active"){const u=e.metrics.toolCallCount;l=Math.min(15,u*2)}else e&&e.status==="completed"&&(l=15);return{score:Math.round(Math.max(0,Math.min(100,r+s+a+l))),reasons:i}}function LE(n){return n>=75?"#10b981":n>=50?"#fbbf24":n>=25?"#f97316":"#ef4444"}const zm={active:"The agent is currently working — emitting tool calls or generating output.",idle:"No mission running. The agent is waiting for the next prompt or has been quiet for a while.",spawning:"The agent process just started. It will transition to active within a second or two.",awaiting_permission:"The agent paused to ask permission for a sensitive tool call. Approve or deny in the Decision Queue.",awaiting_input:"The agent finished what it could and is waiting for your next prompt.",plan_review:"The agent produced a plan and is waiting for your approval before executing.",error:"The agent crashed or hit an unrecoverable error. Look at the SidePanel transcript for details.",terminated:"The agent process exited. No more activity will come from this session.",subagent:"A child agent spawned by another session (typically via the Task tool). Rendered as a moon orbiting the parent planet.",advisor:"A long-lived specialist agent (Compass, Forge, Lumen, Argus, Sentinel, …) with its own AGENT.md describing its role.",pinned:"An advisor that's always running. Pinned advisors orbit close to the sun in the inner ring."},n0={awaiting_permission:0,awaiting_input:1,plan_review:2,error:3,active:4,spawning:5,idle:6,terminated:7};function DE(){const n=ge(Bm),e=ge(PE),t=ge(_=>_.projects),i=ge(_=>_.missions),r=ge(_=>_.pendingPermissions),s=ge(_=>_.selectSession),o=ge(_=>_.selectedSessionIds),a=ge(_=>_.toggleSessionSelection),l=ge(_=>_.clearSessionSelection),c=ge(_=>_.terminateSessions),[u,h]=Ee.useState("needs"),[d,p]=Ee.useState("asc"),m=Ee.useMemo(()=>{const _=[...n,...e],R=new Set(Object.values(r).map(w=>w.sessionId));return _.map(w=>{const E=w.currentMissionId?i[w.currentMissionId]:void 0,A=Object.values(r).filter(L=>L.sessionId===w.id).length,{score:b,reasons:M}=NE(w,E,A);return{session:w,project:t[w.projectId],mission:E,needsAttention:R.has(w.id)||w.status==="awaiting_permission"||w.status==="awaiting_input"||w.status==="plan_review",health:b,healthReasons:M}})},[n,e,t,i,r]),x=Ee.useMemo(()=>{var R;const _=new Map;for(const w of m){const E=((R=w.project)==null?void 0:R.id)??"_",A=_.get(E);A?A.rows.push(w):_.set(E,{project:w.project,rows:[w]})}return[..._.values()].sort((w,E)=>{var A,b;return(((A=E.project)==null?void 0:A.lastActiveAt)??0)-(((b=w.project)==null?void 0:b.lastActiveAt)??0)})},[m]),g=(_,R)=>{var E,A;const w=d==="asc"?1:-1;switch(u){case"name":return((_.session.name??_.session.id)>(R.session.name??R.session.id)?1:-1)*w;case"status":return((n0[_.session.status]??99)-(n0[R.session.status]??99))*w;case"progress":return((((E=_.mission)==null?void 0:E.metrics.toolCallCount)??0)-(((A=R.mission)==null?void 0:A.metrics.toolCallCount)??0))*w;case"context":return(_.session.contextUsagePct-R.session.contextUsagePct)*w;case"lastActivity":return(_.session.updatedAt-R.session.updatedAt)*w;case"needs":return _.needsAttention===R.needsAttention?0:_.needsAttention?-1*w:1*w;case"health":return(_.health-R.health)*w}},f=_=>{u===_?p(d==="asc"?"desc":"asc"):(h(_),p(_==="lastActivity"?"desc":"asc"))},v=_=>u!==_?"":d==="asc"?" ▲":" ▼",y=o.size;return S.jsxs("div",{className:"absolute inset-0 overflow-y-auto bg-solix-bg pt-20 pb-20 px-6 z-0",children:[y>0&&S.jsx("div",{className:"fixed bottom-4 left-1/2 -translate-x-1/2 z-30 pointer-events-auto",children:S.jsxs("div",{className:"rounded-full border border-solix-accent/60 bg-solix-panel/95 backdrop-blur shadow-2xl px-4 py-2 flex items-center gap-3",children:[S.jsxs("span",{className:"text-xs text-slate-200 font-mono",children:[y," selected"]}),S.jsx("button",{onClick:()=>c([...o]),className:"text-xs px-3 py-1 rounded border border-solix-danger text-solix-danger hover:bg-solix-danger/15",children:"Terminate"}),S.jsx("button",{onClick:l,className:"text-xs text-slate-400 hover:text-slate-200",children:"Clear"})]})}),S.jsxs("div",{className:"max-w-6xl mx-auto",children:[S.jsxs("div",{className:"text-xs text-slate-500 uppercase tracking-widest mb-3",children:["List view · ",m.length," agent",m.length===1?"":"s"]}),m.length===0?S.jsxs("div",{className:"text-sm text-slate-500 italic py-12 text-center border border-solix-border rounded",children:["No agents yet. Run ",S.jsx("code",{children:"claude"})," in any terminal — a row will appear here within a second."]}):x.map(({project:_,rows:R})=>{const w=[...R].sort(g),E=(_==null?void 0:_.name)??"(unassigned)";return S.jsxs("section",{className:"mb-8 rounded border border-solix-border overflow-hidden",children:[S.jsxs("header",{className:"bg-solix-panel/60 px-4 py-2 flex items-center justify-between",children:[S.jsxs("div",{children:[S.jsx("span",{className:"text-sm font-semibold text-slate-100",children:E}),S.jsxs("span",{className:"ml-2 text-[10px] uppercase tracking-wide text-slate-500",children:[R.length," agent",R.length===1?"":"s"]})]}),(_==null?void 0:_.cwd)&&S.jsx("span",{className:"text-[10px] font-mono text-slate-500 truncate max-w-[55%]",children:_.cwd})]}),S.jsxs("table",{className:"w-full text-sm",children:[S.jsx("thead",{className:"bg-black/30 text-[10px] uppercase tracking-wide text-slate-500",children:S.jsxs("tr",{children:[S.jsx(Ri,{children:S.jsx("input",{type:"checkbox","aria-label":"Select all in project",checked:w.length>0&&w.every(A=>o.has(A.session.id)),onChange:A=>{A.stopPropagation();const b=w.every(M=>o.has(M.session.id));for(const M of w){const L=o.has(M.session.id);(b&&L||!b&&!L)&&a(M.session.id)}},className:"cursor-pointer"})}),S.jsxs(Ri,{onClick:()=>f("needs"),children:["● ",v("needs")]}),S.jsxs(Ri,{onClick:()=>f("name"),children:["Agent",v("name")]}),S.jsx(Ri,{children:"Advisor"}),S.jsxs(Ri,{onClick:()=>f("status"),children:["Status",v("status")]}),S.jsxs(Ri,{onClick:()=>f("health"),numeric:!0,children:["Health",v("health")]}),S.jsxs(Ri,{onClick:()=>f("progress"),children:["Mission · tools",v("progress")]}),S.jsxs(Ri,{onClick:()=>f("context"),numeric:!0,children:["Context",v("context")]}),S.jsxs(Ri,{onClick:()=>f("lastActivity"),numeric:!0,children:["Last activity",v("lastActivity")]})]})}),S.jsx("tbody",{children:w.map(A=>{var b;return S.jsxs("tr",{onClick:()=>s(A.session.id),className:`border-t border-solix-border hover:bg-solix-border/20 cursor-pointer ${A.needsAttention?"bg-solix-danger/5":""} ${o.has(A.session.id)?"bg-solix-accent/5":""}`,children:[S.jsx("td",{className:"px-3 py-2",onClick:M=>M.stopPropagation(),children:S.jsx("input",{type:"checkbox","aria-label":"Select agent",checked:o.has(A.session.id),onChange:()=>a(A.session.id),className:"cursor-pointer"})}),S.jsx("td",{className:"px-3 py-2",children:A.needsAttention?S.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-solix-danger solix-pulse"}):A.session.status==="active"?S.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-solix-ok"}):S.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-slate-600"})}),S.jsx("td",{className:"px-3 py-2",children:S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"inline-block w-2 h-2 rounded-full",style:{background:IE(A.session.model)},title:String(A.session.model)}),S.jsx("span",{className:"text-slate-100 font-medium",children:A.session.name??A.session.id.slice(0,8)}),A.session.kind==="advisor"&&S.jsx("span",{className:"text-[9px] uppercase tracking-wide text-amber-300",children:"advisor"}),A.session.origin==="agentview"&&S.jsx("span",{className:"text-[9px] uppercase tracking-wide text-cyan-300",title:"Background session managed by Anthropic's Agent View",children:"agent"}),A.session.wrapperSocketPath&&S.jsx("span",{className:"text-[9px] uppercase tracking-wide text-solix-accent",title:"Wrapped by `solix run` — UI composer is enabled",children:"wrapped"}),A.session.worktreePath&&S.jsxs("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded border border-solix-accent/40 text-solix-accent",title:A.session.worktreePath,children:["⌥",UE(A.session.worktreePath)]})]})}),S.jsx("td",{className:"px-3 py-2 text-xs",children:S.jsx(OE,{session:A.session,mission:A.mission})}),S.jsx("td",{className:"px-3 py-2 text-xs text-slate-300",title:zm[A.session.status]??void 0,children:oS(A.session.status)}),S.jsx("td",{className:"px-3 py-2 text-right",children:S.jsx(FE,{score:A.health,reasons:A.healthReasons})}),S.jsx("td",{className:"px-3 py-2 text-xs text-slate-300 truncate max-w-xs",title:A.session.agentViewSummary??((b=A.mission)==null?void 0:b.shortName)??void 0,children:A.session.agentViewSummary?S.jsx("span",{className:"text-slate-100 italic",children:A.session.agentViewSummary}):A.mission?S.jsxs(S.Fragment,{children:[S.jsx("span",{className:"text-slate-100",children:A.mission.shortName}),S.jsxs("span",{className:"text-slate-500 ml-1",children:["· ",A.mission.metrics.toolCallCount," tools"]})]}):S.jsx("span",{className:"text-slate-500 italic",children:"idle"})}),S.jsx("td",{className:"px-3 py-2 text-right",children:S.jsx(BE,{pct:A.session.contextUsagePct})}),S.jsx("td",{className:"px-3 py-2 text-right text-[11px] text-slate-500 font-mono",children:zE(A.session.updatedAt)})]},A.session.id)})})]})]},(_==null?void 0:_.id)??"_")})]})]})}function UE(n){const e=n.split("/").filter(Boolean);return e[e.length-1]??n}const kE=/^\[Acting as ([^\s—]+)/;function OE({session:n,mission:e}){var s;const t=ge(o=>o.advisors);let i,r=!1;if(n.advisorRole)i=Object.values(t).find(o=>o.id===n.advisorRole);else if(e!=null&&e.prompt){const o=e.prompt.match(kE),a=(s=o==null?void 0:o[1])==null?void 0:s.toLowerCase();a&&(i=Object.values(t).find(l=>l.codename.toLowerCase()===a),r=!0)}return i?S.jsxs("span",{className:`inline-flex items-center gap-1 ${r?"opacity-60":""}`,title:i.description,children:[S.jsx("span",{style:{color:i.color},children:i.glyph}),S.jsx("span",{className:"text-slate-200",children:i.codename})]}):S.jsx("span",{className:"text-slate-700",children:"—"})}function Ri({children:n,onClick:e,numeric:t}){return S.jsx("th",{onClick:e,className:`px-3 py-2 select-none ${t?"text-right":"text-left"} ${e?"cursor-pointer hover:text-slate-300":""}`,children:n})}function FE({score:n,reasons:e}){const t=LE(n);return S.jsxs("div",{className:"relative inline-flex items-center gap-2 group",children:[S.jsx("span",{className:"text-[11px] font-mono font-bold",style:{color:t},children:n}),S.jsx("div",{className:"w-16 h-1.5 rounded-full bg-slate-800 overflow-hidden",children:S.jsx("div",{className:"h-full",style:{width:`${Math.max(2,n)}%`,background:t}})}),S.jsxs("div",{className:"pointer-events-none absolute right-0 top-full mt-1 z-50 hidden group-hover:block w-64 rounded border border-solix-border bg-solix-panel/95 backdrop-blur p-2 text-left shadow-xl",children:[S.jsxs("div",{className:"flex items-center justify-between mb-1",children:[S.jsx("span",{className:"text-[10px] uppercase tracking-wide text-slate-400",children:"Health"}),S.jsxs("span",{className:"text-xs font-bold",style:{color:t},children:[n,"/100"]})]}),e.length===0?S.jsx("div",{className:"text-[11px] text-slate-400 italic",children:"All four bands healthy: stable status, no pending decisions, context budget, mission progress."}):S.jsx("ul",{className:"space-y-0.5",children:e.map(i=>S.jsxs("li",{className:"text-[11px] text-slate-200 leading-snug",children:["· ",i]},i))})]})]})}function BE({pct:n}){const e=n>=90?"bg-solix-danger":n>=80?"bg-solix-warn":"bg-solix-accent";return S.jsxs("div",{className:"inline-flex items-center gap-2",children:[S.jsxs("span",{className:"text-[11px] text-slate-400 font-mono",children:[n.toFixed(0),"%"]}),S.jsx("div",{className:"w-20 h-1.5 rounded-full bg-slate-800 overflow-hidden",children:S.jsx("div",{className:`h-full ${e}`,style:{width:`${Math.min(100,n)}%`}})})]})}function zE(n){const e=Date.now()-n;if(e<0)return"now";const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const i=Math.floor(t/60);if(i<60)return`${i}m`;const r=Math.floor(i/60);return r<24?`${r}h`:new Date(n).toLocaleDateString()}function VE(){const n=ge(l=>l.missions),e=ge(l=>l.sessions),t=ge(l=>l.projects),i=ge(l=>l.selectSession),[r,s]=Ee.useState("all"),o=Ee.useMemo(()=>{const l=Object.values(n).sort((c,u)=>u.startedAt-c.startedAt);return r==="all"?l:l.filter(c=>c.status===r)},[n,r]),a=Ee.useMemo(()=>{const l=new Map;for(const c of o){const u=e[c.sessionId],h=u?t[u.projectId]:void 0,d=(h==null?void 0:h.id)??"_",p=l.get(d);p?p.missions.push(c):l.set(d,{project:h,missions:[c]})}return[...l.values()].sort((c,u)=>{var h,d;return(((h=u.missions[0])==null?void 0:h.startedAt)??0)-(((d=c.missions[0])==null?void 0:d.startedAt)??0)})},[o,e,t]);return S.jsx("div",{className:"absolute inset-0 overflow-y-auto bg-solix-bg pt-20 pb-8 px-6 z-0",children:S.jsxs("div",{className:"max-w-4xl mx-auto",children:[S.jsxs("div",{className:"flex items-center justify-between mb-3",children:[S.jsxs("div",{className:"text-xs text-slate-500 uppercase tracking-widest",children:["Missions · ",o.length]}),S.jsx("div",{className:"flex items-center gap-1.5",children:["all","active","completed","failed","cancelled"].map(l=>S.jsx("button",{onClick:()=>s(l),className:`text-[10px] px-2 py-0.5 rounded border ${r===l?"bg-solix-accent/15 border-solix-accent text-solix-accent":"border-solix-border text-slate-400 hover:text-slate-200"}`,children:l},l))})]}),o.length===0?S.jsx("div",{className:"text-sm text-slate-500 italic py-12 text-center border border-solix-border rounded",children:"No missions yet. Send a prompt to a Claude Code session and a mission card will appear here."}):a.map(({project:l,missions:c})=>{const u=(l==null?void 0:l.name)??"(unassigned)";return S.jsxs("section",{className:"mb-6 rounded border border-solix-border overflow-hidden",children:[S.jsxs("header",{className:"bg-solix-panel/60 px-4 py-2 flex items-center justify-between",children:[S.jsxs("div",{children:[S.jsx("span",{className:"text-sm font-semibold text-slate-100",children:u}),S.jsxs("span",{className:"ml-2 text-[10px] uppercase tracking-wide text-slate-500",children:[c.length," mission",c.length===1?"":"s"]})]}),(l==null?void 0:l.cwd)&&S.jsx("span",{className:"text-[10px] font-mono text-slate-500 truncate max-w-[55%]",children:l.cwd})]}),S.jsx("ul",{className:"divide-y divide-solix-border",children:c.map(h=>{const d=e[h.sessionId];return S.jsx("li",{children:S.jsxs("button",{onClick:()=>i(h.sessionId),className:"w-full text-left p-4 hover:bg-solix-border/20 cursor-pointer block",children:[S.jsxs("div",{className:"flex items-start justify-between gap-3",children:[S.jsxs("div",{className:"min-w-0 flex-1",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"text-sm font-semibold text-slate-100",children:h.shortName}),S.jsx(HE,{status:h.status})]}),S.jsx("div",{className:"mt-1 text-xs text-slate-400 line-clamp-2",children:h.prompt}),h.longSummary&&S.jsx("div",{className:"mt-1 text-xs text-slate-300 italic",children:h.longSummary}),h.status==="failed"&&h.errorSummary&&S.jsxs("div",{className:"mt-1 text-xs text-solix-danger italic line-clamp-2",children:["error: ",h.errorSummary]})]}),S.jsxs("div",{className:"text-right text-[10px] text-slate-500 font-mono whitespace-nowrap",children:[WE(h.startedAt),h.metrics.durationMs!==void 0&&S.jsxs("div",{children:[(h.metrics.durationMs/1e3).toFixed(1),"s"]})]})]}),S.jsxs("div",{className:"mt-2 flex items-center gap-3 text-[10px] text-slate-500",children:[d&&S.jsxs("span",{children:["agent:"," ",S.jsx("span",{className:"text-slate-300",children:d.name??d.id.slice(0,8)})]}),S.jsxs("span",{children:[h.metrics.toolCallCount," tools"]}),S.jsxs("span",{title:zm.subagent,children:[h.metrics.subagentCount," subagents"]}),S.jsxs("span",{children:[h.filesTouched.length," files"]})]}),h.filesTouched.length>0&&S.jsxs("div",{className:"mt-2 flex flex-wrap gap-1",children:[h.filesTouched.slice(0,6).map(p=>S.jsx("span",{className:"text-[10px] font-mono text-slate-400 bg-black/30 border border-solix-border rounded px-1.5 py-0.5",children:GE(p)},p)),h.filesTouched.length>6&&S.jsxs("span",{className:"text-[10px] text-slate-500",children:["+",h.filesTouched.length-6]})]})]})},h.id)})})]},(l==null?void 0:l.id)??"_")})]})})}function HE({status:n}){const e=n==="active"?"border-solix-warn text-solix-warn":n==="completed"?"border-solix-ok text-solix-ok":n==="failed"?"border-solix-danger text-solix-danger":"border-solix-border text-slate-400";return S.jsx("span",{className:`text-[9px] uppercase tracking-wide px-1.5 py-0.5 rounded border ${e}`,children:n})}function GE(n){const e=n.match(/[^/\\]+\/?$/);return e?e[0].replace(/\/$/,""):n}function WE(n){const e=Date.now()-n;if(e<0)return"now";const t=Math.floor(e/1e3);if(t<60)return`${t}s ago`;const i=Math.floor(t/60);if(i<60)return`${i}m ago`;const r=Math.floor(i/60);return r<24?`${r}h ago`:new Date(n).toLocaleDateString()}function jE({onOpenGalaxy:n,onNewTask:e,onOpenTimeline:t,onOpenHelp:i,onOpenCrew:r}={}){const s=ge(h=>h.connected),o=ge(Bm),a=ge(h=>h.viewMode),l=ge(h=>h.playback.active),c=ge(h=>h.exitPlayback),u=o.reduce((h,d)=>(d.status==="active"?h.active+=1:d.status==="awaiting_permission"||d.status==="awaiting_input"||d.status==="plan_review"?h.attention+=1:d.status==="idle"&&(h.idle+=1),h),{active:0,idle:0,attention:0});return S.jsxs("div",{className:"pointer-events-none absolute inset-x-0 top-0 flex items-start justify-between p-4 z-40",children:[S.jsxs("div",{className:"pointer-events-auto flex items-center gap-2 sm:gap-3",children:[S.jsxs("div",{className:"flex items-baseline gap-1.5",children:[S.jsx("div",{className:"text-xl font-bold tracking-widest text-solix-accent",children:"SOLIX"}),S.jsxs("span",{className:"text-[10px] font-mono text-slate-500",title:"Solix v1.10.0 — built into this UI bundle",children:["v","1.10.0"]})]}),S.jsx("div",{className:"hidden md:block text-xs text-slate-400",children:"a solar-system command center"}),S.jsx("div",{className:`ml-1 sm:ml-3 px-2 py-1 rounded text-[10px] border ${s?"border-solix-ok text-solix-ok":"border-solix-danger text-solix-danger solix-pulse"}`,children:s?"CONNECTED":"OFFLINE"}),l&&S.jsxs("button",{onClick:c,className:"ml-2 px-2 py-1 rounded text-[10px] border border-solix-accent text-solix-accent solix-pulse hover:bg-solix-accent/15 cursor-pointer flex items-center gap-1.5",title:"Exit Timeline Playback (Esc)","aria-label":"Exit playback",children:[S.jsx("span",{children:"▸ PLAYBACK"}),S.jsx("span",{className:"opacity-70",children:"· exit ✕"})]})]}),S.jsxs("div",{className:"pointer-events-auto flex items-center gap-2 sm:gap-3 text-xs",children:[S.jsxs("div",{className:"hidden sm:flex items-center gap-2",children:[S.jsx(Gh,{label:"active",value:u.active,color:"text-solix-ok"}),S.jsx(Gh,{label:"attention",value:u.attention,color:"text-solix-warn"}),S.jsx(Gh,{label:"idle",value:u.idle,color:"text-slate-400"})]}),S.jsx(XE,{viewMode:a}),t&&S.jsx("button",{onClick:t,className:"hidden sm:inline-block px-2 py-1 rounded bg-solix-panel border border-solix-border text-slate-300 hover:text-white hover:bg-solix-border/30",title:"Timeline playback (T)",children:"⏱ Timeline"}),e&&S.jsx("button",{onClick:e,className:"px-2 py-1 rounded bg-solix-ok/15 border border-solix-ok/40 text-solix-ok hover:bg-solix-ok/25",title:"Launch a new Claude Code task (L)",children:"+ Task"}),r&&S.jsx("button",{onClick:r,className:"px-2 py-1 rounded bg-amber-500/15 border border-amber-400/40 text-amber-200 hover:bg-amber-500/25",title:"Crew: view and enable advisors (C)",children:"✦ Crew"}),n&&S.jsx("button",{onClick:n,className:"px-2 py-1 rounded bg-solix-accent/15 border border-solix-accent/40 text-solix-accent hover:bg-solix-accent/25",title:"Galaxy: export and import (G)",children:"⌬ Galaxy"}),i&&S.jsx("button",{onClick:i,className:"w-7 h-7 rounded-full bg-solix-panel border border-solix-border text-slate-300 hover:text-white hover:bg-solix-border/30 text-sm",title:"Help (?)","aria-label":"Help",children:"?"})]})]})}function XE({viewMode:n}){const e=ge(i=>i.setViewMode),t=[{mode:"galaxy",label:"🪐"},{mode:"list",label:"☰"},{mode:"missions",label:"◎"}];return S.jsx("div",{className:"inline-flex rounded border border-solix-border bg-solix-panel overflow-hidden",children:t.map(i=>S.jsxs("button",{onClick:()=>e(i.mode),className:`px-2 py-1 text-xs ${n===i.mode?"bg-solix-border/50 text-white":"text-slate-400 hover:text-slate-100"}`,title:`${i.mode} view (V)`,children:[i.label," ",S.jsx("span",{className:"hidden sm:inline capitalize",children:i.mode})]},i.mode))})}function Gh({label:n,value:e,color:t}){return S.jsxs("div",{className:"px-2 py-1 rounded bg-solix-panel border border-solix-border",children:[S.jsx("span",{className:`font-bold ${t}`,children:e}),S.jsx("span",{className:"ml-1 opacity-60 uppercase tracking-wide",children:n})]})}function $E(){const n=ge(t=>t.toasts),e=ge(t=>t.dismissToast);return S.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 flex flex-col gap-2 z-30",children:n.map(t=>S.jsx("button",{onClick:()=>e(t.id),className:`pointer-events-auto px-3 py-2 rounded text-xs border max-w-md text-left ${t.level==="error"?"bg-solix-danger/10 border-solix-danger text-solix-danger":t.level==="warn"?"bg-solix-warn/10 border-solix-warn text-solix-warn":"bg-solix-panel border-solix-border text-slate-200"}`,children:t.message},t.id))})}const i0="solix.welcome.dismissed.v1";function YE({onOpenGalaxy:n,forceOpen:e=!1,onClose:t}){const[i,r]=Ee.useState(!1),s=ge(u=>u.advisors),o=ge(u=>Object.keys(u.skills).length),a=ge(u=>Object.keys(u.sessions).length);if(Ee.useEffect(()=>{try{r(localStorage.getItem(i0)==="1")}catch{}},[]),!e&&(i||a>0))return null;const l=()=>{try{localStorage.setItem(i0,"1")}catch{}r(!0),t==null||t()},c=Object.values(s).filter(u=>u.enabled).sort((u,h)=>u.codename.localeCompare(h.codename));return S.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center pointer-events-none",children:S.jsxs("div",{className:"pointer-events-auto max-w-xl w-full mx-4 rounded-xl border border-solix-accent/40 bg-solix-panel/95 backdrop-blur-md shadow-2xl",children:[S.jsxs("div",{className:"px-6 pt-5 pb-3 border-b border-solix-border",children:[S.jsx("div",{className:"text-xs uppercase tracking-widest text-solix-accent",children:"welcome"}),S.jsx("div",{className:"text-2xl font-bold mt-1",children:"Solix — your agent solar system"}),S.jsx("div",{className:"text-sm text-slate-400 mt-1",children:"Mission control for Claude Code. Each agent orbits the sun; each click is a conversation with one of your planets."})]}),S.jsxs("div",{className:"px-6 py-4 space-y-3 text-sm text-slate-300",children:[S.jsx(ta,{n:1,title:"Run a Claude Code session",body:S.jsxs(S.Fragment,{children:["Open a terminal anywhere and run"," ",S.jsx("code",{className:"bg-black/40 px-1 rounded",children:"claude"}),". A planet will appear here within a second."]})}),S.jsx(ta,{n:2,title:"Or seed the demo state",body:S.jsxs(S.Fragment,{children:["In another terminal:"," ",S.jsx("code",{className:"bg-black/40 px-1 rounded",children:"solix demo"}),". You'll get a fully populated galaxy — ~30 sessions across 8 projects, all 14 advisors, moons, and live permission flares — without running Claude Code."]})}),S.jsx(ta,{n:3,title:"Meet the advisor crew",body:S.jsxs(S.Fragment,{children:[c.length>0?`${c.length} crew members loaded. Click any in the inner ring to read their role and invoke them on the focused planet.`:"Crew loading…",c.length>0&&S.jsx("ul",{className:"mt-2 space-y-1",children:c.map(u=>S.jsxs("li",{className:"flex items-baseline gap-2",children:[S.jsxs("span",{className:"font-mono text-xs",style:{color:u.color},children:[u.glyph," ",u.codename]}),S.jsx("span",{className:"text-slate-500 text-xs",children:"—"}),S.jsx("span",{className:"text-slate-300 text-xs",children:u.name})]},u.id))})]})}),S.jsx(ta,{n:4,title:"Browse the asteroid belt",body:S.jsxs(S.Fragment,{children:["Each asteroid is a Skill (",o," discovered). Click one to read its SKILL.md and see which advisors require it."]})}),S.jsx(ta,{n:5,title:"Share your galaxy",body:S.jsxs(S.Fragment,{children:["Press"," ",S.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-black/50 border border-solix-border text-[10px]",children:"G"})," ","or click ",S.jsx("span",{className:"text-solix-accent",children:"⌬ Galaxy"})," ","in the top bar to export, import, publish, or install a galaxy from a registry."]})})]}),S.jsxs("div",{className:"px-6 pb-3 pt-1",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-widest text-slate-500 mb-1.5",children:"Keyboard shortcuts"}),S.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-[11px] text-slate-400",children:[S.jsx(pi,{k:"V",children:"cycle Galaxy → List → Missions"}),S.jsx(pi,{k:"G",children:"toggle Galaxy panel"}),S.jsx(pi,{k:"L",children:"new task"}),S.jsx(pi,{k:"T",children:"timeline"}),S.jsx(pi,{k:"M",children:"jump to Missions"}),S.jsx(pi,{k:"Y",children:"approve top decision"}),S.jsx(pi,{k:"N",children:"deny top decision"}),S.jsx(pi,{k:"Space",children:"play / pause orbits"}),S.jsx(pi,{k:"?",children:"re-open this help"}),S.jsx(pi,{k:"Esc",children:"close panels / exit playback"})]}),S.jsx("div",{className:"text-[10px] text-slate-500 italic mt-2",children:"If clicks feel stuck, a third-party screen overlay (note-taker, recorder) may be intercepting. Quit it temporarily, or use the shortcuts above."})]}),S.jsxs("div",{className:"px-6 py-3 border-t border-solix-border flex items-center gap-2",children:[S.jsx("button",{onClick:()=>{n(),l()},className:"px-3 py-1.5 rounded bg-solix-accent/15 border border-solix-accent/40 text-solix-accent text-xs hover:bg-solix-accent/25",children:"Open Galaxy panel"}),S.jsx("div",{className:"flex-1"}),S.jsxs("span",{className:"text-[10px] font-mono text-slate-500 mr-2",children:["Solix v","1.10.0"]}),S.jsx("button",{onClick:l,className:"px-3 py-1.5 rounded border border-solix-border text-xs text-slate-300 hover:text-white",children:"Got it"})]})]})})}function pi({k:n,children:e}){return S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("kbd",{className:"shrink-0 px-1.5 py-0.5 rounded bg-black/50 border border-solix-border text-[10px] font-mono text-slate-300",children:n}),S.jsx("span",{className:"truncate",children:e})]})}function ta({n,title:e,body:t}){return S.jsxs("div",{className:"flex gap-3",children:[S.jsx("div",{className:"shrink-0 w-6 h-6 rounded-full bg-solix-accent/20 border border-solix-accent/40 text-solix-accent text-xs flex items-center justify-center",children:n}),S.jsxs("div",{children:[S.jsx("div",{className:"text-slate-100 font-medium text-sm",children:e}),S.jsx("div",{className:"text-slate-400 text-xs mt-0.5 leading-relaxed",children:t})]})]})}function qE(n,e,t,i){const r=Wh(i,"command"),s=Wh(i,"file_path"),o=Wh(i,"url");if(t==="Bash"&&r){if(/\brm\s+-rf\b/i.test(r)||/\bsudo\b/i.test(r))return{severity:"danger",text:"Destructive command. Deny unless you have already confirmed the diff."};if(/--no-verify\b/.test(r))return{severity:"warn",text:"Skipping pre-commit hooks. Investigate the failure first."};if(/git\s+push.*--force\b/.test(r))return{severity:"danger",text:"Force-push. Confirm no one else has pushed since."};if(/git\s+push/.test(r)&&/\b(main|master|prod|production)\b/.test(r))return{severity:"warn",text:"Pushing to main/prod. Confirm the diff first."};if(/git\s+reset\s+--hard\b/.test(r))return{severity:"warn",text:"Hard reset will discard uncommitted changes. Stash first if unsure."}}if((t==="Edit"||t==="Write"||t==="MultiEdit")&&s){if(/\.env(\b|\.|\/)|credentials\.json|\.pem$|\.key$/i.test(s))return{severity:"danger",text:"Editing a secrets file. Make sure the agent really needs to."};if(/(^|\/)\.git\//.test(s))return{severity:"warn",text:"Editing inside .git/. Almost certainly a mistake."}}if(t==="WebFetch"&&o){if(/^https?:\/\/(localhost|127\.0\.0\.1|0\.0\.0\.0)/.test(o))return null;if(/^http:\/\//.test(o))return{severity:"info",text:"Plain HTTP fetch. OK for known internal hosts."}}return n.contextUsagePct>=90?{severity:"warn",text:`Context at ${n.contextUsagePct.toFixed(0)}%. Run /compact before continuing.`}:null}function ZE(n,e){return n.status==="error"?{severity:"danger",text:"Session is in error state. Check the chat tab and consider restarting."}:n.contextUsagePct>=90?{severity:"warn",text:`Context at ${n.contextUsagePct.toFixed(0)}%. Compact the conversation before the next prompt.`}:n.contextUsagePct>=80?{severity:"info",text:`Context at ${n.contextUsagePct.toFixed(0)}%. Watch out — output quality drops past 90.`}:e&&e.status==="active"&&e.metrics.toolCallCount===0&&Date.now()-e.startedAt>5*60*1e3?{severity:"info",text:"Active mission with no tool calls in 5+ minutes. Agent may be stuck."}:null}function Wh(n,e){const t=n[e];return typeof t=="string"?t:null}function KE({panelOffsetPx:n=0}={}){const e=ge(x=>x.pendingPermissions),t=ge(x=>x.budgetAlerts),i=ge(x=>x.sessions),r=ge(x=>x.missions),s=ge(x=>x.resolvePermission),o=ge(x=>x.raiseBudget),a=ge(x=>x.dismissBudgetAlert),l=ge(x=>x.selectSession),c=Object.values(e).sort((x,g)=>g.receivedAt-x.receivedAt),u=Object.values(t).sort((x,g)=>g.receivedAt-x.receivedAt),[h,d]=Ee.useState(!1),p=c.length+u.length;Ee.useEffect(()=>{p>0&&d(!1)},[p]);const m=x=>{l(x),d(!0)};return p===0?S.jsx("div",{className:"absolute top-20 z-30 pointer-events-none",style:{right:`${n+16}px`},children:S.jsxs("div",{className:"pointer-events-auto rounded-full border border-solix-border bg-solix-panel/60 backdrop-blur px-3 py-1 text-[10px] text-slate-500 flex items-center gap-2",children:[S.jsx("span",{className:"uppercase tracking-widest",children:"decisions"}),S.jsx("span",{className:"font-bold",children:"0"}),S.jsx("span",{className:"italic opacity-80",children:"— all clear"})]})}):S.jsxs("div",{className:"absolute top-20 z-30 w-80 flex flex-col gap-2 pointer-events-none",style:{right:`${n+16}px`},children:[S.jsxs("div",{className:"pointer-events-auto rounded border border-solix-border bg-solix-panel/85 backdrop-blur px-3 py-2 flex items-center justify-between",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"text-[10px] uppercase tracking-widest text-slate-400",children:"Decisions"}),S.jsx("span",{className:"text-xs font-bold text-solix-danger",children:p})]}),S.jsx("button",{onClick:()=>d(x=>!x),className:"text-[10px] text-slate-400 hover:text-slate-100",children:h?"show":"hide"})]}),!h&&u.map(x=>{var g;return S.jsx(JE,{name:((g=i[x.sessionId])==null?void 0:g.name)??x.sessionId.slice(0,8),costUsd:x.costUsd,budgetUsd:x.budgetUsd,onRaise:()=>{const f=window.prompt(`New budget cap (USD) for this agent — current $${x.budgetUsd.toFixed(2)}, spent $${x.costUsd.toFixed(2)}:`,(x.budgetUsd*2).toFixed(2)),v=f?parseFloat(f):NaN;Number.isFinite(v)&&v>0&&o(x.sessionId,v)},onDismiss:()=>a(x.sessionId)},`budget-${x.sessionId}`)}),!h&&c.map(x=>{const g=i[x.sessionId],f=g!=null&&g.currentMissionId?r[g.currentMissionId]:void 0;return S.jsx(QE,{session:g,mission:f,tool:x.tool,args:x.args,onApprove:()=>s(x.requestId,!0),onDeny:()=>s(x.requestId,!1),onAsk:()=>m(x.sessionId)},x.requestId)})]})}function JE({name:n,costUsd:e,budgetUsd:t,onRaise:i,onDismiss:r}){return S.jsxs("div",{className:"pointer-events-auto rounded border border-solix-danger bg-solix-panel p-3 backdrop-blur shadow-lg",children:[S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsx("div",{className:"text-xs uppercase tracking-wide text-solix-danger",children:n}),S.jsx("div",{className:"text-[10px] uppercase tracking-widest text-solix-danger/80",children:"budget"})]}),S.jsxs("div",{className:"mt-2 text-sm text-slate-100",children:["Budget reached",S.jsxs("span",{className:"ml-1 font-mono text-xs text-slate-300",children:["$",e.toFixed(2)," / $",t.toFixed(2)]})]}),S.jsx("div",{className:"mt-1 text-[11px] text-slate-400 leading-snug",children:"Solix-launched agents won't be sent more prompts until you raise the cap."}),S.jsxs("div",{className:"mt-3 flex gap-1.5",children:[S.jsx("button",{onClick:i,className:"flex-1 py-1.5 rounded bg-solix-ok/20 border border-solix-ok text-solix-ok text-xs hover:bg-solix-ok/30",children:"Raise cap"}),S.jsx("button",{onClick:r,className:"px-2.5 py-1.5 rounded border border-solix-border text-slate-300 text-xs hover:text-white hover:bg-solix-border/30",children:"Dismiss"})]})]})}function QE({session:n,mission:e,tool:t,args:i,onApprove:r,onDeny:s,onAsk:o}){const a=(n==null?void 0:n.name)??(n==null?void 0:n.id.slice(0,8))??"unknown agent",l=n!=null&&n.cwd?iT(n.cwd):"",c=n?qE(n,e,t,i):null;return S.jsxs("div",{className:"pointer-events-auto rounded border border-solix-danger bg-solix-panel p-3 backdrop-blur shadow-lg",children:[S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsx("div",{className:"text-xs uppercase tracking-wide text-solix-danger",children:a}),l&&S.jsx("div",{className:"text-[10px] text-slate-500 truncate ml-2 max-w-[55%]",children:l})]}),e&&S.jsxs("div",{className:"mt-1 text-[11px] text-slate-400 italic truncate",children:["mission: ",e.shortName]}),S.jsxs("div",{className:"mt-2 text-sm text-slate-100",children:[S.jsx("span",{className:"font-semibold",children:t}),S.jsx("span",{className:"ml-1 text-slate-300 text-xs break-words",children:rT(i)})]}),S.jsx(eT,{tool:t,args:i}),c&&S.jsx(nT,{suggestion:c}),S.jsxs("div",{className:"mt-3 flex gap-1.5",children:[S.jsx("button",{onClick:r,className:"flex-1 py-1.5 rounded bg-solix-ok/20 border border-solix-ok text-solix-ok text-xs hover:bg-solix-ok/30",children:"Approve · Y"}),S.jsx("button",{onClick:s,className:"flex-1 py-1.5 rounded bg-solix-danger/20 border border-solix-danger text-solix-danger text-xs hover:bg-solix-danger/30",children:"Deny · N"}),S.jsx("button",{onClick:o,className:"px-2.5 py-1.5 rounded border border-solix-border text-slate-300 text-xs hover:text-white hover:bg-solix-border/30",title:"Open chat with this agent for context",children:"Ask"})]})]})}function eT({tool:n,args:e}){const[t,i]=Ee.useState(!1);if(n==="Bash"){const r=rr(e,"command")??"",s=rr(e,"description");return r?S.jsxs(jh,{label:"will run",children:[S.jsx("pre",{className:"whitespace-pre-wrap break-words font-mono text-[11px] text-slate-100",children:r}),s&&S.jsx("div",{className:"mt-1 text-[10px] text-slate-500 italic",children:s})]}):null}if(n==="Edit"||n==="NotebookEdit"){const r=rr(e,"file_path")??rr(e,"notebook_path"),s=rr(e,"old_string"),o=rr(e,"new_string");return!r&&!s&&!o?null:S.jsxs(jh,{label:"patch",children:[r&&S.jsx("div",{className:"font-mono text-[11px] text-solix-accent break-all",children:r}),s&&S.jsx(Xh,{sign:"-",text:s,expanded:t,colorClass:"text-solix-danger bg-solix-danger/10"}),o&&S.jsx(Xh,{sign:"+",text:o,expanded:t,colorClass:"text-solix-ok bg-solix-ok/10"}),($h(s)||$h(o))&&S.jsx("button",{onClick:()=>i(a=>!a),className:"mt-1 text-[10px] text-slate-400 hover:text-slate-100",children:t?"collapse":"expand"})]})}if(n==="Write"){const r=rr(e,"file_path"),s=rr(e,"content")??"";return r?S.jsxs(jh,{label:"will write",children:[S.jsx("div",{className:"font-mono text-[11px] text-solix-accent break-all",children:r}),s&&S.jsx(Xh,{sign:"+",text:s,expanded:t,colorClass:"text-solix-ok bg-solix-ok/10"}),$h(s)&&S.jsx("button",{onClick:()=>i(o=>!o),className:"mt-1 text-[10px] text-slate-400 hover:text-slate-100",children:t?"collapse":"expand"})]}):null}return null}function jh({label:n,children:e}){return S.jsxs("div",{className:"mt-2 rounded border border-solix-border bg-black/30 px-2 py-1.5",children:[S.jsx("div",{className:"text-[9px] uppercase tracking-wider text-slate-500 mb-1",children:n}),e]})}function Xh({sign:n,text:e,expanded:t,colorClass:i}){const r=t?e:tT(e,240);return S.jsxs("pre",{className:`mt-1 px-1.5 py-1 rounded text-[11px] font-mono whitespace-pre-wrap break-words ${i}`,children:[S.jsx("span",{className:"opacity-50 mr-1",children:n}),r]})}function rr(n,e){const t=n[e];return typeof t=="string"?t:void 0}function $h(n){return!!(n&&n.length>240)}function tT(n,e){if(n.length<=e)return n;const t=Math.floor((e-3)/2);return`${n.slice(0,t)}
57
57
 
58
- ${n.slice(-t)}`}function nT({suggestion:n}){const e=n.severity==="danger"?"text-solix-danger border-solix-danger/40 bg-solix-danger/10":n.severity==="warn"?"text-solix-warn border-solix-warn/40 bg-solix-warn/10":"text-slate-300 border-solix-border bg-black/20";return S.jsxs("div",{className:`mt-2 px-2 py-1 rounded border text-[11px] leading-snug ${e}`,children:[S.jsx("span",{className:"font-semibold mr-1",children:"Suggested:"}),n.text]})}function iT(n){const e=n.match(/[^/\\]+\/?$/);return e?e[0].replace(/\/$/,""):n}function rT(n){const e=Object.keys(n);return e.length?e.slice(0,2).map(i=>{const r=n[i],s=typeof r=="string"?r:JSON.stringify(r);return`${i}=${s.length>40?s.slice(0,40)+"…":s}`}).join(" · "):""}const i0="solix.scenehint.dismissed.v1";function sT(){const n=xe(o=>o.motionEnabled),e=xe(o=>o.viewMode),t=xe(o=>o.toggleMotion),[i,r]=Ae.useState(!0);Ae.useEffect(()=>{try{r(localStorage.getItem(i0)==="1")}catch{}},[]);const s=()=>{try{localStorage.setItem(i0,"1")}catch{}r(!0)};return S.jsxs(S.Fragment,{children:[e==="galaxy"&&!i&&S.jsx("div",{className:"pointer-events-none absolute bottom-4 left-1/2 -translate-x-1/2 z-20",children:S.jsxs("div",{className:"pointer-events-auto rounded-full border border-solix-border bg-solix-panel/85 backdrop-blur px-3 py-1.5 text-[11px] text-slate-300 flex items-center gap-3",children:[S.jsxs("span",{children:[S.jsx("kbd",{className:"px-1 py-0.5 rounded bg-black/40 border border-solix-border text-[10px] mr-1",children:"drag"}),"pan"]}),S.jsxs("span",{children:[S.jsx("kbd",{className:"px-1 py-0.5 rounded bg-black/40 border border-solix-border text-[10px] mr-1",children:"scroll"}),"zoom"]}),S.jsxs("span",{children:[S.jsx("kbd",{className:"px-1 py-0.5 rounded bg-black/40 border border-solix-border text-[10px] mr-1",children:"space"}),"pause"]}),S.jsx("button",{onClick:s,className:"ml-1 text-slate-500 hover:text-slate-100","aria-label":"Dismiss hint",children:"✕"})]})}),S.jsx("div",{className:"pointer-events-none absolute bottom-4 right-4 z-20",children:S.jsx("button",{onClick:t,title:`${n?"Pause":"Play"} orbital motion (Space)`,className:`pointer-events-auto w-10 h-10 rounded-full text-base flex items-center justify-center border backdrop-blur transition-colors ${n?"bg-solix-accent/20 border-solix-accent text-solix-accent":"bg-solix-panel/80 border-solix-border text-slate-300 hover:bg-solix-border/40 hover:text-white"}`,children:n?"⏸":"▶"})})]})}/**
58
+ ${n.slice(-t)}`}function nT({suggestion:n}){const e=n.severity==="danger"?"text-solix-danger border-solix-danger/40 bg-solix-danger/10":n.severity==="warn"?"text-solix-warn border-solix-warn/40 bg-solix-warn/10":"text-slate-300 border-solix-border bg-black/20";return S.jsxs("div",{className:`mt-2 px-2 py-1 rounded border text-[11px] leading-snug ${e}`,children:[S.jsx("span",{className:"font-semibold mr-1",children:"Suggested:"}),n.text]})}function iT(n){const e=n.match(/[^/\\]+\/?$/);return e?e[0].replace(/\/$/,""):n}function rT(n){const e=Object.keys(n);return e.length?e.slice(0,2).map(i=>{const r=n[i],s=typeof r=="string"?r:JSON.stringify(r);return`${i}=${s.length>40?s.slice(0,40)+"…":s}`}).join(" · "):""}const r0="solix.scenehint.dismissed.v1";function sT(){const n=ge(o=>o.motionEnabled),e=ge(o=>o.viewMode),t=ge(o=>o.toggleMotion),[i,r]=Ee.useState(!0);Ee.useEffect(()=>{try{r(localStorage.getItem(r0)==="1")}catch{}},[]);const s=()=>{try{localStorage.setItem(r0,"1")}catch{}r(!0)};return S.jsxs(S.Fragment,{children:[e==="galaxy"&&!i&&S.jsx("div",{className:"pointer-events-none absolute bottom-4 left-1/2 -translate-x-1/2 z-20",children:S.jsxs("div",{className:"pointer-events-auto rounded-full border border-solix-border bg-solix-panel/85 backdrop-blur px-3 py-1.5 text-[11px] text-slate-300 flex items-center gap-3",children:[S.jsxs("span",{children:[S.jsx("kbd",{className:"px-1 py-0.5 rounded bg-black/40 border border-solix-border text-[10px] mr-1",children:"drag"}),"pan"]}),S.jsxs("span",{children:[S.jsx("kbd",{className:"px-1 py-0.5 rounded bg-black/40 border border-solix-border text-[10px] mr-1",children:"scroll"}),"zoom"]}),S.jsxs("span",{children:[S.jsx("kbd",{className:"px-1 py-0.5 rounded bg-black/40 border border-solix-border text-[10px] mr-1",children:"space"}),"pause"]}),S.jsx("button",{onClick:s,className:"ml-1 text-slate-500 hover:text-slate-100","aria-label":"Dismiss hint",children:"✕"})]})}),S.jsx("div",{className:"pointer-events-none absolute bottom-4 right-4 z-20",children:S.jsx("button",{onClick:t,title:`${n?"Pause":"Play"} orbital motion (Space)`,className:`pointer-events-auto w-10 h-10 rounded-full text-base flex items-center justify-center border backdrop-blur transition-colors ${n?"bg-solix-accent/20 border-solix-accent text-solix-accent":"bg-solix-panel/80 border-solix-border text-slate-300 hover:bg-solix-border/40 hover:text-white"}`,children:n?"⏸":"▶"})})]})}/**
59
59
  * @license
60
60
  * Copyright 2010-2024 Three.js Authors
61
61
  * SPDX-License-Identifier: MIT
62
- */const Rd="168",oT={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},aT={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},aS=0,Cp=1,lS=2,lT=3,cT=0,zm=1,cS=2,gi=3,Zi=0,fn=1,vi=2,Wi=0,fs=1,Rp=2,Pp=3,Ip=4,uS=5,vr=100,dS=101,hS=102,fS=103,pS=104,mS=200,gS=201,xS=202,vS=203,Lu=204,Du=205,yS=206,_S=207,SS=208,MS=209,wS=210,bS=211,ES=212,TS=213,AS=214,CS=0,RS=1,PS=2,nl=3,IS=4,NS=5,LS=6,DS=7,Cl=0,US=1,kS=2,ji=0,OS=1,FS=2,BS=3,zS=4,VS=5,HS=6,GS=7,Np="attached",WS="detached",Pd=300,Ki=301,Ir=302,il=303,rl=304,Vo=306,sl=1e3,Xn=1001,ol=1002,Gt=1003,Vm=1004,uT=1004,fo=1005,dT=1005,Ut=1006,Pa=1007,hT=1007,yi=1008,fT=1008,Ei=1009,Hm=1010,Gm=1011,Do=1012,Id=1013,Ji=1014,Sn=1015,Ho=1016,Nd=1017,Ld=1018,Ms=1020,Wm=35902,jm=1021,Xm=1022,dn=1023,$m=1024,Ym=1025,ps=1026,ws=1027,Dd=1028,Rl=1029,qm=1030,Ud=1031,pT=1032,kd=1033,Ia=33776,Na=33777,La=33778,Da=33779,Uu=35840,ku=35841,Ou=35842,Fu=35843,Bu=36196,zu=37492,Vu=37496,Hu=37808,Gu=37809,Wu=37810,ju=37811,Xu=37812,$u=37813,Yu=37814,qu=37815,Zu=37816,Ku=37817,Ju=37818,Qu=37819,ed=37820,td=37821,Ua=36492,nd=36494,id=36495,Zm=36283,rd=36284,sd=36285,od=36286,jS=2200,XS=2201,$S=2202,al=2300,ad=2301,au=2302,as=2400,ls=2401,ll=2402,Od=2500,Km=2501,mT=0,gT=1,xT=2,YS=3200,qS=3201,vT=3202,yT=3203,kr=0,ZS=1,Fi="",Hn="srgb",tr="srgb-linear",Fd="display-p3",Pl="display-p3-linear",cl="linear",ft="srgb",ul="rec709",dl="p3",_T=0,ts=7680,ST=7681,MT=7682,wT=7683,bT=34055,ET=34056,TT=5386,AT=512,CT=513,RT=514,PT=515,IT=516,NT=517,LT=518,Lp=519,KS=512,JS=513,QS=514,Jm=515,eM=516,tM=517,nM=518,iM=519,hl=35044,DT=35048,UT=35040,kT=35045,OT=35049,FT=35041,BT=35046,zT=35050,VT=35042,HT="100",Dp="300 es",_i=2e3,fl=2001;class Ti{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}}const Qt=["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 r0=1234567;const ms=Math.PI/180,Uo=180/Math.PI;function Un(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Qt[n&255]+Qt[n>>8&255]+Qt[n>>16&255]+Qt[n>>24&255]+"-"+Qt[e&255]+Qt[e>>8&255]+"-"+Qt[e>>16&15|64]+Qt[e>>24&255]+"-"+Qt[t&63|128]+Qt[t>>8&255]+"-"+Qt[t>>16&255]+Qt[t>>24&255]+Qt[i&255]+Qt[i>>8&255]+Qt[i>>16&255]+Qt[i>>24&255]).toLowerCase()}function At(n,e,t){return Math.max(e,Math.min(t,n))}function Qm(n,e){return(n%e+e)%e}function GT(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function WT(n,e,t){return n!==e?(t-n)/(e-n):0}function ka(n,e,t){return(1-t)*n+t*e}function jT(n,e,t,i){return ka(n,e,1-Math.exp(-t*i))}function XT(n,e=1){return e-Math.abs(Qm(n,e*2)-e)}function $T(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function YT(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function qT(n,e){return n+Math.floor(Math.random()*(e-n+1))}function ZT(n,e){return n+Math.random()*(e-n)}function KT(n){return n*(.5-Math.random())}function JT(n){n!==void 0&&(r0=n);let e=r0+=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 QT(n){return n*ms}function eA(n){return n*Uo}function tA(n){return(n&n-1)===0&&n!==0}function nA(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function iA(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function rA(n,e,t,i,r){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+i)/2),u=o((e+i)/2),h=s((e-i)/2),d=o((e-i)/2),p=s((i-e)/2),m=o((i-e)/2);switch(r){case"XYX":n.set(a*u,l*h,l*d,a*c);break;case"YZY":n.set(l*d,a*u,l*h,a*c);break;case"ZXZ":n.set(l*h,l*d,a*u,a*c);break;case"XZX":n.set(a*u,l*m,l*p,a*c);break;case"YXY":n.set(l*p,a*u,l*m,a*c);break;case"ZYZ":n.set(l*m,l*p,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function un(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Xe(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const sA={DEG2RAD:ms,RAD2DEG:Uo,generateUUID:Un,clamp:At,euclideanModulo:Qm,mapLinear:GT,inverseLerp:WT,lerp:ka,damp:jT,pingpong:XT,smoothstep:$T,smootherstep:YT,randInt:qT,randFloat:ZT,randFloatSpread:KT,seededRandom:JT,degToRad:QT,radToDeg:eA,isPowerOfTwo:tA,ceilPowerOfTwo:nA,floorPowerOfTwo:iA,setQuaternionFromProperEuler:rA,normalize:Xe,denormalize:un};class Q{constructor(e=0,t=0){Q.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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 t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(At(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class je{constructor(e,t,i,r,s,o,a,l,c){je.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c)}set(e,t,i,r,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=i,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],u=i[4],h=i[7],d=i[2],p=i[5],m=i[8],x=r[0],g=r[3],f=r[6],v=r[1],y=r[4],_=r[7],C=r[2],w=r[5],E=r[8];return s[0]=o*x+a*v+l*C,s[3]=o*g+a*y+l*w,s[6]=o*f+a*_+l*E,s[1]=c*x+u*v+h*C,s[4]=c*g+u*y+h*w,s[7]=c*f+u*_+h*E,s[2]=d*x+p*v+m*C,s[5]=d*g+p*y+m*w,s[8]=d*f+p*_+m*E,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-i*s*u+i*a*l+r*s*c-r*o*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=u*o-a*c,d=a*l-u*s,p=c*s-o*l,m=t*h+i*d+r*p;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/m;return e[0]=h*x,e[1]=(r*c-u*i)*x,e[2]=(a*i-r*o)*x,e[3]=d*x,e[4]=(u*t-r*l)*x,e[5]=(r*s-a*t)*x,e[6]=p*x,e[7]=(i*l-c*t)*x,e[8]=(o*t-i*s)*x,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Yh.makeScale(e,t)),this}rotate(e){return this.premultiply(Yh.makeRotation(-e)),this}translate(e,t){return this.premultiply(Yh.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Yh=new je;function rM(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const oA={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function po(n,e){return new oA[n](e)}function pl(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function sM(){const n=pl("canvas");return n.style.display="block",n}const s0={};function bo(n){n in s0||(s0[n]=!0,console.warn(n))}function aA(n,e,t){return new Promise(function(i,r){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:r();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}const o0=new je().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),a0=new je().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),na={[tr]:{transfer:cl,primaries:ul,luminanceCoefficients:[.2126,.7152,.0722],toReference:n=>n,fromReference:n=>n},[Hn]:{transfer:ft,primaries:ul,luminanceCoefficients:[.2126,.7152,.0722],toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[Pl]:{transfer:cl,primaries:dl,luminanceCoefficients:[.2289,.6917,.0793],toReference:n=>n.applyMatrix3(a0),fromReference:n=>n.applyMatrix3(o0)},[Fd]:{transfer:ft,primaries:dl,luminanceCoefficients:[.2289,.6917,.0793],toReference:n=>n.convertSRGBToLinear().applyMatrix3(a0),fromReference:n=>n.applyMatrix3(o0).convertLinearToSRGB()}},lA=new Set([tr,Pl]),rt={enabled:!0,_workingColorSpace:tr,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!lA.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=na[e].toReference,r=na[t].fromReference;return r(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return na[n].primaries},getTransfer:function(n){return n===Fi?cl:na[n].transfer},getLuminanceCoefficients:function(n,e=this._workingColorSpace){return n.fromArray(na[e].luminanceCoefficients)}};function Eo(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function qh(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Ls;class oM{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Ls===void 0&&(Ls=pl("canvas")),Ls.width=e.width,Ls.height=e.height;const i=Ls.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Ls}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=pl("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=Eo(s[o]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(Eo(t[i]/255)*255):t[i]=Eo(t[i]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let cA=0;class cs{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:cA++}),this.uuid=Un(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push(Zh(r[o].image)):s.push(Zh(r[o]))}else s=Zh(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function Zh(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?oM.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let uA=0;class Ct extends Ti{constructor(e=Ct.DEFAULT_IMAGE,t=Ct.DEFAULT_MAPPING,i=Xn,r=Xn,s=Ut,o=yi,a=dn,l=Ei,c=Ct.DEFAULT_ANISOTROPY,u=Fi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:uA++}),this.uuid=Un(),this.name="",this.source=new cs(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Q(0,0),this.repeat=new Q(1,1),this.center=new Q(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new je,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,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 t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={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&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Pd)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case sl:e.x=e.x-Math.floor(e.x);break;case Xn:e.x=e.x<0?0:1;break;case ol: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 sl:e.y=e.y-Math.floor(e.y);break;case Xn:e.y=e.y<0?0:1;break;case ol: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++}}Ct.DEFAULT_IMAGE=null;Ct.DEFAULT_MAPPING=Pd;Ct.DEFAULT_ANISOTROPY=1;class ct{constructor(e=0,t=0,i=0,r=1){ct.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*i+o[11]*r+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,c=l[0],u=l[4],h=l[8],d=l[1],p=l[5],m=l[9],x=l[2],g=l[6],f=l[10];if(Math.abs(u-d)<.01&&Math.abs(h-x)<.01&&Math.abs(m-g)<.01){if(Math.abs(u+d)<.1&&Math.abs(h+x)<.1&&Math.abs(m+g)<.1&&Math.abs(c+p+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const y=(c+1)/2,_=(p+1)/2,C=(f+1)/2,w=(u+d)/4,E=(h+x)/4,A=(m+g)/4;return y>_&&y>C?y<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(y),r=w/i,s=E/i):_>C?_<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(_),i=w/r,s=A/r):C<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(C),i=E/s,r=A/s),this.set(i,r,s,t),this}let v=Math.sqrt((g-m)*(g-m)+(h-x)*(h-x)+(d-u)*(d-u));return Math.abs(v)<.001&&(v=1),this.x=(g-m)/v,this.y=(h-x)/v,this.z=(d-u)/v,this.w=Math.acos((c+p+f-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[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,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class aM extends Ti{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new ct(0,0,e,t),this.scissorTest=!1,this.viewport=new ct(0,0,e,t);const r={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ut,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);const s=new Ct(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);s.flipY=!1,s.generateMipmaps=i.generateMipmaps,s.internalFormat=i.internalFormat,this.textures=[];const o=i.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=i;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let i=0,r=e.textures.length;i<r;i++)this.textures[i]=e.textures[i].clone(),this.textures[i].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new cs(t),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 li extends aM{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class Bd extends Ct{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Gt,this.minFilter=Gt,this.wrapR=Xn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class dA extends li{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new Bd(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class eg extends Ct{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Gt,this.minFilter=Gt,this.wrapR=Xn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class hA extends li{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new eg(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class En{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,o,a){let l=i[r+0],c=i[r+1],u=i[r+2],h=i[r+3];const d=s[o+0],p=s[o+1],m=s[o+2],x=s[o+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h;return}if(a===1){e[t+0]=d,e[t+1]=p,e[t+2]=m,e[t+3]=x;return}if(h!==x||l!==d||c!==p||u!==m){let g=1-a;const f=l*d+c*p+u*m+h*x,v=f>=0?1:-1,y=1-f*f;if(y>Number.EPSILON){const C=Math.sqrt(y),w=Math.atan2(C,f*v);g=Math.sin(g*w)/C,a=Math.sin(a*w)/C}const _=a*v;if(l=l*g+d*_,c=c*g+p*_,u=u*g+m*_,h=h*g+x*_,g===1-a){const C=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=C,c*=C,u*=C,h*=C}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,r,s,o){const a=i[r],l=i[r+1],c=i[r+2],u=i[r+3],h=s[o],d=s[o+1],p=s[o+2],m=s[o+3];return e[t]=a*m+u*h+l*p-c*d,e[t+1]=l*m+u*d+c*h-a*p,e[t+2]=c*m+u*p+a*d-l*h,e[t+3]=u*m-a*h-l*d-c*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),u=a(r/2),h=a(s/2),d=l(i/2),p=l(r/2),m=l(s/2);switch(o){case"XYZ":this._x=d*u*h+c*p*m,this._y=c*p*h-d*u*m,this._z=c*u*m+d*p*h,this._w=c*u*h-d*p*m;break;case"YXZ":this._x=d*u*h+c*p*m,this._y=c*p*h-d*u*m,this._z=c*u*m-d*p*h,this._w=c*u*h+d*p*m;break;case"ZXY":this._x=d*u*h-c*p*m,this._y=c*p*h+d*u*m,this._z=c*u*m+d*p*h,this._w=c*u*h-d*p*m;break;case"ZYX":this._x=d*u*h-c*p*m,this._y=c*p*h+d*u*m,this._z=c*u*m-d*p*h,this._w=c*u*h+d*p*m;break;case"YZX":this._x=d*u*h+c*p*m,this._y=c*p*h+d*u*m,this._z=c*u*m-d*p*h,this._w=c*u*h-d*p*m;break;case"XZY":this._x=d*u*h-c*p*m,this._y=c*p*h-d*u*m,this._z=c*u*m+d*p*h,this._w=c*u*h+d*p*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],h=t[10],d=i+a+h;if(d>0){const p=.5/Math.sqrt(d+1);this._w=.25/p,this._x=(u-l)*p,this._y=(s-c)*p,this._z=(o-r)*p}else if(i>a&&i>h){const p=2*Math.sqrt(1+i-a-h);this._w=(u-l)/p,this._x=.25*p,this._y=(r+o)/p,this._z=(s+c)/p}else if(a>h){const p=2*Math.sqrt(1+a-i-h);this._w=(s-c)/p,this._x=(r+o)/p,this._y=.25*p,this._z=(l+u)/p}else{const p=2*Math.sqrt(1+h-i-a);this._w=(o-r)/p,this._x=(s+c)/p,this._y=(l+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(At(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-i*c,this._z=s*u+o*c+i*l-r*a,this._w=o*u-i*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,o=this._w;let a=o*e._w+i*e._x+r*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=i,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const p=1-t;return this._w=p*o+t*this._w,this._x=p*i+t*this._x,this._y=p*r+t*this._y,this._z=p*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),h=Math.sin((1-t)*u)/c,d=Math.sin(t*u)/c;return this._w=o*h+this._w*d,this._x=i*h+this._x*d,this._y=r*h+this._y*d,this._z=s*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._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 I{constructor(e=0,t=0,i=0){I.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(l0.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(l0.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*i),u=2*(a*t-s*r),h=2*(s*i-o*t);return this.x=t+l*c+o*h-a*u,this.y=i+l*u+a*c-s*h,this.z=r+l*h+s*u-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 t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-i*l,this.z=i*a-r*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Kh.copy(this).projectOnVector(e),this.sub(Kh)}reflect(e){return this.sub(Kh.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(At(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Kh=new I,l0=new En;class pn{constructor(e=new I(1/0,1/0,1/0),t=new I(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(Jn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(Jn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=Jn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}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,t=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Jn):Jn.fromBufferAttribute(s,o),Jn.applyMatrix4(e.matrixWorld),this.expandByPoint(Jn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),ic.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),ic.copy(i.boundingBox)),ic.applyMatrix4(e.matrixWorld),this.union(ic)}const r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],t);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,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.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,Jn),Jn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ia),rc.subVectors(this.max,ia),Ds.subVectors(e.a,ia),Us.subVectors(e.b,ia),ks.subVectors(e.c,ia),sr.subVectors(Us,Ds),or.subVectors(ks,Us),Vr.subVectors(Ds,ks);let t=[0,-sr.z,sr.y,0,-or.z,or.y,0,-Vr.z,Vr.y,sr.z,0,-sr.x,or.z,0,-or.x,Vr.z,0,-Vr.x,-sr.y,sr.x,0,-or.y,or.x,0,-Vr.y,Vr.x,0];return!Jh(t,Ds,Us,ks,rc)||(t=[1,0,0,0,1,0,0,0,1],!Jh(t,Ds,Us,ks,rc))?!1:(sc.crossVectors(sr,or),t=[sc.x,sc.y,sc.z],Jh(t,Ds,Us,ks,rc))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Jn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Jn).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:(Pi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Pi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Pi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Pi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Pi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Pi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Pi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Pi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Pi),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 Pi=[new I,new I,new I,new I,new I,new I,new I,new I],Jn=new I,ic=new pn,Ds=new I,Us=new I,ks=new I,sr=new I,or=new I,Vr=new I,ia=new I,rc=new I,sc=new I,Hr=new I;function Jh(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){Hr.fromArray(n,s);const a=r.x*Math.abs(Hr.x)+r.y*Math.abs(Hr.y)+r.z*Math.abs(Hr.z),l=e.dot(Hr),c=t.dot(Hr),u=i.dot(Hr);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const fA=new pn,ra=new I,Qh=new I;class rn{constructor(e=new I,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):fA.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),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 t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ra.subVectors(e,this.center);const t=ra.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(ra,r/i),this.radius+=r}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):(Qh.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ra.copy(e.center).add(Qh)),this.expandByPoint(ra.copy(e.center).sub(Qh))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ii=new I,ef=new I,oc=new I,ar=new I,tf=new I,ac=new I,nf=new I;class Go{constructor(e=new I,t=new I(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Ii)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Ii.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ii.copy(this.origin).addScaledVector(this.direction,t),Ii.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){ef.copy(e).add(t).multiplyScalar(.5),oc.copy(t).sub(e).normalize(),ar.copy(this.origin).sub(ef);const s=e.distanceTo(t)*.5,o=-this.direction.dot(oc),a=ar.dot(this.direction),l=-ar.dot(oc),c=ar.lengthSq(),u=Math.abs(1-o*o);let h,d,p,m;if(u>0)if(h=o*l-a,d=o*a-l,m=s*u,h>=0)if(d>=-m)if(d<=m){const x=1/u;h*=x,d*=x,p=h*(h+o*d+2*a)+d*(o*h+d+2*l)+c}else d=s,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*l)+c;else d=-s,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*l)+c;else d<=-m?(h=Math.max(0,-(-o*s+a)),d=h>0?-s:Math.min(Math.max(-s,-l),s),p=-h*h+d*(d+2*l)+c):d<=m?(h=0,d=Math.min(Math.max(-s,-l),s),p=d*(d+2*l)+c):(h=Math.max(0,-(o*s+a)),d=h>0?s:Math.min(Math.max(-s,-l),s),p=-h*h+d*(d+2*l)+c);else d=o>0?-s:s,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(ef).addScaledVector(oc,d),p}intersectSphere(e,t){Ii.subVectors(e.center,this.origin);const i=Ii.dot(this.direction),r=Ii.dot(Ii)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return c>=0?(i=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(i=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),u>=0?(s=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(s=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o<r||isNaN(r))&&(r=o),h>=0?(a=(e.min.z-d.z)*h,l=(e.max.z-d.z)*h):(a=(e.max.z-d.z)*h,l=(e.min.z-d.z)*h),i>l||a>r)||((a>i||i!==i)&&(i=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,Ii)!==null}intersectTriangle(e,t,i,r,s){tf.subVectors(t,e),ac.subVectors(i,e),nf.crossVectors(tf,ac);let o=this.direction.dot(nf),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;ar.subVectors(this.origin,e);const l=a*this.direction.dot(ac.crossVectors(ar,ac));if(l<0)return null;const c=a*this.direction.dot(tf.cross(ar));if(c<0||l+c>o)return null;const u=-a*ar.dot(nf);return u<0?null:this.at(u/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class ke{constructor(e,t,i,r,s,o,a,l,c,u,h,d,p,m,x,g){ke.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c,u,h,d,p,m,x,g)}set(e,t,i,r,s,o,a,l,c,u,h,d,p,m,x,g){const f=this.elements;return f[0]=e,f[4]=t,f[8]=i,f[12]=r,f[1]=s,f[5]=o,f[9]=a,f[13]=l,f[2]=c,f[6]=u,f[10]=h,f[14]=d,f[3]=p,f[7]=m,f[11]=x,f[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ke().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/Os.setFromMatrixColumn(e,0).length(),s=1/Os.setFromMatrixColumn(e,1).length(),o=1/Os.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const d=o*u,p=o*h,m=a*u,x=a*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=p+m*c,t[5]=d-x*c,t[9]=-a*l,t[2]=x-d*c,t[6]=m+p*c,t[10]=o*l}else if(e.order==="YXZ"){const d=l*u,p=l*h,m=c*u,x=c*h;t[0]=d+x*a,t[4]=m*a-p,t[8]=o*c,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=p*a-m,t[6]=x+d*a,t[10]=o*l}else if(e.order==="ZXY"){const d=l*u,p=l*h,m=c*u,x=c*h;t[0]=d-x*a,t[4]=-o*h,t[8]=m+p*a,t[1]=p+m*a,t[5]=o*u,t[9]=x-d*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const d=o*u,p=o*h,m=a*u,x=a*h;t[0]=l*u,t[4]=m*c-p,t[8]=d*c+x,t[1]=l*h,t[5]=x*c+d,t[9]=p*c-m,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const d=o*l,p=o*c,m=a*l,x=a*c;t[0]=l*u,t[4]=x-d*h,t[8]=m*h+p,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=p*h+m,t[10]=d-x*h}else if(e.order==="XZY"){const d=o*l,p=o*c,m=a*l,x=a*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=d*h+x,t[5]=o*u,t[9]=p*h-m,t[2]=m*h-p,t[6]=a*u,t[10]=x*h+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(pA,e,mA)}lookAt(e,t,i){const r=this.elements;return Rn.subVectors(e,t),Rn.lengthSq()===0&&(Rn.z=1),Rn.normalize(),lr.crossVectors(i,Rn),lr.lengthSq()===0&&(Math.abs(i.z)===1?Rn.x+=1e-4:Rn.z+=1e-4,Rn.normalize(),lr.crossVectors(i,Rn)),lr.normalize(),lc.crossVectors(Rn,lr),r[0]=lr.x,r[4]=lc.x,r[8]=Rn.x,r[1]=lr.y,r[5]=lc.y,r[9]=Rn.y,r[2]=lr.z,r[6]=lc.z,r[10]=Rn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],u=i[1],h=i[5],d=i[9],p=i[13],m=i[2],x=i[6],g=i[10],f=i[14],v=i[3],y=i[7],_=i[11],C=i[15],w=r[0],E=r[4],A=r[8],b=r[12],M=r[1],L=r[5],G=r[9],B=r[13],j=r[2],U=r[6],z=r[10],Z=r[14],D=r[3],$=r[7],K=r[11],se=r[15];return s[0]=o*w+a*M+l*j+c*D,s[4]=o*E+a*L+l*U+c*$,s[8]=o*A+a*G+l*z+c*K,s[12]=o*b+a*B+l*Z+c*se,s[1]=u*w+h*M+d*j+p*D,s[5]=u*E+h*L+d*U+p*$,s[9]=u*A+h*G+d*z+p*K,s[13]=u*b+h*B+d*Z+p*se,s[2]=m*w+x*M+g*j+f*D,s[6]=m*E+x*L+g*U+f*$,s[10]=m*A+x*G+g*z+f*K,s[14]=m*b+x*B+g*Z+f*se,s[3]=v*w+y*M+_*j+C*D,s[7]=v*E+y*L+_*U+C*$,s[11]=v*A+y*G+_*z+C*K,s[15]=v*b+y*B+_*Z+C*se,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],h=e[6],d=e[10],p=e[14],m=e[3],x=e[7],g=e[11],f=e[15];return m*(+s*l*h-r*c*h-s*a*d+i*c*d+r*a*p-i*l*p)+x*(+t*l*p-t*c*d+s*o*d-r*o*p+r*c*u-s*l*u)+g*(+t*c*h-t*a*p-s*o*h+i*o*p+s*a*u-i*c*u)+f*(-r*a*u-t*l*h+t*a*d+r*o*h-i*o*d+i*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],p=e[11],m=e[12],x=e[13],g=e[14],f=e[15],v=h*g*c-x*d*c+x*l*p-a*g*p-h*l*f+a*d*f,y=m*d*c-u*g*c-m*l*p+o*g*p+u*l*f-o*d*f,_=u*x*c-m*h*c+m*a*p-o*x*p-u*a*f+o*h*f,C=m*h*l-u*x*l-m*a*d+o*x*d+u*a*g-o*h*g,w=t*v+i*y+r*_+s*C;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const E=1/w;return e[0]=v*E,e[1]=(x*d*s-h*g*s-x*r*p+i*g*p+h*r*f-i*d*f)*E,e[2]=(a*g*s-x*l*s+x*r*c-i*g*c-a*r*f+i*l*f)*E,e[3]=(h*l*s-a*d*s-h*r*c+i*d*c+a*r*p-i*l*p)*E,e[4]=y*E,e[5]=(u*g*s-m*d*s+m*r*p-t*g*p-u*r*f+t*d*f)*E,e[6]=(m*l*s-o*g*s-m*r*c+t*g*c+o*r*f-t*l*f)*E,e[7]=(o*d*s-u*l*s+u*r*c-t*d*c-o*r*p+t*l*p)*E,e[8]=_*E,e[9]=(m*h*s-u*x*s-m*i*p+t*x*p+u*i*f-t*h*f)*E,e[10]=(o*x*s-m*a*s+m*i*c-t*x*c-o*i*f+t*a*f)*E,e[11]=(u*a*s-o*h*s-u*i*c+t*h*c+o*i*p-t*a*p)*E,e[12]=C*E,e[13]=(u*x*r-m*h*r+m*i*d-t*x*d-u*i*g+t*h*g)*E,e[14]=(m*a*r-o*x*r-m*i*l+t*x*l+o*i*g-t*a*g)*E,e[15]=(o*h*r-u*a*r+u*i*l-t*h*l-o*i*d+t*a*d)*E,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+i,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+i,u*l-r*o,0,c*l-r*a,u*l+r*o,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,o){return this.set(1,i,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,h=a+a,d=s*c,p=s*u,m=s*h,x=o*u,g=o*h,f=a*h,v=l*c,y=l*u,_=l*h,C=i.x,w=i.y,E=i.z;return r[0]=(1-(x+f))*C,r[1]=(p+_)*C,r[2]=(m-y)*C,r[3]=0,r[4]=(p-_)*w,r[5]=(1-(d+f))*w,r[6]=(g+v)*w,r[7]=0,r[8]=(m+y)*E,r[9]=(g-v)*E,r[10]=(1-(d+x))*E,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=Os.set(r[0],r[1],r[2]).length();const o=Os.set(r[4],r[5],r[6]).length(),a=Os.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Qn.copy(this);const c=1/s,u=1/o,h=1/a;return Qn.elements[0]*=c,Qn.elements[1]*=c,Qn.elements[2]*=c,Qn.elements[4]*=u,Qn.elements[5]*=u,Qn.elements[6]*=u,Qn.elements[8]*=h,Qn.elements[9]*=h,Qn.elements[10]*=h,t.setFromRotationMatrix(Qn),i.x=s,i.y=o,i.z=a,this}makePerspective(e,t,i,r,s,o,a=_i){const l=this.elements,c=2*s/(t-e),u=2*s/(i-r),h=(t+e)/(t-e),d=(i+r)/(i-r);let p,m;if(a===_i)p=-(o+s)/(o-s),m=-2*o*s/(o-s);else if(a===fl)p=-o/(o-s),m=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=u,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,o,a=_i){const l=this.elements,c=1/(t-e),u=1/(i-r),h=1/(o-s),d=(t+e)*c,p=(i+r)*u;let m,x;if(a===_i)m=(o+s)*h,x=-2*h;else if(a===fl)m=s*h,x=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=x,l[14]=-m,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const Os=new I,Qn=new ke,pA=new I(0,0,0),mA=new I(1,1,1),lr=new I,lc=new I,Rn=new I,c0=new ke,u0=new En;class On{constructor(e=0,t=0,i=0,r=On.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],h=r[2],d=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(At(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-At(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(At(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-At(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(At(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-At(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return c0.makeRotationFromQuaternion(e),this.setFromRotationMatrix(c0,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return u0.setFromEuler(this),this.setFromQuaternion(u0,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}On.DEFAULT_ORDER="XYZ";class zd{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 gA=0;const d0=new I,Fs=new En,Ni=new ke,cc=new I,sa=new I,xA=new I,vA=new En,h0=new I(1,0,0),f0=new I(0,1,0),p0=new I(0,0,1),m0={type:"added"},yA={type:"removed"},Bs={type:"childadded",child:null},rf={type:"childremoved",child:null};class nt extends Ti{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:gA++}),this.uuid=Un(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=nt.DEFAULT_UP.clone();const e=new I,t=new On,i=new En,r=new I(1,1,1);function s(){i.setFromEuler(t,!1)}function o(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new ke},normalMatrix:{value:new je}}),this.matrix=new ke,this.matrixWorld=new ke,this.matrixAutoUpdate=nt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=nt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new zd,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,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Fs.setFromAxisAngle(e,t),this.quaternion.multiply(Fs),this}rotateOnWorldAxis(e,t){return Fs.setFromAxisAngle(e,t),this.quaternion.premultiply(Fs),this}rotateX(e){return this.rotateOnAxis(h0,e)}rotateY(e){return this.rotateOnAxis(f0,e)}rotateZ(e){return this.rotateOnAxis(p0,e)}translateOnAxis(e,t){return d0.copy(e).applyQuaternion(this.quaternion),this.position.add(d0.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(h0,e)}translateY(e){return this.translateOnAxis(f0,e)}translateZ(e){return this.translateOnAxis(p0,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Ni.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?cc.copy(e):cc.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),sa.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ni.lookAt(sa,cc,this.up):Ni.lookAt(cc,sa,this.up),this.quaternion.setFromRotationMatrix(Ni),r&&(Ni.extractRotation(r.matrixWorld),Fs.setFromRotationMatrix(Ni),this.quaternion.premultiply(Fs.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);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(m0),Bs.child=e,this.dispatchEvent(Bs),Bs.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(yA),rf.child=e,this.dispatchEvent(rf),rf.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),Ni.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Ni.multiply(e.parent.matrixWorld)),e.applyMatrix4(Ni),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(m0),Bs.child=e,this.dispatchEvent(Bs),Bs.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){const o=this.children[i].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(sa,e,xA),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(sa,vA,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.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 t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.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)),t===!0){const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.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()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.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?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.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,u=l.length;c<u;c++){const h=l[c];s(e.shapes,h)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.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]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];r.animations.push(s(e.animations,l))}}if(t){const a=o(e.geometries),l=o(e.materials),c=o(e.textures),u=o(e.images),h=o(e.shapes),d=o(e.skeletons),p=o(e.animations),m=o(e.nodes);a.length>0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),h.length>0&&(i.shapes=h),d.length>0&&(i.skeletons=d),p.length>0&&(i.animations=p),m.length>0&&(i.nodes=m)}return i.object=r,i;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.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)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}nt.DEFAULT_UP=new I(0,1,0);nt.DEFAULT_MATRIX_AUTO_UPDATE=!0;nt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const ei=new I,Li=new I,sf=new I,Di=new I,zs=new I,Vs=new I,g0=new I,of=new I,af=new I,lf=new I;class Nn{constructor(e=new I,t=new I,i=new I){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),ei.subVectors(e,t),r.cross(ei);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){ei.subVectors(r,t),Li.subVectors(i,t),sf.subVectors(e,t);const o=ei.dot(ei),a=ei.dot(Li),l=ei.dot(sf),c=Li.dot(Li),u=Li.dot(sf),h=o*c-a*a;if(h===0)return s.set(0,0,0),null;const d=1/h,p=(c*l-a*u)*d,m=(o*u-a*l)*d;return s.set(1-p-m,m,p)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,Di)===null?!1:Di.x>=0&&Di.y>=0&&Di.x+Di.y<=1}static getInterpolation(e,t,i,r,s,o,a,l){return this.getBarycoord(e,t,i,r,Di)===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,Di.x),l.addScaledVector(o,Di.y),l.addScaledVector(a,Di.z),l)}static isFrontFacing(e,t,i,r){return ei.subVectors(i,t),Li.subVectors(e,t),ei.cross(Li).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),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 ei.subVectors(this.c,this.b),Li.subVectors(this.a,this.b),ei.cross(Li).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Nn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Nn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return Nn.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return Nn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Nn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let o,a;zs.subVectors(r,i),Vs.subVectors(s,i),of.subVectors(e,i);const l=zs.dot(of),c=Vs.dot(of);if(l<=0&&c<=0)return t.copy(i);af.subVectors(e,r);const u=zs.dot(af),h=Vs.dot(af);if(u>=0&&h<=u)return t.copy(r);const d=l*h-u*c;if(d<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(i).addScaledVector(zs,o);lf.subVectors(e,s);const p=zs.dot(lf),m=Vs.dot(lf);if(m>=0&&p<=m)return t.copy(s);const x=p*c-l*m;if(x<=0&&c>=0&&m<=0)return a=c/(c-m),t.copy(i).addScaledVector(Vs,a);const g=u*m-p*h;if(g<=0&&h-u>=0&&p-m>=0)return g0.subVectors(s,r),a=(h-u)/(h-u+(p-m)),t.copy(r).addScaledVector(g0,a);const f=1/(g+x+d);return o=x*f,a=d*f,t.copy(i).addScaledVector(zs,o).addScaledVector(Vs,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const lM={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},cr={h:0,s:0,l:0},uc={h:0,s:0,l:0};function cf(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class _e{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Hn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,rt.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=rt.workingColorSpace){return this.r=e,this.g=t,this.b=i,rt.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=rt.workingColorSpace){if(e=Qm(e,1),t=At(t,0,1),i=At(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,o=2*i-s;this.r=cf(o,s,e+1/3),this.g=cf(o,s,e),this.b=cf(o,s,e-1/3)}return rt.toWorkingColorSpace(this,r),this}setStyle(e,t=Hn){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[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 i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Hn){const i=lM[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Eo(e.r),this.g=Eo(e.g),this.b=Eo(e.b),this}copyLinearToSRGB(e){return this.r=qh(e.r),this.g=qh(e.g),this.b=qh(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Hn){return rt.fromWorkingColorSpace(en.copy(this),e),Math.round(At(en.r*255,0,255))*65536+Math.round(At(en.g*255,0,255))*256+Math.round(At(en.b*255,0,255))}getHexString(e=Hn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=rt.workingColorSpace){rt.fromWorkingColorSpace(en.copy(this),t);const i=en.r,r=en.g,s=en.b,o=Math.max(i,r,s),a=Math.min(i,r,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const h=o-a;switch(c=u<=.5?h/(o+a):h/(2-o-a),o){case i:l=(r-s)/h+(r<s?6:0);break;case r:l=(s-i)/h+2;break;case s:l=(i-r)/h+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=rt.workingColorSpace){return rt.fromWorkingColorSpace(en.copy(this),t),e.r=en.r,e.g=en.g,e.b=en.b,e}getStyle(e=Hn){rt.fromWorkingColorSpace(en.copy(this),e);const t=en.r,i=en.g,r=en.b;return e!==Hn?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(cr),this.setHSL(cr.h+e,cr.s+t,cr.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.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,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(cr),e.getHSL(uc);const i=ka(cr.h,uc.h,t),r=ka(cr.s,uc.s,t),s=ka(cr.l,uc.l,t);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const en=new _e;_e.NAMES=lM;let _A=0;class on extends Ti{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:_A++}),this.uuid=Un(),this.name="",this.type="Material",this.blending=fs,this.side=Zi,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Lu,this.blendDst=Du,this.blendEquation=vr,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new _e(0,0,0),this.blendAlpha=0,this.depthFunc=nl,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Lp,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ts,this.stencilZFail=ts,this.stencilZPass=ts,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 t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==fs&&(i.blending=this.blending),this.side!==Zi&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==Lu&&(i.blendSrc=this.blendSrc),this.blendDst!==Du&&(i.blendDst=this.blendDst),this.blendEquation!==vr&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==nl&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Lp&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ts&&(i.stencilFail=this.stencilFail),this.stencilZFail!==ts&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==ts&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(i.textures=s),o.length>0&&(i.images=o)}return i}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 t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,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 Or extends on{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new _e(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 On,this.combine=Cl,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 Bi=SA();function SA(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(i[l]=0,i[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(i[l]=1024>>-c-14,i[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[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,u=0;for(;!(c&8388608);)c<<=1,u-=8388608;c&=-8388609,u+=947912704,s[l]=c|u}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:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function vn(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=At(n,-65504,65504),Bi.floatView[0]=n;const e=Bi.uint32View[0],t=e>>23&511;return Bi.baseTable[t]+((e&8388607)>>Bi.shiftTable[t])}function ya(n){const e=n>>10;return Bi.uint32View[0]=Bi.mantissaTable[Bi.offsetTable[e]+(n&1023)]+Bi.exponentTable[e],Bi.floatView[0]}const MA={toHalfFloat:vn,fromHalfFloat:ya},Lt=new I,dc=new Q;class ht{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=hl,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Sn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return bo("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}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,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)dc.fromBufferAttribute(this,t),dc.applyMatrix3(e),this.setXY(t,dc.x,dc.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)Lt.fromBufferAttribute(this,t),Lt.applyMatrix3(e),this.setXYZ(t,Lt.x,Lt.y,Lt.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)Lt.fromBufferAttribute(this,t),Lt.applyMatrix4(e),this.setXYZ(t,Lt.x,Lt.y,Lt.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Lt.fromBufferAttribute(this,t),Lt.applyNormalMatrix(e),this.setXYZ(t,Lt.x,Lt.y,Lt.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Lt.fromBufferAttribute(this,t),Lt.transformDirection(e),this.setXYZ(t,Lt.x,Lt.y,Lt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=un(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Xe(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=un(t,this.array)),t}setX(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=un(t,this.array)),t}setY(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=un(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=un(t,this.array)),t}setW(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array),r=Xe(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array),r=Xe(r,this.array),s=Xe(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,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!==hl&&(e.usage=this.usage),e}}class wA extends ht{constructor(e,t,i){super(new Int8Array(e),t,i)}}class bA extends ht{constructor(e,t,i){super(new Uint8Array(e),t,i)}}class EA extends ht{constructor(e,t,i){super(new Uint8ClampedArray(e),t,i)}}class TA extends ht{constructor(e,t,i){super(new Int16Array(e),t,i)}}class tg extends ht{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class AA extends ht{constructor(e,t,i){super(new Int32Array(e),t,i)}}class ng extends ht{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class CA extends ht{constructor(e,t,i){super(new Uint16Array(e),t,i),this.isFloat16BufferAttribute=!0}getX(e){let t=ya(this.array[e*this.itemSize]);return this.normalized&&(t=un(t,this.array)),t}setX(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize]=vn(t),this}getY(e){let t=ya(this.array[e*this.itemSize+1]);return this.normalized&&(t=un(t,this.array)),t}setY(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize+1]=vn(t),this}getZ(e){let t=ya(this.array[e*this.itemSize+2]);return this.normalized&&(t=un(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize+2]=vn(t),this}getW(e){let t=ya(this.array[e*this.itemSize+3]);return this.normalized&&(t=un(t,this.array)),t}setW(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize+3]=vn(t),this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array)),this.array[e+0]=vn(t),this.array[e+1]=vn(i),this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array),r=Xe(r,this.array)),this.array[e+0]=vn(t),this.array[e+1]=vn(i),this.array[e+2]=vn(r),this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array),r=Xe(r,this.array),s=Xe(s,this.array)),this.array[e+0]=vn(t),this.array[e+1]=vn(i),this.array[e+2]=vn(r),this.array[e+3]=vn(s),this}}class Pe extends ht{constructor(e,t,i){super(new Float32Array(e),t,i)}}let RA=0;const Vn=new ke,uf=new nt,Hs=new I,Pn=new pn,oa=new pn,Vt=new I;class Ye extends Ti{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:RA++}),this.uuid=Un(),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(rM(e)?ng:tg)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new je().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Vn.makeRotationFromQuaternion(e),this.applyMatrix4(Vn),this}rotateX(e){return Vn.makeRotationX(e),this.applyMatrix4(Vn),this}rotateY(e){return Vn.makeRotationY(e),this.applyMatrix4(Vn),this}rotateZ(e){return Vn.makeRotationZ(e),this.applyMatrix4(Vn),this}translate(e,t,i){return Vn.makeTranslation(e,t,i),this.applyMatrix4(Vn),this}scale(e,t,i){return Vn.makeScale(e,t,i),this.applyMatrix4(Vn),this}lookAt(e){return uf.lookAt(e),uf.updateMatrix(),this.applyMatrix4(uf.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Hs).negate(),this.translate(Hs.x,Hs.y,Hs.z),this}setFromPoints(e){const t=[];for(let i=0,r=e.length;i<r;i++){const s=e[i];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new Pe(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new pn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new I(-1/0,-1/0,-1/0),new I(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];Pn.setFromBufferAttribute(s),this.morphTargetsRelative?(Vt.addVectors(this.boundingBox.min,Pn.min),this.boundingBox.expandByPoint(Vt),Vt.addVectors(this.boundingBox.max,Pn.max),this.boundingBox.expandByPoint(Vt)):(this.boundingBox.expandByPoint(Pn.min),this.boundingBox.expandByPoint(Pn.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 rn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new I,1/0);return}if(e){const i=this.boundingSphere.center;if(Pn.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const a=t[s];oa.setFromBufferAttribute(a),this.morphTargetsRelative?(Vt.addVectors(Pn.min,oa.min),Pn.expandByPoint(Vt),Vt.addVectors(Pn.max,oa.max),Pn.expandByPoint(Vt)):(Pn.expandByPoint(oa.min),Pn.expandByPoint(oa.max))}Pn.getCenter(i);let r=0;for(let s=0,o=e.count;s<o;s++)Vt.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(Vt));if(t)for(let s=0,o=t.length;s<o;s++){const a=t[s],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)Vt.fromBufferAttribute(a,c),l&&(Hs.fromBufferAttribute(e,c),Vt.add(Hs)),r=Math.max(r,i.distanceToSquared(Vt))}this.boundingSphere.radius=Math.sqrt(r),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,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new ht(new Float32Array(4*i.count),4));const o=this.getAttribute("tangent"),a=[],l=[];for(let A=0;A<i.count;A++)a[A]=new I,l[A]=new I;const c=new I,u=new I,h=new I,d=new Q,p=new Q,m=new Q,x=new I,g=new I;function f(A,b,M){c.fromBufferAttribute(i,A),u.fromBufferAttribute(i,b),h.fromBufferAttribute(i,M),d.fromBufferAttribute(s,A),p.fromBufferAttribute(s,b),m.fromBufferAttribute(s,M),u.sub(c),h.sub(c),p.sub(d),m.sub(d);const L=1/(p.x*m.y-m.x*p.y);isFinite(L)&&(x.copy(u).multiplyScalar(m.y).addScaledVector(h,-p.y).multiplyScalar(L),g.copy(h).multiplyScalar(p.x).addScaledVector(u,-m.x).multiplyScalar(L),a[A].add(x),a[b].add(x),a[M].add(x),l[A].add(g),l[b].add(g),l[M].add(g))}let v=this.groups;v.length===0&&(v=[{start:0,count:e.count}]);for(let A=0,b=v.length;A<b;++A){const M=v[A],L=M.start,G=M.count;for(let B=L,j=L+G;B<j;B+=3)f(e.getX(B+0),e.getX(B+1),e.getX(B+2))}const y=new I,_=new I,C=new I,w=new I;function E(A){C.fromBufferAttribute(r,A),w.copy(C);const b=a[A];y.copy(b),y.sub(C.multiplyScalar(C.dot(b))).normalize(),_.crossVectors(w,b);const L=_.dot(l[A])<0?-1:1;o.setXYZW(A,y.x,y.y,y.z,L)}for(let A=0,b=v.length;A<b;++A){const M=v[A],L=M.start,G=M.count;for(let B=L,j=L+G;B<j;B+=3)E(e.getX(B+0)),E(e.getX(B+1)),E(e.getX(B+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new ht(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let d=0,p=i.count;d<p;d++)i.setXYZ(d,0,0,0);const r=new I,s=new I,o=new I,a=new I,l=new I,c=new I,u=new I,h=new I;if(e)for(let d=0,p=e.count;d<p;d+=3){const m=e.getX(d+0),x=e.getX(d+1),g=e.getX(d+2);r.fromBufferAttribute(t,m),s.fromBufferAttribute(t,x),o.fromBufferAttribute(t,g),u.subVectors(o,s),h.subVectors(r,s),u.cross(h),a.fromBufferAttribute(i,m),l.fromBufferAttribute(i,x),c.fromBufferAttribute(i,g),a.add(u),l.add(u),c.add(u),i.setXYZ(m,a.x,a.y,a.z),i.setXYZ(x,l.x,l.y,l.z),i.setXYZ(g,c.x,c.y,c.z)}else for(let d=0,p=t.count;d<p;d+=3)r.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),o.fromBufferAttribute(t,d+2),u.subVectors(o,s),h.subVectors(r,s),u.cross(h),i.setXYZ(d+0,u.x,u.y,u.z),i.setXYZ(d+1,u.x,u.y,u.z),i.setXYZ(d+2,u.x,u.y,u.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)Vt.fromBufferAttribute(e,t),Vt.normalize(),e.setXYZ(t,Vt.x,Vt.y,Vt.z)}toNonIndexed(){function e(a,l){const c=a.array,u=a.itemSize,h=a.normalized,d=new c.constructor(l.length*u);let p=0,m=0;for(let x=0,g=l.length;x<g;x++){a.isInterleavedBufferAttribute?p=l[x]*a.data.stride+a.offset:p=l[x]*u;for(let f=0;f<u;f++)d[m++]=c[p++]}return new ht(d,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Ye,i=this.index.array,r=this.attributes;for(const a in r){const l=r[a],c=e(l,i);t.setAttribute(a,c)}const s=this.morphAttributes;for(const a in s){const l=[],c=s[a];for(let u=0,h=c.length;u<h;u++){const d=c[u],p=e(d,i);l.push(p)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}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 t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,d=c.length;h<d;h++){const p=c[h];u.push(p.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],h=s[c];for(let d=0,p=h.length;d<p;d++)u.push(h[d].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let c=0,u=o.length;c<u;c++){const h=o[c];this.addGroup(h.start,h.count,h.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 x0=new ke,Gr=new Go,hc=new rn,v0=new I,Gs=new I,Ws=new I,js=new I,df=new I,fc=new I,pc=new Q,mc=new Q,gc=new Q,y0=new I,_0=new I,S0=new I,xc=new I,vc=new I;class kt extends nt{constructor(e=new Ye,t=new Or){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),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 t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,o=i.morphTargetsRelative;t.fromBufferAttribute(r,e);const a=this.morphTargetInfluences;if(s&&a){fc.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=a[l],h=s[l];u!==0&&(df.fromBufferAttribute(h,e),o?fc.addScaledVector(df,u):fc.addScaledVector(df.sub(t),u))}t.add(fc)}return t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),hc.copy(i.boundingSphere),hc.applyMatrix4(s),Gr.copy(e.ray).recast(e.near),!(hc.containsPoint(Gr.origin)===!1&&(Gr.intersectSphere(hc,v0)===null||Gr.origin.distanceToSquared(v0)>(e.far-e.near)**2))&&(x0.copy(s).invert(),Gr.copy(e.ray).applyMatrix4(x0),!(i.boundingBox!==null&&Gr.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Gr)))}_computeIntersections(e,t,i){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,d=s.groups,p=s.drawRange;if(a!==null)if(Array.isArray(o))for(let m=0,x=d.length;m<x;m++){const g=d[m],f=o[g.materialIndex],v=Math.max(g.start,p.start),y=Math.min(a.count,Math.min(g.start+g.count,p.start+p.count));for(let _=v,C=y;_<C;_+=3){const w=a.getX(_),E=a.getX(_+1),A=a.getX(_+2);r=yc(this,f,e,i,c,u,h,w,E,A),r&&(r.faceIndex=Math.floor(_/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{const m=Math.max(0,p.start),x=Math.min(a.count,p.start+p.count);for(let g=m,f=x;g<f;g+=3){const v=a.getX(g),y=a.getX(g+1),_=a.getX(g+2);r=yc(this,o,e,i,c,u,h,v,y,_),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let m=0,x=d.length;m<x;m++){const g=d[m],f=o[g.materialIndex],v=Math.max(g.start,p.start),y=Math.min(l.count,Math.min(g.start+g.count,p.start+p.count));for(let _=v,C=y;_<C;_+=3){const w=_,E=_+1,A=_+2;r=yc(this,f,e,i,c,u,h,w,E,A),r&&(r.faceIndex=Math.floor(_/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{const m=Math.max(0,p.start),x=Math.min(l.count,p.start+p.count);for(let g=m,f=x;g<f;g+=3){const v=g,y=g+1,_=g+2;r=yc(this,o,e,i,c,u,h,v,y,_),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}}}function PA(n,e,t,i,r,s,o,a){let l;if(e.side===fn?l=i.intersectTriangle(o,s,r,!0,a):l=i.intersectTriangle(r,s,o,e.side===Zi,a),l===null)return null;vc.copy(a),vc.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(vc);return c<t.near||c>t.far?null:{distance:c,point:vc.clone(),object:n}}function yc(n,e,t,i,r,s,o,a,l,c){n.getVertexPosition(a,Gs),n.getVertexPosition(l,Ws),n.getVertexPosition(c,js);const u=PA(n,e,t,i,Gs,Ws,js,xc);if(u){r&&(pc.fromBufferAttribute(r,a),mc.fromBufferAttribute(r,l),gc.fromBufferAttribute(r,c),u.uv=Nn.getInterpolation(xc,Gs,Ws,js,pc,mc,gc,new Q)),s&&(pc.fromBufferAttribute(s,a),mc.fromBufferAttribute(s,l),gc.fromBufferAttribute(s,c),u.uv1=Nn.getInterpolation(xc,Gs,Ws,js,pc,mc,gc,new Q)),o&&(y0.fromBufferAttribute(o,a),_0.fromBufferAttribute(o,l),S0.fromBufferAttribute(o,c),u.normal=Nn.getInterpolation(xc,Gs,Ws,js,y0,_0,S0,new I),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const h={a,b:l,c,normal:new I,materialIndex:0};Nn.getNormal(Gs,Ws,js,h.normal),u.face=h}return u}class Cs extends Ye{constructor(e=1,t=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],h=[];let d=0,p=0;m("z","y","x",-1,-1,i,t,e,o,s,0),m("z","y","x",1,-1,i,t,-e,o,s,1),m("x","z","y",1,1,e,i,t,r,o,2),m("x","z","y",1,-1,e,i,-t,r,o,3),m("x","y","z",1,-1,e,t,i,r,s,4),m("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new Pe(c,3)),this.setAttribute("normal",new Pe(u,3)),this.setAttribute("uv",new Pe(h,2));function m(x,g,f,v,y,_,C,w,E,A,b){const M=_/E,L=C/A,G=_/2,B=C/2,j=w/2,U=E+1,z=A+1;let Z=0,D=0;const $=new I;for(let K=0;K<z;K++){const se=K*L-B;for(let Te=0;Te<U;Te++){const qe=Te*M-G;$[x]=qe*v,$[g]=se*y,$[f]=j,c.push($.x,$.y,$.z),$[x]=0,$[g]=0,$[f]=w>0?1:-1,u.push($.x,$.y,$.z),h.push(Te/E),h.push(1-K/A),Z+=1}}for(let K=0;K<A;K++)for(let se=0;se<E;se++){const Te=d+se+U*K,qe=d+se+U*(K+1),X=d+(se+1)+U*(K+1),oe=d+(se+1)+U*K;l.push(Te,qe,oe),l.push(qe,X,oe),D+=6}a.addGroup(p,D,b),p+=D,d+=Z}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Cs(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function ko(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone():Array.isArray(r)?e[t][i]=r.slice():e[t][i]=r}}return e}function ln(n){const e={};for(let t=0;t<n.length;t++){const i=ko(n[t]);for(const r in i)e[r]=i[r]}return e}function IA(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function cM(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:rt.workingColorSpace}const uM={clone:ko,merge:ln};var NA=`void main() {
62
+ */const Rd="168",oT={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},aT={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},aS=0,Cp=1,lS=2,lT=3,cT=0,Vm=1,cS=2,gi=3,Zi=0,fn=1,vi=2,Wi=0,fs=1,Rp=2,Pp=3,Ip=4,uS=5,vr=100,dS=101,hS=102,fS=103,pS=104,mS=200,gS=201,xS=202,vS=203,Du=204,Uu=205,yS=206,_S=207,SS=208,MS=209,wS=210,bS=211,ES=212,TS=213,AS=214,CS=0,RS=1,PS=2,nl=3,IS=4,NS=5,LS=6,DS=7,Rl=0,US=1,kS=2,ji=0,OS=1,FS=2,BS=3,zS=4,VS=5,HS=6,GS=7,Np="attached",WS="detached",Pd=300,Ki=301,Ir=302,il=303,rl=304,Vo=306,sl=1e3,Xn=1001,ol=1002,Gt=1003,Hm=1004,uT=1004,fo=1005,dT=1005,Ut=1006,Pa=1007,hT=1007,yi=1008,fT=1008,Ei=1009,Gm=1010,Wm=1011,Do=1012,Id=1013,Ji=1014,Sn=1015,Ho=1016,Nd=1017,Ld=1018,Ms=1020,jm=35902,Xm=1021,$m=1022,dn=1023,Ym=1024,qm=1025,ps=1026,ws=1027,Dd=1028,Pl=1029,Zm=1030,Ud=1031,pT=1032,kd=1033,Ia=33776,Na=33777,La=33778,Da=33779,ku=35840,Ou=35841,Fu=35842,Bu=35843,zu=36196,Vu=37492,Hu=37496,Gu=37808,Wu=37809,ju=37810,Xu=37811,$u=37812,Yu=37813,qu=37814,Zu=37815,Ku=37816,Ju=37817,Qu=37818,ed=37819,td=37820,nd=37821,Ua=36492,id=36494,rd=36495,Km=36283,sd=36284,od=36285,ad=36286,jS=2200,XS=2201,$S=2202,al=2300,ld=2301,lu=2302,as=2400,ls=2401,ll=2402,Od=2500,Jm=2501,mT=0,gT=1,xT=2,YS=3200,qS=3201,vT=3202,yT=3203,kr=0,ZS=1,Fi="",Hn="srgb",tr="srgb-linear",Fd="display-p3",Il="display-p3-linear",cl="linear",ft="srgb",ul="rec709",dl="p3",_T=0,ts=7680,ST=7681,MT=7682,wT=7683,bT=34055,ET=34056,TT=5386,AT=512,CT=513,RT=514,PT=515,IT=516,NT=517,LT=518,Lp=519,KS=512,JS=513,QS=514,Qm=515,eM=516,tM=517,nM=518,iM=519,hl=35044,DT=35048,UT=35040,kT=35045,OT=35049,FT=35041,BT=35046,zT=35050,VT=35042,HT="100",Dp="300 es",_i=2e3,fl=2001;class Ti{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}}const Qt=["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 s0=1234567;const ms=Math.PI/180,Uo=180/Math.PI;function Un(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Qt[n&255]+Qt[n>>8&255]+Qt[n>>16&255]+Qt[n>>24&255]+"-"+Qt[e&255]+Qt[e>>8&255]+"-"+Qt[e>>16&15|64]+Qt[e>>24&255]+"-"+Qt[t&63|128]+Qt[t>>8&255]+"-"+Qt[t>>16&255]+Qt[t>>24&255]+Qt[i&255]+Qt[i>>8&255]+Qt[i>>16&255]+Qt[i>>24&255]).toLowerCase()}function At(n,e,t){return Math.max(e,Math.min(t,n))}function eg(n,e){return(n%e+e)%e}function GT(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function WT(n,e,t){return n!==e?(t-n)/(e-n):0}function ka(n,e,t){return(1-t)*n+t*e}function jT(n,e,t,i){return ka(n,e,1-Math.exp(-t*i))}function XT(n,e=1){return e-Math.abs(eg(n,e*2)-e)}function $T(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function YT(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function qT(n,e){return n+Math.floor(Math.random()*(e-n+1))}function ZT(n,e){return n+Math.random()*(e-n)}function KT(n){return n*(.5-Math.random())}function JT(n){n!==void 0&&(s0=n);let e=s0+=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 QT(n){return n*ms}function eA(n){return n*Uo}function tA(n){return(n&n-1)===0&&n!==0}function nA(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function iA(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function rA(n,e,t,i,r){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+i)/2),u=o((e+i)/2),h=s((e-i)/2),d=o((e-i)/2),p=s((i-e)/2),m=o((i-e)/2);switch(r){case"XYX":n.set(a*u,l*h,l*d,a*c);break;case"YZY":n.set(l*d,a*u,l*h,a*c);break;case"ZXZ":n.set(l*h,l*d,a*u,a*c);break;case"XZX":n.set(a*u,l*m,l*p,a*c);break;case"YXY":n.set(l*p,a*u,l*m,a*c);break;case"ZYZ":n.set(l*m,l*p,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function un(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Xe(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const sA={DEG2RAD:ms,RAD2DEG:Uo,generateUUID:Un,clamp:At,euclideanModulo:eg,mapLinear:GT,inverseLerp:WT,lerp:ka,damp:jT,pingpong:XT,smoothstep:$T,smootherstep:YT,randInt:qT,randFloat:ZT,randFloatSpread:KT,seededRandom:JT,degToRad:QT,radToDeg:eA,isPowerOfTwo:tA,ceilPowerOfTwo:nA,floorPowerOfTwo:iA,setQuaternionFromProperEuler:rA,normalize:Xe,denormalize:un};class Q{constructor(e=0,t=0){Q.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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 t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(At(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class je{constructor(e,t,i,r,s,o,a,l,c){je.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c)}set(e,t,i,r,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=i,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],u=i[4],h=i[7],d=i[2],p=i[5],m=i[8],x=r[0],g=r[3],f=r[6],v=r[1],y=r[4],_=r[7],R=r[2],w=r[5],E=r[8];return s[0]=o*x+a*v+l*R,s[3]=o*g+a*y+l*w,s[6]=o*f+a*_+l*E,s[1]=c*x+u*v+h*R,s[4]=c*g+u*y+h*w,s[7]=c*f+u*_+h*E,s[2]=d*x+p*v+m*R,s[5]=d*g+p*y+m*w,s[8]=d*f+p*_+m*E,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-i*s*u+i*a*l+r*s*c-r*o*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=u*o-a*c,d=a*l-u*s,p=c*s-o*l,m=t*h+i*d+r*p;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/m;return e[0]=h*x,e[1]=(r*c-u*i)*x,e[2]=(a*i-r*o)*x,e[3]=d*x,e[4]=(u*t-r*l)*x,e[5]=(r*s-a*t)*x,e[6]=p*x,e[7]=(i*l-c*t)*x,e[8]=(o*t-i*s)*x,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Yh.makeScale(e,t)),this}rotate(e){return this.premultiply(Yh.makeRotation(-e)),this}translate(e,t){return this.premultiply(Yh.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Yh=new je;function rM(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const oA={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function po(n,e){return new oA[n](e)}function pl(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function sM(){const n=pl("canvas");return n.style.display="block",n}const o0={};function bo(n){n in o0||(o0[n]=!0,console.warn(n))}function aA(n,e,t){return new Promise(function(i,r){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:r();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}const a0=new je().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),l0=new je().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),na={[tr]:{transfer:cl,primaries:ul,luminanceCoefficients:[.2126,.7152,.0722],toReference:n=>n,fromReference:n=>n},[Hn]:{transfer:ft,primaries:ul,luminanceCoefficients:[.2126,.7152,.0722],toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[Il]:{transfer:cl,primaries:dl,luminanceCoefficients:[.2289,.6917,.0793],toReference:n=>n.applyMatrix3(l0),fromReference:n=>n.applyMatrix3(a0)},[Fd]:{transfer:ft,primaries:dl,luminanceCoefficients:[.2289,.6917,.0793],toReference:n=>n.convertSRGBToLinear().applyMatrix3(l0),fromReference:n=>n.applyMatrix3(a0).convertLinearToSRGB()}},lA=new Set([tr,Il]),rt={enabled:!0,_workingColorSpace:tr,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!lA.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=na[e].toReference,r=na[t].fromReference;return r(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return na[n].primaries},getTransfer:function(n){return n===Fi?cl:na[n].transfer},getLuminanceCoefficients:function(n,e=this._workingColorSpace){return n.fromArray(na[e].luminanceCoefficients)}};function Eo(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function qh(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Ls;class oM{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Ls===void 0&&(Ls=pl("canvas")),Ls.width=e.width,Ls.height=e.height;const i=Ls.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Ls}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=pl("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=Eo(s[o]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(Eo(t[i]/255)*255):t[i]=Eo(t[i]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let cA=0;class cs{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:cA++}),this.uuid=Un(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push(Zh(r[o].image)):s.push(Zh(r[o]))}else s=Zh(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function Zh(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?oM.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let uA=0;class Ct extends Ti{constructor(e=Ct.DEFAULT_IMAGE,t=Ct.DEFAULT_MAPPING,i=Xn,r=Xn,s=Ut,o=yi,a=dn,l=Ei,c=Ct.DEFAULT_ANISOTROPY,u=Fi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:uA++}),this.uuid=Un(),this.name="",this.source=new cs(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Q(0,0),this.repeat=new Q(1,1),this.center=new Q(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new je,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,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 t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={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&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Pd)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case sl:e.x=e.x-Math.floor(e.x);break;case Xn:e.x=e.x<0?0:1;break;case ol: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 sl:e.y=e.y-Math.floor(e.y);break;case Xn:e.y=e.y<0?0:1;break;case ol: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++}}Ct.DEFAULT_IMAGE=null;Ct.DEFAULT_MAPPING=Pd;Ct.DEFAULT_ANISOTROPY=1;class ct{constructor(e=0,t=0,i=0,r=1){ct.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*i+o[11]*r+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,c=l[0],u=l[4],h=l[8],d=l[1],p=l[5],m=l[9],x=l[2],g=l[6],f=l[10];if(Math.abs(u-d)<.01&&Math.abs(h-x)<.01&&Math.abs(m-g)<.01){if(Math.abs(u+d)<.1&&Math.abs(h+x)<.1&&Math.abs(m+g)<.1&&Math.abs(c+p+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const y=(c+1)/2,_=(p+1)/2,R=(f+1)/2,w=(u+d)/4,E=(h+x)/4,A=(m+g)/4;return y>_&&y>R?y<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(y),r=w/i,s=E/i):_>R?_<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(_),i=w/r,s=A/r):R<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(R),i=E/s,r=A/s),this.set(i,r,s,t),this}let v=Math.sqrt((g-m)*(g-m)+(h-x)*(h-x)+(d-u)*(d-u));return Math.abs(v)<.001&&(v=1),this.x=(g-m)/v,this.y=(h-x)/v,this.z=(d-u)/v,this.w=Math.acos((c+p+f-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[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,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class aM extends Ti{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new ct(0,0,e,t),this.scissorTest=!1,this.viewport=new ct(0,0,e,t);const r={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ut,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);const s=new Ct(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);s.flipY=!1,s.generateMipmaps=i.generateMipmaps,s.internalFormat=i.internalFormat,this.textures=[];const o=i.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=i;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let i=0,r=e.textures.length;i<r;i++)this.textures[i]=e.textures[i].clone(),this.textures[i].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new cs(t),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 li extends aM{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class Bd extends Ct{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Gt,this.minFilter=Gt,this.wrapR=Xn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class dA extends li{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new Bd(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class tg extends Ct{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Gt,this.minFilter=Gt,this.wrapR=Xn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class hA extends li{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new tg(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class En{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,o,a){let l=i[r+0],c=i[r+1],u=i[r+2],h=i[r+3];const d=s[o+0],p=s[o+1],m=s[o+2],x=s[o+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h;return}if(a===1){e[t+0]=d,e[t+1]=p,e[t+2]=m,e[t+3]=x;return}if(h!==x||l!==d||c!==p||u!==m){let g=1-a;const f=l*d+c*p+u*m+h*x,v=f>=0?1:-1,y=1-f*f;if(y>Number.EPSILON){const R=Math.sqrt(y),w=Math.atan2(R,f*v);g=Math.sin(g*w)/R,a=Math.sin(a*w)/R}const _=a*v;if(l=l*g+d*_,c=c*g+p*_,u=u*g+m*_,h=h*g+x*_,g===1-a){const R=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=R,c*=R,u*=R,h*=R}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,r,s,o){const a=i[r],l=i[r+1],c=i[r+2],u=i[r+3],h=s[o],d=s[o+1],p=s[o+2],m=s[o+3];return e[t]=a*m+u*h+l*p-c*d,e[t+1]=l*m+u*d+c*h-a*p,e[t+2]=c*m+u*p+a*d-l*h,e[t+3]=u*m-a*h-l*d-c*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),u=a(r/2),h=a(s/2),d=l(i/2),p=l(r/2),m=l(s/2);switch(o){case"XYZ":this._x=d*u*h+c*p*m,this._y=c*p*h-d*u*m,this._z=c*u*m+d*p*h,this._w=c*u*h-d*p*m;break;case"YXZ":this._x=d*u*h+c*p*m,this._y=c*p*h-d*u*m,this._z=c*u*m-d*p*h,this._w=c*u*h+d*p*m;break;case"ZXY":this._x=d*u*h-c*p*m,this._y=c*p*h+d*u*m,this._z=c*u*m+d*p*h,this._w=c*u*h-d*p*m;break;case"ZYX":this._x=d*u*h-c*p*m,this._y=c*p*h+d*u*m,this._z=c*u*m-d*p*h,this._w=c*u*h+d*p*m;break;case"YZX":this._x=d*u*h+c*p*m,this._y=c*p*h+d*u*m,this._z=c*u*m-d*p*h,this._w=c*u*h-d*p*m;break;case"XZY":this._x=d*u*h-c*p*m,this._y=c*p*h-d*u*m,this._z=c*u*m+d*p*h,this._w=c*u*h+d*p*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],h=t[10],d=i+a+h;if(d>0){const p=.5/Math.sqrt(d+1);this._w=.25/p,this._x=(u-l)*p,this._y=(s-c)*p,this._z=(o-r)*p}else if(i>a&&i>h){const p=2*Math.sqrt(1+i-a-h);this._w=(u-l)/p,this._x=.25*p,this._y=(r+o)/p,this._z=(s+c)/p}else if(a>h){const p=2*Math.sqrt(1+a-i-h);this._w=(s-c)/p,this._x=(r+o)/p,this._y=.25*p,this._z=(l+u)/p}else{const p=2*Math.sqrt(1+h-i-a);this._w=(o-r)/p,this._x=(s+c)/p,this._y=(l+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(At(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-i*c,this._z=s*u+o*c+i*l-r*a,this._w=o*u-i*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,o=this._w;let a=o*e._w+i*e._x+r*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=i,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const p=1-t;return this._w=p*o+t*this._w,this._x=p*i+t*this._x,this._y=p*r+t*this._y,this._z=p*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),h=Math.sin((1-t)*u)/c,d=Math.sin(t*u)/c;return this._w=o*h+this._w*d,this._x=i*h+this._x*d,this._y=r*h+this._y*d,this._z=s*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._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 I{constructor(e=0,t=0,i=0){I.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(c0.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(c0.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*i),u=2*(a*t-s*r),h=2*(s*i-o*t);return this.x=t+l*c+o*h-a*u,this.y=i+l*u+a*c-s*h,this.z=r+l*h+s*u-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 t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-i*l,this.z=i*a-r*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Kh.copy(this).projectOnVector(e),this.sub(Kh)}reflect(e){return this.sub(Kh.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(At(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Kh=new I,c0=new En;class pn{constructor(e=new I(1/0,1/0,1/0),t=new I(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(Jn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(Jn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=Jn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}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,t=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Jn):Jn.fromBufferAttribute(s,o),Jn.applyMatrix4(e.matrixWorld),this.expandByPoint(Jn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),rc.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),rc.copy(i.boundingBox)),rc.applyMatrix4(e.matrixWorld),this.union(rc)}const r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],t);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,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.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,Jn),Jn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ia),sc.subVectors(this.max,ia),Ds.subVectors(e.a,ia),Us.subVectors(e.b,ia),ks.subVectors(e.c,ia),sr.subVectors(Us,Ds),or.subVectors(ks,Us),Vr.subVectors(Ds,ks);let t=[0,-sr.z,sr.y,0,-or.z,or.y,0,-Vr.z,Vr.y,sr.z,0,-sr.x,or.z,0,-or.x,Vr.z,0,-Vr.x,-sr.y,sr.x,0,-or.y,or.x,0,-Vr.y,Vr.x,0];return!Jh(t,Ds,Us,ks,sc)||(t=[1,0,0,0,1,0,0,0,1],!Jh(t,Ds,Us,ks,sc))?!1:(oc.crossVectors(sr,or),t=[oc.x,oc.y,oc.z],Jh(t,Ds,Us,ks,sc))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Jn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Jn).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:(Pi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Pi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Pi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Pi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Pi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Pi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Pi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Pi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Pi),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 Pi=[new I,new I,new I,new I,new I,new I,new I,new I],Jn=new I,rc=new pn,Ds=new I,Us=new I,ks=new I,sr=new I,or=new I,Vr=new I,ia=new I,sc=new I,oc=new I,Hr=new I;function Jh(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){Hr.fromArray(n,s);const a=r.x*Math.abs(Hr.x)+r.y*Math.abs(Hr.y)+r.z*Math.abs(Hr.z),l=e.dot(Hr),c=t.dot(Hr),u=i.dot(Hr);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const fA=new pn,ra=new I,Qh=new I;class rn{constructor(e=new I,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):fA.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),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 t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ra.subVectors(e,this.center);const t=ra.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(ra,r/i),this.radius+=r}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):(Qh.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ra.copy(e.center).add(Qh)),this.expandByPoint(ra.copy(e.center).sub(Qh))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ii=new I,ef=new I,ac=new I,ar=new I,tf=new I,lc=new I,nf=new I;class Go{constructor(e=new I,t=new I(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Ii)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Ii.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ii.copy(this.origin).addScaledVector(this.direction,t),Ii.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){ef.copy(e).add(t).multiplyScalar(.5),ac.copy(t).sub(e).normalize(),ar.copy(this.origin).sub(ef);const s=e.distanceTo(t)*.5,o=-this.direction.dot(ac),a=ar.dot(this.direction),l=-ar.dot(ac),c=ar.lengthSq(),u=Math.abs(1-o*o);let h,d,p,m;if(u>0)if(h=o*l-a,d=o*a-l,m=s*u,h>=0)if(d>=-m)if(d<=m){const x=1/u;h*=x,d*=x,p=h*(h+o*d+2*a)+d*(o*h+d+2*l)+c}else d=s,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*l)+c;else d=-s,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*l)+c;else d<=-m?(h=Math.max(0,-(-o*s+a)),d=h>0?-s:Math.min(Math.max(-s,-l),s),p=-h*h+d*(d+2*l)+c):d<=m?(h=0,d=Math.min(Math.max(-s,-l),s),p=d*(d+2*l)+c):(h=Math.max(0,-(o*s+a)),d=h>0?s:Math.min(Math.max(-s,-l),s),p=-h*h+d*(d+2*l)+c);else d=o>0?-s:s,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(ef).addScaledVector(ac,d),p}intersectSphere(e,t){Ii.subVectors(e.center,this.origin);const i=Ii.dot(this.direction),r=Ii.dot(Ii)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return c>=0?(i=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(i=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),u>=0?(s=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(s=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o<r||isNaN(r))&&(r=o),h>=0?(a=(e.min.z-d.z)*h,l=(e.max.z-d.z)*h):(a=(e.max.z-d.z)*h,l=(e.min.z-d.z)*h),i>l||a>r)||((a>i||i!==i)&&(i=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,Ii)!==null}intersectTriangle(e,t,i,r,s){tf.subVectors(t,e),lc.subVectors(i,e),nf.crossVectors(tf,lc);let o=this.direction.dot(nf),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;ar.subVectors(this.origin,e);const l=a*this.direction.dot(lc.crossVectors(ar,lc));if(l<0)return null;const c=a*this.direction.dot(tf.cross(ar));if(c<0||l+c>o)return null;const u=-a*ar.dot(nf);return u<0?null:this.at(u/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class ke{constructor(e,t,i,r,s,o,a,l,c,u,h,d,p,m,x,g){ke.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c,u,h,d,p,m,x,g)}set(e,t,i,r,s,o,a,l,c,u,h,d,p,m,x,g){const f=this.elements;return f[0]=e,f[4]=t,f[8]=i,f[12]=r,f[1]=s,f[5]=o,f[9]=a,f[13]=l,f[2]=c,f[6]=u,f[10]=h,f[14]=d,f[3]=p,f[7]=m,f[11]=x,f[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ke().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/Os.setFromMatrixColumn(e,0).length(),s=1/Os.setFromMatrixColumn(e,1).length(),o=1/Os.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const d=o*u,p=o*h,m=a*u,x=a*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=p+m*c,t[5]=d-x*c,t[9]=-a*l,t[2]=x-d*c,t[6]=m+p*c,t[10]=o*l}else if(e.order==="YXZ"){const d=l*u,p=l*h,m=c*u,x=c*h;t[0]=d+x*a,t[4]=m*a-p,t[8]=o*c,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=p*a-m,t[6]=x+d*a,t[10]=o*l}else if(e.order==="ZXY"){const d=l*u,p=l*h,m=c*u,x=c*h;t[0]=d-x*a,t[4]=-o*h,t[8]=m+p*a,t[1]=p+m*a,t[5]=o*u,t[9]=x-d*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const d=o*u,p=o*h,m=a*u,x=a*h;t[0]=l*u,t[4]=m*c-p,t[8]=d*c+x,t[1]=l*h,t[5]=x*c+d,t[9]=p*c-m,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const d=o*l,p=o*c,m=a*l,x=a*c;t[0]=l*u,t[4]=x-d*h,t[8]=m*h+p,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=p*h+m,t[10]=d-x*h}else if(e.order==="XZY"){const d=o*l,p=o*c,m=a*l,x=a*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=d*h+x,t[5]=o*u,t[9]=p*h-m,t[2]=m*h-p,t[6]=a*u,t[10]=x*h+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(pA,e,mA)}lookAt(e,t,i){const r=this.elements;return Rn.subVectors(e,t),Rn.lengthSq()===0&&(Rn.z=1),Rn.normalize(),lr.crossVectors(i,Rn),lr.lengthSq()===0&&(Math.abs(i.z)===1?Rn.x+=1e-4:Rn.z+=1e-4,Rn.normalize(),lr.crossVectors(i,Rn)),lr.normalize(),cc.crossVectors(Rn,lr),r[0]=lr.x,r[4]=cc.x,r[8]=Rn.x,r[1]=lr.y,r[5]=cc.y,r[9]=Rn.y,r[2]=lr.z,r[6]=cc.z,r[10]=Rn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],u=i[1],h=i[5],d=i[9],p=i[13],m=i[2],x=i[6],g=i[10],f=i[14],v=i[3],y=i[7],_=i[11],R=i[15],w=r[0],E=r[4],A=r[8],b=r[12],M=r[1],L=r[5],G=r[9],B=r[13],j=r[2],U=r[6],z=r[10],Z=r[14],D=r[3],$=r[7],K=r[11],se=r[15];return s[0]=o*w+a*M+l*j+c*D,s[4]=o*E+a*L+l*U+c*$,s[8]=o*A+a*G+l*z+c*K,s[12]=o*b+a*B+l*Z+c*se,s[1]=u*w+h*M+d*j+p*D,s[5]=u*E+h*L+d*U+p*$,s[9]=u*A+h*G+d*z+p*K,s[13]=u*b+h*B+d*Z+p*se,s[2]=m*w+x*M+g*j+f*D,s[6]=m*E+x*L+g*U+f*$,s[10]=m*A+x*G+g*z+f*K,s[14]=m*b+x*B+g*Z+f*se,s[3]=v*w+y*M+_*j+R*D,s[7]=v*E+y*L+_*U+R*$,s[11]=v*A+y*G+_*z+R*K,s[15]=v*b+y*B+_*Z+R*se,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],h=e[6],d=e[10],p=e[14],m=e[3],x=e[7],g=e[11],f=e[15];return m*(+s*l*h-r*c*h-s*a*d+i*c*d+r*a*p-i*l*p)+x*(+t*l*p-t*c*d+s*o*d-r*o*p+r*c*u-s*l*u)+g*(+t*c*h-t*a*p-s*o*h+i*o*p+s*a*u-i*c*u)+f*(-r*a*u-t*l*h+t*a*d+r*o*h-i*o*d+i*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],p=e[11],m=e[12],x=e[13],g=e[14],f=e[15],v=h*g*c-x*d*c+x*l*p-a*g*p-h*l*f+a*d*f,y=m*d*c-u*g*c-m*l*p+o*g*p+u*l*f-o*d*f,_=u*x*c-m*h*c+m*a*p-o*x*p-u*a*f+o*h*f,R=m*h*l-u*x*l-m*a*d+o*x*d+u*a*g-o*h*g,w=t*v+i*y+r*_+s*R;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const E=1/w;return e[0]=v*E,e[1]=(x*d*s-h*g*s-x*r*p+i*g*p+h*r*f-i*d*f)*E,e[2]=(a*g*s-x*l*s+x*r*c-i*g*c-a*r*f+i*l*f)*E,e[3]=(h*l*s-a*d*s-h*r*c+i*d*c+a*r*p-i*l*p)*E,e[4]=y*E,e[5]=(u*g*s-m*d*s+m*r*p-t*g*p-u*r*f+t*d*f)*E,e[6]=(m*l*s-o*g*s-m*r*c+t*g*c+o*r*f-t*l*f)*E,e[7]=(o*d*s-u*l*s+u*r*c-t*d*c-o*r*p+t*l*p)*E,e[8]=_*E,e[9]=(m*h*s-u*x*s-m*i*p+t*x*p+u*i*f-t*h*f)*E,e[10]=(o*x*s-m*a*s+m*i*c-t*x*c-o*i*f+t*a*f)*E,e[11]=(u*a*s-o*h*s-u*i*c+t*h*c+o*i*p-t*a*p)*E,e[12]=R*E,e[13]=(u*x*r-m*h*r+m*i*d-t*x*d-u*i*g+t*h*g)*E,e[14]=(m*a*r-o*x*r-m*i*l+t*x*l+o*i*g-t*a*g)*E,e[15]=(o*h*r-u*a*r+u*i*l-t*h*l-o*i*d+t*a*d)*E,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+i,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+i,u*l-r*o,0,c*l-r*a,u*l+r*o,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,o){return this.set(1,i,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,h=a+a,d=s*c,p=s*u,m=s*h,x=o*u,g=o*h,f=a*h,v=l*c,y=l*u,_=l*h,R=i.x,w=i.y,E=i.z;return r[0]=(1-(x+f))*R,r[1]=(p+_)*R,r[2]=(m-y)*R,r[3]=0,r[4]=(p-_)*w,r[5]=(1-(d+f))*w,r[6]=(g+v)*w,r[7]=0,r[8]=(m+y)*E,r[9]=(g-v)*E,r[10]=(1-(d+x))*E,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=Os.set(r[0],r[1],r[2]).length();const o=Os.set(r[4],r[5],r[6]).length(),a=Os.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Qn.copy(this);const c=1/s,u=1/o,h=1/a;return Qn.elements[0]*=c,Qn.elements[1]*=c,Qn.elements[2]*=c,Qn.elements[4]*=u,Qn.elements[5]*=u,Qn.elements[6]*=u,Qn.elements[8]*=h,Qn.elements[9]*=h,Qn.elements[10]*=h,t.setFromRotationMatrix(Qn),i.x=s,i.y=o,i.z=a,this}makePerspective(e,t,i,r,s,o,a=_i){const l=this.elements,c=2*s/(t-e),u=2*s/(i-r),h=(t+e)/(t-e),d=(i+r)/(i-r);let p,m;if(a===_i)p=-(o+s)/(o-s),m=-2*o*s/(o-s);else if(a===fl)p=-o/(o-s),m=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=u,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,o,a=_i){const l=this.elements,c=1/(t-e),u=1/(i-r),h=1/(o-s),d=(t+e)*c,p=(i+r)*u;let m,x;if(a===_i)m=(o+s)*h,x=-2*h;else if(a===fl)m=s*h,x=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=x,l[14]=-m,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const Os=new I,Qn=new ke,pA=new I(0,0,0),mA=new I(1,1,1),lr=new I,cc=new I,Rn=new I,u0=new ke,d0=new En;class On{constructor(e=0,t=0,i=0,r=On.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],h=r[2],d=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(At(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-At(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(At(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-At(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(At(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-At(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return u0.makeRotationFromQuaternion(e),this.setFromRotationMatrix(u0,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return d0.setFromEuler(this),this.setFromQuaternion(d0,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}On.DEFAULT_ORDER="XYZ";class zd{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 gA=0;const h0=new I,Fs=new En,Ni=new ke,uc=new I,sa=new I,xA=new I,vA=new En,f0=new I(1,0,0),p0=new I(0,1,0),m0=new I(0,0,1),g0={type:"added"},yA={type:"removed"},Bs={type:"childadded",child:null},rf={type:"childremoved",child:null};class nt extends Ti{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:gA++}),this.uuid=Un(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=nt.DEFAULT_UP.clone();const e=new I,t=new On,i=new En,r=new I(1,1,1);function s(){i.setFromEuler(t,!1)}function o(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new ke},normalMatrix:{value:new je}}),this.matrix=new ke,this.matrixWorld=new ke,this.matrixAutoUpdate=nt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=nt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new zd,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,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Fs.setFromAxisAngle(e,t),this.quaternion.multiply(Fs),this}rotateOnWorldAxis(e,t){return Fs.setFromAxisAngle(e,t),this.quaternion.premultiply(Fs),this}rotateX(e){return this.rotateOnAxis(f0,e)}rotateY(e){return this.rotateOnAxis(p0,e)}rotateZ(e){return this.rotateOnAxis(m0,e)}translateOnAxis(e,t){return h0.copy(e).applyQuaternion(this.quaternion),this.position.add(h0.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(f0,e)}translateY(e){return this.translateOnAxis(p0,e)}translateZ(e){return this.translateOnAxis(m0,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Ni.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?uc.copy(e):uc.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),sa.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ni.lookAt(sa,uc,this.up):Ni.lookAt(uc,sa,this.up),this.quaternion.setFromRotationMatrix(Ni),r&&(Ni.extractRotation(r.matrixWorld),Fs.setFromRotationMatrix(Ni),this.quaternion.premultiply(Fs.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);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(g0),Bs.child=e,this.dispatchEvent(Bs),Bs.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(yA),rf.child=e,this.dispatchEvent(rf),rf.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),Ni.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Ni.multiply(e.parent.matrixWorld)),e.applyMatrix4(Ni),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(g0),Bs.child=e,this.dispatchEvent(Bs),Bs.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){const o=this.children[i].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(sa,e,xA),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(sa,vA,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.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 t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.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)),t===!0){const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.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()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.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?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.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,u=l.length;c<u;c++){const h=l[c];s(e.shapes,h)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.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]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];r.animations.push(s(e.animations,l))}}if(t){const a=o(e.geometries),l=o(e.materials),c=o(e.textures),u=o(e.images),h=o(e.shapes),d=o(e.skeletons),p=o(e.animations),m=o(e.nodes);a.length>0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),h.length>0&&(i.shapes=h),d.length>0&&(i.skeletons=d),p.length>0&&(i.animations=p),m.length>0&&(i.nodes=m)}return i.object=r,i;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.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)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}nt.DEFAULT_UP=new I(0,1,0);nt.DEFAULT_MATRIX_AUTO_UPDATE=!0;nt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const ei=new I,Li=new I,sf=new I,Di=new I,zs=new I,Vs=new I,x0=new I,of=new I,af=new I,lf=new I;class Nn{constructor(e=new I,t=new I,i=new I){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),ei.subVectors(e,t),r.cross(ei);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){ei.subVectors(r,t),Li.subVectors(i,t),sf.subVectors(e,t);const o=ei.dot(ei),a=ei.dot(Li),l=ei.dot(sf),c=Li.dot(Li),u=Li.dot(sf),h=o*c-a*a;if(h===0)return s.set(0,0,0),null;const d=1/h,p=(c*l-a*u)*d,m=(o*u-a*l)*d;return s.set(1-p-m,m,p)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,Di)===null?!1:Di.x>=0&&Di.y>=0&&Di.x+Di.y<=1}static getInterpolation(e,t,i,r,s,o,a,l){return this.getBarycoord(e,t,i,r,Di)===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,Di.x),l.addScaledVector(o,Di.y),l.addScaledVector(a,Di.z),l)}static isFrontFacing(e,t,i,r){return ei.subVectors(i,t),Li.subVectors(e,t),ei.cross(Li).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),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 ei.subVectors(this.c,this.b),Li.subVectors(this.a,this.b),ei.cross(Li).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Nn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Nn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return Nn.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return Nn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Nn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let o,a;zs.subVectors(r,i),Vs.subVectors(s,i),of.subVectors(e,i);const l=zs.dot(of),c=Vs.dot(of);if(l<=0&&c<=0)return t.copy(i);af.subVectors(e,r);const u=zs.dot(af),h=Vs.dot(af);if(u>=0&&h<=u)return t.copy(r);const d=l*h-u*c;if(d<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(i).addScaledVector(zs,o);lf.subVectors(e,s);const p=zs.dot(lf),m=Vs.dot(lf);if(m>=0&&p<=m)return t.copy(s);const x=p*c-l*m;if(x<=0&&c>=0&&m<=0)return a=c/(c-m),t.copy(i).addScaledVector(Vs,a);const g=u*m-p*h;if(g<=0&&h-u>=0&&p-m>=0)return x0.subVectors(s,r),a=(h-u)/(h-u+(p-m)),t.copy(r).addScaledVector(x0,a);const f=1/(g+x+d);return o=x*f,a=d*f,t.copy(i).addScaledVector(zs,o).addScaledVector(Vs,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const lM={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},cr={h:0,s:0,l:0},dc={h:0,s:0,l:0};function cf(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class _e{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Hn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,rt.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=rt.workingColorSpace){return this.r=e,this.g=t,this.b=i,rt.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=rt.workingColorSpace){if(e=eg(e,1),t=At(t,0,1),i=At(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,o=2*i-s;this.r=cf(o,s,e+1/3),this.g=cf(o,s,e),this.b=cf(o,s,e-1/3)}return rt.toWorkingColorSpace(this,r),this}setStyle(e,t=Hn){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[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 i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Hn){const i=lM[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Eo(e.r),this.g=Eo(e.g),this.b=Eo(e.b),this}copyLinearToSRGB(e){return this.r=qh(e.r),this.g=qh(e.g),this.b=qh(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Hn){return rt.fromWorkingColorSpace(en.copy(this),e),Math.round(At(en.r*255,0,255))*65536+Math.round(At(en.g*255,0,255))*256+Math.round(At(en.b*255,0,255))}getHexString(e=Hn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=rt.workingColorSpace){rt.fromWorkingColorSpace(en.copy(this),t);const i=en.r,r=en.g,s=en.b,o=Math.max(i,r,s),a=Math.min(i,r,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const h=o-a;switch(c=u<=.5?h/(o+a):h/(2-o-a),o){case i:l=(r-s)/h+(r<s?6:0);break;case r:l=(s-i)/h+2;break;case s:l=(i-r)/h+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=rt.workingColorSpace){return rt.fromWorkingColorSpace(en.copy(this),t),e.r=en.r,e.g=en.g,e.b=en.b,e}getStyle(e=Hn){rt.fromWorkingColorSpace(en.copy(this),e);const t=en.r,i=en.g,r=en.b;return e!==Hn?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(cr),this.setHSL(cr.h+e,cr.s+t,cr.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.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,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(cr),e.getHSL(dc);const i=ka(cr.h,dc.h,t),r=ka(cr.s,dc.s,t),s=ka(cr.l,dc.l,t);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const en=new _e;_e.NAMES=lM;let _A=0;class on extends Ti{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:_A++}),this.uuid=Un(),this.name="",this.type="Material",this.blending=fs,this.side=Zi,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Du,this.blendDst=Uu,this.blendEquation=vr,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new _e(0,0,0),this.blendAlpha=0,this.depthFunc=nl,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Lp,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ts,this.stencilZFail=ts,this.stencilZPass=ts,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 t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==fs&&(i.blending=this.blending),this.side!==Zi&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==Du&&(i.blendSrc=this.blendSrc),this.blendDst!==Uu&&(i.blendDst=this.blendDst),this.blendEquation!==vr&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==nl&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Lp&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ts&&(i.stencilFail=this.stencilFail),this.stencilZFail!==ts&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==ts&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(i.textures=s),o.length>0&&(i.images=o)}return i}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 t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,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 Or extends on{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new _e(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 On,this.combine=Rl,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 Bi=SA();function SA(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(i[l]=0,i[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(i[l]=1024>>-c-14,i[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[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,u=0;for(;!(c&8388608);)c<<=1,u-=8388608;c&=-8388609,u+=947912704,s[l]=c|u}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:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function vn(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=At(n,-65504,65504),Bi.floatView[0]=n;const e=Bi.uint32View[0],t=e>>23&511;return Bi.baseTable[t]+((e&8388607)>>Bi.shiftTable[t])}function ya(n){const e=n>>10;return Bi.uint32View[0]=Bi.mantissaTable[Bi.offsetTable[e]+(n&1023)]+Bi.exponentTable[e],Bi.floatView[0]}const MA={toHalfFloat:vn,fromHalfFloat:ya},Lt=new I,hc=new Q;class ht{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=hl,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Sn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return bo("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}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,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)hc.fromBufferAttribute(this,t),hc.applyMatrix3(e),this.setXY(t,hc.x,hc.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)Lt.fromBufferAttribute(this,t),Lt.applyMatrix3(e),this.setXYZ(t,Lt.x,Lt.y,Lt.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)Lt.fromBufferAttribute(this,t),Lt.applyMatrix4(e),this.setXYZ(t,Lt.x,Lt.y,Lt.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Lt.fromBufferAttribute(this,t),Lt.applyNormalMatrix(e),this.setXYZ(t,Lt.x,Lt.y,Lt.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Lt.fromBufferAttribute(this,t),Lt.transformDirection(e),this.setXYZ(t,Lt.x,Lt.y,Lt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=un(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Xe(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=un(t,this.array)),t}setX(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=un(t,this.array)),t}setY(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=un(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=un(t,this.array)),t}setW(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array),r=Xe(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array),r=Xe(r,this.array),s=Xe(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,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!==hl&&(e.usage=this.usage),e}}class wA extends ht{constructor(e,t,i){super(new Int8Array(e),t,i)}}class bA extends ht{constructor(e,t,i){super(new Uint8Array(e),t,i)}}class EA extends ht{constructor(e,t,i){super(new Uint8ClampedArray(e),t,i)}}class TA extends ht{constructor(e,t,i){super(new Int16Array(e),t,i)}}class ng extends ht{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class AA extends ht{constructor(e,t,i){super(new Int32Array(e),t,i)}}class ig extends ht{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class CA extends ht{constructor(e,t,i){super(new Uint16Array(e),t,i),this.isFloat16BufferAttribute=!0}getX(e){let t=ya(this.array[e*this.itemSize]);return this.normalized&&(t=un(t,this.array)),t}setX(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize]=vn(t),this}getY(e){let t=ya(this.array[e*this.itemSize+1]);return this.normalized&&(t=un(t,this.array)),t}setY(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize+1]=vn(t),this}getZ(e){let t=ya(this.array[e*this.itemSize+2]);return this.normalized&&(t=un(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize+2]=vn(t),this}getW(e){let t=ya(this.array[e*this.itemSize+3]);return this.normalized&&(t=un(t,this.array)),t}setW(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize+3]=vn(t),this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array)),this.array[e+0]=vn(t),this.array[e+1]=vn(i),this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array),r=Xe(r,this.array)),this.array[e+0]=vn(t),this.array[e+1]=vn(i),this.array[e+2]=vn(r),this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array),r=Xe(r,this.array),s=Xe(s,this.array)),this.array[e+0]=vn(t),this.array[e+1]=vn(i),this.array[e+2]=vn(r),this.array[e+3]=vn(s),this}}class Pe extends ht{constructor(e,t,i){super(new Float32Array(e),t,i)}}let RA=0;const Vn=new ke,uf=new nt,Hs=new I,Pn=new pn,oa=new pn,Vt=new I;class Ye extends Ti{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:RA++}),this.uuid=Un(),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(rM(e)?ig:ng)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new je().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Vn.makeRotationFromQuaternion(e),this.applyMatrix4(Vn),this}rotateX(e){return Vn.makeRotationX(e),this.applyMatrix4(Vn),this}rotateY(e){return Vn.makeRotationY(e),this.applyMatrix4(Vn),this}rotateZ(e){return Vn.makeRotationZ(e),this.applyMatrix4(Vn),this}translate(e,t,i){return Vn.makeTranslation(e,t,i),this.applyMatrix4(Vn),this}scale(e,t,i){return Vn.makeScale(e,t,i),this.applyMatrix4(Vn),this}lookAt(e){return uf.lookAt(e),uf.updateMatrix(),this.applyMatrix4(uf.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Hs).negate(),this.translate(Hs.x,Hs.y,Hs.z),this}setFromPoints(e){const t=[];for(let i=0,r=e.length;i<r;i++){const s=e[i];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new Pe(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new pn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new I(-1/0,-1/0,-1/0),new I(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];Pn.setFromBufferAttribute(s),this.morphTargetsRelative?(Vt.addVectors(this.boundingBox.min,Pn.min),this.boundingBox.expandByPoint(Vt),Vt.addVectors(this.boundingBox.max,Pn.max),this.boundingBox.expandByPoint(Vt)):(this.boundingBox.expandByPoint(Pn.min),this.boundingBox.expandByPoint(Pn.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 rn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new I,1/0);return}if(e){const i=this.boundingSphere.center;if(Pn.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const a=t[s];oa.setFromBufferAttribute(a),this.morphTargetsRelative?(Vt.addVectors(Pn.min,oa.min),Pn.expandByPoint(Vt),Vt.addVectors(Pn.max,oa.max),Pn.expandByPoint(Vt)):(Pn.expandByPoint(oa.min),Pn.expandByPoint(oa.max))}Pn.getCenter(i);let r=0;for(let s=0,o=e.count;s<o;s++)Vt.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(Vt));if(t)for(let s=0,o=t.length;s<o;s++){const a=t[s],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)Vt.fromBufferAttribute(a,c),l&&(Hs.fromBufferAttribute(e,c),Vt.add(Hs)),r=Math.max(r,i.distanceToSquared(Vt))}this.boundingSphere.radius=Math.sqrt(r),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,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new ht(new Float32Array(4*i.count),4));const o=this.getAttribute("tangent"),a=[],l=[];for(let A=0;A<i.count;A++)a[A]=new I,l[A]=new I;const c=new I,u=new I,h=new I,d=new Q,p=new Q,m=new Q,x=new I,g=new I;function f(A,b,M){c.fromBufferAttribute(i,A),u.fromBufferAttribute(i,b),h.fromBufferAttribute(i,M),d.fromBufferAttribute(s,A),p.fromBufferAttribute(s,b),m.fromBufferAttribute(s,M),u.sub(c),h.sub(c),p.sub(d),m.sub(d);const L=1/(p.x*m.y-m.x*p.y);isFinite(L)&&(x.copy(u).multiplyScalar(m.y).addScaledVector(h,-p.y).multiplyScalar(L),g.copy(h).multiplyScalar(p.x).addScaledVector(u,-m.x).multiplyScalar(L),a[A].add(x),a[b].add(x),a[M].add(x),l[A].add(g),l[b].add(g),l[M].add(g))}let v=this.groups;v.length===0&&(v=[{start:0,count:e.count}]);for(let A=0,b=v.length;A<b;++A){const M=v[A],L=M.start,G=M.count;for(let B=L,j=L+G;B<j;B+=3)f(e.getX(B+0),e.getX(B+1),e.getX(B+2))}const y=new I,_=new I,R=new I,w=new I;function E(A){R.fromBufferAttribute(r,A),w.copy(R);const b=a[A];y.copy(b),y.sub(R.multiplyScalar(R.dot(b))).normalize(),_.crossVectors(w,b);const L=_.dot(l[A])<0?-1:1;o.setXYZW(A,y.x,y.y,y.z,L)}for(let A=0,b=v.length;A<b;++A){const M=v[A],L=M.start,G=M.count;for(let B=L,j=L+G;B<j;B+=3)E(e.getX(B+0)),E(e.getX(B+1)),E(e.getX(B+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new ht(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let d=0,p=i.count;d<p;d++)i.setXYZ(d,0,0,0);const r=new I,s=new I,o=new I,a=new I,l=new I,c=new I,u=new I,h=new I;if(e)for(let d=0,p=e.count;d<p;d+=3){const m=e.getX(d+0),x=e.getX(d+1),g=e.getX(d+2);r.fromBufferAttribute(t,m),s.fromBufferAttribute(t,x),o.fromBufferAttribute(t,g),u.subVectors(o,s),h.subVectors(r,s),u.cross(h),a.fromBufferAttribute(i,m),l.fromBufferAttribute(i,x),c.fromBufferAttribute(i,g),a.add(u),l.add(u),c.add(u),i.setXYZ(m,a.x,a.y,a.z),i.setXYZ(x,l.x,l.y,l.z),i.setXYZ(g,c.x,c.y,c.z)}else for(let d=0,p=t.count;d<p;d+=3)r.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),o.fromBufferAttribute(t,d+2),u.subVectors(o,s),h.subVectors(r,s),u.cross(h),i.setXYZ(d+0,u.x,u.y,u.z),i.setXYZ(d+1,u.x,u.y,u.z),i.setXYZ(d+2,u.x,u.y,u.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)Vt.fromBufferAttribute(e,t),Vt.normalize(),e.setXYZ(t,Vt.x,Vt.y,Vt.z)}toNonIndexed(){function e(a,l){const c=a.array,u=a.itemSize,h=a.normalized,d=new c.constructor(l.length*u);let p=0,m=0;for(let x=0,g=l.length;x<g;x++){a.isInterleavedBufferAttribute?p=l[x]*a.data.stride+a.offset:p=l[x]*u;for(let f=0;f<u;f++)d[m++]=c[p++]}return new ht(d,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Ye,i=this.index.array,r=this.attributes;for(const a in r){const l=r[a],c=e(l,i);t.setAttribute(a,c)}const s=this.morphAttributes;for(const a in s){const l=[],c=s[a];for(let u=0,h=c.length;u<h;u++){const d=c[u],p=e(d,i);l.push(p)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}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 t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,d=c.length;h<d;h++){const p=c[h];u.push(p.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],h=s[c];for(let d=0,p=h.length;d<p;d++)u.push(h[d].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let c=0,u=o.length;c<u;c++){const h=o[c];this.addGroup(h.start,h.count,h.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 v0=new ke,Gr=new Go,fc=new rn,y0=new I,Gs=new I,Ws=new I,js=new I,df=new I,pc=new I,mc=new Q,gc=new Q,xc=new Q,_0=new I,S0=new I,M0=new I,vc=new I,yc=new I;class kt extends nt{constructor(e=new Ye,t=new Or){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),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 t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,o=i.morphTargetsRelative;t.fromBufferAttribute(r,e);const a=this.morphTargetInfluences;if(s&&a){pc.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=a[l],h=s[l];u!==0&&(df.fromBufferAttribute(h,e),o?pc.addScaledVector(df,u):pc.addScaledVector(df.sub(t),u))}t.add(pc)}return t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),fc.copy(i.boundingSphere),fc.applyMatrix4(s),Gr.copy(e.ray).recast(e.near),!(fc.containsPoint(Gr.origin)===!1&&(Gr.intersectSphere(fc,y0)===null||Gr.origin.distanceToSquared(y0)>(e.far-e.near)**2))&&(v0.copy(s).invert(),Gr.copy(e.ray).applyMatrix4(v0),!(i.boundingBox!==null&&Gr.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Gr)))}_computeIntersections(e,t,i){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,d=s.groups,p=s.drawRange;if(a!==null)if(Array.isArray(o))for(let m=0,x=d.length;m<x;m++){const g=d[m],f=o[g.materialIndex],v=Math.max(g.start,p.start),y=Math.min(a.count,Math.min(g.start+g.count,p.start+p.count));for(let _=v,R=y;_<R;_+=3){const w=a.getX(_),E=a.getX(_+1),A=a.getX(_+2);r=_c(this,f,e,i,c,u,h,w,E,A),r&&(r.faceIndex=Math.floor(_/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{const m=Math.max(0,p.start),x=Math.min(a.count,p.start+p.count);for(let g=m,f=x;g<f;g+=3){const v=a.getX(g),y=a.getX(g+1),_=a.getX(g+2);r=_c(this,o,e,i,c,u,h,v,y,_),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let m=0,x=d.length;m<x;m++){const g=d[m],f=o[g.materialIndex],v=Math.max(g.start,p.start),y=Math.min(l.count,Math.min(g.start+g.count,p.start+p.count));for(let _=v,R=y;_<R;_+=3){const w=_,E=_+1,A=_+2;r=_c(this,f,e,i,c,u,h,w,E,A),r&&(r.faceIndex=Math.floor(_/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{const m=Math.max(0,p.start),x=Math.min(l.count,p.start+p.count);for(let g=m,f=x;g<f;g+=3){const v=g,y=g+1,_=g+2;r=_c(this,o,e,i,c,u,h,v,y,_),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}}}function PA(n,e,t,i,r,s,o,a){let l;if(e.side===fn?l=i.intersectTriangle(o,s,r,!0,a):l=i.intersectTriangle(r,s,o,e.side===Zi,a),l===null)return null;yc.copy(a),yc.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(yc);return c<t.near||c>t.far?null:{distance:c,point:yc.clone(),object:n}}function _c(n,e,t,i,r,s,o,a,l,c){n.getVertexPosition(a,Gs),n.getVertexPosition(l,Ws),n.getVertexPosition(c,js);const u=PA(n,e,t,i,Gs,Ws,js,vc);if(u){r&&(mc.fromBufferAttribute(r,a),gc.fromBufferAttribute(r,l),xc.fromBufferAttribute(r,c),u.uv=Nn.getInterpolation(vc,Gs,Ws,js,mc,gc,xc,new Q)),s&&(mc.fromBufferAttribute(s,a),gc.fromBufferAttribute(s,l),xc.fromBufferAttribute(s,c),u.uv1=Nn.getInterpolation(vc,Gs,Ws,js,mc,gc,xc,new Q)),o&&(_0.fromBufferAttribute(o,a),S0.fromBufferAttribute(o,l),M0.fromBufferAttribute(o,c),u.normal=Nn.getInterpolation(vc,Gs,Ws,js,_0,S0,M0,new I),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const h={a,b:l,c,normal:new I,materialIndex:0};Nn.getNormal(Gs,Ws,js,h.normal),u.face=h}return u}class Cs extends Ye{constructor(e=1,t=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],h=[];let d=0,p=0;m("z","y","x",-1,-1,i,t,e,o,s,0),m("z","y","x",1,-1,i,t,-e,o,s,1),m("x","z","y",1,1,e,i,t,r,o,2),m("x","z","y",1,-1,e,i,-t,r,o,3),m("x","y","z",1,-1,e,t,i,r,s,4),m("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new Pe(c,3)),this.setAttribute("normal",new Pe(u,3)),this.setAttribute("uv",new Pe(h,2));function m(x,g,f,v,y,_,R,w,E,A,b){const M=_/E,L=R/A,G=_/2,B=R/2,j=w/2,U=E+1,z=A+1;let Z=0,D=0;const $=new I;for(let K=0;K<z;K++){const se=K*L-B;for(let Ae=0;Ae<U;Ae++){const qe=Ae*M-G;$[x]=qe*v,$[g]=se*y,$[f]=j,c.push($.x,$.y,$.z),$[x]=0,$[g]=0,$[f]=w>0?1:-1,u.push($.x,$.y,$.z),h.push(Ae/E),h.push(1-K/A),Z+=1}}for(let K=0;K<A;K++)for(let se=0;se<E;se++){const Ae=d+se+U*K,qe=d+se+U*(K+1),X=d+(se+1)+U*(K+1),oe=d+(se+1)+U*K;l.push(Ae,qe,oe),l.push(qe,X,oe),D+=6}a.addGroup(p,D,b),p+=D,d+=Z}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Cs(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function ko(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone():Array.isArray(r)?e[t][i]=r.slice():e[t][i]=r}}return e}function ln(n){const e={};for(let t=0;t<n.length;t++){const i=ko(n[t]);for(const r in i)e[r]=i[r]}return e}function IA(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function cM(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:rt.workingColorSpace}const uM={clone:ko,merge:ln};var NA=`void main() {
63
63
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
64
64
  }`,LA=`void main() {
65
65
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
66
- }`;class ci extends on{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=NA,this.fragmentShader=LA,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=ko(e.uniforms),this.uniformsGroups=IA(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 t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class Vd extends nt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ke,this.projectionMatrix=new ke,this.projectionMatrixInverse=new ke,this.coordinateSystem=_i}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const ur=new I,M0=new Q,w0=new Q;class Yt extends Vd{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Uo*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(ms*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Uo*2*Math.atan(Math.tan(ms*.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,t,i){ur.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(ur.x,ur.y).multiplyScalar(-e/ur.z),ur.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(ur.x,ur.y).multiplyScalar(-e/ur.z)}getViewSize(e,t){return this.getViewBounds(e,M0,w0),t.subVectors(w0,M0)}setViewOffset(e,t,i,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(ms*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*i/c,r*=o.width/l,i*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Xs=-90,$s=1;class dM extends nt{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Yt(Xs,$s,e,t);r.layers=this.layers,this.add(r);const s=new Yt(Xs,$s,e,t);s.layers=this.layers,this.add(s);const o=new Yt(Xs,$s,e,t);o.layers=this.layers,this.add(o);const a=new Yt(Xs,$s,e,t);a.layers=this.layers,this.add(a);const l=new Yt(Xs,$s,e,t);l.layers=this.layers,this.add(l);const c=new Yt(Xs,$s,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===_i)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.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===fl)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.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 t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,u]=this.children,h=e.getRenderTarget(),d=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),m=e.xr.enabled;e.xr.enabled=!1;const x=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(t,s),e.setRenderTarget(i,1,r),e.render(t,o),e.setRenderTarget(i,2,r),e.render(t,a),e.setRenderTarget(i,3,r),e.render(t,l),e.setRenderTarget(i,4,r),e.render(t,c),i.texture.generateMipmaps=x,e.setRenderTarget(i,5,r),e.render(t,u),e.setRenderTarget(h,d,p),e.xr.enabled=m,i.texture.needsPMREMUpdate=!0}}class Il extends Ct{constructor(e,t,i,r,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:Ki,super(e,t,i,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class hM extends li{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];this.texture=new Il(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Ut}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:`
66
+ }`;class ci extends on{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=NA,this.fragmentShader=LA,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=ko(e.uniforms),this.uniformsGroups=IA(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 t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class Vd extends nt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ke,this.projectionMatrix=new ke,this.projectionMatrixInverse=new ke,this.coordinateSystem=_i}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const ur=new I,w0=new Q,b0=new Q;class Yt extends Vd{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Uo*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(ms*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Uo*2*Math.atan(Math.tan(ms*.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,t,i){ur.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(ur.x,ur.y).multiplyScalar(-e/ur.z),ur.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(ur.x,ur.y).multiplyScalar(-e/ur.z)}getViewSize(e,t){return this.getViewBounds(e,w0,b0),t.subVectors(b0,w0)}setViewOffset(e,t,i,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(ms*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*i/c,r*=o.width/l,i*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Xs=-90,$s=1;class dM extends nt{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Yt(Xs,$s,e,t);r.layers=this.layers,this.add(r);const s=new Yt(Xs,$s,e,t);s.layers=this.layers,this.add(s);const o=new Yt(Xs,$s,e,t);o.layers=this.layers,this.add(o);const a=new Yt(Xs,$s,e,t);a.layers=this.layers,this.add(a);const l=new Yt(Xs,$s,e,t);l.layers=this.layers,this.add(l);const c=new Yt(Xs,$s,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===_i)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.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===fl)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.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 t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,u]=this.children,h=e.getRenderTarget(),d=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),m=e.xr.enabled;e.xr.enabled=!1;const x=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(t,s),e.setRenderTarget(i,1,r),e.render(t,o),e.setRenderTarget(i,2,r),e.render(t,a),e.setRenderTarget(i,3,r),e.render(t,l),e.setRenderTarget(i,4,r),e.render(t,c),i.texture.generateMipmaps=x,e.setRenderTarget(i,5,r),e.render(t,u),e.setRenderTarget(h,d,p),e.xr.enabled=m,i.texture.needsPMREMUpdate=!0}}class Nl extends Ct{constructor(e,t,i,r,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:Ki,super(e,t,i,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class hM extends li{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];this.texture=new Nl(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Ut}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:`
67
67
 
68
68
  varying vec3 vWorldDirection;
69
69
 
@@ -98,7 +98,7 @@ ${n.slice(-t)}`}function nT({suggestion:n}){const e=n.severity==="danger"?"text-
98
98
  gl_FragColor = texture2D( tEquirect, sampleUV );
99
99
 
100
100
  }
101
- `},r=new Cs(5,5,5),s=new ci({name:"CubemapFromEquirect",uniforms:ko(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:fn,blending:Wi});s.uniforms.tEquirect.value=t;const o=new kt(r,s),a=t.minFilter;return t.minFilter===yi&&(t.minFilter=Ut),new dM(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,r);e.setRenderTarget(s)}}const hf=new I,DA=new I,UA=new je;class mr{constructor(e=new I(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=hf.subVectors(i,t).cross(DA.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(hf),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||UA.getNormalMatrix(e),r=this.coplanarPoint(hf).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.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 Wr=new rn,_c=new I;class Nl{constructor(e=new mr,t=new mr,i=new mr,r=new mr,s=new mr,o=new mr){this.planes=[e,t,i,r,s,o]}set(e,t,i,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=_i){const i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],l=r[3],c=r[4],u=r[5],h=r[6],d=r[7],p=r[8],m=r[9],x=r[10],g=r[11],f=r[12],v=r[13],y=r[14],_=r[15];if(i[0].setComponents(l-s,d-c,g-p,_-f).normalize(),i[1].setComponents(l+s,d+c,g+p,_+f).normalize(),i[2].setComponents(l+o,d+u,g+m,_+v).normalize(),i[3].setComponents(l-o,d-u,g-m,_-v).normalize(),i[4].setComponents(l-a,d-h,g-x,_-y).normalize(),t===_i)i[5].setComponents(l+a,d+h,g+x,_+y).normalize();else if(t===fl)i[5].setComponents(a,h,x,y).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Wr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Wr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Wr)}intersectsSprite(e){return Wr.center.set(0,0,0),Wr.radius=.7071067811865476,Wr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Wr)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(_c.x=r.normal.x>0?e.max.x:e.min.x,_c.y=r.normal.y>0?e.max.y:e.min.y,_c.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(_c)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function fM(){let n=null,e=!1,t=null,i=null;function r(s,o){t(s,o),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function kA(n){const e=new WeakMap;function t(a,l){const c=a.array,u=a.usage,h=c.byteLength,d=n.createBuffer();n.bindBuffer(l,d),n.bufferData(l,c,u),a.onUploadCallback();let p;if(c instanceof Float32Array)p=n.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?p=n.HALF_FLOAT:p=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)p=n.SHORT;else if(c instanceof Uint32Array)p=n.UNSIGNED_INT;else if(c instanceof Int32Array)p=n.INT;else if(c instanceof Int8Array)p=n.BYTE;else if(c instanceof Uint8Array)p=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)p=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:p,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:h}}function i(a,l,c){const u=l.array,h=l._updateRange,d=l.updateRanges;if(n.bindBuffer(c,a),h.count===-1&&d.length===0&&n.bufferSubData(c,0,u),d.length!==0){for(let p=0,m=d.length;p<m;p++){const x=d[p];n.bufferSubData(c,x.start*u.BYTES_PER_ELEMENT,u,x.start,x.count)}l.clearUpdateRanges()}h.count!==-1&&(n.bufferSubData(c,h.offset*u.BYTES_PER_ELEMENT,u,h.offset,h.count),h.count=-1),l.onUploadCallback()}function r(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);const l=e.get(a);l&&(n.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){const u=e.get(a);(!u||u.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,t(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.");i(c.buffer,a,l),c.version=a.version}}return{get:r,remove:s,update:o}}class Wo extends Ye{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,o=t/2,a=Math.floor(i),l=Math.floor(r),c=a+1,u=l+1,h=e/a,d=t/l,p=[],m=[],x=[],g=[];for(let f=0;f<u;f++){const v=f*d-o;for(let y=0;y<c;y++){const _=y*h-s;m.push(_,-v,0),x.push(0,0,1),g.push(y/a),g.push(1-f/l)}}for(let f=0;f<l;f++)for(let v=0;v<a;v++){const y=v+c*f,_=v+c*(f+1),C=v+1+c*(f+1),w=v+1+c*f;p.push(y,_,w),p.push(_,C,w)}this.setIndex(p),this.setAttribute("position",new Pe(m,3)),this.setAttribute("normal",new Pe(x,3)),this.setAttribute("uv",new Pe(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Wo(e.width,e.height,e.widthSegments,e.heightSegments)}}var OA=`#ifdef USE_ALPHAHASH
101
+ `},r=new Cs(5,5,5),s=new ci({name:"CubemapFromEquirect",uniforms:ko(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:fn,blending:Wi});s.uniforms.tEquirect.value=t;const o=new kt(r,s),a=t.minFilter;return t.minFilter===yi&&(t.minFilter=Ut),new dM(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,r);e.setRenderTarget(s)}}const hf=new I,DA=new I,UA=new je;class mr{constructor(e=new I(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=hf.subVectors(i,t).cross(DA.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(hf),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||UA.getNormalMatrix(e),r=this.coplanarPoint(hf).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.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 Wr=new rn,Sc=new I;class Ll{constructor(e=new mr,t=new mr,i=new mr,r=new mr,s=new mr,o=new mr){this.planes=[e,t,i,r,s,o]}set(e,t,i,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=_i){const i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],l=r[3],c=r[4],u=r[5],h=r[6],d=r[7],p=r[8],m=r[9],x=r[10],g=r[11],f=r[12],v=r[13],y=r[14],_=r[15];if(i[0].setComponents(l-s,d-c,g-p,_-f).normalize(),i[1].setComponents(l+s,d+c,g+p,_+f).normalize(),i[2].setComponents(l+o,d+u,g+m,_+v).normalize(),i[3].setComponents(l-o,d-u,g-m,_-v).normalize(),i[4].setComponents(l-a,d-h,g-x,_-y).normalize(),t===_i)i[5].setComponents(l+a,d+h,g+x,_+y).normalize();else if(t===fl)i[5].setComponents(a,h,x,y).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Wr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Wr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Wr)}intersectsSprite(e){return Wr.center.set(0,0,0),Wr.radius=.7071067811865476,Wr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Wr)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(Sc.x=r.normal.x>0?e.max.x:e.min.x,Sc.y=r.normal.y>0?e.max.y:e.min.y,Sc.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Sc)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function fM(){let n=null,e=!1,t=null,i=null;function r(s,o){t(s,o),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function kA(n){const e=new WeakMap;function t(a,l){const c=a.array,u=a.usage,h=c.byteLength,d=n.createBuffer();n.bindBuffer(l,d),n.bufferData(l,c,u),a.onUploadCallback();let p;if(c instanceof Float32Array)p=n.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?p=n.HALF_FLOAT:p=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)p=n.SHORT;else if(c instanceof Uint32Array)p=n.UNSIGNED_INT;else if(c instanceof Int32Array)p=n.INT;else if(c instanceof Int8Array)p=n.BYTE;else if(c instanceof Uint8Array)p=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)p=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:p,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:h}}function i(a,l,c){const u=l.array,h=l._updateRange,d=l.updateRanges;if(n.bindBuffer(c,a),h.count===-1&&d.length===0&&n.bufferSubData(c,0,u),d.length!==0){for(let p=0,m=d.length;p<m;p++){const x=d[p];n.bufferSubData(c,x.start*u.BYTES_PER_ELEMENT,u,x.start,x.count)}l.clearUpdateRanges()}h.count!==-1&&(n.bufferSubData(c,h.offset*u.BYTES_PER_ELEMENT,u,h.offset,h.count),h.count=-1),l.onUploadCallback()}function r(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);const l=e.get(a);l&&(n.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){const u=e.get(a);(!u||u.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,t(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.");i(c.buffer,a,l),c.version=a.version}}return{get:r,remove:s,update:o}}class Wo extends Ye{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,o=t/2,a=Math.floor(i),l=Math.floor(r),c=a+1,u=l+1,h=e/a,d=t/l,p=[],m=[],x=[],g=[];for(let f=0;f<u;f++){const v=f*d-o;for(let y=0;y<c;y++){const _=y*h-s;m.push(_,-v,0),x.push(0,0,1),g.push(y/a),g.push(1-f/l)}}for(let f=0;f<l;f++)for(let v=0;v<a;v++){const y=v+c*f,_=v+c*(f+1),R=v+1+c*(f+1),w=v+1+c*f;p.push(y,_,w),p.push(_,R,w)}this.setIndex(p),this.setAttribute("position",new Pe(m,3)),this.setAttribute("normal",new Pe(x,3)),this.setAttribute("uv",new Pe(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Wo(e.width,e.height,e.widthSegments,e.heightSegments)}}var OA=`#ifdef USE_ALPHAHASH
102
102
  if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
103
103
  #endif`,FA=`#ifdef USE_ALPHAHASH
104
104
  const float ALPHA_HASH_SCALE = 0.05;
@@ -3643,7 +3643,7 @@ void main() {
3643
3643
  #include <tonemapping_fragment>
3644
3644
  #include <colorspace_fragment>
3645
3645
  #include <fog_fragment>
3646
- }`,$e={alphahash_fragment:OA,alphahash_pars_fragment:FA,alphamap_fragment:BA,alphamap_pars_fragment:zA,alphatest_fragment:VA,alphatest_pars_fragment:HA,aomap_fragment:GA,aomap_pars_fragment:WA,batching_pars_vertex:jA,batching_vertex:XA,begin_vertex:$A,beginnormal_vertex:YA,bsdfs:qA,iridescence_fragment:ZA,bumpmap_pars_fragment:KA,clipping_planes_fragment:JA,clipping_planes_pars_fragment:QA,clipping_planes_pars_vertex:eC,clipping_planes_vertex:tC,color_fragment:nC,color_pars_fragment:iC,color_pars_vertex:rC,color_vertex:sC,common:oC,cube_uv_reflection_fragment:aC,defaultnormal_vertex:lC,displacementmap_pars_vertex:cC,displacementmap_vertex:uC,emissivemap_fragment:dC,emissivemap_pars_fragment:hC,colorspace_fragment:fC,colorspace_pars_fragment:pC,envmap_fragment:mC,envmap_common_pars_fragment:gC,envmap_pars_fragment:xC,envmap_pars_vertex:vC,envmap_physical_pars_fragment:RC,envmap_vertex:yC,fog_vertex:_C,fog_pars_vertex:SC,fog_fragment:MC,fog_pars_fragment:wC,gradientmap_pars_fragment:bC,lightmap_pars_fragment:EC,lights_lambert_fragment:TC,lights_lambert_pars_fragment:AC,lights_pars_begin:CC,lights_toon_fragment:PC,lights_toon_pars_fragment:IC,lights_phong_fragment:NC,lights_phong_pars_fragment:LC,lights_physical_fragment:DC,lights_physical_pars_fragment:UC,lights_fragment_begin:kC,lights_fragment_maps:OC,lights_fragment_end:FC,logdepthbuf_fragment:BC,logdepthbuf_pars_fragment:zC,logdepthbuf_pars_vertex:VC,logdepthbuf_vertex:HC,map_fragment:GC,map_pars_fragment:WC,map_particle_fragment:jC,map_particle_pars_fragment:XC,metalnessmap_fragment:$C,metalnessmap_pars_fragment:YC,morphinstance_vertex:qC,morphcolor_vertex:ZC,morphnormal_vertex:KC,morphtarget_pars_vertex:JC,morphtarget_vertex:QC,normal_fragment_begin:eR,normal_fragment_maps:tR,normal_pars_fragment:nR,normal_pars_vertex:iR,normal_vertex:rR,normalmap_pars_fragment:sR,clearcoat_normal_fragment_begin:oR,clearcoat_normal_fragment_maps:aR,clearcoat_pars_fragment:lR,iridescence_pars_fragment:cR,opaque_fragment:uR,packing:dR,premultiplied_alpha_fragment:hR,project_vertex:fR,dithering_fragment:pR,dithering_pars_fragment:mR,roughnessmap_fragment:gR,roughnessmap_pars_fragment:xR,shadowmap_pars_fragment:vR,shadowmap_pars_vertex:yR,shadowmap_vertex:_R,shadowmask_pars_fragment:SR,skinbase_vertex:MR,skinning_pars_vertex:wR,skinning_vertex:bR,skinnormal_vertex:ER,specularmap_fragment:TR,specularmap_pars_fragment:AR,tonemapping_fragment:CR,tonemapping_pars_fragment:RR,transmission_fragment:PR,transmission_pars_fragment:IR,uv_pars_fragment:NR,uv_pars_vertex:LR,uv_vertex:DR,worldpos_vertex:UR,background_vert:kR,background_frag:OR,backgroundCube_vert:FR,backgroundCube_frag:BR,cube_vert:zR,cube_frag:VR,depth_vert:HR,depth_frag:GR,distanceRGBA_vert:WR,distanceRGBA_frag:jR,equirect_vert:XR,equirect_frag:$R,linedashed_vert:YR,linedashed_frag:qR,meshbasic_vert:ZR,meshbasic_frag:KR,meshlambert_vert:JR,meshlambert_frag:QR,meshmatcap_vert:e2,meshmatcap_frag:t2,meshnormal_vert:n2,meshnormal_frag:i2,meshphong_vert:r2,meshphong_frag:s2,meshphysical_vert:o2,meshphysical_frag:a2,meshtoon_vert:l2,meshtoon_frag:c2,points_vert:u2,points_frag:d2,shadow_vert:h2,shadow_frag:f2,sprite_vert:p2,sprite_frag:m2},fe={common:{diffuse:{value:new _e(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new je},alphaMap:{value:null},alphaMapTransform:{value:new je},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new je}},envmap:{envMap:{value:null},envMapRotation:{value:new je},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new je}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new je}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new je},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new je},normalScale:{value:new Q(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new je},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new je}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new je}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new je}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new _e(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 _e(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new je},alphaTest:{value:0},uvTransform:{value:new je}},sprite:{diffuse:{value:new _e(16777215)},opacity:{value:1},center:{value:new Q(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new je},alphaMap:{value:null},alphaMapTransform:{value:new je},alphaTest:{value:0}}},ri={basic:{uniforms:ln([fe.common,fe.specularmap,fe.envmap,fe.aomap,fe.lightmap,fe.fog]),vertexShader:$e.meshbasic_vert,fragmentShader:$e.meshbasic_frag},lambert:{uniforms:ln([fe.common,fe.specularmap,fe.envmap,fe.aomap,fe.lightmap,fe.emissivemap,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.fog,fe.lights,{emissive:{value:new _e(0)}}]),vertexShader:$e.meshlambert_vert,fragmentShader:$e.meshlambert_frag},phong:{uniforms:ln([fe.common,fe.specularmap,fe.envmap,fe.aomap,fe.lightmap,fe.emissivemap,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.fog,fe.lights,{emissive:{value:new _e(0)},specular:{value:new _e(1118481)},shininess:{value:30}}]),vertexShader:$e.meshphong_vert,fragmentShader:$e.meshphong_frag},standard:{uniforms:ln([fe.common,fe.envmap,fe.aomap,fe.lightmap,fe.emissivemap,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.roughnessmap,fe.metalnessmap,fe.fog,fe.lights,{emissive:{value:new _e(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:$e.meshphysical_vert,fragmentShader:$e.meshphysical_frag},toon:{uniforms:ln([fe.common,fe.aomap,fe.lightmap,fe.emissivemap,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.gradientmap,fe.fog,fe.lights,{emissive:{value:new _e(0)}}]),vertexShader:$e.meshtoon_vert,fragmentShader:$e.meshtoon_frag},matcap:{uniforms:ln([fe.common,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.fog,{matcap:{value:null}}]),vertexShader:$e.meshmatcap_vert,fragmentShader:$e.meshmatcap_frag},points:{uniforms:ln([fe.points,fe.fog]),vertexShader:$e.points_vert,fragmentShader:$e.points_frag},dashed:{uniforms:ln([fe.common,fe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:$e.linedashed_vert,fragmentShader:$e.linedashed_frag},depth:{uniforms:ln([fe.common,fe.displacementmap]),vertexShader:$e.depth_vert,fragmentShader:$e.depth_frag},normal:{uniforms:ln([fe.common,fe.bumpmap,fe.normalmap,fe.displacementmap,{opacity:{value:1}}]),vertexShader:$e.meshnormal_vert,fragmentShader:$e.meshnormal_frag},sprite:{uniforms:ln([fe.sprite,fe.fog]),vertexShader:$e.sprite_vert,fragmentShader:$e.sprite_frag},background:{uniforms:{uvTransform:{value:new je},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:$e.background_vert,fragmentShader:$e.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new je}},vertexShader:$e.backgroundCube_vert,fragmentShader:$e.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:$e.cube_vert,fragmentShader:$e.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:$e.equirect_vert,fragmentShader:$e.equirect_frag},distanceRGBA:{uniforms:ln([fe.common,fe.displacementmap,{referencePosition:{value:new I},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:$e.distanceRGBA_vert,fragmentShader:$e.distanceRGBA_frag},shadow:{uniforms:ln([fe.lights,fe.fog,{color:{value:new _e(0)},opacity:{value:1}}]),vertexShader:$e.shadow_vert,fragmentShader:$e.shadow_frag}};ri.physical={uniforms:ln([ri.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new je},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new je},clearcoatNormalScale:{value:new Q(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new je},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new je},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new je},sheen:{value:0},sheenColor:{value:new _e(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new je},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new je},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new je},transmissionSamplerSize:{value:new Q},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new je},attenuationDistance:{value:0},attenuationColor:{value:new _e(0)},specularColor:{value:new _e(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new je},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new je},anisotropyVector:{value:new Q},anisotropyMap:{value:null},anisotropyMapTransform:{value:new je}}]),vertexShader:$e.meshphysical_vert,fragmentShader:$e.meshphysical_frag};const Sc={r:0,b:0,g:0},jr=new On,g2=new ke;function x2(n,e,t,i,r,s,o){const a=new _e(0);let l=s===!0?0:1,c,u,h=null,d=0,p=null;function m(v){let y=v.isScene===!0?v.background:null;return y&&y.isTexture&&(y=(v.backgroundBlurriness>0?t:e).get(y)),y}function x(v){let y=!1;const _=m(v);_===null?f(a,l):_&&_.isColor&&(f(_,1),y=!0);const C=n.xr.getEnvironmentBlendMode();C==="additive"?i.buffers.color.setClear(0,0,0,1,o):C==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||y)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function g(v,y){const _=m(y);_&&(_.isCubeTexture||_.mapping===Vo)?(u===void 0&&(u=new kt(new Cs(1,1,1),new ci({name:"BackgroundCubeMaterial",uniforms:ko(ri.backgroundCube.uniforms),vertexShader:ri.backgroundCube.vertexShader,fragmentShader:ri.backgroundCube.fragmentShader,side:fn,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(C,w,E){this.matrixWorld.copyPosition(E.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),jr.copy(y.backgroundRotation),jr.x*=-1,jr.y*=-1,jr.z*=-1,_.isCubeTexture&&_.isRenderTargetTexture===!1&&(jr.y*=-1,jr.z*=-1),u.material.uniforms.envMap.value=_,u.material.uniforms.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=y.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(g2.makeRotationFromEuler(jr)),u.material.toneMapped=rt.getTransfer(_.colorSpace)!==ft,(h!==_||d!==_.version||p!==n.toneMapping)&&(u.material.needsUpdate=!0,h=_,d=_.version,p=n.toneMapping),u.layers.enableAll(),v.unshift(u,u.geometry,u.material,0,0,null)):_&&_.isTexture&&(c===void 0&&(c=new kt(new Wo(2,2),new ci({name:"BackgroundMaterial",uniforms:ko(ri.background.uniforms),vertexShader:ri.background.vertexShader,fragmentShader:ri.background.fragmentShader,side:Zi,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=_,c.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,c.material.toneMapped=rt.getTransfer(_.colorSpace)!==ft,_.matrixAutoUpdate===!0&&_.updateMatrix(),c.material.uniforms.uvTransform.value.copy(_.matrix),(h!==_||d!==_.version||p!==n.toneMapping)&&(c.material.needsUpdate=!0,h=_,d=_.version,p=n.toneMapping),c.layers.enableAll(),v.unshift(c,c.geometry,c.material,0,0,null))}function f(v,y){v.getRGB(Sc,cM(n)),i.buffers.color.setClear(Sc.r,Sc.g,Sc.b,y,o)}return{getClearColor:function(){return a},setClearColor:function(v,y=1){a.set(v),l=y,f(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(v){l=v,f(a,l)},render:x,addToRenderList:g}}function v2(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},r=d(null);let s=r,o=!1;function a(M,L,G,B,j){let U=!1;const z=h(B,G,L);s!==z&&(s=z,c(s.object)),U=p(M,B,G,j),U&&m(M,B,G,j),j!==null&&e.update(j,n.ELEMENT_ARRAY_BUFFER),(U||o)&&(o=!1,_(M,L,G,B),j!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(j).buffer))}function l(){return n.createVertexArray()}function c(M){return n.bindVertexArray(M)}function u(M){return n.deleteVertexArray(M)}function h(M,L,G){const B=G.wireframe===!0;let j=i[M.id];j===void 0&&(j={},i[M.id]=j);let U=j[L.id];U===void 0&&(U={},j[L.id]=U);let z=U[B];return z===void 0&&(z=d(l()),U[B]=z),z}function d(M){const L=[],G=[],B=[];for(let j=0;j<t;j++)L[j]=0,G[j]=0,B[j]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:L,enabledAttributes:G,attributeDivisors:B,object:M,attributes:{},index:null}}function p(M,L,G,B){const j=s.attributes,U=L.attributes;let z=0;const Z=G.getAttributes();for(const D in Z)if(Z[D].location>=0){const K=j[D];let se=U[D];if(se===void 0&&(D==="instanceMatrix"&&M.instanceMatrix&&(se=M.instanceMatrix),D==="instanceColor"&&M.instanceColor&&(se=M.instanceColor)),K===void 0||K.attribute!==se||se&&K.data!==se.data)return!0;z++}return s.attributesNum!==z||s.index!==B}function m(M,L,G,B){const j={},U=L.attributes;let z=0;const Z=G.getAttributes();for(const D in Z)if(Z[D].location>=0){let K=U[D];K===void 0&&(D==="instanceMatrix"&&M.instanceMatrix&&(K=M.instanceMatrix),D==="instanceColor"&&M.instanceColor&&(K=M.instanceColor));const se={};se.attribute=K,K&&K.data&&(se.data=K.data),j[D]=se,z++}s.attributes=j,s.attributesNum=z,s.index=B}function x(){const M=s.newAttributes;for(let L=0,G=M.length;L<G;L++)M[L]=0}function g(M){f(M,0)}function f(M,L){const G=s.newAttributes,B=s.enabledAttributes,j=s.attributeDivisors;G[M]=1,B[M]===0&&(n.enableVertexAttribArray(M),B[M]=1),j[M]!==L&&(n.vertexAttribDivisor(M,L),j[M]=L)}function v(){const M=s.newAttributes,L=s.enabledAttributes;for(let G=0,B=L.length;G<B;G++)L[G]!==M[G]&&(n.disableVertexAttribArray(G),L[G]=0)}function y(M,L,G,B,j,U,z){z===!0?n.vertexAttribIPointer(M,L,G,j,U):n.vertexAttribPointer(M,L,G,B,j,U)}function _(M,L,G,B){x();const j=B.attributes,U=G.getAttributes(),z=L.defaultAttributeValues;for(const Z in U){const D=U[Z];if(D.location>=0){let $=j[Z];if($===void 0&&(Z==="instanceMatrix"&&M.instanceMatrix&&($=M.instanceMatrix),Z==="instanceColor"&&M.instanceColor&&($=M.instanceColor)),$!==void 0){const K=$.normalized,se=$.itemSize,Te=e.get($);if(Te===void 0)continue;const qe=Te.buffer,X=Te.type,oe=Te.bytesPerElement,ve=X===n.INT||X===n.UNSIGNED_INT||$.gpuType===Id;if($.isInterleavedBufferAttribute){const de=$.data,De=de.stride,He=$.offset;if(de.isInstancedInterleavedBuffer){for(let Be=0;Be<D.locationSize;Be++)f(D.location+Be,de.meshPerAttribute);M.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=de.meshPerAttribute*de.count)}else for(let Be=0;Be<D.locationSize;Be++)g(D.location+Be);n.bindBuffer(n.ARRAY_BUFFER,qe);for(let Be=0;Be<D.locationSize;Be++)y(D.location+Be,se/D.locationSize,X,K,De*oe,(He+se/D.locationSize*Be)*oe,ve)}else{if($.isInstancedBufferAttribute){for(let de=0;de<D.locationSize;de++)f(D.location+de,$.meshPerAttribute);M.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=$.meshPerAttribute*$.count)}else for(let de=0;de<D.locationSize;de++)g(D.location+de);n.bindBuffer(n.ARRAY_BUFFER,qe);for(let de=0;de<D.locationSize;de++)y(D.location+de,se/D.locationSize,X,K,se*oe,se/D.locationSize*de*oe,ve)}}else if(z!==void 0){const K=z[Z];if(K!==void 0)switch(K.length){case 2:n.vertexAttrib2fv(D.location,K);break;case 3:n.vertexAttrib3fv(D.location,K);break;case 4:n.vertexAttrib4fv(D.location,K);break;default:n.vertexAttrib1fv(D.location,K)}}}}v()}function C(){A();for(const M in i){const L=i[M];for(const G in L){const B=L[G];for(const j in B)u(B[j].object),delete B[j];delete L[G]}delete i[M]}}function w(M){if(i[M.id]===void 0)return;const L=i[M.id];for(const G in L){const B=L[G];for(const j in B)u(B[j].object),delete B[j];delete L[G]}delete i[M.id]}function E(M){for(const L in i){const G=i[L];if(G[M.id]===void 0)continue;const B=G[M.id];for(const j in B)u(B[j].object),delete B[j];delete G[M.id]}}function A(){b(),o=!0,s!==r&&(s=r,c(s.object))}function b(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:a,reset:A,resetDefaultState:b,dispose:C,releaseStatesOfGeometry:w,releaseStatesOfProgram:E,initAttributes:x,enableAttribute:g,disableUnusedAttributes:v}}function y2(n,e,t){let i;function r(c){i=c}function s(c,u){n.drawArrays(i,c,u),t.update(u,i,1)}function o(c,u,h){h!==0&&(n.drawArraysInstanced(i,c,u,h),t.update(u,i,h))}function a(c,u,h){if(h===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,c,0,u,0,h);let p=0;for(let m=0;m<h;m++)p+=u[m];t.update(p,i,1)}function l(c,u,h,d){if(h===0)return;const p=e.get("WEBGL_multi_draw");if(p===null)for(let m=0;m<c.length;m++)o(c[m],u[m],d[m]);else{p.multiDrawArraysInstancedWEBGL(i,c,0,u,0,d,0,h);let m=0;for(let x=0;x<h;x++)m+=u[x];for(let x=0;x<d.length;x++)t.update(m,i,d[x])}}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=a,this.renderMultiDrawInstances=l}function _2(n,e,t,i){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const w=e.get("EXT_texture_filter_anisotropic");r=n.getParameter(w.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(w){return!(w!==dn&&i.convert(w)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(w){const E=w===Ho&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(w!==Ei&&i.convert(w)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&w!==Sn&&!E)}function l(w){if(w==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const u=l(c);u!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const h=t.logarithmicDepthBuffer===!0,d=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),p=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=n.getParameter(n.MAX_TEXTURE_SIZE),x=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),g=n.getParameter(n.MAX_VERTEX_ATTRIBS),f=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),v=n.getParameter(n.MAX_VARYING_VECTORS),y=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),_=p>0,C=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:h,maxTextures:d,maxVertexTextures:p,maxTextureSize:m,maxCubemapSize:x,maxAttributes:g,maxVertexUniforms:f,maxVaryings:v,maxFragmentUniforms:y,vertexTextures:_,maxSamples:C}}function S2(n){const e=this;let t=null,i=0,r=!1,s=!1;const o=new mr,a=new je,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,d){const p=h.length!==0||d||i!==0||r;return r=d,i=h.length,p},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,d){t=u(h,d,0)},this.setState=function(h,d,p){const m=h.clippingPlanes,x=h.clipIntersection,g=h.clipShadows,f=n.get(h);if(!r||m===null||m.length===0||s&&!g)s?u(null):c();else{const v=s?0:i,y=v*4;let _=f.clippingState||null;l.value=_,_=u(m,d,y,p);for(let C=0;C!==y;++C)_[C]=t[C];f.clippingState=_,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=v}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(h,d,p,m){const x=h!==null?h.length:0;let g=null;if(x!==0){if(g=l.value,m!==!0||g===null){const f=p+x*4,v=d.matrixWorldInverse;a.getNormalMatrix(v),(g===null||g.length<f)&&(g=new Float32Array(f));for(let y=0,_=p;y!==x;++y,_+=4)o.copy(h[y]).applyMatrix4(v,a),o.normal.toArray(g,_),g[_+3]=o.constant}l.value=g,l.needsUpdate=!0}return e.numPlanes=x,e.numIntersection=0,g}}function M2(n){let e=new WeakMap;function t(o,a){return a===il?o.mapping=Ki:a===rl&&(o.mapping=Ir),o}function i(o){if(o&&o.isTexture){const a=o.mapping;if(a===il||a===rl)if(e.has(o)){const l=e.get(o).texture;return t(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const c=new hM(l.height);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",r),t(c.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class Hd extends Vd{constructor(e=-1,t=1,i=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,o=i+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*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 t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const mo=4,b0=[.125,.215,.35,.446,.526,.582],is=20,ff=new Hd,E0=new _e;let pf=null,mf=0,gf=0,xf=!1;const ns=(1+Math.sqrt(5))/2,Ys=1/ns,T0=[new I(-ns,Ys,0),new I(ns,Ys,0),new I(-Ys,0,ns),new I(Ys,0,ns),new I(0,ns,-Ys),new I(0,ns,Ys),new I(-1,1,-1),new I(1,1,-1),new I(-1,1,1),new I(1,1,1)];class Up{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){pf=this._renderer.getRenderTarget(),mf=this._renderer.getActiveCubeFace(),gf=this._renderer.getActiveMipmapLevel(),xf=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=R0(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=C0(),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(pf,mf,gf),this._renderer.xr.enabled=xf,e.scissorTest=!1,Mc(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Ki||e.mapping===Ir?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),pf=this._renderer.getRenderTarget(),mf=this._renderer.getActiveCubeFace(),gf=this._renderer.getActiveMipmapLevel(),xf=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:Ut,minFilter:Ut,generateMipmaps:!1,type:Ho,format:dn,colorSpace:tr,depthBuffer:!1},r=A0(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=A0(e,t,i);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=w2(s)),this._blurMaterial=b2(s,e,t)}return r}_compileMaterial(e){const t=new kt(this._lodPlanes[0],e);this._renderer.compile(t,ff)}_sceneToCubeUV(e,t,i,r){const a=new Yt(90,1,t,i),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,h=u.autoClear,d=u.toneMapping;u.getClearColor(E0),u.toneMapping=ji,u.autoClear=!1;const p=new Or({name:"PMREM.Background",side:fn,depthWrite:!1,depthTest:!1}),m=new kt(new Cs,p);let x=!1;const g=e.background;g?g.isColor&&(p.color.copy(g),e.background=null,x=!0):(p.color.copy(E0),x=!0);for(let f=0;f<6;f++){const v=f%3;v===0?(a.up.set(0,l[f],0),a.lookAt(c[f],0,0)):v===1?(a.up.set(0,0,l[f]),a.lookAt(0,c[f],0)):(a.up.set(0,l[f],0),a.lookAt(0,0,c[f]));const y=this._cubeSize;Mc(r,v*y,f>2?y:0,y,y),u.setRenderTarget(r),x&&u.render(m,a),u.render(e,a)}m.geometry.dispose(),m.material.dispose(),u.toneMapping=d,u.autoClear=h,e.background=g}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===Ki||e.mapping===Ir;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=R0()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=C0());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new kt(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Mc(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,ff)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;s<r;s++){const o=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),a=T0[(r-s-1)%T0.length];this._blur(e,s-1,s,o,a)}t.autoClear=i}_blur(e,t,i,r,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,i,r,"latitudinal",s),this._halfBlur(o,e,i,i,r,"longitudinal",s)}_halfBlur(e,t,i,r,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 u=3,h=new kt(this._lodPlanes[r],c),d=c.uniforms,p=this._sizeLods[i]-1,m=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*is-1),x=s/m,g=isFinite(s)?1+Math.floor(u*x):is;g>is&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${is}`);const f=[];let v=0;for(let E=0;E<is;++E){const A=E/x,b=Math.exp(-A*A/2);f.push(b),E===0?v+=b:E<g&&(v+=2*b)}for(let E=0;E<f.length;E++)f[E]=f[E]/v;d.envMap.value=e.texture,d.samples.value=g,d.weights.value=f,d.latitudinal.value=o==="latitudinal",a&&(d.poleAxis.value=a);const{_lodMax:y}=this;d.dTheta.value=m,d.mipInt.value=y-i;const _=this._sizeLods[r],C=3*_*(r>y-mo?r-y+mo:0),w=4*(this._cubeSize-_);Mc(t,C,w,3*_,2*_),l.setRenderTarget(t),l.render(h,ff)}}function w2(n){const e=[],t=[],i=[];let r=n;const s=n-mo+1+b0.length;for(let o=0;o<s;o++){const a=Math.pow(2,r);t.push(a);let l=1/a;o>n-mo?l=b0[o-n+mo-1]:o===0&&(l=0),i.push(l);const c=1/(a-2),u=-c,h=1+c,d=[u,u,h,u,h,h,u,u,h,h,u,h],p=6,m=6,x=3,g=2,f=1,v=new Float32Array(x*m*p),y=new Float32Array(g*m*p),_=new Float32Array(f*m*p);for(let w=0;w<p;w++){const E=w%3*2/3-1,A=w>2?0:-1,b=[E,A,0,E+2/3,A,0,E+2/3,A+1,0,E,A,0,E+2/3,A+1,0,E,A+1,0];v.set(b,x*m*w),y.set(d,g*m*w);const M=[w,w,w,w,w,w];_.set(M,f*m*w)}const C=new Ye;C.setAttribute("position",new ht(v,x)),C.setAttribute("uv",new ht(y,g)),C.setAttribute("faceIndex",new ht(_,f)),e.push(C),r>mo&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function A0(n,e,t){const i=new li(n,e,t);return i.texture.mapping=Vo,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Mc(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function b2(n,e,t){const i=new Float32Array(is),r=new I(0,1,0);return new ci({name:"SphericalGaussianBlur",defines:{n:is,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:ig(),fragmentShader:`
3646
+ }`,$e={alphahash_fragment:OA,alphahash_pars_fragment:FA,alphamap_fragment:BA,alphamap_pars_fragment:zA,alphatest_fragment:VA,alphatest_pars_fragment:HA,aomap_fragment:GA,aomap_pars_fragment:WA,batching_pars_vertex:jA,batching_vertex:XA,begin_vertex:$A,beginnormal_vertex:YA,bsdfs:qA,iridescence_fragment:ZA,bumpmap_pars_fragment:KA,clipping_planes_fragment:JA,clipping_planes_pars_fragment:QA,clipping_planes_pars_vertex:eC,clipping_planes_vertex:tC,color_fragment:nC,color_pars_fragment:iC,color_pars_vertex:rC,color_vertex:sC,common:oC,cube_uv_reflection_fragment:aC,defaultnormal_vertex:lC,displacementmap_pars_vertex:cC,displacementmap_vertex:uC,emissivemap_fragment:dC,emissivemap_pars_fragment:hC,colorspace_fragment:fC,colorspace_pars_fragment:pC,envmap_fragment:mC,envmap_common_pars_fragment:gC,envmap_pars_fragment:xC,envmap_pars_vertex:vC,envmap_physical_pars_fragment:RC,envmap_vertex:yC,fog_vertex:_C,fog_pars_vertex:SC,fog_fragment:MC,fog_pars_fragment:wC,gradientmap_pars_fragment:bC,lightmap_pars_fragment:EC,lights_lambert_fragment:TC,lights_lambert_pars_fragment:AC,lights_pars_begin:CC,lights_toon_fragment:PC,lights_toon_pars_fragment:IC,lights_phong_fragment:NC,lights_phong_pars_fragment:LC,lights_physical_fragment:DC,lights_physical_pars_fragment:UC,lights_fragment_begin:kC,lights_fragment_maps:OC,lights_fragment_end:FC,logdepthbuf_fragment:BC,logdepthbuf_pars_fragment:zC,logdepthbuf_pars_vertex:VC,logdepthbuf_vertex:HC,map_fragment:GC,map_pars_fragment:WC,map_particle_fragment:jC,map_particle_pars_fragment:XC,metalnessmap_fragment:$C,metalnessmap_pars_fragment:YC,morphinstance_vertex:qC,morphcolor_vertex:ZC,morphnormal_vertex:KC,morphtarget_pars_vertex:JC,morphtarget_vertex:QC,normal_fragment_begin:eR,normal_fragment_maps:tR,normal_pars_fragment:nR,normal_pars_vertex:iR,normal_vertex:rR,normalmap_pars_fragment:sR,clearcoat_normal_fragment_begin:oR,clearcoat_normal_fragment_maps:aR,clearcoat_pars_fragment:lR,iridescence_pars_fragment:cR,opaque_fragment:uR,packing:dR,premultiplied_alpha_fragment:hR,project_vertex:fR,dithering_fragment:pR,dithering_pars_fragment:mR,roughnessmap_fragment:gR,roughnessmap_pars_fragment:xR,shadowmap_pars_fragment:vR,shadowmap_pars_vertex:yR,shadowmap_vertex:_R,shadowmask_pars_fragment:SR,skinbase_vertex:MR,skinning_pars_vertex:wR,skinning_vertex:bR,skinnormal_vertex:ER,specularmap_fragment:TR,specularmap_pars_fragment:AR,tonemapping_fragment:CR,tonemapping_pars_fragment:RR,transmission_fragment:PR,transmission_pars_fragment:IR,uv_pars_fragment:NR,uv_pars_vertex:LR,uv_vertex:DR,worldpos_vertex:UR,background_vert:kR,background_frag:OR,backgroundCube_vert:FR,backgroundCube_frag:BR,cube_vert:zR,cube_frag:VR,depth_vert:HR,depth_frag:GR,distanceRGBA_vert:WR,distanceRGBA_frag:jR,equirect_vert:XR,equirect_frag:$R,linedashed_vert:YR,linedashed_frag:qR,meshbasic_vert:ZR,meshbasic_frag:KR,meshlambert_vert:JR,meshlambert_frag:QR,meshmatcap_vert:e2,meshmatcap_frag:t2,meshnormal_vert:n2,meshnormal_frag:i2,meshphong_vert:r2,meshphong_frag:s2,meshphysical_vert:o2,meshphysical_frag:a2,meshtoon_vert:l2,meshtoon_frag:c2,points_vert:u2,points_frag:d2,shadow_vert:h2,shadow_frag:f2,sprite_vert:p2,sprite_frag:m2},fe={common:{diffuse:{value:new _e(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new je},alphaMap:{value:null},alphaMapTransform:{value:new je},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new je}},envmap:{envMap:{value:null},envMapRotation:{value:new je},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new je}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new je}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new je},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new je},normalScale:{value:new Q(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new je},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new je}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new je}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new je}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new _e(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 _e(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new je},alphaTest:{value:0},uvTransform:{value:new je}},sprite:{diffuse:{value:new _e(16777215)},opacity:{value:1},center:{value:new Q(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new je},alphaMap:{value:null},alphaMapTransform:{value:new je},alphaTest:{value:0}}},ri={basic:{uniforms:ln([fe.common,fe.specularmap,fe.envmap,fe.aomap,fe.lightmap,fe.fog]),vertexShader:$e.meshbasic_vert,fragmentShader:$e.meshbasic_frag},lambert:{uniforms:ln([fe.common,fe.specularmap,fe.envmap,fe.aomap,fe.lightmap,fe.emissivemap,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.fog,fe.lights,{emissive:{value:new _e(0)}}]),vertexShader:$e.meshlambert_vert,fragmentShader:$e.meshlambert_frag},phong:{uniforms:ln([fe.common,fe.specularmap,fe.envmap,fe.aomap,fe.lightmap,fe.emissivemap,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.fog,fe.lights,{emissive:{value:new _e(0)},specular:{value:new _e(1118481)},shininess:{value:30}}]),vertexShader:$e.meshphong_vert,fragmentShader:$e.meshphong_frag},standard:{uniforms:ln([fe.common,fe.envmap,fe.aomap,fe.lightmap,fe.emissivemap,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.roughnessmap,fe.metalnessmap,fe.fog,fe.lights,{emissive:{value:new _e(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:$e.meshphysical_vert,fragmentShader:$e.meshphysical_frag},toon:{uniforms:ln([fe.common,fe.aomap,fe.lightmap,fe.emissivemap,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.gradientmap,fe.fog,fe.lights,{emissive:{value:new _e(0)}}]),vertexShader:$e.meshtoon_vert,fragmentShader:$e.meshtoon_frag},matcap:{uniforms:ln([fe.common,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.fog,{matcap:{value:null}}]),vertexShader:$e.meshmatcap_vert,fragmentShader:$e.meshmatcap_frag},points:{uniforms:ln([fe.points,fe.fog]),vertexShader:$e.points_vert,fragmentShader:$e.points_frag},dashed:{uniforms:ln([fe.common,fe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:$e.linedashed_vert,fragmentShader:$e.linedashed_frag},depth:{uniforms:ln([fe.common,fe.displacementmap]),vertexShader:$e.depth_vert,fragmentShader:$e.depth_frag},normal:{uniforms:ln([fe.common,fe.bumpmap,fe.normalmap,fe.displacementmap,{opacity:{value:1}}]),vertexShader:$e.meshnormal_vert,fragmentShader:$e.meshnormal_frag},sprite:{uniforms:ln([fe.sprite,fe.fog]),vertexShader:$e.sprite_vert,fragmentShader:$e.sprite_frag},background:{uniforms:{uvTransform:{value:new je},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:$e.background_vert,fragmentShader:$e.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new je}},vertexShader:$e.backgroundCube_vert,fragmentShader:$e.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:$e.cube_vert,fragmentShader:$e.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:$e.equirect_vert,fragmentShader:$e.equirect_frag},distanceRGBA:{uniforms:ln([fe.common,fe.displacementmap,{referencePosition:{value:new I},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:$e.distanceRGBA_vert,fragmentShader:$e.distanceRGBA_frag},shadow:{uniforms:ln([fe.lights,fe.fog,{color:{value:new _e(0)},opacity:{value:1}}]),vertexShader:$e.shadow_vert,fragmentShader:$e.shadow_frag}};ri.physical={uniforms:ln([ri.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new je},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new je},clearcoatNormalScale:{value:new Q(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new je},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new je},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new je},sheen:{value:0},sheenColor:{value:new _e(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new je},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new je},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new je},transmissionSamplerSize:{value:new Q},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new je},attenuationDistance:{value:0},attenuationColor:{value:new _e(0)},specularColor:{value:new _e(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new je},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new je},anisotropyVector:{value:new Q},anisotropyMap:{value:null},anisotropyMapTransform:{value:new je}}]),vertexShader:$e.meshphysical_vert,fragmentShader:$e.meshphysical_frag};const Mc={r:0,b:0,g:0},jr=new On,g2=new ke;function x2(n,e,t,i,r,s,o){const a=new _e(0);let l=s===!0?0:1,c,u,h=null,d=0,p=null;function m(v){let y=v.isScene===!0?v.background:null;return y&&y.isTexture&&(y=(v.backgroundBlurriness>0?t:e).get(y)),y}function x(v){let y=!1;const _=m(v);_===null?f(a,l):_&&_.isColor&&(f(_,1),y=!0);const R=n.xr.getEnvironmentBlendMode();R==="additive"?i.buffers.color.setClear(0,0,0,1,o):R==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||y)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function g(v,y){const _=m(y);_&&(_.isCubeTexture||_.mapping===Vo)?(u===void 0&&(u=new kt(new Cs(1,1,1),new ci({name:"BackgroundCubeMaterial",uniforms:ko(ri.backgroundCube.uniforms),vertexShader:ri.backgroundCube.vertexShader,fragmentShader:ri.backgroundCube.fragmentShader,side:fn,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(R,w,E){this.matrixWorld.copyPosition(E.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),jr.copy(y.backgroundRotation),jr.x*=-1,jr.y*=-1,jr.z*=-1,_.isCubeTexture&&_.isRenderTargetTexture===!1&&(jr.y*=-1,jr.z*=-1),u.material.uniforms.envMap.value=_,u.material.uniforms.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=y.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(g2.makeRotationFromEuler(jr)),u.material.toneMapped=rt.getTransfer(_.colorSpace)!==ft,(h!==_||d!==_.version||p!==n.toneMapping)&&(u.material.needsUpdate=!0,h=_,d=_.version,p=n.toneMapping),u.layers.enableAll(),v.unshift(u,u.geometry,u.material,0,0,null)):_&&_.isTexture&&(c===void 0&&(c=new kt(new Wo(2,2),new ci({name:"BackgroundMaterial",uniforms:ko(ri.background.uniforms),vertexShader:ri.background.vertexShader,fragmentShader:ri.background.fragmentShader,side:Zi,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=_,c.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,c.material.toneMapped=rt.getTransfer(_.colorSpace)!==ft,_.matrixAutoUpdate===!0&&_.updateMatrix(),c.material.uniforms.uvTransform.value.copy(_.matrix),(h!==_||d!==_.version||p!==n.toneMapping)&&(c.material.needsUpdate=!0,h=_,d=_.version,p=n.toneMapping),c.layers.enableAll(),v.unshift(c,c.geometry,c.material,0,0,null))}function f(v,y){v.getRGB(Mc,cM(n)),i.buffers.color.setClear(Mc.r,Mc.g,Mc.b,y,o)}return{getClearColor:function(){return a},setClearColor:function(v,y=1){a.set(v),l=y,f(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(v){l=v,f(a,l)},render:x,addToRenderList:g}}function v2(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},r=d(null);let s=r,o=!1;function a(M,L,G,B,j){let U=!1;const z=h(B,G,L);s!==z&&(s=z,c(s.object)),U=p(M,B,G,j),U&&m(M,B,G,j),j!==null&&e.update(j,n.ELEMENT_ARRAY_BUFFER),(U||o)&&(o=!1,_(M,L,G,B),j!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(j).buffer))}function l(){return n.createVertexArray()}function c(M){return n.bindVertexArray(M)}function u(M){return n.deleteVertexArray(M)}function h(M,L,G){const B=G.wireframe===!0;let j=i[M.id];j===void 0&&(j={},i[M.id]=j);let U=j[L.id];U===void 0&&(U={},j[L.id]=U);let z=U[B];return z===void 0&&(z=d(l()),U[B]=z),z}function d(M){const L=[],G=[],B=[];for(let j=0;j<t;j++)L[j]=0,G[j]=0,B[j]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:L,enabledAttributes:G,attributeDivisors:B,object:M,attributes:{},index:null}}function p(M,L,G,B){const j=s.attributes,U=L.attributes;let z=0;const Z=G.getAttributes();for(const D in Z)if(Z[D].location>=0){const K=j[D];let se=U[D];if(se===void 0&&(D==="instanceMatrix"&&M.instanceMatrix&&(se=M.instanceMatrix),D==="instanceColor"&&M.instanceColor&&(se=M.instanceColor)),K===void 0||K.attribute!==se||se&&K.data!==se.data)return!0;z++}return s.attributesNum!==z||s.index!==B}function m(M,L,G,B){const j={},U=L.attributes;let z=0;const Z=G.getAttributes();for(const D in Z)if(Z[D].location>=0){let K=U[D];K===void 0&&(D==="instanceMatrix"&&M.instanceMatrix&&(K=M.instanceMatrix),D==="instanceColor"&&M.instanceColor&&(K=M.instanceColor));const se={};se.attribute=K,K&&K.data&&(se.data=K.data),j[D]=se,z++}s.attributes=j,s.attributesNum=z,s.index=B}function x(){const M=s.newAttributes;for(let L=0,G=M.length;L<G;L++)M[L]=0}function g(M){f(M,0)}function f(M,L){const G=s.newAttributes,B=s.enabledAttributes,j=s.attributeDivisors;G[M]=1,B[M]===0&&(n.enableVertexAttribArray(M),B[M]=1),j[M]!==L&&(n.vertexAttribDivisor(M,L),j[M]=L)}function v(){const M=s.newAttributes,L=s.enabledAttributes;for(let G=0,B=L.length;G<B;G++)L[G]!==M[G]&&(n.disableVertexAttribArray(G),L[G]=0)}function y(M,L,G,B,j,U,z){z===!0?n.vertexAttribIPointer(M,L,G,j,U):n.vertexAttribPointer(M,L,G,B,j,U)}function _(M,L,G,B){x();const j=B.attributes,U=G.getAttributes(),z=L.defaultAttributeValues;for(const Z in U){const D=U[Z];if(D.location>=0){let $=j[Z];if($===void 0&&(Z==="instanceMatrix"&&M.instanceMatrix&&($=M.instanceMatrix),Z==="instanceColor"&&M.instanceColor&&($=M.instanceColor)),$!==void 0){const K=$.normalized,se=$.itemSize,Ae=e.get($);if(Ae===void 0)continue;const qe=Ae.buffer,X=Ae.type,oe=Ae.bytesPerElement,ve=X===n.INT||X===n.UNSIGNED_INT||$.gpuType===Id;if($.isInterleavedBufferAttribute){const de=$.data,De=de.stride,He=$.offset;if(de.isInstancedInterleavedBuffer){for(let Be=0;Be<D.locationSize;Be++)f(D.location+Be,de.meshPerAttribute);M.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=de.meshPerAttribute*de.count)}else for(let Be=0;Be<D.locationSize;Be++)g(D.location+Be);n.bindBuffer(n.ARRAY_BUFFER,qe);for(let Be=0;Be<D.locationSize;Be++)y(D.location+Be,se/D.locationSize,X,K,De*oe,(He+se/D.locationSize*Be)*oe,ve)}else{if($.isInstancedBufferAttribute){for(let de=0;de<D.locationSize;de++)f(D.location+de,$.meshPerAttribute);M.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=$.meshPerAttribute*$.count)}else for(let de=0;de<D.locationSize;de++)g(D.location+de);n.bindBuffer(n.ARRAY_BUFFER,qe);for(let de=0;de<D.locationSize;de++)y(D.location+de,se/D.locationSize,X,K,se*oe,se/D.locationSize*de*oe,ve)}}else if(z!==void 0){const K=z[Z];if(K!==void 0)switch(K.length){case 2:n.vertexAttrib2fv(D.location,K);break;case 3:n.vertexAttrib3fv(D.location,K);break;case 4:n.vertexAttrib4fv(D.location,K);break;default:n.vertexAttrib1fv(D.location,K)}}}}v()}function R(){A();for(const M in i){const L=i[M];for(const G in L){const B=L[G];for(const j in B)u(B[j].object),delete B[j];delete L[G]}delete i[M]}}function w(M){if(i[M.id]===void 0)return;const L=i[M.id];for(const G in L){const B=L[G];for(const j in B)u(B[j].object),delete B[j];delete L[G]}delete i[M.id]}function E(M){for(const L in i){const G=i[L];if(G[M.id]===void 0)continue;const B=G[M.id];for(const j in B)u(B[j].object),delete B[j];delete G[M.id]}}function A(){b(),o=!0,s!==r&&(s=r,c(s.object))}function b(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:a,reset:A,resetDefaultState:b,dispose:R,releaseStatesOfGeometry:w,releaseStatesOfProgram:E,initAttributes:x,enableAttribute:g,disableUnusedAttributes:v}}function y2(n,e,t){let i;function r(c){i=c}function s(c,u){n.drawArrays(i,c,u),t.update(u,i,1)}function o(c,u,h){h!==0&&(n.drawArraysInstanced(i,c,u,h),t.update(u,i,h))}function a(c,u,h){if(h===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,c,0,u,0,h);let p=0;for(let m=0;m<h;m++)p+=u[m];t.update(p,i,1)}function l(c,u,h,d){if(h===0)return;const p=e.get("WEBGL_multi_draw");if(p===null)for(let m=0;m<c.length;m++)o(c[m],u[m],d[m]);else{p.multiDrawArraysInstancedWEBGL(i,c,0,u,0,d,0,h);let m=0;for(let x=0;x<h;x++)m+=u[x];for(let x=0;x<d.length;x++)t.update(m,i,d[x])}}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=a,this.renderMultiDrawInstances=l}function _2(n,e,t,i){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const w=e.get("EXT_texture_filter_anisotropic");r=n.getParameter(w.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(w){return!(w!==dn&&i.convert(w)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(w){const E=w===Ho&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(w!==Ei&&i.convert(w)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&w!==Sn&&!E)}function l(w){if(w==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const u=l(c);u!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const h=t.logarithmicDepthBuffer===!0,d=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),p=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=n.getParameter(n.MAX_TEXTURE_SIZE),x=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),g=n.getParameter(n.MAX_VERTEX_ATTRIBS),f=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),v=n.getParameter(n.MAX_VARYING_VECTORS),y=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),_=p>0,R=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:h,maxTextures:d,maxVertexTextures:p,maxTextureSize:m,maxCubemapSize:x,maxAttributes:g,maxVertexUniforms:f,maxVaryings:v,maxFragmentUniforms:y,vertexTextures:_,maxSamples:R}}function S2(n){const e=this;let t=null,i=0,r=!1,s=!1;const o=new mr,a=new je,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,d){const p=h.length!==0||d||i!==0||r;return r=d,i=h.length,p},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,d){t=u(h,d,0)},this.setState=function(h,d,p){const m=h.clippingPlanes,x=h.clipIntersection,g=h.clipShadows,f=n.get(h);if(!r||m===null||m.length===0||s&&!g)s?u(null):c();else{const v=s?0:i,y=v*4;let _=f.clippingState||null;l.value=_,_=u(m,d,y,p);for(let R=0;R!==y;++R)_[R]=t[R];f.clippingState=_,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=v}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(h,d,p,m){const x=h!==null?h.length:0;let g=null;if(x!==0){if(g=l.value,m!==!0||g===null){const f=p+x*4,v=d.matrixWorldInverse;a.getNormalMatrix(v),(g===null||g.length<f)&&(g=new Float32Array(f));for(let y=0,_=p;y!==x;++y,_+=4)o.copy(h[y]).applyMatrix4(v,a),o.normal.toArray(g,_),g[_+3]=o.constant}l.value=g,l.needsUpdate=!0}return e.numPlanes=x,e.numIntersection=0,g}}function M2(n){let e=new WeakMap;function t(o,a){return a===il?o.mapping=Ki:a===rl&&(o.mapping=Ir),o}function i(o){if(o&&o.isTexture){const a=o.mapping;if(a===il||a===rl)if(e.has(o)){const l=e.get(o).texture;return t(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const c=new hM(l.height);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",r),t(c.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class Hd extends Vd{constructor(e=-1,t=1,i=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,o=i+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*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 t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const mo=4,E0=[.125,.215,.35,.446,.526,.582],is=20,ff=new Hd,T0=new _e;let pf=null,mf=0,gf=0,xf=!1;const ns=(1+Math.sqrt(5))/2,Ys=1/ns,A0=[new I(-ns,Ys,0),new I(ns,Ys,0),new I(-Ys,0,ns),new I(Ys,0,ns),new I(0,ns,-Ys),new I(0,ns,Ys),new I(-1,1,-1),new I(1,1,-1),new I(-1,1,1),new I(1,1,1)];class Up{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){pf=this._renderer.getRenderTarget(),mf=this._renderer.getActiveCubeFace(),gf=this._renderer.getActiveMipmapLevel(),xf=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=P0(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=R0(),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(pf,mf,gf),this._renderer.xr.enabled=xf,e.scissorTest=!1,wc(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Ki||e.mapping===Ir?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),pf=this._renderer.getRenderTarget(),mf=this._renderer.getActiveCubeFace(),gf=this._renderer.getActiveMipmapLevel(),xf=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:Ut,minFilter:Ut,generateMipmaps:!1,type:Ho,format:dn,colorSpace:tr,depthBuffer:!1},r=C0(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=C0(e,t,i);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=w2(s)),this._blurMaterial=b2(s,e,t)}return r}_compileMaterial(e){const t=new kt(this._lodPlanes[0],e);this._renderer.compile(t,ff)}_sceneToCubeUV(e,t,i,r){const a=new Yt(90,1,t,i),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,h=u.autoClear,d=u.toneMapping;u.getClearColor(T0),u.toneMapping=ji,u.autoClear=!1;const p=new Or({name:"PMREM.Background",side:fn,depthWrite:!1,depthTest:!1}),m=new kt(new Cs,p);let x=!1;const g=e.background;g?g.isColor&&(p.color.copy(g),e.background=null,x=!0):(p.color.copy(T0),x=!0);for(let f=0;f<6;f++){const v=f%3;v===0?(a.up.set(0,l[f],0),a.lookAt(c[f],0,0)):v===1?(a.up.set(0,0,l[f]),a.lookAt(0,c[f],0)):(a.up.set(0,l[f],0),a.lookAt(0,0,c[f]));const y=this._cubeSize;wc(r,v*y,f>2?y:0,y,y),u.setRenderTarget(r),x&&u.render(m,a),u.render(e,a)}m.geometry.dispose(),m.material.dispose(),u.toneMapping=d,u.autoClear=h,e.background=g}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===Ki||e.mapping===Ir;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=P0()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=R0());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new kt(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;wc(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,ff)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;s<r;s++){const o=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),a=A0[(r-s-1)%A0.length];this._blur(e,s-1,s,o,a)}t.autoClear=i}_blur(e,t,i,r,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,i,r,"latitudinal",s),this._halfBlur(o,e,i,i,r,"longitudinal",s)}_halfBlur(e,t,i,r,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 u=3,h=new kt(this._lodPlanes[r],c),d=c.uniforms,p=this._sizeLods[i]-1,m=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*is-1),x=s/m,g=isFinite(s)?1+Math.floor(u*x):is;g>is&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${is}`);const f=[];let v=0;for(let E=0;E<is;++E){const A=E/x,b=Math.exp(-A*A/2);f.push(b),E===0?v+=b:E<g&&(v+=2*b)}for(let E=0;E<f.length;E++)f[E]=f[E]/v;d.envMap.value=e.texture,d.samples.value=g,d.weights.value=f,d.latitudinal.value=o==="latitudinal",a&&(d.poleAxis.value=a);const{_lodMax:y}=this;d.dTheta.value=m,d.mipInt.value=y-i;const _=this._sizeLods[r],R=3*_*(r>y-mo?r-y+mo:0),w=4*(this._cubeSize-_);wc(t,R,w,3*_,2*_),l.setRenderTarget(t),l.render(h,ff)}}function w2(n){const e=[],t=[],i=[];let r=n;const s=n-mo+1+E0.length;for(let o=0;o<s;o++){const a=Math.pow(2,r);t.push(a);let l=1/a;o>n-mo?l=E0[o-n+mo-1]:o===0&&(l=0),i.push(l);const c=1/(a-2),u=-c,h=1+c,d=[u,u,h,u,h,h,u,u,h,h,u,h],p=6,m=6,x=3,g=2,f=1,v=new Float32Array(x*m*p),y=new Float32Array(g*m*p),_=new Float32Array(f*m*p);for(let w=0;w<p;w++){const E=w%3*2/3-1,A=w>2?0:-1,b=[E,A,0,E+2/3,A,0,E+2/3,A+1,0,E,A,0,E+2/3,A+1,0,E,A+1,0];v.set(b,x*m*w),y.set(d,g*m*w);const M=[w,w,w,w,w,w];_.set(M,f*m*w)}const R=new Ye;R.setAttribute("position",new ht(v,x)),R.setAttribute("uv",new ht(y,g)),R.setAttribute("faceIndex",new ht(_,f)),e.push(R),r>mo&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function C0(n,e,t){const i=new li(n,e,t);return i.texture.mapping=Vo,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function wc(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function b2(n,e,t){const i=new Float32Array(is),r=new I(0,1,0);return new ci({name:"SphericalGaussianBlur",defines:{n:is,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:rg(),fragmentShader:`
3647
3647
 
3648
3648
  precision mediump float;
3649
3649
  precision mediump int;
@@ -3703,7 +3703,7 @@ void main() {
3703
3703
  }
3704
3704
 
3705
3705
  }
3706
- `,blending:Wi,depthTest:!1,depthWrite:!1})}function C0(){return new ci({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:ig(),fragmentShader:`
3706
+ `,blending:Wi,depthTest:!1,depthWrite:!1})}function R0(){return new ci({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:rg(),fragmentShader:`
3707
3707
 
3708
3708
  precision mediump float;
3709
3709
  precision mediump int;
@@ -3722,7 +3722,7 @@ void main() {
3722
3722
  gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3723
3723
 
3724
3724
  }
3725
- `,blending:Wi,depthTest:!1,depthWrite:!1})}function R0(){return new ci({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:ig(),fragmentShader:`
3725
+ `,blending:Wi,depthTest:!1,depthWrite:!1})}function P0(){return new ci({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:rg(),fragmentShader:`
3726
3726
 
3727
3727
  precision mediump float;
3728
3728
  precision mediump int;
@@ -3738,7 +3738,7 @@ void main() {
3738
3738
  gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3739
3739
 
3740
3740
  }
3741
- `,blending:Wi,depthTest:!1,depthWrite:!1})}function ig(){return`
3741
+ `,blending:Wi,depthTest:!1,depthWrite:!1})}function rg(){return`
3742
3742
 
3743
3743
  precision mediump float;
3744
3744
  precision mediump int;
@@ -3793,16 +3793,16 @@ void main() {
3793
3793
  gl_Position = vec4( position, 1.0 );
3794
3794
 
3795
3795
  }
3796
- `}function E2(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,c=l===il||l===rl,u=l===Ki||l===Ir;if(c||u){let h=e.get(a);const d=h!==void 0?h.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==d)return t===null&&(t=new Up(n)),h=c?t.fromEquirectangular(a,h):t.fromCubemap(a,h),h.texture.pmremVersion=a.pmremVersion,e.set(a,h),h.texture;if(h!==void 0)return h.texture;{const p=a.image;return c&&p&&p.height>0||u&&p&&r(p)?(t===null&&(t=new Up(n)),h=c?t.fromEquirectangular(a):t.fromCubemap(a),h.texture.pmremVersion=a.pmremVersion,e.set(a,h),a.addEventListener("dispose",s),h.texture):null}}}return a}function r(a){let l=0;const c=6;for(let u=0;u<c;u++)a[u]!==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,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:o}}function T2(n){const e={};function t(i){if(e[i]!==void 0)return e[i];let r;switch(i){case"WEBGL_depth_texture":r=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=n.getExtension(i)}return e[i]=r,r}return{has:function(i){return t(i)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(i){const r=t(i);return r===null&&bo("THREE.WebGLRenderer: "+i+" extension not supported."),r}}}function A2(n,e,t,i){const r={},s=new WeakMap;function o(h){const d=h.target;d.index!==null&&e.remove(d.index);for(const m in d.attributes)e.remove(d.attributes[m]);for(const m in d.morphAttributes){const x=d.morphAttributes[m];for(let g=0,f=x.length;g<f;g++)e.remove(x[g])}d.removeEventListener("dispose",o),delete r[d.id];const p=s.get(d);p&&(e.remove(p),s.delete(d)),i.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function a(h,d){return r[d.id]===!0||(d.addEventListener("dispose",o),r[d.id]=!0,t.memory.geometries++),d}function l(h){const d=h.attributes;for(const m in d)e.update(d[m],n.ARRAY_BUFFER);const p=h.morphAttributes;for(const m in p){const x=p[m];for(let g=0,f=x.length;g<f;g++)e.update(x[g],n.ARRAY_BUFFER)}}function c(h){const d=[],p=h.index,m=h.attributes.position;let x=0;if(p!==null){const v=p.array;x=p.version;for(let y=0,_=v.length;y<_;y+=3){const C=v[y+0],w=v[y+1],E=v[y+2];d.push(C,w,w,E,E,C)}}else if(m!==void 0){const v=m.array;x=m.version;for(let y=0,_=v.length/3-1;y<_;y+=3){const C=y+0,w=y+1,E=y+2;d.push(C,w,w,E,E,C)}}else return;const g=new(rM(d)?ng:tg)(d,1);g.version=x;const f=s.get(h);f&&e.remove(f),s.set(h,g)}function u(h){const d=s.get(h);if(d){const p=h.index;p!==null&&d.version<p.version&&c(h)}else c(h);return s.get(h)}return{get:a,update:l,getWireframeAttribute:u}}function C2(n,e,t){let i;function r(d){i=d}let s,o;function a(d){s=d.type,o=d.bytesPerElement}function l(d,p){n.drawElements(i,p,s,d*o),t.update(p,i,1)}function c(d,p,m){m!==0&&(n.drawElementsInstanced(i,p,s,d*o,m),t.update(p,i,m))}function u(d,p,m){if(m===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,p,0,s,d,0,m);let g=0;for(let f=0;f<m;f++)g+=p[f];t.update(g,i,1)}function h(d,p,m,x){if(m===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let f=0;f<d.length;f++)c(d[f]/o,p[f],x[f]);else{g.multiDrawElementsInstancedWEBGL(i,p,0,s,d,0,x,0,m);let f=0;for(let v=0;v<m;v++)f+=p[v];for(let v=0;v<x.length;v++)t.update(f,i,x[v])}}this.setMode=r,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=u,this.renderMultiDrawInstances=h}function R2(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,o,a){switch(t.calls++,o){case n.TRIANGLES:t.triangles+=a*(s/3);break;case n.LINES:t.lines+=a*(s/2);break;case n.LINE_STRIP:t.lines+=a*(s-1);break;case n.LINE_LOOP:t.lines+=a*s;break;case n.POINTS:t.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:i}}function P2(n,e,t){const i=new WeakMap,r=new ct;function s(o,a,l){const c=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,h=u!==void 0?u.length:0;let d=i.get(a);if(d===void 0||d.count!==h){let b=function(){E.dispose(),i.delete(a),a.removeEventListener("dispose",b)};d!==void 0&&d.texture.dispose();const p=a.morphAttributes.position!==void 0,m=a.morphAttributes.normal!==void 0,x=a.morphAttributes.color!==void 0,g=a.morphAttributes.position||[],f=a.morphAttributes.normal||[],v=a.morphAttributes.color||[];let y=0;p===!0&&(y=1),m===!0&&(y=2),x===!0&&(y=3);let _=a.attributes.position.count*y,C=1;_>e.maxTextureSize&&(C=Math.ceil(_/e.maxTextureSize),_=e.maxTextureSize);const w=new Float32Array(_*C*4*h),E=new Bd(w,_,C,h);E.type=Sn,E.needsUpdate=!0;const A=y*4;for(let M=0;M<h;M++){const L=g[M],G=f[M],B=v[M],j=_*C*4*M;for(let U=0;U<L.count;U++){const z=U*A;p===!0&&(r.fromBufferAttribute(L,U),w[j+z+0]=r.x,w[j+z+1]=r.y,w[j+z+2]=r.z,w[j+z+3]=0),m===!0&&(r.fromBufferAttribute(G,U),w[j+z+4]=r.x,w[j+z+5]=r.y,w[j+z+6]=r.z,w[j+z+7]=0),x===!0&&(r.fromBufferAttribute(B,U),w[j+z+8]=r.x,w[j+z+9]=r.y,w[j+z+10]=r.z,w[j+z+11]=B.itemSize===4?r.w:1)}}d={count:h,texture:E,size:new Q(_,C)},i.set(a,d),a.addEventListener("dispose",b)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(n,"morphTexture",o.morphTexture,t);else{let p=0;for(let x=0;x<c.length;x++)p+=c[x];const m=a.morphTargetsRelative?1:1-p;l.getUniforms().setValue(n,"morphTargetBaseInfluence",m),l.getUniforms().setValue(n,"morphTargetInfluences",c)}l.getUniforms().setValue(n,"morphTargetsTexture",d.texture,t),l.getUniforms().setValue(n,"morphTargetsTextureSize",d.size)}return{update:s}}function I2(n,e,t,i){let r=new WeakMap;function s(l){const c=i.render.frame,u=l.geometry,h=e.get(l,u);if(r.get(h)!==c&&(e.update(h),r.set(h,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),r.get(l)!==c&&(t.update(l.instanceMatrix,n.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,n.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const d=l.skeleton;r.get(d)!==c&&(d.update(),r.set(d,c))}return h}function o(){r=new WeakMap}function a(l){const c=l.target;c.removeEventListener("dispose",a),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:o}}class rg extends Ct{constructor(e,t,i,r,s,o,a,l,c,u=ps){if(u!==ps&&u!==ws)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===ps&&(i=Ji),i===void 0&&u===ws&&(i=Ms),super(null,r,s,o,a,l,u,i,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:Gt,this.minFilter=l!==void 0?l:Gt,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}const pM=new Ct,P0=new rg(1,1),mM=new Bd,gM=new eg,xM=new Il,I0=[],N0=[],L0=new Float32Array(16),D0=new Float32Array(9),U0=new Float32Array(4);function jo(n,e,t){const i=n[0];if(i<=0||i>0)return n;const r=e*t;let s=I0[r];if(s===void 0&&(s=new Float32Array(r),I0[r]=s),e!==0){i.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function Bt(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function zt(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function Gd(n,e){let t=N0[e];t===void 0&&(t=new Int32Array(e),N0[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function N2(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function L2(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Bt(t,e))return;n.uniform2fv(this.addr,e),zt(t,e)}}function D2(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Bt(t,e))return;n.uniform3fv(this.addr,e),zt(t,e)}}function U2(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Bt(t,e))return;n.uniform4fv(this.addr,e),zt(t,e)}}function k2(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Bt(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),zt(t,e)}else{if(Bt(t,i))return;U0.set(i),n.uniformMatrix2fv(this.addr,!1,U0),zt(t,i)}}function O2(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Bt(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),zt(t,e)}else{if(Bt(t,i))return;D0.set(i),n.uniformMatrix3fv(this.addr,!1,D0),zt(t,i)}}function F2(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Bt(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),zt(t,e)}else{if(Bt(t,i))return;L0.set(i),n.uniformMatrix4fv(this.addr,!1,L0),zt(t,i)}}function B2(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function z2(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Bt(t,e))return;n.uniform2iv(this.addr,e),zt(t,e)}}function V2(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Bt(t,e))return;n.uniform3iv(this.addr,e),zt(t,e)}}function H2(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Bt(t,e))return;n.uniform4iv(this.addr,e),zt(t,e)}}function G2(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function W2(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Bt(t,e))return;n.uniform2uiv(this.addr,e),zt(t,e)}}function j2(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Bt(t,e))return;n.uniform3uiv(this.addr,e),zt(t,e)}}function X2(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Bt(t,e))return;n.uniform4uiv(this.addr,e),zt(t,e)}}function $2(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r);let s;this.type===n.SAMPLER_2D_SHADOW?(P0.compareFunction=Jm,s=P0):s=pM,t.setTexture2D(e||s,r)}function Y2(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture3D(e||gM,r)}function q2(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTextureCube(e||xM,r)}function Z2(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2DArray(e||mM,r)}function K2(n){switch(n){case 5126:return N2;case 35664:return L2;case 35665:return D2;case 35666:return U2;case 35674:return k2;case 35675:return O2;case 35676:return F2;case 5124:case 35670:return B2;case 35667:case 35671:return z2;case 35668:case 35672:return V2;case 35669:case 35673:return H2;case 5125:return G2;case 36294:return W2;case 36295:return j2;case 36296:return X2;case 35678:case 36198:case 36298:case 36306:case 35682:return $2;case 35679:case 36299:case 36307:return Y2;case 35680:case 36300:case 36308:case 36293:return q2;case 36289:case 36303:case 36311:case 36292:return Z2}}function J2(n,e){n.uniform1fv(this.addr,e)}function Q2(n,e){const t=jo(e,this.size,2);n.uniform2fv(this.addr,t)}function eP(n,e){const t=jo(e,this.size,3);n.uniform3fv(this.addr,t)}function tP(n,e){const t=jo(e,this.size,4);n.uniform4fv(this.addr,t)}function nP(n,e){const t=jo(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function iP(n,e){const t=jo(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function rP(n,e){const t=jo(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function sP(n,e){n.uniform1iv(this.addr,e)}function oP(n,e){n.uniform2iv(this.addr,e)}function aP(n,e){n.uniform3iv(this.addr,e)}function lP(n,e){n.uniform4iv(this.addr,e)}function cP(n,e){n.uniform1uiv(this.addr,e)}function uP(n,e){n.uniform2uiv(this.addr,e)}function dP(n,e){n.uniform3uiv(this.addr,e)}function hP(n,e){n.uniform4uiv(this.addr,e)}function fP(n,e,t){const i=this.cache,r=e.length,s=Gd(t,r);Bt(i,s)||(n.uniform1iv(this.addr,s),zt(i,s));for(let o=0;o!==r;++o)t.setTexture2D(e[o]||pM,s[o])}function pP(n,e,t){const i=this.cache,r=e.length,s=Gd(t,r);Bt(i,s)||(n.uniform1iv(this.addr,s),zt(i,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||gM,s[o])}function mP(n,e,t){const i=this.cache,r=e.length,s=Gd(t,r);Bt(i,s)||(n.uniform1iv(this.addr,s),zt(i,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||xM,s[o])}function gP(n,e,t){const i=this.cache,r=e.length,s=Gd(t,r);Bt(i,s)||(n.uniform1iv(this.addr,s),zt(i,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||mM,s[o])}function xP(n){switch(n){case 5126:return J2;case 35664:return Q2;case 35665:return eP;case 35666:return tP;case 35674:return nP;case 35675:return iP;case 35676:return rP;case 5124:case 35670:return sP;case 35667:case 35671:return oP;case 35668:case 35672:return aP;case 35669:case 35673:return lP;case 5125:return cP;case 36294:return uP;case 36295:return dP;case 36296:return hP;case 35678:case 36198:case 36298:case 36306:case 35682:return fP;case 35679:case 36299:case 36307:return pP;case 35680:case 36300:case 36308:case 36293:return mP;case 36289:case 36303:case 36311:case 36292:return gP}}class vP{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=K2(t.type)}}class yP{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=xP(t.type)}}class _P{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){const r=this.seq;for(let s=0,o=r.length;s!==o;++s){const a=r[s];a.setValue(e,t[a.id],i)}}}const vf=/(\w+)(\])?(\[|\.)?/g;function k0(n,e){n.seq.push(e),n.map[e.id]=e}function SP(n,e,t){const i=n.name,r=i.length;for(vf.lastIndex=0;;){const s=vf.exec(i),o=vf.lastIndex;let a=s[1];const l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){k0(t,c===void 0?new vP(a,n,e):new yP(a,n,e));break}else{let h=t.map[a];h===void 0&&(h=new _P(a),k0(t,h)),t=h}}}class lu{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<i;++r){const s=e.getActiveUniform(t,r),o=e.getUniformLocation(t,s.name);SP(s,o,this)}}setValue(e,t,i,r){const s=this.map[t];s!==void 0&&s.setValue(e,i,r)}setOptional(e,t,i){const r=t[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let s=0,o=t.length;s!==o;++s){const a=t[s],l=i[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,r)}}static seqWithValue(e,t){const i=[];for(let r=0,s=e.length;r!==s;++r){const o=e[r];o.id in t&&i.push(o)}return i}}function O0(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}const MP=37297;let wP=0;function bP(n,e){const t=n.split(`
3796
+ `}function E2(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,c=l===il||l===rl,u=l===Ki||l===Ir;if(c||u){let h=e.get(a);const d=h!==void 0?h.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==d)return t===null&&(t=new Up(n)),h=c?t.fromEquirectangular(a,h):t.fromCubemap(a,h),h.texture.pmremVersion=a.pmremVersion,e.set(a,h),h.texture;if(h!==void 0)return h.texture;{const p=a.image;return c&&p&&p.height>0||u&&p&&r(p)?(t===null&&(t=new Up(n)),h=c?t.fromEquirectangular(a):t.fromCubemap(a),h.texture.pmremVersion=a.pmremVersion,e.set(a,h),a.addEventListener("dispose",s),h.texture):null}}}return a}function r(a){let l=0;const c=6;for(let u=0;u<c;u++)a[u]!==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,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:o}}function T2(n){const e={};function t(i){if(e[i]!==void 0)return e[i];let r;switch(i){case"WEBGL_depth_texture":r=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=n.getExtension(i)}return e[i]=r,r}return{has:function(i){return t(i)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(i){const r=t(i);return r===null&&bo("THREE.WebGLRenderer: "+i+" extension not supported."),r}}}function A2(n,e,t,i){const r={},s=new WeakMap;function o(h){const d=h.target;d.index!==null&&e.remove(d.index);for(const m in d.attributes)e.remove(d.attributes[m]);for(const m in d.morphAttributes){const x=d.morphAttributes[m];for(let g=0,f=x.length;g<f;g++)e.remove(x[g])}d.removeEventListener("dispose",o),delete r[d.id];const p=s.get(d);p&&(e.remove(p),s.delete(d)),i.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function a(h,d){return r[d.id]===!0||(d.addEventListener("dispose",o),r[d.id]=!0,t.memory.geometries++),d}function l(h){const d=h.attributes;for(const m in d)e.update(d[m],n.ARRAY_BUFFER);const p=h.morphAttributes;for(const m in p){const x=p[m];for(let g=0,f=x.length;g<f;g++)e.update(x[g],n.ARRAY_BUFFER)}}function c(h){const d=[],p=h.index,m=h.attributes.position;let x=0;if(p!==null){const v=p.array;x=p.version;for(let y=0,_=v.length;y<_;y+=3){const R=v[y+0],w=v[y+1],E=v[y+2];d.push(R,w,w,E,E,R)}}else if(m!==void 0){const v=m.array;x=m.version;for(let y=0,_=v.length/3-1;y<_;y+=3){const R=y+0,w=y+1,E=y+2;d.push(R,w,w,E,E,R)}}else return;const g=new(rM(d)?ig:ng)(d,1);g.version=x;const f=s.get(h);f&&e.remove(f),s.set(h,g)}function u(h){const d=s.get(h);if(d){const p=h.index;p!==null&&d.version<p.version&&c(h)}else c(h);return s.get(h)}return{get:a,update:l,getWireframeAttribute:u}}function C2(n,e,t){let i;function r(d){i=d}let s,o;function a(d){s=d.type,o=d.bytesPerElement}function l(d,p){n.drawElements(i,p,s,d*o),t.update(p,i,1)}function c(d,p,m){m!==0&&(n.drawElementsInstanced(i,p,s,d*o,m),t.update(p,i,m))}function u(d,p,m){if(m===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,p,0,s,d,0,m);let g=0;for(let f=0;f<m;f++)g+=p[f];t.update(g,i,1)}function h(d,p,m,x){if(m===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let f=0;f<d.length;f++)c(d[f]/o,p[f],x[f]);else{g.multiDrawElementsInstancedWEBGL(i,p,0,s,d,0,x,0,m);let f=0;for(let v=0;v<m;v++)f+=p[v];for(let v=0;v<x.length;v++)t.update(f,i,x[v])}}this.setMode=r,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=u,this.renderMultiDrawInstances=h}function R2(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,o,a){switch(t.calls++,o){case n.TRIANGLES:t.triangles+=a*(s/3);break;case n.LINES:t.lines+=a*(s/2);break;case n.LINE_STRIP:t.lines+=a*(s-1);break;case n.LINE_LOOP:t.lines+=a*s;break;case n.POINTS:t.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:i}}function P2(n,e,t){const i=new WeakMap,r=new ct;function s(o,a,l){const c=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,h=u!==void 0?u.length:0;let d=i.get(a);if(d===void 0||d.count!==h){let b=function(){E.dispose(),i.delete(a),a.removeEventListener("dispose",b)};d!==void 0&&d.texture.dispose();const p=a.morphAttributes.position!==void 0,m=a.morphAttributes.normal!==void 0,x=a.morphAttributes.color!==void 0,g=a.morphAttributes.position||[],f=a.morphAttributes.normal||[],v=a.morphAttributes.color||[];let y=0;p===!0&&(y=1),m===!0&&(y=2),x===!0&&(y=3);let _=a.attributes.position.count*y,R=1;_>e.maxTextureSize&&(R=Math.ceil(_/e.maxTextureSize),_=e.maxTextureSize);const w=new Float32Array(_*R*4*h),E=new Bd(w,_,R,h);E.type=Sn,E.needsUpdate=!0;const A=y*4;for(let M=0;M<h;M++){const L=g[M],G=f[M],B=v[M],j=_*R*4*M;for(let U=0;U<L.count;U++){const z=U*A;p===!0&&(r.fromBufferAttribute(L,U),w[j+z+0]=r.x,w[j+z+1]=r.y,w[j+z+2]=r.z,w[j+z+3]=0),m===!0&&(r.fromBufferAttribute(G,U),w[j+z+4]=r.x,w[j+z+5]=r.y,w[j+z+6]=r.z,w[j+z+7]=0),x===!0&&(r.fromBufferAttribute(B,U),w[j+z+8]=r.x,w[j+z+9]=r.y,w[j+z+10]=r.z,w[j+z+11]=B.itemSize===4?r.w:1)}}d={count:h,texture:E,size:new Q(_,R)},i.set(a,d),a.addEventListener("dispose",b)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(n,"morphTexture",o.morphTexture,t);else{let p=0;for(let x=0;x<c.length;x++)p+=c[x];const m=a.morphTargetsRelative?1:1-p;l.getUniforms().setValue(n,"morphTargetBaseInfluence",m),l.getUniforms().setValue(n,"morphTargetInfluences",c)}l.getUniforms().setValue(n,"morphTargetsTexture",d.texture,t),l.getUniforms().setValue(n,"morphTargetsTextureSize",d.size)}return{update:s}}function I2(n,e,t,i){let r=new WeakMap;function s(l){const c=i.render.frame,u=l.geometry,h=e.get(l,u);if(r.get(h)!==c&&(e.update(h),r.set(h,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),r.get(l)!==c&&(t.update(l.instanceMatrix,n.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,n.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const d=l.skeleton;r.get(d)!==c&&(d.update(),r.set(d,c))}return h}function o(){r=new WeakMap}function a(l){const c=l.target;c.removeEventListener("dispose",a),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:o}}class sg extends Ct{constructor(e,t,i,r,s,o,a,l,c,u=ps){if(u!==ps&&u!==ws)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===ps&&(i=Ji),i===void 0&&u===ws&&(i=Ms),super(null,r,s,o,a,l,u,i,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:Gt,this.minFilter=l!==void 0?l:Gt,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}const pM=new Ct,I0=new sg(1,1),mM=new Bd,gM=new tg,xM=new Nl,N0=[],L0=[],D0=new Float32Array(16),U0=new Float32Array(9),k0=new Float32Array(4);function jo(n,e,t){const i=n[0];if(i<=0||i>0)return n;const r=e*t;let s=N0[r];if(s===void 0&&(s=new Float32Array(r),N0[r]=s),e!==0){i.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function Bt(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function zt(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function Gd(n,e){let t=L0[e];t===void 0&&(t=new Int32Array(e),L0[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function N2(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function L2(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Bt(t,e))return;n.uniform2fv(this.addr,e),zt(t,e)}}function D2(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Bt(t,e))return;n.uniform3fv(this.addr,e),zt(t,e)}}function U2(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Bt(t,e))return;n.uniform4fv(this.addr,e),zt(t,e)}}function k2(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Bt(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),zt(t,e)}else{if(Bt(t,i))return;k0.set(i),n.uniformMatrix2fv(this.addr,!1,k0),zt(t,i)}}function O2(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Bt(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),zt(t,e)}else{if(Bt(t,i))return;U0.set(i),n.uniformMatrix3fv(this.addr,!1,U0),zt(t,i)}}function F2(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Bt(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),zt(t,e)}else{if(Bt(t,i))return;D0.set(i),n.uniformMatrix4fv(this.addr,!1,D0),zt(t,i)}}function B2(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function z2(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Bt(t,e))return;n.uniform2iv(this.addr,e),zt(t,e)}}function V2(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Bt(t,e))return;n.uniform3iv(this.addr,e),zt(t,e)}}function H2(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Bt(t,e))return;n.uniform4iv(this.addr,e),zt(t,e)}}function G2(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function W2(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Bt(t,e))return;n.uniform2uiv(this.addr,e),zt(t,e)}}function j2(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Bt(t,e))return;n.uniform3uiv(this.addr,e),zt(t,e)}}function X2(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Bt(t,e))return;n.uniform4uiv(this.addr,e),zt(t,e)}}function $2(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r);let s;this.type===n.SAMPLER_2D_SHADOW?(I0.compareFunction=Qm,s=I0):s=pM,t.setTexture2D(e||s,r)}function Y2(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture3D(e||gM,r)}function q2(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTextureCube(e||xM,r)}function Z2(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2DArray(e||mM,r)}function K2(n){switch(n){case 5126:return N2;case 35664:return L2;case 35665:return D2;case 35666:return U2;case 35674:return k2;case 35675:return O2;case 35676:return F2;case 5124:case 35670:return B2;case 35667:case 35671:return z2;case 35668:case 35672:return V2;case 35669:case 35673:return H2;case 5125:return G2;case 36294:return W2;case 36295:return j2;case 36296:return X2;case 35678:case 36198:case 36298:case 36306:case 35682:return $2;case 35679:case 36299:case 36307:return Y2;case 35680:case 36300:case 36308:case 36293:return q2;case 36289:case 36303:case 36311:case 36292:return Z2}}function J2(n,e){n.uniform1fv(this.addr,e)}function Q2(n,e){const t=jo(e,this.size,2);n.uniform2fv(this.addr,t)}function eP(n,e){const t=jo(e,this.size,3);n.uniform3fv(this.addr,t)}function tP(n,e){const t=jo(e,this.size,4);n.uniform4fv(this.addr,t)}function nP(n,e){const t=jo(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function iP(n,e){const t=jo(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function rP(n,e){const t=jo(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function sP(n,e){n.uniform1iv(this.addr,e)}function oP(n,e){n.uniform2iv(this.addr,e)}function aP(n,e){n.uniform3iv(this.addr,e)}function lP(n,e){n.uniform4iv(this.addr,e)}function cP(n,e){n.uniform1uiv(this.addr,e)}function uP(n,e){n.uniform2uiv(this.addr,e)}function dP(n,e){n.uniform3uiv(this.addr,e)}function hP(n,e){n.uniform4uiv(this.addr,e)}function fP(n,e,t){const i=this.cache,r=e.length,s=Gd(t,r);Bt(i,s)||(n.uniform1iv(this.addr,s),zt(i,s));for(let o=0;o!==r;++o)t.setTexture2D(e[o]||pM,s[o])}function pP(n,e,t){const i=this.cache,r=e.length,s=Gd(t,r);Bt(i,s)||(n.uniform1iv(this.addr,s),zt(i,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||gM,s[o])}function mP(n,e,t){const i=this.cache,r=e.length,s=Gd(t,r);Bt(i,s)||(n.uniform1iv(this.addr,s),zt(i,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||xM,s[o])}function gP(n,e,t){const i=this.cache,r=e.length,s=Gd(t,r);Bt(i,s)||(n.uniform1iv(this.addr,s),zt(i,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||mM,s[o])}function xP(n){switch(n){case 5126:return J2;case 35664:return Q2;case 35665:return eP;case 35666:return tP;case 35674:return nP;case 35675:return iP;case 35676:return rP;case 5124:case 35670:return sP;case 35667:case 35671:return oP;case 35668:case 35672:return aP;case 35669:case 35673:return lP;case 5125:return cP;case 36294:return uP;case 36295:return dP;case 36296:return hP;case 35678:case 36198:case 36298:case 36306:case 35682:return fP;case 35679:case 36299:case 36307:return pP;case 35680:case 36300:case 36308:case 36293:return mP;case 36289:case 36303:case 36311:case 36292:return gP}}class vP{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=K2(t.type)}}class yP{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=xP(t.type)}}class _P{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){const r=this.seq;for(let s=0,o=r.length;s!==o;++s){const a=r[s];a.setValue(e,t[a.id],i)}}}const vf=/(\w+)(\])?(\[|\.)?/g;function O0(n,e){n.seq.push(e),n.map[e.id]=e}function SP(n,e,t){const i=n.name,r=i.length;for(vf.lastIndex=0;;){const s=vf.exec(i),o=vf.lastIndex;let a=s[1];const l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){O0(t,c===void 0?new vP(a,n,e):new yP(a,n,e));break}else{let h=t.map[a];h===void 0&&(h=new _P(a),O0(t,h)),t=h}}}class cu{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<i;++r){const s=e.getActiveUniform(t,r),o=e.getUniformLocation(t,s.name);SP(s,o,this)}}setValue(e,t,i,r){const s=this.map[t];s!==void 0&&s.setValue(e,i,r)}setOptional(e,t,i){const r=t[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let s=0,o=t.length;s!==o;++s){const a=t[s],l=i[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,r)}}static seqWithValue(e,t){const i=[];for(let r=0,s=e.length;r!==s;++r){const o=e[r];o.id in t&&i.push(o)}return i}}function F0(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}const MP=37297;let wP=0;function bP(n,e){const t=n.split(`
3797
3797
  `),i=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=r;o<s;o++){const a=o+1;i.push(`${a===e?">":" "} ${a}: ${t[o]}`)}return i.join(`
3798
- `)}function EP(n){const e=rt.getPrimaries(rt.workingColorSpace),t=rt.getPrimaries(n);let i;switch(e===t?i="":e===dl&&t===ul?i="LinearDisplayP3ToLinearSRGB":e===ul&&t===dl&&(i="LinearSRGBToLinearDisplayP3"),n){case tr:case Pl:return[i,"LinearTransferOETF"];case Hn:case Fd:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[i,"LinearTransferOETF"]}}function F0(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return t.toUpperCase()+`
3798
+ `)}function EP(n){const e=rt.getPrimaries(rt.workingColorSpace),t=rt.getPrimaries(n);let i;switch(e===t?i="":e===dl&&t===ul?i="LinearDisplayP3ToLinearSRGB":e===ul&&t===dl&&(i="LinearSRGBToLinearDisplayP3"),n){case tr:case Il:return[i,"LinearTransferOETF"];case Hn:case Fd:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[i,"LinearTransferOETF"]}}function B0(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return t.toUpperCase()+`
3799
3799
 
3800
3800
  `+r+`
3801
3801
 
3802
- `+bP(n.getShaderSource(e),o)}else return r}function TP(n,e){const t=EP(e);return`vec4 ${n}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function AP(n,e){let t;switch(e){case OS:t="Linear";break;case FS:t="Reinhard";break;case BS:t="Cineon";break;case zS:t="ACESFilmic";break;case HS:t="AgX";break;case GS:t="Neutral";break;case VS:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const wc=new I;function CP(){rt.getLuminanceCoefficients(wc);const n=wc.x.toFixed(4),e=wc.y.toFixed(4),t=wc.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
3802
+ `+bP(n.getShaderSource(e),o)}else return r}function TP(n,e){const t=EP(e);return`vec4 ${n}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function AP(n,e){let t;switch(e){case OS:t="Linear";break;case FS:t="Reinhard";break;case BS:t="Cineon";break;case zS:t="ACESFilmic";break;case HS:t="AgX";break;case GS:t="Neutral";break;case VS:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const bc=new I;function CP(){rt.getLuminanceCoefficients(bc);const n=bc.x.toFixed(4),e=bc.y.toFixed(4),t=bc.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
3803
3803
  `)}function RP(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(_a).join(`
3804
3804
  `)}function PP(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
3805
- `)}function IP(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const s=n.getActiveAttrib(e,r),o=s.name;let a=1;s.type===n.FLOAT_MAT2&&(a=2),s.type===n.FLOAT_MAT3&&(a=3),s.type===n.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:n.getAttribLocation(e,o),locationSize:a}}return t}function _a(n){return n!==""}function B0(n,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.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,t).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 z0(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const NP=/^[ \t]*#include +<([\w\d./]+)>/gm;function kp(n){return n.replace(NP,DP)}const LP=new Map;function DP(n,e){let t=$e[e];if(t===void 0){const i=LP.get(e);if(i!==void 0)t=$e[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return kp(t)}const UP=/#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 V0(n){return n.replace(UP,kP)}function kP(n,e,t,i){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function H0(n){let e=`precision ${n.precision} float;
3805
+ `)}function IP(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const s=n.getActiveAttrib(e,r),o=s.name;let a=1;s.type===n.FLOAT_MAT2&&(a=2),s.type===n.FLOAT_MAT3&&(a=3),s.type===n.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:n.getAttribLocation(e,o),locationSize:a}}return t}function _a(n){return n!==""}function z0(n,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.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,t).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 V0(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const NP=/^[ \t]*#include +<([\w\d./]+)>/gm;function kp(n){return n.replace(NP,DP)}const LP=new Map;function DP(n,e){let t=$e[e];if(t===void 0){const i=LP.get(e);if(i!==void 0)t=$e[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return kp(t)}const UP=/#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 H0(n){return n.replace(UP,kP)}function kP(n,e,t,i){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function G0(n){let e=`precision ${n.precision} float;
3806
3806
  precision ${n.precision} int;
3807
3807
  precision ${n.precision} sampler2D;
3808
3808
  precision ${n.precision} samplerCube;
@@ -3822,28 +3822,28 @@ void main() {
3822
3822
  `;return n.precision==="highp"?e+=`
3823
3823
  #define HIGH_PRECISION`:n.precision==="mediump"?e+=`
3824
3824
  #define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=`
3825
- #define LOW_PRECISION`),e}function OP(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===zm?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===cS?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===gi&&(e="SHADOWMAP_TYPE_VSM"),e}function FP(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case Ki:case Ir:e="ENVMAP_TYPE_CUBE";break;case Vo:e="ENVMAP_TYPE_CUBE_UV";break}return e}function BP(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case Ir:e="ENVMAP_MODE_REFRACTION";break}return e}function zP(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case Cl:e="ENVMAP_BLENDING_MULTIPLY";break;case US:e="ENVMAP_BLENDING_MIX";break;case kS:e="ENVMAP_BLENDING_ADD";break}return e}function VP(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:i,maxMip:t}}function HP(n,e,t,i){const r=n.getContext(),s=t.defines;let o=t.vertexShader,a=t.fragmentShader;const l=OP(t),c=FP(t),u=BP(t),h=zP(t),d=VP(t),p=RP(t),m=PP(s),x=r.createProgram();let g,f,v=t.glslVersion?"#version "+t.glslVersion+`
3825
+ #define LOW_PRECISION`),e}function OP(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===Vm?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===cS?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===gi&&(e="SHADOWMAP_TYPE_VSM"),e}function FP(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case Ki:case Ir:e="ENVMAP_TYPE_CUBE";break;case Vo:e="ENVMAP_TYPE_CUBE_UV";break}return e}function BP(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case Ir:e="ENVMAP_MODE_REFRACTION";break}return e}function zP(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case Rl:e="ENVMAP_BLENDING_MULTIPLY";break;case US:e="ENVMAP_BLENDING_MIX";break;case kS:e="ENVMAP_BLENDING_ADD";break}return e}function VP(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:i,maxMip:t}}function HP(n,e,t,i){const r=n.getContext(),s=t.defines;let o=t.vertexShader,a=t.fragmentShader;const l=OP(t),c=FP(t),u=BP(t),h=zP(t),d=VP(t),p=RP(t),m=PP(s),x=r.createProgram();let g,f,v=t.glslVersion?"#version "+t.glslVersion+`
3826
3826
  `:"";t.isRawShaderMaterial?(g=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(_a).join(`
3827
3827
  `),g.length>0&&(g+=`
3828
3828
  `),f=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(_a).join(`
3829
3829
  `),f.length>0&&(f+=`
3830
- `)):(g=[H0(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","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",`
3830
+ `)):(g=[G0(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","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",`
3831
3831
  `].filter(_a).join(`
3832
- `),f=[H0(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==ji?"#define TONE_MAPPING":"",t.toneMapping!==ji?$e.tonemapping_pars_fragment:"",t.toneMapping!==ji?AP("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",$e.colorspace_pars_fragment,TP("linearToOutputTexel",t.outputColorSpace),CP(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
3832
+ `),f=[G0(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==ji?"#define TONE_MAPPING":"",t.toneMapping!==ji?$e.tonemapping_pars_fragment:"",t.toneMapping!==ji?AP("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",$e.colorspace_pars_fragment,TP("linearToOutputTexel",t.outputColorSpace),CP(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
3833
3833
  `].filter(_a).join(`
3834
- `)),o=kp(o),o=B0(o,t),o=z0(o,t),a=kp(a),a=B0(a,t),a=z0(a,t),o=V0(o),a=V0(a),t.isRawShaderMaterial!==!0&&(v=`#version 300 es
3834
+ `)),o=kp(o),o=z0(o,t),o=V0(o,t),a=kp(a),a=z0(a,t),a=V0(a,t),o=H0(o),a=H0(a),t.isRawShaderMaterial!==!0&&(v=`#version 300 es
3835
3835
  `,g=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(`
3836
3836
  `)+`
3837
3837
  `+g,f=["#define varying in",t.glslVersion===Dp?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Dp?"":"#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(`
3838
3838
  `)+`
3839
- `+f);const y=v+g+o,_=v+f+a,C=O0(r,r.VERTEX_SHADER,y),w=O0(r,r.FRAGMENT_SHADER,_);r.attachShader(x,C),r.attachShader(x,w),t.index0AttributeName!==void 0?r.bindAttribLocation(x,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(x,0,"position"),r.linkProgram(x);function E(L){if(n.debug.checkShaderErrors){const G=r.getProgramInfoLog(x).trim(),B=r.getShaderInfoLog(C).trim(),j=r.getShaderInfoLog(w).trim();let U=!0,z=!0;if(r.getProgramParameter(x,r.LINK_STATUS)===!1)if(U=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,x,C,w);else{const Z=F0(r,C,"vertex"),D=F0(r,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(x,r.VALIDATE_STATUS)+`
3839
+ `+f);const y=v+g+o,_=v+f+a,R=F0(r,r.VERTEX_SHADER,y),w=F0(r,r.FRAGMENT_SHADER,_);r.attachShader(x,R),r.attachShader(x,w),t.index0AttributeName!==void 0?r.bindAttribLocation(x,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(x,0,"position"),r.linkProgram(x);function E(L){if(n.debug.checkShaderErrors){const G=r.getProgramInfoLog(x).trim(),B=r.getShaderInfoLog(R).trim(),j=r.getShaderInfoLog(w).trim();let U=!0,z=!0;if(r.getProgramParameter(x,r.LINK_STATUS)===!1)if(U=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,x,R,w);else{const Z=B0(r,R,"vertex"),D=B0(r,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(x,r.VALIDATE_STATUS)+`
3840
3840
 
3841
3841
  Material Name: `+L.name+`
3842
3842
  Material Type: `+L.type+`
3843
3843
 
3844
3844
  Program Info Log: `+G+`
3845
3845
  `+Z+`
3846
- `+D)}else G!==""?console.warn("THREE.WebGLProgram: Program Info Log:",G):(B===""||j==="")&&(z=!1);z&&(L.diagnostics={runnable:U,programLog:G,vertexShader:{log:B,prefix:g},fragmentShader:{log:j,prefix:f}})}r.deleteShader(C),r.deleteShader(w),A=new lu(r,x),b=IP(r,x)}let A;this.getUniforms=function(){return A===void 0&&E(this),A};let b;this.getAttributes=function(){return b===void 0&&E(this),b};let M=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=r.getProgramParameter(x,MP)),M},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(x),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=wP++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=C,this.fragmentShader=w,this}let GP=0;class WP{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new jP(e),t.set(e,i)),i}}class jP{constructor(e){this.id=GP++,this.code=e,this.usedTimes=0}}function XP(n,e,t,i,r,s,o){const a=new zd,l=new WP,c=new Set,u=[],h=r.logarithmicDepthBuffer,d=r.vertexTextures;let p=r.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function x(b){return c.add(b),b===0?"uv":`uv${b}`}function g(b,M,L,G,B){const j=G.fog,U=B.geometry,z=b.isMeshStandardMaterial?G.environment:null,Z=(b.isMeshStandardMaterial?t:e).get(b.envMap||z),D=Z&&Z.mapping===Vo?Z.image.height:null,$=m[b.type];b.precision!==null&&(p=r.getMaxPrecision(b.precision),p!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",p,"instead."));const K=U.morphAttributes.position||U.morphAttributes.normal||U.morphAttributes.color,se=K!==void 0?K.length:0;let Te=0;U.morphAttributes.position!==void 0&&(Te=1),U.morphAttributes.normal!==void 0&&(Te=2),U.morphAttributes.color!==void 0&&(Te=3);let qe,X,oe,ve;if($){const st=ri[$];qe=st.vertexShader,X=st.fragmentShader}else qe=b.vertexShader,X=b.fragmentShader,l.update(b),oe=l.getVertexShaderID(b),ve=l.getFragmentShaderID(b);const de=n.getRenderTarget(),De=B.isInstancedMesh===!0,He=B.isBatchedMesh===!0,Be=!!b.map,it=!!b.matcap,P=!!Z,le=!!b.aoMap,ie=!!b.lightMap,ge=!!b.bumpMap,Y=!!b.normalMap,Ue=!!b.displacementMap,me=!!b.emissiveMap,be=!!b.metalnessMap,N=!!b.roughnessMap,T=b.anisotropy>0,H=b.clearcoat>0,ee=b.dispersion>0,J=b.iridescence>0,ne=b.sheen>0,Le=b.transmission>0,pe=T&&!!b.anisotropyMap,Me=H&&!!b.clearcoatMap,We=H&&!!b.clearcoatNormalMap,ae=H&&!!b.clearcoatRoughnessMap,Se=J&&!!b.iridescenceMap,Je=J&&!!b.iridescenceThicknessMap,Ve=ne&&!!b.sheenColorMap,Ee=ne&&!!b.sheenRoughnessMap,Ge=!!b.specularMap,Ze=!!b.specularColorMap,vt=!!b.specularIntensityMap,k=Le&&!!b.transmissionMap,ce=Le&&!!b.thicknessMap,q=!!b.gradientMap,te=!!b.alphaMap,he=b.alphaTest>0,Oe=!!b.alphaHash,Qe=!!b.extensions;let It=ji;b.toneMapped&&(de===null||de.isXRRenderTarget===!0)&&(It=n.toneMapping);const jt={shaderID:$,shaderType:b.type,shaderName:b.name,vertexShader:qe,fragmentShader:X,defines:b.defines,customVertexShaderID:oe,customFragmentShaderID:ve,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:p,batching:He,batchingColor:He&&B._colorsTexture!==null,instancing:De,instancingColor:De&&B.instanceColor!==null,instancingMorph:De&&B.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:de===null?n.outputColorSpace:de.isXRRenderTarget===!0?de.texture.colorSpace:tr,alphaToCoverage:!!b.alphaToCoverage,map:Be,matcap:it,envMap:P,envMapMode:P&&Z.mapping,envMapCubeUVHeight:D,aoMap:le,lightMap:ie,bumpMap:ge,normalMap:Y,displacementMap:d&&Ue,emissiveMap:me,normalMapObjectSpace:Y&&b.normalMapType===ZS,normalMapTangentSpace:Y&&b.normalMapType===kr,metalnessMap:be,roughnessMap:N,anisotropy:T,anisotropyMap:pe,clearcoat:H,clearcoatMap:Me,clearcoatNormalMap:We,clearcoatRoughnessMap:ae,dispersion:ee,iridescence:J,iridescenceMap:Se,iridescenceThicknessMap:Je,sheen:ne,sheenColorMap:Ve,sheenRoughnessMap:Ee,specularMap:Ge,specularColorMap:Ze,specularIntensityMap:vt,transmission:Le,transmissionMap:k,thicknessMap:ce,gradientMap:q,opaque:b.transparent===!1&&b.blending===fs&&b.alphaToCoverage===!1,alphaMap:te,alphaTest:he,alphaHash:Oe,combine:b.combine,mapUv:Be&&x(b.map.channel),aoMapUv:le&&x(b.aoMap.channel),lightMapUv:ie&&x(b.lightMap.channel),bumpMapUv:ge&&x(b.bumpMap.channel),normalMapUv:Y&&x(b.normalMap.channel),displacementMapUv:Ue&&x(b.displacementMap.channel),emissiveMapUv:me&&x(b.emissiveMap.channel),metalnessMapUv:be&&x(b.metalnessMap.channel),roughnessMapUv:N&&x(b.roughnessMap.channel),anisotropyMapUv:pe&&x(b.anisotropyMap.channel),clearcoatMapUv:Me&&x(b.clearcoatMap.channel),clearcoatNormalMapUv:We&&x(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ae&&x(b.clearcoatRoughnessMap.channel),iridescenceMapUv:Se&&x(b.iridescenceMap.channel),iridescenceThicknessMapUv:Je&&x(b.iridescenceThicknessMap.channel),sheenColorMapUv:Ve&&x(b.sheenColorMap.channel),sheenRoughnessMapUv:Ee&&x(b.sheenRoughnessMap.channel),specularMapUv:Ge&&x(b.specularMap.channel),specularColorMapUv:Ze&&x(b.specularColorMap.channel),specularIntensityMapUv:vt&&x(b.specularIntensityMap.channel),transmissionMapUv:k&&x(b.transmissionMap.channel),thicknessMapUv:ce&&x(b.thicknessMap.channel),alphaMapUv:te&&x(b.alphaMap.channel),vertexTangents:!!U.attributes.tangent&&(Y||T),vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!U.attributes.color&&U.attributes.color.itemSize===4,pointsUvs:B.isPoints===!0&&!!U.attributes.uv&&(Be||te),fog:!!j,useFog:b.fog===!0,fogExp2:!!j&&j.isFogExp2,flatShading:b.flatShading===!0,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:B.isSkinnedMesh===!0,morphTargets:U.morphAttributes.position!==void 0,morphNormals:U.morphAttributes.normal!==void 0,morphColors:U.morphAttributes.color!==void 0,morphTargetsCount:se,morphTextureStride:Te,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numLightProbes:M.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:b.dithering,shadowMapEnabled:n.shadowMap.enabled&&L.length>0,shadowMapType:n.shadowMap.type,toneMapping:It,decodeVideoTexture:Be&&b.map.isVideoTexture===!0&&rt.getTransfer(b.map.colorSpace)===ft,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===vi,flipSided:b.side===fn,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionClipCullDistance:Qe&&b.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Qe&&b.extensions.multiDraw===!0||He)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:b.customProgramCacheKey()};return jt.vertexUv1s=c.has(1),jt.vertexUv2s=c.has(2),jt.vertexUv3s=c.has(3),c.clear(),jt}function f(b){const M=[];if(b.shaderID?M.push(b.shaderID):(M.push(b.customVertexShaderID),M.push(b.customFragmentShaderID)),b.defines!==void 0)for(const L in b.defines)M.push(L),M.push(b.defines[L]);return b.isRawShaderMaterial===!1&&(v(M,b),y(M,b),M.push(n.outputColorSpace)),M.push(b.customProgramCacheKey),M.join()}function v(b,M){b.push(M.precision),b.push(M.outputColorSpace),b.push(M.envMapMode),b.push(M.envMapCubeUVHeight),b.push(M.mapUv),b.push(M.alphaMapUv),b.push(M.lightMapUv),b.push(M.aoMapUv),b.push(M.bumpMapUv),b.push(M.normalMapUv),b.push(M.displacementMapUv),b.push(M.emissiveMapUv),b.push(M.metalnessMapUv),b.push(M.roughnessMapUv),b.push(M.anisotropyMapUv),b.push(M.clearcoatMapUv),b.push(M.clearcoatNormalMapUv),b.push(M.clearcoatRoughnessMapUv),b.push(M.iridescenceMapUv),b.push(M.iridescenceThicknessMapUv),b.push(M.sheenColorMapUv),b.push(M.sheenRoughnessMapUv),b.push(M.specularMapUv),b.push(M.specularColorMapUv),b.push(M.specularIntensityMapUv),b.push(M.transmissionMapUv),b.push(M.thicknessMapUv),b.push(M.combine),b.push(M.fogExp2),b.push(M.sizeAttenuation),b.push(M.morphTargetsCount),b.push(M.morphAttributeCount),b.push(M.numDirLights),b.push(M.numPointLights),b.push(M.numSpotLights),b.push(M.numSpotLightMaps),b.push(M.numHemiLights),b.push(M.numRectAreaLights),b.push(M.numDirLightShadows),b.push(M.numPointLightShadows),b.push(M.numSpotLightShadows),b.push(M.numSpotLightShadowsWithMaps),b.push(M.numLightProbes),b.push(M.shadowMapType),b.push(M.toneMapping),b.push(M.numClippingPlanes),b.push(M.numClipIntersection),b.push(M.depthPacking)}function y(b,M){a.disableAll(),M.supportsVertexTextures&&a.enable(0),M.instancing&&a.enable(1),M.instancingColor&&a.enable(2),M.instancingMorph&&a.enable(3),M.matcap&&a.enable(4),M.envMap&&a.enable(5),M.normalMapObjectSpace&&a.enable(6),M.normalMapTangentSpace&&a.enable(7),M.clearcoat&&a.enable(8),M.iridescence&&a.enable(9),M.alphaTest&&a.enable(10),M.vertexColors&&a.enable(11),M.vertexAlphas&&a.enable(12),M.vertexUv1s&&a.enable(13),M.vertexUv2s&&a.enable(14),M.vertexUv3s&&a.enable(15),M.vertexTangents&&a.enable(16),M.anisotropy&&a.enable(17),M.alphaHash&&a.enable(18),M.batching&&a.enable(19),M.dispersion&&a.enable(20),M.batchingColor&&a.enable(21),b.push(a.mask),a.disableAll(),M.fog&&a.enable(0),M.useFog&&a.enable(1),M.flatShading&&a.enable(2),M.logarithmicDepthBuffer&&a.enable(3),M.skinning&&a.enable(4),M.morphTargets&&a.enable(5),M.morphNormals&&a.enable(6),M.morphColors&&a.enable(7),M.premultipliedAlpha&&a.enable(8),M.shadowMapEnabled&&a.enable(9),M.doubleSided&&a.enable(10),M.flipSided&&a.enable(11),M.useDepthPacking&&a.enable(12),M.dithering&&a.enable(13),M.transmission&&a.enable(14),M.sheen&&a.enable(15),M.opaque&&a.enable(16),M.pointsUvs&&a.enable(17),M.decodeVideoTexture&&a.enable(18),M.alphaToCoverage&&a.enable(19),b.push(a.mask)}function _(b){const M=m[b.type];let L;if(M){const G=ri[M];L=uM.clone(G.uniforms)}else L=b.uniforms;return L}function C(b,M){let L;for(let G=0,B=u.length;G<B;G++){const j=u[G];if(j.cacheKey===M){L=j,++L.usedTimes;break}}return L===void 0&&(L=new HP(n,M,b,s),u.push(L)),L}function w(b){if(--b.usedTimes===0){const M=u.indexOf(b);u[M]=u[u.length-1],u.pop(),b.destroy()}}function E(b){l.remove(b)}function A(){l.dispose()}return{getParameters:g,getProgramCacheKey:f,getUniforms:_,acquireProgram:C,releaseProgram:w,releaseShaderCache:E,programs:u,dispose:A}}function $P(){let n=new WeakMap;function e(o){return n.has(o)}function t(o){let a=n.get(o);return a===void 0&&(a={},n.set(o,a)),a}function i(o){n.delete(o)}function r(o,a,l){n.get(o)[a]=l}function s(){n=new WeakMap}return{has:e,get:t,remove:i,update:r,dispose:s}}function YP(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.z!==e.z?n.z-e.z:n.id-e.id}function G0(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function W0(){const n=[];let e=0;const t=[],i=[],r=[];function s(){e=0,t.length=0,i.length=0,r.length=0}function o(h,d,p,m,x,g){let f=n[e];return f===void 0?(f={id:h.id,object:h,geometry:d,material:p,groupOrder:m,renderOrder:h.renderOrder,z:x,group:g},n[e]=f):(f.id=h.id,f.object=h,f.geometry=d,f.material=p,f.groupOrder=m,f.renderOrder=h.renderOrder,f.z=x,f.group=g),e++,f}function a(h,d,p,m,x,g){const f=o(h,d,p,m,x,g);p.transmission>0?i.push(f):p.transparent===!0?r.push(f):t.push(f)}function l(h,d,p,m,x,g){const f=o(h,d,p,m,x,g);p.transmission>0?i.unshift(f):p.transparent===!0?r.unshift(f):t.unshift(f)}function c(h,d){t.length>1&&t.sort(h||YP),i.length>1&&i.sort(d||G0),r.length>1&&r.sort(d||G0)}function u(){for(let h=e,d=n.length;h<d;h++){const p=n[h];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:i,transparent:r,init:s,push:a,unshift:l,finish:u,sort:c}}function qP(){let n=new WeakMap;function e(i,r){const s=n.get(i);let o;return s===void 0?(o=new W0,n.set(i,[o])):r>=s.length?(o=new W0,s.push(o)):o=s[r],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function ZP(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new I,color:new _e};break;case"SpotLight":t={position:new I,direction:new I,color:new _e,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new I,color:new _e,distance:0,decay:0};break;case"HemisphereLight":t={direction:new I,skyColor:new _e,groundColor:new _e};break;case"RectAreaLight":t={color:new _e,position:new I,halfWidth:new I,halfHeight:new I};break}return n[e.id]=t,t}}}function KP(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Q};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Q};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Q,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let JP=0;function QP(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function eI(n){const e=new ZP,t=KP(),i={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++)i.probe.push(new I);const r=new I,s=new ke,o=new ke;function a(c){let u=0,h=0,d=0;for(let b=0;b<9;b++)i.probe[b].set(0,0,0);let p=0,m=0,x=0,g=0,f=0,v=0,y=0,_=0,C=0,w=0,E=0;c.sort(QP);for(let b=0,M=c.length;b<M;b++){const L=c[b],G=L.color,B=L.intensity,j=L.distance,U=L.shadow&&L.shadow.map?L.shadow.map.texture:null;if(L.isAmbientLight)u+=G.r*B,h+=G.g*B,d+=G.b*B;else if(L.isLightProbe){for(let z=0;z<9;z++)i.probe[z].addScaledVector(L.sh.coefficients[z],B);E++}else if(L.isDirectionalLight){const z=e.get(L);if(z.color.copy(L.color).multiplyScalar(L.intensity),L.castShadow){const Z=L.shadow,D=t.get(L);D.shadowIntensity=Z.intensity,D.shadowBias=Z.bias,D.shadowNormalBias=Z.normalBias,D.shadowRadius=Z.radius,D.shadowMapSize=Z.mapSize,i.directionalShadow[p]=D,i.directionalShadowMap[p]=U,i.directionalShadowMatrix[p]=L.shadow.matrix,v++}i.directional[p]=z,p++}else if(L.isSpotLight){const z=e.get(L);z.position.setFromMatrixPosition(L.matrixWorld),z.color.copy(G).multiplyScalar(B),z.distance=j,z.coneCos=Math.cos(L.angle),z.penumbraCos=Math.cos(L.angle*(1-L.penumbra)),z.decay=L.decay,i.spot[x]=z;const Z=L.shadow;if(L.map&&(i.spotLightMap[C]=L.map,C++,Z.updateMatrices(L),L.castShadow&&w++),i.spotLightMatrix[x]=Z.matrix,L.castShadow){const D=t.get(L);D.shadowIntensity=Z.intensity,D.shadowBias=Z.bias,D.shadowNormalBias=Z.normalBias,D.shadowRadius=Z.radius,D.shadowMapSize=Z.mapSize,i.spotShadow[x]=D,i.spotShadowMap[x]=U,_++}x++}else if(L.isRectAreaLight){const z=e.get(L);z.color.copy(G).multiplyScalar(B),z.halfWidth.set(L.width*.5,0,0),z.halfHeight.set(0,L.height*.5,0),i.rectArea[g]=z,g++}else if(L.isPointLight){const z=e.get(L);if(z.color.copy(L.color).multiplyScalar(L.intensity),z.distance=L.distance,z.decay=L.decay,L.castShadow){const Z=L.shadow,D=t.get(L);D.shadowIntensity=Z.intensity,D.shadowBias=Z.bias,D.shadowNormalBias=Z.normalBias,D.shadowRadius=Z.radius,D.shadowMapSize=Z.mapSize,D.shadowCameraNear=Z.camera.near,D.shadowCameraFar=Z.camera.far,i.pointShadow[m]=D,i.pointShadowMap[m]=U,i.pointShadowMatrix[m]=L.shadow.matrix,y++}i.point[m]=z,m++}else if(L.isHemisphereLight){const z=e.get(L);z.skyColor.copy(L.color).multiplyScalar(B),z.groundColor.copy(L.groundColor).multiplyScalar(B),i.hemi[f]=z,f++}}g>0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=fe.LTC_FLOAT_1,i.rectAreaLTC2=fe.LTC_FLOAT_2):(i.rectAreaLTC1=fe.LTC_HALF_1,i.rectAreaLTC2=fe.LTC_HALF_2)),i.ambient[0]=u,i.ambient[1]=h,i.ambient[2]=d;const A=i.hash;(A.directionalLength!==p||A.pointLength!==m||A.spotLength!==x||A.rectAreaLength!==g||A.hemiLength!==f||A.numDirectionalShadows!==v||A.numPointShadows!==y||A.numSpotShadows!==_||A.numSpotMaps!==C||A.numLightProbes!==E)&&(i.directional.length=p,i.spot.length=x,i.rectArea.length=g,i.point.length=m,i.hemi.length=f,i.directionalShadow.length=v,i.directionalShadowMap.length=v,i.pointShadow.length=y,i.pointShadowMap.length=y,i.spotShadow.length=_,i.spotShadowMap.length=_,i.directionalShadowMatrix.length=v,i.pointShadowMatrix.length=y,i.spotLightMatrix.length=_+C-w,i.spotLightMap.length=C,i.numSpotLightShadowsWithMaps=w,i.numLightProbes=E,A.directionalLength=p,A.pointLength=m,A.spotLength=x,A.rectAreaLength=g,A.hemiLength=f,A.numDirectionalShadows=v,A.numPointShadows=y,A.numSpotShadows=_,A.numSpotMaps=C,A.numLightProbes=E,i.version=JP++)}function l(c,u){let h=0,d=0,p=0,m=0,x=0;const g=u.matrixWorldInverse;for(let f=0,v=c.length;f<v;f++){const y=c[f];if(y.isDirectionalLight){const _=i.directional[h];_.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),_.direction.sub(r),_.direction.transformDirection(g),h++}else if(y.isSpotLight){const _=i.spot[p];_.position.setFromMatrixPosition(y.matrixWorld),_.position.applyMatrix4(g),_.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),_.direction.sub(r),_.direction.transformDirection(g),p++}else if(y.isRectAreaLight){const _=i.rectArea[m];_.position.setFromMatrixPosition(y.matrixWorld),_.position.applyMatrix4(g),o.identity(),s.copy(y.matrixWorld),s.premultiply(g),o.extractRotation(s),_.halfWidth.set(y.width*.5,0,0),_.halfHeight.set(0,y.height*.5,0),_.halfWidth.applyMatrix4(o),_.halfHeight.applyMatrix4(o),m++}else if(y.isPointLight){const _=i.point[d];_.position.setFromMatrixPosition(y.matrixWorld),_.position.applyMatrix4(g),d++}else if(y.isHemisphereLight){const _=i.hemi[x];_.direction.setFromMatrixPosition(y.matrixWorld),_.direction.transformDirection(g),x++}}}return{setup:a,setupView:l,state:i}}function j0(n){const e=new eI(n),t=[],i=[];function r(u){c.camera=u,t.length=0,i.length=0}function s(u){t.push(u)}function o(u){i.push(u)}function a(){e.setup(t)}function l(u){e.setupView(t,u)}const c={lightsArray:t,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:c,setupLights:a,setupLightsView:l,pushLight:s,pushShadow:o}}function tI(n){let e=new WeakMap;function t(r,s=0){const o=e.get(r);let a;return o===void 0?(a=new j0(n),e.set(r,[a])):s>=o.length?(a=new j0(n),o.push(a)):a=o[s],a}function i(){e=new WeakMap}return{get:t,dispose:i}}class sg extends on{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=YS,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 og extends on{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 nI=`void main() {
3846
+ `+D)}else G!==""?console.warn("THREE.WebGLProgram: Program Info Log:",G):(B===""||j==="")&&(z=!1);z&&(L.diagnostics={runnable:U,programLog:G,vertexShader:{log:B,prefix:g},fragmentShader:{log:j,prefix:f}})}r.deleteShader(R),r.deleteShader(w),A=new cu(r,x),b=IP(r,x)}let A;this.getUniforms=function(){return A===void 0&&E(this),A};let b;this.getAttributes=function(){return b===void 0&&E(this),b};let M=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=r.getProgramParameter(x,MP)),M},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(x),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=wP++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=R,this.fragmentShader=w,this}let GP=0;class WP{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new jP(e),t.set(e,i)),i}}class jP{constructor(e){this.id=GP++,this.code=e,this.usedTimes=0}}function XP(n,e,t,i,r,s,o){const a=new zd,l=new WP,c=new Set,u=[],h=r.logarithmicDepthBuffer,d=r.vertexTextures;let p=r.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function x(b){return c.add(b),b===0?"uv":`uv${b}`}function g(b,M,L,G,B){const j=G.fog,U=B.geometry,z=b.isMeshStandardMaterial?G.environment:null,Z=(b.isMeshStandardMaterial?t:e).get(b.envMap||z),D=Z&&Z.mapping===Vo?Z.image.height:null,$=m[b.type];b.precision!==null&&(p=r.getMaxPrecision(b.precision),p!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",p,"instead."));const K=U.morphAttributes.position||U.morphAttributes.normal||U.morphAttributes.color,se=K!==void 0?K.length:0;let Ae=0;U.morphAttributes.position!==void 0&&(Ae=1),U.morphAttributes.normal!==void 0&&(Ae=2),U.morphAttributes.color!==void 0&&(Ae=3);let qe,X,oe,ve;if($){const st=ri[$];qe=st.vertexShader,X=st.fragmentShader}else qe=b.vertexShader,X=b.fragmentShader,l.update(b),oe=l.getVertexShaderID(b),ve=l.getFragmentShaderID(b);const de=n.getRenderTarget(),De=B.isInstancedMesh===!0,He=B.isBatchedMesh===!0,Be=!!b.map,it=!!b.matcap,P=!!Z,le=!!b.aoMap,ie=!!b.lightMap,xe=!!b.bumpMap,Y=!!b.normalMap,Ue=!!b.displacementMap,me=!!b.emissiveMap,be=!!b.metalnessMap,N=!!b.roughnessMap,T=b.anisotropy>0,H=b.clearcoat>0,ee=b.dispersion>0,J=b.iridescence>0,ne=b.sheen>0,Le=b.transmission>0,pe=T&&!!b.anisotropyMap,Me=H&&!!b.clearcoatMap,We=H&&!!b.clearcoatNormalMap,ae=H&&!!b.clearcoatRoughnessMap,Se=J&&!!b.iridescenceMap,Je=J&&!!b.iridescenceThicknessMap,Ve=ne&&!!b.sheenColorMap,Te=ne&&!!b.sheenRoughnessMap,Ge=!!b.specularMap,Ze=!!b.specularColorMap,vt=!!b.specularIntensityMap,k=Le&&!!b.transmissionMap,ce=Le&&!!b.thicknessMap,q=!!b.gradientMap,te=!!b.alphaMap,he=b.alphaTest>0,Oe=!!b.alphaHash,Qe=!!b.extensions;let It=ji;b.toneMapped&&(de===null||de.isXRRenderTarget===!0)&&(It=n.toneMapping);const jt={shaderID:$,shaderType:b.type,shaderName:b.name,vertexShader:qe,fragmentShader:X,defines:b.defines,customVertexShaderID:oe,customFragmentShaderID:ve,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:p,batching:He,batchingColor:He&&B._colorsTexture!==null,instancing:De,instancingColor:De&&B.instanceColor!==null,instancingMorph:De&&B.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:de===null?n.outputColorSpace:de.isXRRenderTarget===!0?de.texture.colorSpace:tr,alphaToCoverage:!!b.alphaToCoverage,map:Be,matcap:it,envMap:P,envMapMode:P&&Z.mapping,envMapCubeUVHeight:D,aoMap:le,lightMap:ie,bumpMap:xe,normalMap:Y,displacementMap:d&&Ue,emissiveMap:me,normalMapObjectSpace:Y&&b.normalMapType===ZS,normalMapTangentSpace:Y&&b.normalMapType===kr,metalnessMap:be,roughnessMap:N,anisotropy:T,anisotropyMap:pe,clearcoat:H,clearcoatMap:Me,clearcoatNormalMap:We,clearcoatRoughnessMap:ae,dispersion:ee,iridescence:J,iridescenceMap:Se,iridescenceThicknessMap:Je,sheen:ne,sheenColorMap:Ve,sheenRoughnessMap:Te,specularMap:Ge,specularColorMap:Ze,specularIntensityMap:vt,transmission:Le,transmissionMap:k,thicknessMap:ce,gradientMap:q,opaque:b.transparent===!1&&b.blending===fs&&b.alphaToCoverage===!1,alphaMap:te,alphaTest:he,alphaHash:Oe,combine:b.combine,mapUv:Be&&x(b.map.channel),aoMapUv:le&&x(b.aoMap.channel),lightMapUv:ie&&x(b.lightMap.channel),bumpMapUv:xe&&x(b.bumpMap.channel),normalMapUv:Y&&x(b.normalMap.channel),displacementMapUv:Ue&&x(b.displacementMap.channel),emissiveMapUv:me&&x(b.emissiveMap.channel),metalnessMapUv:be&&x(b.metalnessMap.channel),roughnessMapUv:N&&x(b.roughnessMap.channel),anisotropyMapUv:pe&&x(b.anisotropyMap.channel),clearcoatMapUv:Me&&x(b.clearcoatMap.channel),clearcoatNormalMapUv:We&&x(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ae&&x(b.clearcoatRoughnessMap.channel),iridescenceMapUv:Se&&x(b.iridescenceMap.channel),iridescenceThicknessMapUv:Je&&x(b.iridescenceThicknessMap.channel),sheenColorMapUv:Ve&&x(b.sheenColorMap.channel),sheenRoughnessMapUv:Te&&x(b.sheenRoughnessMap.channel),specularMapUv:Ge&&x(b.specularMap.channel),specularColorMapUv:Ze&&x(b.specularColorMap.channel),specularIntensityMapUv:vt&&x(b.specularIntensityMap.channel),transmissionMapUv:k&&x(b.transmissionMap.channel),thicknessMapUv:ce&&x(b.thicknessMap.channel),alphaMapUv:te&&x(b.alphaMap.channel),vertexTangents:!!U.attributes.tangent&&(Y||T),vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!U.attributes.color&&U.attributes.color.itemSize===4,pointsUvs:B.isPoints===!0&&!!U.attributes.uv&&(Be||te),fog:!!j,useFog:b.fog===!0,fogExp2:!!j&&j.isFogExp2,flatShading:b.flatShading===!0,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:B.isSkinnedMesh===!0,morphTargets:U.morphAttributes.position!==void 0,morphNormals:U.morphAttributes.normal!==void 0,morphColors:U.morphAttributes.color!==void 0,morphTargetsCount:se,morphTextureStride:Ae,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numLightProbes:M.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:b.dithering,shadowMapEnabled:n.shadowMap.enabled&&L.length>0,shadowMapType:n.shadowMap.type,toneMapping:It,decodeVideoTexture:Be&&b.map.isVideoTexture===!0&&rt.getTransfer(b.map.colorSpace)===ft,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===vi,flipSided:b.side===fn,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionClipCullDistance:Qe&&b.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Qe&&b.extensions.multiDraw===!0||He)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:b.customProgramCacheKey()};return jt.vertexUv1s=c.has(1),jt.vertexUv2s=c.has(2),jt.vertexUv3s=c.has(3),c.clear(),jt}function f(b){const M=[];if(b.shaderID?M.push(b.shaderID):(M.push(b.customVertexShaderID),M.push(b.customFragmentShaderID)),b.defines!==void 0)for(const L in b.defines)M.push(L),M.push(b.defines[L]);return b.isRawShaderMaterial===!1&&(v(M,b),y(M,b),M.push(n.outputColorSpace)),M.push(b.customProgramCacheKey),M.join()}function v(b,M){b.push(M.precision),b.push(M.outputColorSpace),b.push(M.envMapMode),b.push(M.envMapCubeUVHeight),b.push(M.mapUv),b.push(M.alphaMapUv),b.push(M.lightMapUv),b.push(M.aoMapUv),b.push(M.bumpMapUv),b.push(M.normalMapUv),b.push(M.displacementMapUv),b.push(M.emissiveMapUv),b.push(M.metalnessMapUv),b.push(M.roughnessMapUv),b.push(M.anisotropyMapUv),b.push(M.clearcoatMapUv),b.push(M.clearcoatNormalMapUv),b.push(M.clearcoatRoughnessMapUv),b.push(M.iridescenceMapUv),b.push(M.iridescenceThicknessMapUv),b.push(M.sheenColorMapUv),b.push(M.sheenRoughnessMapUv),b.push(M.specularMapUv),b.push(M.specularColorMapUv),b.push(M.specularIntensityMapUv),b.push(M.transmissionMapUv),b.push(M.thicknessMapUv),b.push(M.combine),b.push(M.fogExp2),b.push(M.sizeAttenuation),b.push(M.morphTargetsCount),b.push(M.morphAttributeCount),b.push(M.numDirLights),b.push(M.numPointLights),b.push(M.numSpotLights),b.push(M.numSpotLightMaps),b.push(M.numHemiLights),b.push(M.numRectAreaLights),b.push(M.numDirLightShadows),b.push(M.numPointLightShadows),b.push(M.numSpotLightShadows),b.push(M.numSpotLightShadowsWithMaps),b.push(M.numLightProbes),b.push(M.shadowMapType),b.push(M.toneMapping),b.push(M.numClippingPlanes),b.push(M.numClipIntersection),b.push(M.depthPacking)}function y(b,M){a.disableAll(),M.supportsVertexTextures&&a.enable(0),M.instancing&&a.enable(1),M.instancingColor&&a.enable(2),M.instancingMorph&&a.enable(3),M.matcap&&a.enable(4),M.envMap&&a.enable(5),M.normalMapObjectSpace&&a.enable(6),M.normalMapTangentSpace&&a.enable(7),M.clearcoat&&a.enable(8),M.iridescence&&a.enable(9),M.alphaTest&&a.enable(10),M.vertexColors&&a.enable(11),M.vertexAlphas&&a.enable(12),M.vertexUv1s&&a.enable(13),M.vertexUv2s&&a.enable(14),M.vertexUv3s&&a.enable(15),M.vertexTangents&&a.enable(16),M.anisotropy&&a.enable(17),M.alphaHash&&a.enable(18),M.batching&&a.enable(19),M.dispersion&&a.enable(20),M.batchingColor&&a.enable(21),b.push(a.mask),a.disableAll(),M.fog&&a.enable(0),M.useFog&&a.enable(1),M.flatShading&&a.enable(2),M.logarithmicDepthBuffer&&a.enable(3),M.skinning&&a.enable(4),M.morphTargets&&a.enable(5),M.morphNormals&&a.enable(6),M.morphColors&&a.enable(7),M.premultipliedAlpha&&a.enable(8),M.shadowMapEnabled&&a.enable(9),M.doubleSided&&a.enable(10),M.flipSided&&a.enable(11),M.useDepthPacking&&a.enable(12),M.dithering&&a.enable(13),M.transmission&&a.enable(14),M.sheen&&a.enable(15),M.opaque&&a.enable(16),M.pointsUvs&&a.enable(17),M.decodeVideoTexture&&a.enable(18),M.alphaToCoverage&&a.enable(19),b.push(a.mask)}function _(b){const M=m[b.type];let L;if(M){const G=ri[M];L=uM.clone(G.uniforms)}else L=b.uniforms;return L}function R(b,M){let L;for(let G=0,B=u.length;G<B;G++){const j=u[G];if(j.cacheKey===M){L=j,++L.usedTimes;break}}return L===void 0&&(L=new HP(n,M,b,s),u.push(L)),L}function w(b){if(--b.usedTimes===0){const M=u.indexOf(b);u[M]=u[u.length-1],u.pop(),b.destroy()}}function E(b){l.remove(b)}function A(){l.dispose()}return{getParameters:g,getProgramCacheKey:f,getUniforms:_,acquireProgram:R,releaseProgram:w,releaseShaderCache:E,programs:u,dispose:A}}function $P(){let n=new WeakMap;function e(o){return n.has(o)}function t(o){let a=n.get(o);return a===void 0&&(a={},n.set(o,a)),a}function i(o){n.delete(o)}function r(o,a,l){n.get(o)[a]=l}function s(){n=new WeakMap}return{has:e,get:t,remove:i,update:r,dispose:s}}function YP(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.z!==e.z?n.z-e.z:n.id-e.id}function W0(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function j0(){const n=[];let e=0;const t=[],i=[],r=[];function s(){e=0,t.length=0,i.length=0,r.length=0}function o(h,d,p,m,x,g){let f=n[e];return f===void 0?(f={id:h.id,object:h,geometry:d,material:p,groupOrder:m,renderOrder:h.renderOrder,z:x,group:g},n[e]=f):(f.id=h.id,f.object=h,f.geometry=d,f.material=p,f.groupOrder=m,f.renderOrder=h.renderOrder,f.z=x,f.group=g),e++,f}function a(h,d,p,m,x,g){const f=o(h,d,p,m,x,g);p.transmission>0?i.push(f):p.transparent===!0?r.push(f):t.push(f)}function l(h,d,p,m,x,g){const f=o(h,d,p,m,x,g);p.transmission>0?i.unshift(f):p.transparent===!0?r.unshift(f):t.unshift(f)}function c(h,d){t.length>1&&t.sort(h||YP),i.length>1&&i.sort(d||W0),r.length>1&&r.sort(d||W0)}function u(){for(let h=e,d=n.length;h<d;h++){const p=n[h];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:i,transparent:r,init:s,push:a,unshift:l,finish:u,sort:c}}function qP(){let n=new WeakMap;function e(i,r){const s=n.get(i);let o;return s===void 0?(o=new j0,n.set(i,[o])):r>=s.length?(o=new j0,s.push(o)):o=s[r],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function ZP(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new I,color:new _e};break;case"SpotLight":t={position:new I,direction:new I,color:new _e,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new I,color:new _e,distance:0,decay:0};break;case"HemisphereLight":t={direction:new I,skyColor:new _e,groundColor:new _e};break;case"RectAreaLight":t={color:new _e,position:new I,halfWidth:new I,halfHeight:new I};break}return n[e.id]=t,t}}}function KP(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Q};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Q};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Q,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let JP=0;function QP(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function eI(n){const e=new ZP,t=KP(),i={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++)i.probe.push(new I);const r=new I,s=new ke,o=new ke;function a(c){let u=0,h=0,d=0;for(let b=0;b<9;b++)i.probe[b].set(0,0,0);let p=0,m=0,x=0,g=0,f=0,v=0,y=0,_=0,R=0,w=0,E=0;c.sort(QP);for(let b=0,M=c.length;b<M;b++){const L=c[b],G=L.color,B=L.intensity,j=L.distance,U=L.shadow&&L.shadow.map?L.shadow.map.texture:null;if(L.isAmbientLight)u+=G.r*B,h+=G.g*B,d+=G.b*B;else if(L.isLightProbe){for(let z=0;z<9;z++)i.probe[z].addScaledVector(L.sh.coefficients[z],B);E++}else if(L.isDirectionalLight){const z=e.get(L);if(z.color.copy(L.color).multiplyScalar(L.intensity),L.castShadow){const Z=L.shadow,D=t.get(L);D.shadowIntensity=Z.intensity,D.shadowBias=Z.bias,D.shadowNormalBias=Z.normalBias,D.shadowRadius=Z.radius,D.shadowMapSize=Z.mapSize,i.directionalShadow[p]=D,i.directionalShadowMap[p]=U,i.directionalShadowMatrix[p]=L.shadow.matrix,v++}i.directional[p]=z,p++}else if(L.isSpotLight){const z=e.get(L);z.position.setFromMatrixPosition(L.matrixWorld),z.color.copy(G).multiplyScalar(B),z.distance=j,z.coneCos=Math.cos(L.angle),z.penumbraCos=Math.cos(L.angle*(1-L.penumbra)),z.decay=L.decay,i.spot[x]=z;const Z=L.shadow;if(L.map&&(i.spotLightMap[R]=L.map,R++,Z.updateMatrices(L),L.castShadow&&w++),i.spotLightMatrix[x]=Z.matrix,L.castShadow){const D=t.get(L);D.shadowIntensity=Z.intensity,D.shadowBias=Z.bias,D.shadowNormalBias=Z.normalBias,D.shadowRadius=Z.radius,D.shadowMapSize=Z.mapSize,i.spotShadow[x]=D,i.spotShadowMap[x]=U,_++}x++}else if(L.isRectAreaLight){const z=e.get(L);z.color.copy(G).multiplyScalar(B),z.halfWidth.set(L.width*.5,0,0),z.halfHeight.set(0,L.height*.5,0),i.rectArea[g]=z,g++}else if(L.isPointLight){const z=e.get(L);if(z.color.copy(L.color).multiplyScalar(L.intensity),z.distance=L.distance,z.decay=L.decay,L.castShadow){const Z=L.shadow,D=t.get(L);D.shadowIntensity=Z.intensity,D.shadowBias=Z.bias,D.shadowNormalBias=Z.normalBias,D.shadowRadius=Z.radius,D.shadowMapSize=Z.mapSize,D.shadowCameraNear=Z.camera.near,D.shadowCameraFar=Z.camera.far,i.pointShadow[m]=D,i.pointShadowMap[m]=U,i.pointShadowMatrix[m]=L.shadow.matrix,y++}i.point[m]=z,m++}else if(L.isHemisphereLight){const z=e.get(L);z.skyColor.copy(L.color).multiplyScalar(B),z.groundColor.copy(L.groundColor).multiplyScalar(B),i.hemi[f]=z,f++}}g>0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=fe.LTC_FLOAT_1,i.rectAreaLTC2=fe.LTC_FLOAT_2):(i.rectAreaLTC1=fe.LTC_HALF_1,i.rectAreaLTC2=fe.LTC_HALF_2)),i.ambient[0]=u,i.ambient[1]=h,i.ambient[2]=d;const A=i.hash;(A.directionalLength!==p||A.pointLength!==m||A.spotLength!==x||A.rectAreaLength!==g||A.hemiLength!==f||A.numDirectionalShadows!==v||A.numPointShadows!==y||A.numSpotShadows!==_||A.numSpotMaps!==R||A.numLightProbes!==E)&&(i.directional.length=p,i.spot.length=x,i.rectArea.length=g,i.point.length=m,i.hemi.length=f,i.directionalShadow.length=v,i.directionalShadowMap.length=v,i.pointShadow.length=y,i.pointShadowMap.length=y,i.spotShadow.length=_,i.spotShadowMap.length=_,i.directionalShadowMatrix.length=v,i.pointShadowMatrix.length=y,i.spotLightMatrix.length=_+R-w,i.spotLightMap.length=R,i.numSpotLightShadowsWithMaps=w,i.numLightProbes=E,A.directionalLength=p,A.pointLength=m,A.spotLength=x,A.rectAreaLength=g,A.hemiLength=f,A.numDirectionalShadows=v,A.numPointShadows=y,A.numSpotShadows=_,A.numSpotMaps=R,A.numLightProbes=E,i.version=JP++)}function l(c,u){let h=0,d=0,p=0,m=0,x=0;const g=u.matrixWorldInverse;for(let f=0,v=c.length;f<v;f++){const y=c[f];if(y.isDirectionalLight){const _=i.directional[h];_.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),_.direction.sub(r),_.direction.transformDirection(g),h++}else if(y.isSpotLight){const _=i.spot[p];_.position.setFromMatrixPosition(y.matrixWorld),_.position.applyMatrix4(g),_.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),_.direction.sub(r),_.direction.transformDirection(g),p++}else if(y.isRectAreaLight){const _=i.rectArea[m];_.position.setFromMatrixPosition(y.matrixWorld),_.position.applyMatrix4(g),o.identity(),s.copy(y.matrixWorld),s.premultiply(g),o.extractRotation(s),_.halfWidth.set(y.width*.5,0,0),_.halfHeight.set(0,y.height*.5,0),_.halfWidth.applyMatrix4(o),_.halfHeight.applyMatrix4(o),m++}else if(y.isPointLight){const _=i.point[d];_.position.setFromMatrixPosition(y.matrixWorld),_.position.applyMatrix4(g),d++}else if(y.isHemisphereLight){const _=i.hemi[x];_.direction.setFromMatrixPosition(y.matrixWorld),_.direction.transformDirection(g),x++}}}return{setup:a,setupView:l,state:i}}function X0(n){const e=new eI(n),t=[],i=[];function r(u){c.camera=u,t.length=0,i.length=0}function s(u){t.push(u)}function o(u){i.push(u)}function a(){e.setup(t)}function l(u){e.setupView(t,u)}const c={lightsArray:t,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:c,setupLights:a,setupLightsView:l,pushLight:s,pushShadow:o}}function tI(n){let e=new WeakMap;function t(r,s=0){const o=e.get(r);let a;return o===void 0?(a=new X0(n),e.set(r,[a])):s>=o.length?(a=new X0(n),o.push(a)):a=o[s],a}function i(){e=new WeakMap}return{get:t,dispose:i}}class og extends on{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=YS,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 ag extends on{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 nI=`void main() {
3847
3847
  gl_Position = vec4( position, 1.0 );
3848
3848
  }`,iI=`uniform sampler2D shadow_pass;
3849
3849
  uniform vec2 resolution;
@@ -3871,7 +3871,7 @@ void main() {
3871
3871
  squared_mean = squared_mean / samples;
3872
3872
  float std_dev = sqrt( squared_mean - mean * mean );
3873
3873
  gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
3874
- }`;function rI(n,e,t){let i=new Nl;const r=new Q,s=new Q,o=new ct,a=new sg({depthPacking:qS}),l=new og,c={},u=t.maxTextureSize,h={[Zi]:fn,[fn]:Zi,[vi]:vi},d=new ci({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Q},radius:{value:4}},vertexShader:nI,fragmentShader:iI}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const m=new Ye;m.setAttribute("position",new ht(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new kt(m,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=zm;let f=this.type;this.render=function(w,E,A){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||w.length===0)return;const b=n.getRenderTarget(),M=n.getActiveCubeFace(),L=n.getActiveMipmapLevel(),G=n.state;G.setBlending(Wi),G.buffers.color.setClear(1,1,1,1),G.buffers.depth.setTest(!0),G.setScissorTest(!1);const B=f!==gi&&this.type===gi,j=f===gi&&this.type!==gi;for(let U=0,z=w.length;U<z;U++){const Z=w[U],D=Z.shadow;if(D===void 0){console.warn("THREE.WebGLShadowMap:",Z,"has no shadow.");continue}if(D.autoUpdate===!1&&D.needsUpdate===!1)continue;r.copy(D.mapSize);const $=D.getFrameExtents();if(r.multiply($),s.copy(D.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/$.x),r.x=s.x*$.x,D.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/$.y),r.y=s.y*$.y,D.mapSize.y=s.y)),D.map===null||B===!0||j===!0){const se=this.type!==gi?{minFilter:Gt,magFilter:Gt}:{};D.map!==null&&D.map.dispose(),D.map=new li(r.x,r.y,se),D.map.texture.name=Z.name+".shadowMap",D.camera.updateProjectionMatrix()}n.setRenderTarget(D.map),n.clear();const K=D.getViewportCount();for(let se=0;se<K;se++){const Te=D.getViewport(se);o.set(s.x*Te.x,s.y*Te.y,s.x*Te.z,s.y*Te.w),G.viewport(o),D.updateMatrices(Z,se),i=D.getFrustum(),_(E,A,D.camera,Z,this.type)}D.isPointLightShadow!==!0&&this.type===gi&&v(D,A),D.needsUpdate=!1}f=this.type,g.needsUpdate=!1,n.setRenderTarget(b,M,L)};function v(w,E){const A=e.update(x);d.defines.VSM_SAMPLES!==w.blurSamples&&(d.defines.VSM_SAMPLES=w.blurSamples,p.defines.VSM_SAMPLES=w.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),w.mapPass===null&&(w.mapPass=new li(r.x,r.y)),d.uniforms.shadow_pass.value=w.map.texture,d.uniforms.resolution.value=w.mapSize,d.uniforms.radius.value=w.radius,n.setRenderTarget(w.mapPass),n.clear(),n.renderBufferDirect(E,null,A,d,x,null),p.uniforms.shadow_pass.value=w.mapPass.texture,p.uniforms.resolution.value=w.mapSize,p.uniforms.radius.value=w.radius,n.setRenderTarget(w.map),n.clear(),n.renderBufferDirect(E,null,A,p,x,null)}function y(w,E,A,b){let M=null;const L=A.isPointLight===!0?w.customDistanceMaterial:w.customDepthMaterial;if(L!==void 0)M=L;else if(M=A.isPointLight===!0?l:a,n.localClippingEnabled&&E.clipShadows===!0&&Array.isArray(E.clippingPlanes)&&E.clippingPlanes.length!==0||E.displacementMap&&E.displacementScale!==0||E.alphaMap&&E.alphaTest>0||E.map&&E.alphaTest>0){const G=M.uuid,B=E.uuid;let j=c[G];j===void 0&&(j={},c[G]=j);let U=j[B];U===void 0&&(U=M.clone(),j[B]=U,E.addEventListener("dispose",C)),M=U}if(M.visible=E.visible,M.wireframe=E.wireframe,b===gi?M.side=E.shadowSide!==null?E.shadowSide:E.side:M.side=E.shadowSide!==null?E.shadowSide:h[E.side],M.alphaMap=E.alphaMap,M.alphaTest=E.alphaTest,M.map=E.map,M.clipShadows=E.clipShadows,M.clippingPlanes=E.clippingPlanes,M.clipIntersection=E.clipIntersection,M.displacementMap=E.displacementMap,M.displacementScale=E.displacementScale,M.displacementBias=E.displacementBias,M.wireframeLinewidth=E.wireframeLinewidth,M.linewidth=E.linewidth,A.isPointLight===!0&&M.isMeshDistanceMaterial===!0){const G=n.properties.get(M);G.light=A}return M}function _(w,E,A,b,M){if(w.visible===!1)return;if(w.layers.test(E.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&M===gi)&&(!w.frustumCulled||i.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(A.matrixWorldInverse,w.matrixWorld);const B=e.update(w),j=w.material;if(Array.isArray(j)){const U=B.groups;for(let z=0,Z=U.length;z<Z;z++){const D=U[z],$=j[D.materialIndex];if($&&$.visible){const K=y(w,$,b,M);w.onBeforeShadow(n,w,E,A,B,K,D),n.renderBufferDirect(A,null,B,K,w,D),w.onAfterShadow(n,w,E,A,B,K,D)}}}else if(j.visible){const U=y(w,j,b,M);w.onBeforeShadow(n,w,E,A,B,U,null),n.renderBufferDirect(A,null,B,U,w,null),w.onAfterShadow(n,w,E,A,B,U,null)}}const G=w.children;for(let B=0,j=G.length;B<j;B++)_(G[B],E,A,b,M)}function C(w){w.target.removeEventListener("dispose",C);for(const A in c){const b=c[A],M=w.target.uuid;M in b&&(b[M].dispose(),delete b[M])}}}function sI(n){function e(){let k=!1;const ce=new ct;let q=null;const te=new ct(0,0,0,0);return{setMask:function(he){q!==he&&!k&&(n.colorMask(he,he,he,he),q=he)},setLocked:function(he){k=he},setClear:function(he,Oe,Qe,It,jt){jt===!0&&(he*=It,Oe*=It,Qe*=It),ce.set(he,Oe,Qe,It),te.equals(ce)===!1&&(n.clearColor(he,Oe,Qe,It),te.copy(ce))},reset:function(){k=!1,q=null,te.set(-1,0,0,0)}}}function t(){let k=!1,ce=null,q=null,te=null;return{setTest:function(he){he?ve(n.DEPTH_TEST):de(n.DEPTH_TEST)},setMask:function(he){ce!==he&&!k&&(n.depthMask(he),ce=he)},setFunc:function(he){if(q!==he){switch(he){case CS:n.depthFunc(n.NEVER);break;case RS:n.depthFunc(n.ALWAYS);break;case PS:n.depthFunc(n.LESS);break;case nl:n.depthFunc(n.LEQUAL);break;case IS:n.depthFunc(n.EQUAL);break;case NS:n.depthFunc(n.GEQUAL);break;case LS:n.depthFunc(n.GREATER);break;case DS:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}q=he}},setLocked:function(he){k=he},setClear:function(he){te!==he&&(n.clearDepth(he),te=he)},reset:function(){k=!1,ce=null,q=null,te=null}}}function i(){let k=!1,ce=null,q=null,te=null,he=null,Oe=null,Qe=null,It=null,jt=null;return{setTest:function(st){k||(st?ve(n.STENCIL_TEST):de(n.STENCIL_TEST))},setMask:function(st){ce!==st&&!k&&(n.stencilMask(st),ce=st)},setFunc:function(st,Ci,hi){(q!==st||te!==Ci||he!==hi)&&(n.stencilFunc(st,Ci,hi),q=st,te=Ci,he=hi)},setOp:function(st,Ci,hi){(Oe!==st||Qe!==Ci||It!==hi)&&(n.stencilOp(st,Ci,hi),Oe=st,Qe=Ci,It=hi)},setLocked:function(st){k=st},setClear:function(st){jt!==st&&(n.clearStencil(st),jt=st)},reset:function(){k=!1,ce=null,q=null,te=null,he=null,Oe=null,Qe=null,It=null,jt=null}}}const r=new e,s=new t,o=new i,a=new WeakMap,l=new WeakMap;let c={},u={},h=new WeakMap,d=[],p=null,m=!1,x=null,g=null,f=null,v=null,y=null,_=null,C=null,w=new _e(0,0,0),E=0,A=!1,b=null,M=null,L=null,G=null,B=null;const j=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let U=!1,z=0;const Z=n.getParameter(n.VERSION);Z.indexOf("WebGL")!==-1?(z=parseFloat(/^WebGL (\d)/.exec(Z)[1]),U=z>=1):Z.indexOf("OpenGL ES")!==-1&&(z=parseFloat(/^OpenGL ES (\d)/.exec(Z)[1]),U=z>=2);let D=null,$={};const K=n.getParameter(n.SCISSOR_BOX),se=n.getParameter(n.VIEWPORT),Te=new ct().fromArray(K),qe=new ct().fromArray(se);function X(k,ce,q,te){const he=new Uint8Array(4),Oe=n.createTexture();n.bindTexture(k,Oe),n.texParameteri(k,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(k,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Qe=0;Qe<q;Qe++)k===n.TEXTURE_3D||k===n.TEXTURE_2D_ARRAY?n.texImage3D(ce,0,n.RGBA,1,1,te,0,n.RGBA,n.UNSIGNED_BYTE,he):n.texImage2D(ce+Qe,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,he);return Oe}const oe={};oe[n.TEXTURE_2D]=X(n.TEXTURE_2D,n.TEXTURE_2D,1),oe[n.TEXTURE_CUBE_MAP]=X(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),oe[n.TEXTURE_2D_ARRAY]=X(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),oe[n.TEXTURE_3D]=X(n.TEXTURE_3D,n.TEXTURE_3D,1,1),r.setClear(0,0,0,1),s.setClear(1),o.setClear(0),ve(n.DEPTH_TEST),s.setFunc(nl),ge(!1),Y(Cp),ve(n.CULL_FACE),le(Wi);function ve(k){c[k]!==!0&&(n.enable(k),c[k]=!0)}function de(k){c[k]!==!1&&(n.disable(k),c[k]=!1)}function De(k,ce){return u[k]!==ce?(n.bindFramebuffer(k,ce),u[k]=ce,k===n.DRAW_FRAMEBUFFER&&(u[n.FRAMEBUFFER]=ce),k===n.FRAMEBUFFER&&(u[n.DRAW_FRAMEBUFFER]=ce),!0):!1}function He(k,ce){let q=d,te=!1;if(k){q=h.get(ce),q===void 0&&(q=[],h.set(ce,q));const he=k.textures;if(q.length!==he.length||q[0]!==n.COLOR_ATTACHMENT0){for(let Oe=0,Qe=he.length;Oe<Qe;Oe++)q[Oe]=n.COLOR_ATTACHMENT0+Oe;q.length=he.length,te=!0}}else q[0]!==n.BACK&&(q[0]=n.BACK,te=!0);te&&n.drawBuffers(q)}function Be(k){return p!==k?(n.useProgram(k),p=k,!0):!1}const it={[vr]:n.FUNC_ADD,[dS]:n.FUNC_SUBTRACT,[hS]:n.FUNC_REVERSE_SUBTRACT};it[fS]=n.MIN,it[pS]=n.MAX;const P={[mS]:n.ZERO,[gS]:n.ONE,[xS]:n.SRC_COLOR,[Lu]:n.SRC_ALPHA,[wS]:n.SRC_ALPHA_SATURATE,[SS]:n.DST_COLOR,[yS]:n.DST_ALPHA,[vS]:n.ONE_MINUS_SRC_COLOR,[Du]:n.ONE_MINUS_SRC_ALPHA,[MS]:n.ONE_MINUS_DST_COLOR,[_S]:n.ONE_MINUS_DST_ALPHA,[bS]:n.CONSTANT_COLOR,[ES]:n.ONE_MINUS_CONSTANT_COLOR,[TS]:n.CONSTANT_ALPHA,[AS]:n.ONE_MINUS_CONSTANT_ALPHA};function le(k,ce,q,te,he,Oe,Qe,It,jt,st){if(k===Wi){m===!0&&(de(n.BLEND),m=!1);return}if(m===!1&&(ve(n.BLEND),m=!0),k!==uS){if(k!==x||st!==A){if((g!==vr||y!==vr)&&(n.blendEquation(n.FUNC_ADD),g=vr,y=vr),st)switch(k){case fs:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Rp:n.blendFunc(n.ONE,n.ONE);break;case Pp:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Ip:n.blendFuncSeparate(n.ZERO,n.SRC_COLOR,n.ZERO,n.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",k);break}else switch(k){case fs:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Rp:n.blendFunc(n.SRC_ALPHA,n.ONE);break;case Pp:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Ip:n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",k);break}f=null,v=null,_=null,C=null,w.set(0,0,0),E=0,x=k,A=st}return}he=he||ce,Oe=Oe||q,Qe=Qe||te,(ce!==g||he!==y)&&(n.blendEquationSeparate(it[ce],it[he]),g=ce,y=he),(q!==f||te!==v||Oe!==_||Qe!==C)&&(n.blendFuncSeparate(P[q],P[te],P[Oe],P[Qe]),f=q,v=te,_=Oe,C=Qe),(It.equals(w)===!1||jt!==E)&&(n.blendColor(It.r,It.g,It.b,jt),w.copy(It),E=jt),x=k,A=!1}function ie(k,ce){k.side===vi?de(n.CULL_FACE):ve(n.CULL_FACE);let q=k.side===fn;ce&&(q=!q),ge(q),k.blending===fs&&k.transparent===!1?le(Wi):le(k.blending,k.blendEquation,k.blendSrc,k.blendDst,k.blendEquationAlpha,k.blendSrcAlpha,k.blendDstAlpha,k.blendColor,k.blendAlpha,k.premultipliedAlpha),s.setFunc(k.depthFunc),s.setTest(k.depthTest),s.setMask(k.depthWrite),r.setMask(k.colorWrite);const te=k.stencilWrite;o.setTest(te),te&&(o.setMask(k.stencilWriteMask),o.setFunc(k.stencilFunc,k.stencilRef,k.stencilFuncMask),o.setOp(k.stencilFail,k.stencilZFail,k.stencilZPass)),me(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits),k.alphaToCoverage===!0?ve(n.SAMPLE_ALPHA_TO_COVERAGE):de(n.SAMPLE_ALPHA_TO_COVERAGE)}function ge(k){b!==k&&(k?n.frontFace(n.CW):n.frontFace(n.CCW),b=k)}function Y(k){k!==aS?(ve(n.CULL_FACE),k!==M&&(k===Cp?n.cullFace(n.BACK):k===lS?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):de(n.CULL_FACE),M=k}function Ue(k){k!==L&&(U&&n.lineWidth(k),L=k)}function me(k,ce,q){k?(ve(n.POLYGON_OFFSET_FILL),(G!==ce||B!==q)&&(n.polygonOffset(ce,q),G=ce,B=q)):de(n.POLYGON_OFFSET_FILL)}function be(k){k?ve(n.SCISSOR_TEST):de(n.SCISSOR_TEST)}function N(k){k===void 0&&(k=n.TEXTURE0+j-1),D!==k&&(n.activeTexture(k),D=k)}function T(k,ce,q){q===void 0&&(D===null?q=n.TEXTURE0+j-1:q=D);let te=$[q];te===void 0&&(te={type:void 0,texture:void 0},$[q]=te),(te.type!==k||te.texture!==ce)&&(D!==q&&(n.activeTexture(q),D=q),n.bindTexture(k,ce||oe[k]),te.type=k,te.texture=ce)}function H(){const k=$[D];k!==void 0&&k.type!==void 0&&(n.bindTexture(k.type,null),k.type=void 0,k.texture=void 0)}function ee(){try{n.compressedTexImage2D.apply(n,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function J(){try{n.compressedTexImage3D.apply(n,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function ne(){try{n.texSubImage2D.apply(n,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function Le(){try{n.texSubImage3D.apply(n,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function pe(){try{n.compressedTexSubImage2D.apply(n,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function Me(){try{n.compressedTexSubImage3D.apply(n,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function We(){try{n.texStorage2D.apply(n,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function ae(){try{n.texStorage3D.apply(n,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function Se(){try{n.texImage2D.apply(n,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function Je(){try{n.texImage3D.apply(n,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function Ve(k){Te.equals(k)===!1&&(n.scissor(k.x,k.y,k.z,k.w),Te.copy(k))}function Ee(k){qe.equals(k)===!1&&(n.viewport(k.x,k.y,k.z,k.w),qe.copy(k))}function Ge(k,ce){let q=l.get(ce);q===void 0&&(q=new WeakMap,l.set(ce,q));let te=q.get(k);te===void 0&&(te=n.getUniformBlockIndex(ce,k.name),q.set(k,te))}function Ze(k,ce){const te=l.get(ce).get(k);a.get(ce)!==te&&(n.uniformBlockBinding(ce,te,k.__bindingPointIndex),a.set(ce,te))}function vt(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),c={},D=null,$={},u={},h=new WeakMap,d=[],p=null,m=!1,x=null,g=null,f=null,v=null,y=null,_=null,C=null,w=new _e(0,0,0),E=0,A=!1,b=null,M=null,L=null,G=null,B=null,Te.set(0,0,n.canvas.width,n.canvas.height),qe.set(0,0,n.canvas.width,n.canvas.height),r.reset(),s.reset(),o.reset()}return{buffers:{color:r,depth:s,stencil:o},enable:ve,disable:de,bindFramebuffer:De,drawBuffers:He,useProgram:Be,setBlending:le,setMaterial:ie,setFlipSided:ge,setCullFace:Y,setLineWidth:Ue,setPolygonOffset:me,setScissorTest:be,activeTexture:N,bindTexture:T,unbindTexture:H,compressedTexImage2D:ee,compressedTexImage3D:J,texImage2D:Se,texImage3D:Je,updateUBOMapping:Ge,uniformBlockBinding:Ze,texStorage2D:We,texStorage3D:ae,texSubImage2D:ne,texSubImage3D:Le,compressedTexSubImage2D:pe,compressedTexSubImage3D:Me,scissor:Ve,viewport:Ee,reset:vt}}function oI(n,e){const t=n.image&&n.image.width?n.image.width/n.image.height:1;return t>e?(n.repeat.x=1,n.repeat.y=t/e,n.offset.x=0,n.offset.y=(1-n.repeat.y)/2):(n.repeat.x=e/t,n.repeat.y=1,n.offset.x=(1-n.repeat.x)/2,n.offset.y=0),n}function aI(n,e){const t=n.image&&n.image.width?n.image.width/n.image.height:1;return t>e?(n.repeat.x=e/t,n.repeat.y=1,n.offset.x=(1-n.repeat.x)/2,n.offset.y=0):(n.repeat.x=1,n.repeat.y=t/e,n.offset.x=0,n.offset.y=(1-n.repeat.y)/2),n}function lI(n){return n.repeat.x=1,n.repeat.y=1,n.offset.x=0,n.offset.y=0,n}function Op(n,e,t,i){const r=cI(i);switch(t){case jm:return n*e;case $m:return n*e;case Ym:return n*e*2;case Dd:return n*e/r.components*r.byteLength;case Rl:return n*e/r.components*r.byteLength;case qm:return n*e*2/r.components*r.byteLength;case Ud:return n*e*2/r.components*r.byteLength;case Xm:return n*e*3/r.components*r.byteLength;case dn:return n*e*4/r.components*r.byteLength;case kd:return n*e*4/r.components*r.byteLength;case Ia:case Na:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case La:case Da:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case ku:case Fu:return Math.max(n,16)*Math.max(e,8)/4;case Uu:case Ou:return Math.max(n,8)*Math.max(e,8)/2;case Bu:case zu:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Vu:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Hu:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Gu:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case Wu:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case ju:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case Xu:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case $u:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case Yu:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case qu:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case Zu:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case Ku:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case Ju:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case Qu:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case ed:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case td:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case Ua:case nd:case id:return Math.ceil(n/4)*Math.ceil(e/4)*16;case Zm:case rd:return Math.ceil(n/4)*Math.ceil(e/4)*8;case sd:case od:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function cI(n){switch(n){case Ei:case Hm:return{byteLength:1,components:1};case Do:case Gm:case Ho:return{byteLength:2,components:1};case Nd:case Ld:return{byteLength:2,components:4};case Ji:case Id:case Sn:return{byteLength:4,components:1};case Wm:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}const uI={contain:oI,cover:aI,fill:lI,getByteLength:Op};function dI(n,e,t,i,r,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 Q,u=new WeakMap;let h;const d=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function m(N,T){return p?new OffscreenCanvas(N,T):pl("canvas")}function x(N,T,H){let ee=1;const J=be(N);if((J.width>H||J.height>H)&&(ee=H/Math.max(J.width,J.height)),ee<1)if(typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&N instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&N instanceof ImageBitmap||typeof VideoFrame<"u"&&N instanceof VideoFrame){const ne=Math.floor(ee*J.width),Le=Math.floor(ee*J.height);h===void 0&&(h=m(ne,Le));const pe=T?m(ne,Le):h;return pe.width=ne,pe.height=Le,pe.getContext("2d").drawImage(N,0,0,ne,Le),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+J.width+"x"+J.height+") to ("+ne+"x"+Le+")."),pe}else return"data"in N&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+J.width+"x"+J.height+")."),N;return N}function g(N){return N.generateMipmaps&&N.minFilter!==Gt&&N.minFilter!==Ut}function f(N){n.generateMipmap(N)}function v(N,T,H,ee,J=!1){if(N!==null){if(n[N]!==void 0)return n[N];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let ne=T;if(T===n.RED&&(H===n.FLOAT&&(ne=n.R32F),H===n.HALF_FLOAT&&(ne=n.R16F),H===n.UNSIGNED_BYTE&&(ne=n.R8)),T===n.RED_INTEGER&&(H===n.UNSIGNED_BYTE&&(ne=n.R8UI),H===n.UNSIGNED_SHORT&&(ne=n.R16UI),H===n.UNSIGNED_INT&&(ne=n.R32UI),H===n.BYTE&&(ne=n.R8I),H===n.SHORT&&(ne=n.R16I),H===n.INT&&(ne=n.R32I)),T===n.RG&&(H===n.FLOAT&&(ne=n.RG32F),H===n.HALF_FLOAT&&(ne=n.RG16F),H===n.UNSIGNED_BYTE&&(ne=n.RG8)),T===n.RG_INTEGER&&(H===n.UNSIGNED_BYTE&&(ne=n.RG8UI),H===n.UNSIGNED_SHORT&&(ne=n.RG16UI),H===n.UNSIGNED_INT&&(ne=n.RG32UI),H===n.BYTE&&(ne=n.RG8I),H===n.SHORT&&(ne=n.RG16I),H===n.INT&&(ne=n.RG32I)),T===n.RGB&&H===n.UNSIGNED_INT_5_9_9_9_REV&&(ne=n.RGB9_E5),T===n.RGBA){const Le=J?cl:rt.getTransfer(ee);H===n.FLOAT&&(ne=n.RGBA32F),H===n.HALF_FLOAT&&(ne=n.RGBA16F),H===n.UNSIGNED_BYTE&&(ne=Le===ft?n.SRGB8_ALPHA8:n.RGBA8),H===n.UNSIGNED_SHORT_4_4_4_4&&(ne=n.RGBA4),H===n.UNSIGNED_SHORT_5_5_5_1&&(ne=n.RGB5_A1)}return(ne===n.R16F||ne===n.R32F||ne===n.RG16F||ne===n.RG32F||ne===n.RGBA16F||ne===n.RGBA32F)&&e.get("EXT_color_buffer_float"),ne}function y(N,T){let H;return N?T===null||T===Ji||T===Ms?H=n.DEPTH24_STENCIL8:T===Sn?H=n.DEPTH32F_STENCIL8:T===Do&&(H=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):T===null||T===Ji||T===Ms?H=n.DEPTH_COMPONENT24:T===Sn?H=n.DEPTH_COMPONENT32F:T===Do&&(H=n.DEPTH_COMPONENT16),H}function _(N,T){return g(N)===!0||N.isFramebufferTexture&&N.minFilter!==Gt&&N.minFilter!==Ut?Math.log2(Math.max(T.width,T.height))+1:N.mipmaps!==void 0&&N.mipmaps.length>0?N.mipmaps.length:N.isCompressedTexture&&Array.isArray(N.image)?T.mipmaps.length:1}function C(N){const T=N.target;T.removeEventListener("dispose",C),E(T),T.isVideoTexture&&u.delete(T)}function w(N){const T=N.target;T.removeEventListener("dispose",w),b(T)}function E(N){const T=i.get(N);if(T.__webglInit===void 0)return;const H=N.source,ee=d.get(H);if(ee){const J=ee[T.__cacheKey];J.usedTimes--,J.usedTimes===0&&A(N),Object.keys(ee).length===0&&d.delete(H)}i.remove(N)}function A(N){const T=i.get(N);n.deleteTexture(T.__webglTexture);const H=N.source,ee=d.get(H);delete ee[T.__cacheKey],o.memory.textures--}function b(N){const T=i.get(N);if(N.depthTexture&&N.depthTexture.dispose(),N.isWebGLCubeRenderTarget)for(let ee=0;ee<6;ee++){if(Array.isArray(T.__webglFramebuffer[ee]))for(let J=0;J<T.__webglFramebuffer[ee].length;J++)n.deleteFramebuffer(T.__webglFramebuffer[ee][J]);else n.deleteFramebuffer(T.__webglFramebuffer[ee]);T.__webglDepthbuffer&&n.deleteRenderbuffer(T.__webglDepthbuffer[ee])}else{if(Array.isArray(T.__webglFramebuffer))for(let ee=0;ee<T.__webglFramebuffer.length;ee++)n.deleteFramebuffer(T.__webglFramebuffer[ee]);else n.deleteFramebuffer(T.__webglFramebuffer);if(T.__webglDepthbuffer&&n.deleteRenderbuffer(T.__webglDepthbuffer),T.__webglMultisampledFramebuffer&&n.deleteFramebuffer(T.__webglMultisampledFramebuffer),T.__webglColorRenderbuffer)for(let ee=0;ee<T.__webglColorRenderbuffer.length;ee++)T.__webglColorRenderbuffer[ee]&&n.deleteRenderbuffer(T.__webglColorRenderbuffer[ee]);T.__webglDepthRenderbuffer&&n.deleteRenderbuffer(T.__webglDepthRenderbuffer)}const H=N.textures;for(let ee=0,J=H.length;ee<J;ee++){const ne=i.get(H[ee]);ne.__webglTexture&&(n.deleteTexture(ne.__webglTexture),o.memory.textures--),i.remove(H[ee])}i.remove(N)}let M=0;function L(){M=0}function G(){const N=M;return N>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+r.maxTextures),M+=1,N}function B(N){const T=[];return T.push(N.wrapS),T.push(N.wrapT),T.push(N.wrapR||0),T.push(N.magFilter),T.push(N.minFilter),T.push(N.anisotropy),T.push(N.internalFormat),T.push(N.format),T.push(N.type),T.push(N.generateMipmaps),T.push(N.premultiplyAlpha),T.push(N.flipY),T.push(N.unpackAlignment),T.push(N.colorSpace),T.join()}function j(N,T){const H=i.get(N);if(N.isVideoTexture&&Ue(N),N.isRenderTargetTexture===!1&&N.version>0&&H.__version!==N.version){const ee=N.image;if(ee===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ee.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{qe(H,N,T);return}}t.bindTexture(n.TEXTURE_2D,H.__webglTexture,n.TEXTURE0+T)}function U(N,T){const H=i.get(N);if(N.version>0&&H.__version!==N.version){qe(H,N,T);return}t.bindTexture(n.TEXTURE_2D_ARRAY,H.__webglTexture,n.TEXTURE0+T)}function z(N,T){const H=i.get(N);if(N.version>0&&H.__version!==N.version){qe(H,N,T);return}t.bindTexture(n.TEXTURE_3D,H.__webglTexture,n.TEXTURE0+T)}function Z(N,T){const H=i.get(N);if(N.version>0&&H.__version!==N.version){X(H,N,T);return}t.bindTexture(n.TEXTURE_CUBE_MAP,H.__webglTexture,n.TEXTURE0+T)}const D={[sl]:n.REPEAT,[Xn]:n.CLAMP_TO_EDGE,[ol]:n.MIRRORED_REPEAT},$={[Gt]:n.NEAREST,[Vm]:n.NEAREST_MIPMAP_NEAREST,[fo]:n.NEAREST_MIPMAP_LINEAR,[Ut]:n.LINEAR,[Pa]:n.LINEAR_MIPMAP_NEAREST,[yi]:n.LINEAR_MIPMAP_LINEAR},K={[KS]:n.NEVER,[iM]:n.ALWAYS,[JS]:n.LESS,[Jm]:n.LEQUAL,[QS]:n.EQUAL,[nM]:n.GEQUAL,[eM]:n.GREATER,[tM]:n.NOTEQUAL};function se(N,T){if(T.type===Sn&&e.has("OES_texture_float_linear")===!1&&(T.magFilter===Ut||T.magFilter===Pa||T.magFilter===fo||T.magFilter===yi||T.minFilter===Ut||T.minFilter===Pa||T.minFilter===fo||T.minFilter===yi)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(N,n.TEXTURE_WRAP_S,D[T.wrapS]),n.texParameteri(N,n.TEXTURE_WRAP_T,D[T.wrapT]),(N===n.TEXTURE_3D||N===n.TEXTURE_2D_ARRAY)&&n.texParameteri(N,n.TEXTURE_WRAP_R,D[T.wrapR]),n.texParameteri(N,n.TEXTURE_MAG_FILTER,$[T.magFilter]),n.texParameteri(N,n.TEXTURE_MIN_FILTER,$[T.minFilter]),T.compareFunction&&(n.texParameteri(N,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(N,n.TEXTURE_COMPARE_FUNC,K[T.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(T.magFilter===Gt||T.minFilter!==fo&&T.minFilter!==yi||T.type===Sn&&e.has("OES_texture_float_linear")===!1)return;if(T.anisotropy>1||i.get(T).__currentAnisotropy){const H=e.get("EXT_texture_filter_anisotropic");n.texParameterf(N,H.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(T.anisotropy,r.getMaxAnisotropy())),i.get(T).__currentAnisotropy=T.anisotropy}}}function Te(N,T){let H=!1;N.__webglInit===void 0&&(N.__webglInit=!0,T.addEventListener("dispose",C));const ee=T.source;let J=d.get(ee);J===void 0&&(J={},d.set(ee,J));const ne=B(T);if(ne!==N.__cacheKey){J[ne]===void 0&&(J[ne]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,H=!0),J[ne].usedTimes++;const Le=J[N.__cacheKey];Le!==void 0&&(J[N.__cacheKey].usedTimes--,Le.usedTimes===0&&A(T)),N.__cacheKey=ne,N.__webglTexture=J[ne].texture}return H}function qe(N,T,H){let ee=n.TEXTURE_2D;(T.isDataArrayTexture||T.isCompressedArrayTexture)&&(ee=n.TEXTURE_2D_ARRAY),T.isData3DTexture&&(ee=n.TEXTURE_3D);const J=Te(N,T),ne=T.source;t.bindTexture(ee,N.__webglTexture,n.TEXTURE0+H);const Le=i.get(ne);if(ne.version!==Le.__version||J===!0){t.activeTexture(n.TEXTURE0+H);const pe=rt.getPrimaries(rt.workingColorSpace),Me=T.colorSpace===Fi?null:rt.getPrimaries(T.colorSpace),We=T.colorSpace===Fi||pe===Me?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,T.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,T.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,T.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,We);let ae=x(T.image,!1,r.maxTextureSize);ae=me(T,ae);const Se=s.convert(T.format,T.colorSpace),Je=s.convert(T.type);let Ve=v(T.internalFormat,Se,Je,T.colorSpace,T.isVideoTexture);se(ee,T);let Ee;const Ge=T.mipmaps,Ze=T.isVideoTexture!==!0,vt=Le.__version===void 0||J===!0,k=ne.dataReady,ce=_(T,ae);if(T.isDepthTexture)Ve=y(T.format===ws,T.type),vt&&(Ze?t.texStorage2D(n.TEXTURE_2D,1,Ve,ae.width,ae.height):t.texImage2D(n.TEXTURE_2D,0,Ve,ae.width,ae.height,0,Se,Je,null));else if(T.isDataTexture)if(Ge.length>0){Ze&&vt&&t.texStorage2D(n.TEXTURE_2D,ce,Ve,Ge[0].width,Ge[0].height);for(let q=0,te=Ge.length;q<te;q++)Ee=Ge[q],Ze?k&&t.texSubImage2D(n.TEXTURE_2D,q,0,0,Ee.width,Ee.height,Se,Je,Ee.data):t.texImage2D(n.TEXTURE_2D,q,Ve,Ee.width,Ee.height,0,Se,Je,Ee.data);T.generateMipmaps=!1}else Ze?(vt&&t.texStorage2D(n.TEXTURE_2D,ce,Ve,ae.width,ae.height),k&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,ae.width,ae.height,Se,Je,ae.data)):t.texImage2D(n.TEXTURE_2D,0,Ve,ae.width,ae.height,0,Se,Je,ae.data);else if(T.isCompressedTexture)if(T.isCompressedArrayTexture){Ze&&vt&&t.texStorage3D(n.TEXTURE_2D_ARRAY,ce,Ve,Ge[0].width,Ge[0].height,ae.depth);for(let q=0,te=Ge.length;q<te;q++)if(Ee=Ge[q],T.format!==dn)if(Se!==null)if(Ze){if(k)if(T.layerUpdates.size>0){const he=Op(Ee.width,Ee.height,T.format,T.type);for(const Oe of T.layerUpdates){const Qe=Ee.data.subarray(Oe*he/Ee.data.BYTES_PER_ELEMENT,(Oe+1)*he/Ee.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,q,0,0,Oe,Ee.width,Ee.height,1,Se,Qe,0,0)}T.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,q,0,0,0,Ee.width,Ee.height,ae.depth,Se,Ee.data,0,0)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,q,Ve,Ee.width,Ee.height,ae.depth,0,Ee.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ze?k&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,q,0,0,0,Ee.width,Ee.height,ae.depth,Se,Je,Ee.data):t.texImage3D(n.TEXTURE_2D_ARRAY,q,Ve,Ee.width,Ee.height,ae.depth,0,Se,Je,Ee.data)}else{Ze&&vt&&t.texStorage2D(n.TEXTURE_2D,ce,Ve,Ge[0].width,Ge[0].height);for(let q=0,te=Ge.length;q<te;q++)Ee=Ge[q],T.format!==dn?Se!==null?Ze?k&&t.compressedTexSubImage2D(n.TEXTURE_2D,q,0,0,Ee.width,Ee.height,Se,Ee.data):t.compressedTexImage2D(n.TEXTURE_2D,q,Ve,Ee.width,Ee.height,0,Ee.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ze?k&&t.texSubImage2D(n.TEXTURE_2D,q,0,0,Ee.width,Ee.height,Se,Je,Ee.data):t.texImage2D(n.TEXTURE_2D,q,Ve,Ee.width,Ee.height,0,Se,Je,Ee.data)}else if(T.isDataArrayTexture)if(Ze){if(vt&&t.texStorage3D(n.TEXTURE_2D_ARRAY,ce,Ve,ae.width,ae.height,ae.depth),k)if(T.layerUpdates.size>0){const q=Op(ae.width,ae.height,T.format,T.type);for(const te of T.layerUpdates){const he=ae.data.subarray(te*q/ae.data.BYTES_PER_ELEMENT,(te+1)*q/ae.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,te,ae.width,ae.height,1,Se,Je,he)}T.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,ae.width,ae.height,ae.depth,Se,Je,ae.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,Ve,ae.width,ae.height,ae.depth,0,Se,Je,ae.data);else if(T.isData3DTexture)Ze?(vt&&t.texStorage3D(n.TEXTURE_3D,ce,Ve,ae.width,ae.height,ae.depth),k&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,ae.width,ae.height,ae.depth,Se,Je,ae.data)):t.texImage3D(n.TEXTURE_3D,0,Ve,ae.width,ae.height,ae.depth,0,Se,Je,ae.data);else if(T.isFramebufferTexture){if(vt)if(Ze)t.texStorage2D(n.TEXTURE_2D,ce,Ve,ae.width,ae.height);else{let q=ae.width,te=ae.height;for(let he=0;he<ce;he++)t.texImage2D(n.TEXTURE_2D,he,Ve,q,te,0,Se,Je,null),q>>=1,te>>=1}}else if(Ge.length>0){if(Ze&&vt){const q=be(Ge[0]);t.texStorage2D(n.TEXTURE_2D,ce,Ve,q.width,q.height)}for(let q=0,te=Ge.length;q<te;q++)Ee=Ge[q],Ze?k&&t.texSubImage2D(n.TEXTURE_2D,q,0,0,Se,Je,Ee):t.texImage2D(n.TEXTURE_2D,q,Ve,Se,Je,Ee);T.generateMipmaps=!1}else if(Ze){if(vt){const q=be(ae);t.texStorage2D(n.TEXTURE_2D,ce,Ve,q.width,q.height)}k&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,Se,Je,ae)}else t.texImage2D(n.TEXTURE_2D,0,Ve,Se,Je,ae);g(T)&&f(ee),Le.__version=ne.version,T.onUpdate&&T.onUpdate(T)}N.__version=T.version}function X(N,T,H){if(T.image.length!==6)return;const ee=Te(N,T),J=T.source;t.bindTexture(n.TEXTURE_CUBE_MAP,N.__webglTexture,n.TEXTURE0+H);const ne=i.get(J);if(J.version!==ne.__version||ee===!0){t.activeTexture(n.TEXTURE0+H);const Le=rt.getPrimaries(rt.workingColorSpace),pe=T.colorSpace===Fi?null:rt.getPrimaries(T.colorSpace),Me=T.colorSpace===Fi||Le===pe?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,T.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,T.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,T.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Me);const We=T.isCompressedTexture||T.image[0].isCompressedTexture,ae=T.image[0]&&T.image[0].isDataTexture,Se=[];for(let te=0;te<6;te++)!We&&!ae?Se[te]=x(T.image[te],!0,r.maxCubemapSize):Se[te]=ae?T.image[te].image:T.image[te],Se[te]=me(T,Se[te]);const Je=Se[0],Ve=s.convert(T.format,T.colorSpace),Ee=s.convert(T.type),Ge=v(T.internalFormat,Ve,Ee,T.colorSpace),Ze=T.isVideoTexture!==!0,vt=ne.__version===void 0||ee===!0,k=J.dataReady;let ce=_(T,Je);se(n.TEXTURE_CUBE_MAP,T);let q;if(We){Ze&&vt&&t.texStorage2D(n.TEXTURE_CUBE_MAP,ce,Ge,Je.width,Je.height);for(let te=0;te<6;te++){q=Se[te].mipmaps;for(let he=0;he<q.length;he++){const Oe=q[he];T.format!==dn?Ve!==null?Ze?k&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+te,he,0,0,Oe.width,Oe.height,Ve,Oe.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+te,he,Ge,Oe.width,Oe.height,0,Oe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ze?k&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+te,he,0,0,Oe.width,Oe.height,Ve,Ee,Oe.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+te,he,Ge,Oe.width,Oe.height,0,Ve,Ee,Oe.data)}}}else{if(q=T.mipmaps,Ze&&vt){q.length>0&&ce++;const te=be(Se[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,ce,Ge,te.width,te.height)}for(let te=0;te<6;te++)if(ae){Ze?k&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,0,0,Se[te].width,Se[te].height,Ve,Ee,Se[te].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,Ge,Se[te].width,Se[te].height,0,Ve,Ee,Se[te].data);for(let he=0;he<q.length;he++){const Qe=q[he].image[te].image;Ze?k&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+te,he+1,0,0,Qe.width,Qe.height,Ve,Ee,Qe.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+te,he+1,Ge,Qe.width,Qe.height,0,Ve,Ee,Qe.data)}}else{Ze?k&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,0,0,Ve,Ee,Se[te]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,Ge,Ve,Ee,Se[te]);for(let he=0;he<q.length;he++){const Oe=q[he];Ze?k&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+te,he+1,0,0,Ve,Ee,Oe.image[te]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+te,he+1,Ge,Ve,Ee,Oe.image[te])}}}g(T)&&f(n.TEXTURE_CUBE_MAP),ne.__version=J.version,T.onUpdate&&T.onUpdate(T)}N.__version=T.version}function oe(N,T,H,ee,J,ne){const Le=s.convert(H.format,H.colorSpace),pe=s.convert(H.type),Me=v(H.internalFormat,Le,pe,H.colorSpace);if(!i.get(T).__hasExternalTextures){const ae=Math.max(1,T.width>>ne),Se=Math.max(1,T.height>>ne);J===n.TEXTURE_3D||J===n.TEXTURE_2D_ARRAY?t.texImage3D(J,ne,Me,ae,Se,T.depth,0,Le,pe,null):t.texImage2D(J,ne,Me,ae,Se,0,Le,pe,null)}t.bindFramebuffer(n.FRAMEBUFFER,N),Y(T)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,ee,J,i.get(H).__webglTexture,0,ge(T)):(J===n.TEXTURE_2D||J>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&J<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,ee,J,i.get(H).__webglTexture,ne),t.bindFramebuffer(n.FRAMEBUFFER,null)}function ve(N,T,H){if(n.bindRenderbuffer(n.RENDERBUFFER,N),T.depthBuffer){const ee=T.depthTexture,J=ee&&ee.isDepthTexture?ee.type:null,ne=y(T.stencilBuffer,J),Le=T.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,pe=ge(T);Y(T)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,pe,ne,T.width,T.height):H?n.renderbufferStorageMultisample(n.RENDERBUFFER,pe,ne,T.width,T.height):n.renderbufferStorage(n.RENDERBUFFER,ne,T.width,T.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,Le,n.RENDERBUFFER,N)}else{const ee=T.textures;for(let J=0;J<ee.length;J++){const ne=ee[J],Le=s.convert(ne.format,ne.colorSpace),pe=s.convert(ne.type),Me=v(ne.internalFormat,Le,pe,ne.colorSpace),We=ge(T);H&&Y(T)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,We,Me,T.width,T.height):Y(T)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,We,Me,T.width,T.height):n.renderbufferStorage(n.RENDERBUFFER,Me,T.width,T.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function de(N,T){if(T&&T.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(n.FRAMEBUFFER,N),!(T.depthTexture&&T.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(T.depthTexture).__webglTexture||T.depthTexture.image.width!==T.width||T.depthTexture.image.height!==T.height)&&(T.depthTexture.image.width=T.width,T.depthTexture.image.height=T.height,T.depthTexture.needsUpdate=!0),j(T.depthTexture,0);const ee=i.get(T.depthTexture).__webglTexture,J=ge(T);if(T.depthTexture.format===ps)Y(T)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,ee,0,J):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,ee,0);else if(T.depthTexture.format===ws)Y(T)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,ee,0,J):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,ee,0);else throw new Error("Unknown depthTexture format")}function De(N){const T=i.get(N),H=N.isWebGLCubeRenderTarget===!0;if(T.__boundDepthTexture!==N.depthTexture){const ee=N.depthTexture;if(T.__depthDisposeCallback&&T.__depthDisposeCallback(),ee){const J=()=>{delete T.__boundDepthTexture,delete T.__depthDisposeCallback,ee.removeEventListener("dispose",J)};ee.addEventListener("dispose",J),T.__depthDisposeCallback=J}T.__boundDepthTexture=ee}if(N.depthTexture&&!T.__autoAllocateDepthBuffer){if(H)throw new Error("target.depthTexture not supported in Cube render targets");de(T.__webglFramebuffer,N)}else if(H){T.__webglDepthbuffer=[];for(let ee=0;ee<6;ee++)if(t.bindFramebuffer(n.FRAMEBUFFER,T.__webglFramebuffer[ee]),T.__webglDepthbuffer[ee]===void 0)T.__webglDepthbuffer[ee]=n.createRenderbuffer(),ve(T.__webglDepthbuffer[ee],N,!1);else{const J=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ne=T.__webglDepthbuffer[ee];n.bindRenderbuffer(n.RENDERBUFFER,ne),n.framebufferRenderbuffer(n.FRAMEBUFFER,J,n.RENDERBUFFER,ne)}}else if(t.bindFramebuffer(n.FRAMEBUFFER,T.__webglFramebuffer),T.__webglDepthbuffer===void 0)T.__webglDepthbuffer=n.createRenderbuffer(),ve(T.__webglDepthbuffer,N,!1);else{const ee=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,J=T.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,J),n.framebufferRenderbuffer(n.FRAMEBUFFER,ee,n.RENDERBUFFER,J)}t.bindFramebuffer(n.FRAMEBUFFER,null)}function He(N,T,H){const ee=i.get(N);T!==void 0&&oe(ee.__webglFramebuffer,N,N.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),H!==void 0&&De(N)}function Be(N){const T=N.texture,H=i.get(N),ee=i.get(T);N.addEventListener("dispose",w);const J=N.textures,ne=N.isWebGLCubeRenderTarget===!0,Le=J.length>1;if(Le||(ee.__webglTexture===void 0&&(ee.__webglTexture=n.createTexture()),ee.__version=T.version,o.memory.textures++),ne){H.__webglFramebuffer=[];for(let pe=0;pe<6;pe++)if(T.mipmaps&&T.mipmaps.length>0){H.__webglFramebuffer[pe]=[];for(let Me=0;Me<T.mipmaps.length;Me++)H.__webglFramebuffer[pe][Me]=n.createFramebuffer()}else H.__webglFramebuffer[pe]=n.createFramebuffer()}else{if(T.mipmaps&&T.mipmaps.length>0){H.__webglFramebuffer=[];for(let pe=0;pe<T.mipmaps.length;pe++)H.__webglFramebuffer[pe]=n.createFramebuffer()}else H.__webglFramebuffer=n.createFramebuffer();if(Le)for(let pe=0,Me=J.length;pe<Me;pe++){const We=i.get(J[pe]);We.__webglTexture===void 0&&(We.__webglTexture=n.createTexture(),o.memory.textures++)}if(N.samples>0&&Y(N)===!1){H.__webglMultisampledFramebuffer=n.createFramebuffer(),H.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,H.__webglMultisampledFramebuffer);for(let pe=0;pe<J.length;pe++){const Me=J[pe];H.__webglColorRenderbuffer[pe]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,H.__webglColorRenderbuffer[pe]);const We=s.convert(Me.format,Me.colorSpace),ae=s.convert(Me.type),Se=v(Me.internalFormat,We,ae,Me.colorSpace,N.isXRRenderTarget===!0),Je=ge(N);n.renderbufferStorageMultisample(n.RENDERBUFFER,Je,Se,N.width,N.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+pe,n.RENDERBUFFER,H.__webglColorRenderbuffer[pe])}n.bindRenderbuffer(n.RENDERBUFFER,null),N.depthBuffer&&(H.__webglDepthRenderbuffer=n.createRenderbuffer(),ve(H.__webglDepthRenderbuffer,N,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(ne){t.bindTexture(n.TEXTURE_CUBE_MAP,ee.__webglTexture),se(n.TEXTURE_CUBE_MAP,T);for(let pe=0;pe<6;pe++)if(T.mipmaps&&T.mipmaps.length>0)for(let Me=0;Me<T.mipmaps.length;Me++)oe(H.__webglFramebuffer[pe][Me],N,T,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Me);else oe(H.__webglFramebuffer[pe],N,T,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0);g(T)&&f(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Le){for(let pe=0,Me=J.length;pe<Me;pe++){const We=J[pe],ae=i.get(We);t.bindTexture(n.TEXTURE_2D,ae.__webglTexture),se(n.TEXTURE_2D,We),oe(H.__webglFramebuffer,N,We,n.COLOR_ATTACHMENT0+pe,n.TEXTURE_2D,0),g(We)&&f(n.TEXTURE_2D)}t.unbindTexture()}else{let pe=n.TEXTURE_2D;if((N.isWebGL3DRenderTarget||N.isWebGLArrayRenderTarget)&&(pe=N.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(pe,ee.__webglTexture),se(pe,T),T.mipmaps&&T.mipmaps.length>0)for(let Me=0;Me<T.mipmaps.length;Me++)oe(H.__webglFramebuffer[Me],N,T,n.COLOR_ATTACHMENT0,pe,Me);else oe(H.__webglFramebuffer,N,T,n.COLOR_ATTACHMENT0,pe,0);g(T)&&f(pe),t.unbindTexture()}N.depthBuffer&&De(N)}function it(N){const T=N.textures;for(let H=0,ee=T.length;H<ee;H++){const J=T[H];if(g(J)){const ne=N.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:n.TEXTURE_2D,Le=i.get(J).__webglTexture;t.bindTexture(ne,Le),f(ne),t.unbindTexture()}}}const P=[],le=[];function ie(N){if(N.samples>0){if(Y(N)===!1){const T=N.textures,H=N.width,ee=N.height;let J=n.COLOR_BUFFER_BIT;const ne=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Le=i.get(N),pe=T.length>1;if(pe)for(let Me=0;Me<T.length;Me++)t.bindFramebuffer(n.FRAMEBUFFER,Le.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Me,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,Le.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Me,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,Le.__webglMultisampledFramebuffer),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Le.__webglFramebuffer);for(let Me=0;Me<T.length;Me++){if(N.resolveDepthBuffer&&(N.depthBuffer&&(J|=n.DEPTH_BUFFER_BIT),N.stencilBuffer&&N.resolveStencilBuffer&&(J|=n.STENCIL_BUFFER_BIT)),pe){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,Le.__webglColorRenderbuffer[Me]);const We=i.get(T[Me]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,We,0)}n.blitFramebuffer(0,0,H,ee,0,0,H,ee,J,n.NEAREST),l===!0&&(P.length=0,le.length=0,P.push(n.COLOR_ATTACHMENT0+Me),N.depthBuffer&&N.resolveDepthBuffer===!1&&(P.push(ne),le.push(ne),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,le)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,P))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),pe)for(let Me=0;Me<T.length;Me++){t.bindFramebuffer(n.FRAMEBUFFER,Le.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Me,n.RENDERBUFFER,Le.__webglColorRenderbuffer[Me]);const We=i.get(T[Me]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,Le.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Me,n.TEXTURE_2D,We,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Le.__webglMultisampledFramebuffer)}else if(N.depthBuffer&&N.resolveDepthBuffer===!1&&l){const T=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[T])}}}function ge(N){return Math.min(r.maxSamples,N.samples)}function Y(N){const T=i.get(N);return N.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&T.__useRenderToTexture!==!1}function Ue(N){const T=o.render.frame;u.get(N)!==T&&(u.set(N,T),N.update())}function me(N,T){const H=N.colorSpace,ee=N.format,J=N.type;return N.isCompressedTexture===!0||N.isVideoTexture===!0||H!==tr&&H!==Fi&&(rt.getTransfer(H)===ft?(ee!==dn||J!==Ei)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",H)),T}function be(N){return typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement?(c.width=N.naturalWidth||N.width,c.height=N.naturalHeight||N.height):typeof VideoFrame<"u"&&N instanceof VideoFrame?(c.width=N.displayWidth,c.height=N.displayHeight):(c.width=N.width,c.height=N.height),c}this.allocateTextureUnit=G,this.resetTextureUnits=L,this.setTexture2D=j,this.setTexture2DArray=U,this.setTexture3D=z,this.setTextureCube=Z,this.rebindTextures=He,this.setupRenderTarget=Be,this.updateRenderTargetMipmap=it,this.updateMultisampleRenderTarget=ie,this.setupDepthRenderbuffer=De,this.setupFrameBufferTexture=oe,this.useMultisampledRTT=Y}function vM(n,e){function t(i,r=Fi){let s;const o=rt.getTransfer(r);if(i===Ei)return n.UNSIGNED_BYTE;if(i===Nd)return n.UNSIGNED_SHORT_4_4_4_4;if(i===Ld)return n.UNSIGNED_SHORT_5_5_5_1;if(i===Wm)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===Hm)return n.BYTE;if(i===Gm)return n.SHORT;if(i===Do)return n.UNSIGNED_SHORT;if(i===Id)return n.INT;if(i===Ji)return n.UNSIGNED_INT;if(i===Sn)return n.FLOAT;if(i===Ho)return n.HALF_FLOAT;if(i===jm)return n.ALPHA;if(i===Xm)return n.RGB;if(i===dn)return n.RGBA;if(i===$m)return n.LUMINANCE;if(i===Ym)return n.LUMINANCE_ALPHA;if(i===ps)return n.DEPTH_COMPONENT;if(i===ws)return n.DEPTH_STENCIL;if(i===Dd)return n.RED;if(i===Rl)return n.RED_INTEGER;if(i===qm)return n.RG;if(i===Ud)return n.RG_INTEGER;if(i===kd)return n.RGBA_INTEGER;if(i===Ia||i===Na||i===La||i===Da)if(o===ft)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===Ia)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Na)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===La)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Da)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===Ia)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Na)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===La)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Da)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===Uu||i===ku||i===Ou||i===Fu)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===Uu)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===ku)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Ou)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Fu)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===Bu||i===zu||i===Vu)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===Bu||i===zu)return o===ft?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===Vu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===Hu||i===Gu||i===Wu||i===ju||i===Xu||i===$u||i===Yu||i===qu||i===Zu||i===Ku||i===Ju||i===Qu||i===ed||i===td)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===Hu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===Gu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===Wu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===ju)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Xu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===$u)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===Yu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===qu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Zu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Ku)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Ju)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Qu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===ed)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===td)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Ua||i===nd||i===id)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===Ua)return o===ft?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===nd)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===id)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===Zm||i===rd||i===sd||i===od)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===Ua)return s.COMPRESSED_RED_RGTC1_EXT;if(i===rd)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===sd)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===od)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===Ms?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}class yM extends Yt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class go extends nt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const hI={type:"move"};class yf{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new go,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 go,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new I,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new I),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new go,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new I,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new I),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const x of e.hand.values()){const g=t.getJointPose(x,i),f=this._getHandJoint(c,x);g!==null&&(f.matrix.fromArray(g.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=g.radius),f.visible=g!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],d=u.position.distanceTo(h.position),p=.02,m=.005;c.inputState.pinching&&d>p+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=p-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),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&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(hI)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new go;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const fI=`
3874
+ }`;function rI(n,e,t){let i=new Ll;const r=new Q,s=new Q,o=new ct,a=new og({depthPacking:qS}),l=new ag,c={},u=t.maxTextureSize,h={[Zi]:fn,[fn]:Zi,[vi]:vi},d=new ci({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Q},radius:{value:4}},vertexShader:nI,fragmentShader:iI}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const m=new Ye;m.setAttribute("position",new ht(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new kt(m,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Vm;let f=this.type;this.render=function(w,E,A){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||w.length===0)return;const b=n.getRenderTarget(),M=n.getActiveCubeFace(),L=n.getActiveMipmapLevel(),G=n.state;G.setBlending(Wi),G.buffers.color.setClear(1,1,1,1),G.buffers.depth.setTest(!0),G.setScissorTest(!1);const B=f!==gi&&this.type===gi,j=f===gi&&this.type!==gi;for(let U=0,z=w.length;U<z;U++){const Z=w[U],D=Z.shadow;if(D===void 0){console.warn("THREE.WebGLShadowMap:",Z,"has no shadow.");continue}if(D.autoUpdate===!1&&D.needsUpdate===!1)continue;r.copy(D.mapSize);const $=D.getFrameExtents();if(r.multiply($),s.copy(D.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/$.x),r.x=s.x*$.x,D.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/$.y),r.y=s.y*$.y,D.mapSize.y=s.y)),D.map===null||B===!0||j===!0){const se=this.type!==gi?{minFilter:Gt,magFilter:Gt}:{};D.map!==null&&D.map.dispose(),D.map=new li(r.x,r.y,se),D.map.texture.name=Z.name+".shadowMap",D.camera.updateProjectionMatrix()}n.setRenderTarget(D.map),n.clear();const K=D.getViewportCount();for(let se=0;se<K;se++){const Ae=D.getViewport(se);o.set(s.x*Ae.x,s.y*Ae.y,s.x*Ae.z,s.y*Ae.w),G.viewport(o),D.updateMatrices(Z,se),i=D.getFrustum(),_(E,A,D.camera,Z,this.type)}D.isPointLightShadow!==!0&&this.type===gi&&v(D,A),D.needsUpdate=!1}f=this.type,g.needsUpdate=!1,n.setRenderTarget(b,M,L)};function v(w,E){const A=e.update(x);d.defines.VSM_SAMPLES!==w.blurSamples&&(d.defines.VSM_SAMPLES=w.blurSamples,p.defines.VSM_SAMPLES=w.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),w.mapPass===null&&(w.mapPass=new li(r.x,r.y)),d.uniforms.shadow_pass.value=w.map.texture,d.uniforms.resolution.value=w.mapSize,d.uniforms.radius.value=w.radius,n.setRenderTarget(w.mapPass),n.clear(),n.renderBufferDirect(E,null,A,d,x,null),p.uniforms.shadow_pass.value=w.mapPass.texture,p.uniforms.resolution.value=w.mapSize,p.uniforms.radius.value=w.radius,n.setRenderTarget(w.map),n.clear(),n.renderBufferDirect(E,null,A,p,x,null)}function y(w,E,A,b){let M=null;const L=A.isPointLight===!0?w.customDistanceMaterial:w.customDepthMaterial;if(L!==void 0)M=L;else if(M=A.isPointLight===!0?l:a,n.localClippingEnabled&&E.clipShadows===!0&&Array.isArray(E.clippingPlanes)&&E.clippingPlanes.length!==0||E.displacementMap&&E.displacementScale!==0||E.alphaMap&&E.alphaTest>0||E.map&&E.alphaTest>0){const G=M.uuid,B=E.uuid;let j=c[G];j===void 0&&(j={},c[G]=j);let U=j[B];U===void 0&&(U=M.clone(),j[B]=U,E.addEventListener("dispose",R)),M=U}if(M.visible=E.visible,M.wireframe=E.wireframe,b===gi?M.side=E.shadowSide!==null?E.shadowSide:E.side:M.side=E.shadowSide!==null?E.shadowSide:h[E.side],M.alphaMap=E.alphaMap,M.alphaTest=E.alphaTest,M.map=E.map,M.clipShadows=E.clipShadows,M.clippingPlanes=E.clippingPlanes,M.clipIntersection=E.clipIntersection,M.displacementMap=E.displacementMap,M.displacementScale=E.displacementScale,M.displacementBias=E.displacementBias,M.wireframeLinewidth=E.wireframeLinewidth,M.linewidth=E.linewidth,A.isPointLight===!0&&M.isMeshDistanceMaterial===!0){const G=n.properties.get(M);G.light=A}return M}function _(w,E,A,b,M){if(w.visible===!1)return;if(w.layers.test(E.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&M===gi)&&(!w.frustumCulled||i.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(A.matrixWorldInverse,w.matrixWorld);const B=e.update(w),j=w.material;if(Array.isArray(j)){const U=B.groups;for(let z=0,Z=U.length;z<Z;z++){const D=U[z],$=j[D.materialIndex];if($&&$.visible){const K=y(w,$,b,M);w.onBeforeShadow(n,w,E,A,B,K,D),n.renderBufferDirect(A,null,B,K,w,D),w.onAfterShadow(n,w,E,A,B,K,D)}}}else if(j.visible){const U=y(w,j,b,M);w.onBeforeShadow(n,w,E,A,B,U,null),n.renderBufferDirect(A,null,B,U,w,null),w.onAfterShadow(n,w,E,A,B,U,null)}}const G=w.children;for(let B=0,j=G.length;B<j;B++)_(G[B],E,A,b,M)}function R(w){w.target.removeEventListener("dispose",R);for(const A in c){const b=c[A],M=w.target.uuid;M in b&&(b[M].dispose(),delete b[M])}}}function sI(n){function e(){let k=!1;const ce=new ct;let q=null;const te=new ct(0,0,0,0);return{setMask:function(he){q!==he&&!k&&(n.colorMask(he,he,he,he),q=he)},setLocked:function(he){k=he},setClear:function(he,Oe,Qe,It,jt){jt===!0&&(he*=It,Oe*=It,Qe*=It),ce.set(he,Oe,Qe,It),te.equals(ce)===!1&&(n.clearColor(he,Oe,Qe,It),te.copy(ce))},reset:function(){k=!1,q=null,te.set(-1,0,0,0)}}}function t(){let k=!1,ce=null,q=null,te=null;return{setTest:function(he){he?ve(n.DEPTH_TEST):de(n.DEPTH_TEST)},setMask:function(he){ce!==he&&!k&&(n.depthMask(he),ce=he)},setFunc:function(he){if(q!==he){switch(he){case CS:n.depthFunc(n.NEVER);break;case RS:n.depthFunc(n.ALWAYS);break;case PS:n.depthFunc(n.LESS);break;case nl:n.depthFunc(n.LEQUAL);break;case IS:n.depthFunc(n.EQUAL);break;case NS:n.depthFunc(n.GEQUAL);break;case LS:n.depthFunc(n.GREATER);break;case DS:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}q=he}},setLocked:function(he){k=he},setClear:function(he){te!==he&&(n.clearDepth(he),te=he)},reset:function(){k=!1,ce=null,q=null,te=null}}}function i(){let k=!1,ce=null,q=null,te=null,he=null,Oe=null,Qe=null,It=null,jt=null;return{setTest:function(st){k||(st?ve(n.STENCIL_TEST):de(n.STENCIL_TEST))},setMask:function(st){ce!==st&&!k&&(n.stencilMask(st),ce=st)},setFunc:function(st,Ci,hi){(q!==st||te!==Ci||he!==hi)&&(n.stencilFunc(st,Ci,hi),q=st,te=Ci,he=hi)},setOp:function(st,Ci,hi){(Oe!==st||Qe!==Ci||It!==hi)&&(n.stencilOp(st,Ci,hi),Oe=st,Qe=Ci,It=hi)},setLocked:function(st){k=st},setClear:function(st){jt!==st&&(n.clearStencil(st),jt=st)},reset:function(){k=!1,ce=null,q=null,te=null,he=null,Oe=null,Qe=null,It=null,jt=null}}}const r=new e,s=new t,o=new i,a=new WeakMap,l=new WeakMap;let c={},u={},h=new WeakMap,d=[],p=null,m=!1,x=null,g=null,f=null,v=null,y=null,_=null,R=null,w=new _e(0,0,0),E=0,A=!1,b=null,M=null,L=null,G=null,B=null;const j=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let U=!1,z=0;const Z=n.getParameter(n.VERSION);Z.indexOf("WebGL")!==-1?(z=parseFloat(/^WebGL (\d)/.exec(Z)[1]),U=z>=1):Z.indexOf("OpenGL ES")!==-1&&(z=parseFloat(/^OpenGL ES (\d)/.exec(Z)[1]),U=z>=2);let D=null,$={};const K=n.getParameter(n.SCISSOR_BOX),se=n.getParameter(n.VIEWPORT),Ae=new ct().fromArray(K),qe=new ct().fromArray(se);function X(k,ce,q,te){const he=new Uint8Array(4),Oe=n.createTexture();n.bindTexture(k,Oe),n.texParameteri(k,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(k,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Qe=0;Qe<q;Qe++)k===n.TEXTURE_3D||k===n.TEXTURE_2D_ARRAY?n.texImage3D(ce,0,n.RGBA,1,1,te,0,n.RGBA,n.UNSIGNED_BYTE,he):n.texImage2D(ce+Qe,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,he);return Oe}const oe={};oe[n.TEXTURE_2D]=X(n.TEXTURE_2D,n.TEXTURE_2D,1),oe[n.TEXTURE_CUBE_MAP]=X(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),oe[n.TEXTURE_2D_ARRAY]=X(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),oe[n.TEXTURE_3D]=X(n.TEXTURE_3D,n.TEXTURE_3D,1,1),r.setClear(0,0,0,1),s.setClear(1),o.setClear(0),ve(n.DEPTH_TEST),s.setFunc(nl),xe(!1),Y(Cp),ve(n.CULL_FACE),le(Wi);function ve(k){c[k]!==!0&&(n.enable(k),c[k]=!0)}function de(k){c[k]!==!1&&(n.disable(k),c[k]=!1)}function De(k,ce){return u[k]!==ce?(n.bindFramebuffer(k,ce),u[k]=ce,k===n.DRAW_FRAMEBUFFER&&(u[n.FRAMEBUFFER]=ce),k===n.FRAMEBUFFER&&(u[n.DRAW_FRAMEBUFFER]=ce),!0):!1}function He(k,ce){let q=d,te=!1;if(k){q=h.get(ce),q===void 0&&(q=[],h.set(ce,q));const he=k.textures;if(q.length!==he.length||q[0]!==n.COLOR_ATTACHMENT0){for(let Oe=0,Qe=he.length;Oe<Qe;Oe++)q[Oe]=n.COLOR_ATTACHMENT0+Oe;q.length=he.length,te=!0}}else q[0]!==n.BACK&&(q[0]=n.BACK,te=!0);te&&n.drawBuffers(q)}function Be(k){return p!==k?(n.useProgram(k),p=k,!0):!1}const it={[vr]:n.FUNC_ADD,[dS]:n.FUNC_SUBTRACT,[hS]:n.FUNC_REVERSE_SUBTRACT};it[fS]=n.MIN,it[pS]=n.MAX;const P={[mS]:n.ZERO,[gS]:n.ONE,[xS]:n.SRC_COLOR,[Du]:n.SRC_ALPHA,[wS]:n.SRC_ALPHA_SATURATE,[SS]:n.DST_COLOR,[yS]:n.DST_ALPHA,[vS]:n.ONE_MINUS_SRC_COLOR,[Uu]:n.ONE_MINUS_SRC_ALPHA,[MS]:n.ONE_MINUS_DST_COLOR,[_S]:n.ONE_MINUS_DST_ALPHA,[bS]:n.CONSTANT_COLOR,[ES]:n.ONE_MINUS_CONSTANT_COLOR,[TS]:n.CONSTANT_ALPHA,[AS]:n.ONE_MINUS_CONSTANT_ALPHA};function le(k,ce,q,te,he,Oe,Qe,It,jt,st){if(k===Wi){m===!0&&(de(n.BLEND),m=!1);return}if(m===!1&&(ve(n.BLEND),m=!0),k!==uS){if(k!==x||st!==A){if((g!==vr||y!==vr)&&(n.blendEquation(n.FUNC_ADD),g=vr,y=vr),st)switch(k){case fs:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Rp:n.blendFunc(n.ONE,n.ONE);break;case Pp:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Ip:n.blendFuncSeparate(n.ZERO,n.SRC_COLOR,n.ZERO,n.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",k);break}else switch(k){case fs:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Rp:n.blendFunc(n.SRC_ALPHA,n.ONE);break;case Pp:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Ip:n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",k);break}f=null,v=null,_=null,R=null,w.set(0,0,0),E=0,x=k,A=st}return}he=he||ce,Oe=Oe||q,Qe=Qe||te,(ce!==g||he!==y)&&(n.blendEquationSeparate(it[ce],it[he]),g=ce,y=he),(q!==f||te!==v||Oe!==_||Qe!==R)&&(n.blendFuncSeparate(P[q],P[te],P[Oe],P[Qe]),f=q,v=te,_=Oe,R=Qe),(It.equals(w)===!1||jt!==E)&&(n.blendColor(It.r,It.g,It.b,jt),w.copy(It),E=jt),x=k,A=!1}function ie(k,ce){k.side===vi?de(n.CULL_FACE):ve(n.CULL_FACE);let q=k.side===fn;ce&&(q=!q),xe(q),k.blending===fs&&k.transparent===!1?le(Wi):le(k.blending,k.blendEquation,k.blendSrc,k.blendDst,k.blendEquationAlpha,k.blendSrcAlpha,k.blendDstAlpha,k.blendColor,k.blendAlpha,k.premultipliedAlpha),s.setFunc(k.depthFunc),s.setTest(k.depthTest),s.setMask(k.depthWrite),r.setMask(k.colorWrite);const te=k.stencilWrite;o.setTest(te),te&&(o.setMask(k.stencilWriteMask),o.setFunc(k.stencilFunc,k.stencilRef,k.stencilFuncMask),o.setOp(k.stencilFail,k.stencilZFail,k.stencilZPass)),me(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits),k.alphaToCoverage===!0?ve(n.SAMPLE_ALPHA_TO_COVERAGE):de(n.SAMPLE_ALPHA_TO_COVERAGE)}function xe(k){b!==k&&(k?n.frontFace(n.CW):n.frontFace(n.CCW),b=k)}function Y(k){k!==aS?(ve(n.CULL_FACE),k!==M&&(k===Cp?n.cullFace(n.BACK):k===lS?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):de(n.CULL_FACE),M=k}function Ue(k){k!==L&&(U&&n.lineWidth(k),L=k)}function me(k,ce,q){k?(ve(n.POLYGON_OFFSET_FILL),(G!==ce||B!==q)&&(n.polygonOffset(ce,q),G=ce,B=q)):de(n.POLYGON_OFFSET_FILL)}function be(k){k?ve(n.SCISSOR_TEST):de(n.SCISSOR_TEST)}function N(k){k===void 0&&(k=n.TEXTURE0+j-1),D!==k&&(n.activeTexture(k),D=k)}function T(k,ce,q){q===void 0&&(D===null?q=n.TEXTURE0+j-1:q=D);let te=$[q];te===void 0&&(te={type:void 0,texture:void 0},$[q]=te),(te.type!==k||te.texture!==ce)&&(D!==q&&(n.activeTexture(q),D=q),n.bindTexture(k,ce||oe[k]),te.type=k,te.texture=ce)}function H(){const k=$[D];k!==void 0&&k.type!==void 0&&(n.bindTexture(k.type,null),k.type=void 0,k.texture=void 0)}function ee(){try{n.compressedTexImage2D.apply(n,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function J(){try{n.compressedTexImage3D.apply(n,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function ne(){try{n.texSubImage2D.apply(n,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function Le(){try{n.texSubImage3D.apply(n,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function pe(){try{n.compressedTexSubImage2D.apply(n,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function Me(){try{n.compressedTexSubImage3D.apply(n,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function We(){try{n.texStorage2D.apply(n,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function ae(){try{n.texStorage3D.apply(n,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function Se(){try{n.texImage2D.apply(n,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function Je(){try{n.texImage3D.apply(n,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function Ve(k){Ae.equals(k)===!1&&(n.scissor(k.x,k.y,k.z,k.w),Ae.copy(k))}function Te(k){qe.equals(k)===!1&&(n.viewport(k.x,k.y,k.z,k.w),qe.copy(k))}function Ge(k,ce){let q=l.get(ce);q===void 0&&(q=new WeakMap,l.set(ce,q));let te=q.get(k);te===void 0&&(te=n.getUniformBlockIndex(ce,k.name),q.set(k,te))}function Ze(k,ce){const te=l.get(ce).get(k);a.get(ce)!==te&&(n.uniformBlockBinding(ce,te,k.__bindingPointIndex),a.set(ce,te))}function vt(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),c={},D=null,$={},u={},h=new WeakMap,d=[],p=null,m=!1,x=null,g=null,f=null,v=null,y=null,_=null,R=null,w=new _e(0,0,0),E=0,A=!1,b=null,M=null,L=null,G=null,B=null,Ae.set(0,0,n.canvas.width,n.canvas.height),qe.set(0,0,n.canvas.width,n.canvas.height),r.reset(),s.reset(),o.reset()}return{buffers:{color:r,depth:s,stencil:o},enable:ve,disable:de,bindFramebuffer:De,drawBuffers:He,useProgram:Be,setBlending:le,setMaterial:ie,setFlipSided:xe,setCullFace:Y,setLineWidth:Ue,setPolygonOffset:me,setScissorTest:be,activeTexture:N,bindTexture:T,unbindTexture:H,compressedTexImage2D:ee,compressedTexImage3D:J,texImage2D:Se,texImage3D:Je,updateUBOMapping:Ge,uniformBlockBinding:Ze,texStorage2D:We,texStorage3D:ae,texSubImage2D:ne,texSubImage3D:Le,compressedTexSubImage2D:pe,compressedTexSubImage3D:Me,scissor:Ve,viewport:Te,reset:vt}}function oI(n,e){const t=n.image&&n.image.width?n.image.width/n.image.height:1;return t>e?(n.repeat.x=1,n.repeat.y=t/e,n.offset.x=0,n.offset.y=(1-n.repeat.y)/2):(n.repeat.x=e/t,n.repeat.y=1,n.offset.x=(1-n.repeat.x)/2,n.offset.y=0),n}function aI(n,e){const t=n.image&&n.image.width?n.image.width/n.image.height:1;return t>e?(n.repeat.x=e/t,n.repeat.y=1,n.offset.x=(1-n.repeat.x)/2,n.offset.y=0):(n.repeat.x=1,n.repeat.y=t/e,n.offset.x=0,n.offset.y=(1-n.repeat.y)/2),n}function lI(n){return n.repeat.x=1,n.repeat.y=1,n.offset.x=0,n.offset.y=0,n}function Op(n,e,t,i){const r=cI(i);switch(t){case Xm:return n*e;case Ym:return n*e;case qm:return n*e*2;case Dd:return n*e/r.components*r.byteLength;case Pl:return n*e/r.components*r.byteLength;case Zm:return n*e*2/r.components*r.byteLength;case Ud:return n*e*2/r.components*r.byteLength;case $m:return n*e*3/r.components*r.byteLength;case dn:return n*e*4/r.components*r.byteLength;case kd:return n*e*4/r.components*r.byteLength;case Ia:case Na:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case La:case Da:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Ou:case Bu:return Math.max(n,16)*Math.max(e,8)/4;case ku:case Fu:return Math.max(n,8)*Math.max(e,8)/2;case zu:case Vu:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Hu:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Gu:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Wu:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case ju:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case Xu:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case $u:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case Yu:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case qu:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case Zu:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case Ku:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case Ju:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case Qu:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case ed:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case td:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case nd:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case Ua:case id:case rd:return Math.ceil(n/4)*Math.ceil(e/4)*16;case Km:case sd:return Math.ceil(n/4)*Math.ceil(e/4)*8;case od:case ad:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function cI(n){switch(n){case Ei:case Gm:return{byteLength:1,components:1};case Do:case Wm:case Ho:return{byteLength:2,components:1};case Nd:case Ld:return{byteLength:2,components:4};case Ji:case Id:case Sn:return{byteLength:4,components:1};case jm:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}const uI={contain:oI,cover:aI,fill:lI,getByteLength:Op};function dI(n,e,t,i,r,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 Q,u=new WeakMap;let h;const d=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function m(N,T){return p?new OffscreenCanvas(N,T):pl("canvas")}function x(N,T,H){let ee=1;const J=be(N);if((J.width>H||J.height>H)&&(ee=H/Math.max(J.width,J.height)),ee<1)if(typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&N instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&N instanceof ImageBitmap||typeof VideoFrame<"u"&&N instanceof VideoFrame){const ne=Math.floor(ee*J.width),Le=Math.floor(ee*J.height);h===void 0&&(h=m(ne,Le));const pe=T?m(ne,Le):h;return pe.width=ne,pe.height=Le,pe.getContext("2d").drawImage(N,0,0,ne,Le),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+J.width+"x"+J.height+") to ("+ne+"x"+Le+")."),pe}else return"data"in N&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+J.width+"x"+J.height+")."),N;return N}function g(N){return N.generateMipmaps&&N.minFilter!==Gt&&N.minFilter!==Ut}function f(N){n.generateMipmap(N)}function v(N,T,H,ee,J=!1){if(N!==null){if(n[N]!==void 0)return n[N];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let ne=T;if(T===n.RED&&(H===n.FLOAT&&(ne=n.R32F),H===n.HALF_FLOAT&&(ne=n.R16F),H===n.UNSIGNED_BYTE&&(ne=n.R8)),T===n.RED_INTEGER&&(H===n.UNSIGNED_BYTE&&(ne=n.R8UI),H===n.UNSIGNED_SHORT&&(ne=n.R16UI),H===n.UNSIGNED_INT&&(ne=n.R32UI),H===n.BYTE&&(ne=n.R8I),H===n.SHORT&&(ne=n.R16I),H===n.INT&&(ne=n.R32I)),T===n.RG&&(H===n.FLOAT&&(ne=n.RG32F),H===n.HALF_FLOAT&&(ne=n.RG16F),H===n.UNSIGNED_BYTE&&(ne=n.RG8)),T===n.RG_INTEGER&&(H===n.UNSIGNED_BYTE&&(ne=n.RG8UI),H===n.UNSIGNED_SHORT&&(ne=n.RG16UI),H===n.UNSIGNED_INT&&(ne=n.RG32UI),H===n.BYTE&&(ne=n.RG8I),H===n.SHORT&&(ne=n.RG16I),H===n.INT&&(ne=n.RG32I)),T===n.RGB&&H===n.UNSIGNED_INT_5_9_9_9_REV&&(ne=n.RGB9_E5),T===n.RGBA){const Le=J?cl:rt.getTransfer(ee);H===n.FLOAT&&(ne=n.RGBA32F),H===n.HALF_FLOAT&&(ne=n.RGBA16F),H===n.UNSIGNED_BYTE&&(ne=Le===ft?n.SRGB8_ALPHA8:n.RGBA8),H===n.UNSIGNED_SHORT_4_4_4_4&&(ne=n.RGBA4),H===n.UNSIGNED_SHORT_5_5_5_1&&(ne=n.RGB5_A1)}return(ne===n.R16F||ne===n.R32F||ne===n.RG16F||ne===n.RG32F||ne===n.RGBA16F||ne===n.RGBA32F)&&e.get("EXT_color_buffer_float"),ne}function y(N,T){let H;return N?T===null||T===Ji||T===Ms?H=n.DEPTH24_STENCIL8:T===Sn?H=n.DEPTH32F_STENCIL8:T===Do&&(H=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):T===null||T===Ji||T===Ms?H=n.DEPTH_COMPONENT24:T===Sn?H=n.DEPTH_COMPONENT32F:T===Do&&(H=n.DEPTH_COMPONENT16),H}function _(N,T){return g(N)===!0||N.isFramebufferTexture&&N.minFilter!==Gt&&N.minFilter!==Ut?Math.log2(Math.max(T.width,T.height))+1:N.mipmaps!==void 0&&N.mipmaps.length>0?N.mipmaps.length:N.isCompressedTexture&&Array.isArray(N.image)?T.mipmaps.length:1}function R(N){const T=N.target;T.removeEventListener("dispose",R),E(T),T.isVideoTexture&&u.delete(T)}function w(N){const T=N.target;T.removeEventListener("dispose",w),b(T)}function E(N){const T=i.get(N);if(T.__webglInit===void 0)return;const H=N.source,ee=d.get(H);if(ee){const J=ee[T.__cacheKey];J.usedTimes--,J.usedTimes===0&&A(N),Object.keys(ee).length===0&&d.delete(H)}i.remove(N)}function A(N){const T=i.get(N);n.deleteTexture(T.__webglTexture);const H=N.source,ee=d.get(H);delete ee[T.__cacheKey],o.memory.textures--}function b(N){const T=i.get(N);if(N.depthTexture&&N.depthTexture.dispose(),N.isWebGLCubeRenderTarget)for(let ee=0;ee<6;ee++){if(Array.isArray(T.__webglFramebuffer[ee]))for(let J=0;J<T.__webglFramebuffer[ee].length;J++)n.deleteFramebuffer(T.__webglFramebuffer[ee][J]);else n.deleteFramebuffer(T.__webglFramebuffer[ee]);T.__webglDepthbuffer&&n.deleteRenderbuffer(T.__webglDepthbuffer[ee])}else{if(Array.isArray(T.__webglFramebuffer))for(let ee=0;ee<T.__webglFramebuffer.length;ee++)n.deleteFramebuffer(T.__webglFramebuffer[ee]);else n.deleteFramebuffer(T.__webglFramebuffer);if(T.__webglDepthbuffer&&n.deleteRenderbuffer(T.__webglDepthbuffer),T.__webglMultisampledFramebuffer&&n.deleteFramebuffer(T.__webglMultisampledFramebuffer),T.__webglColorRenderbuffer)for(let ee=0;ee<T.__webglColorRenderbuffer.length;ee++)T.__webglColorRenderbuffer[ee]&&n.deleteRenderbuffer(T.__webglColorRenderbuffer[ee]);T.__webglDepthRenderbuffer&&n.deleteRenderbuffer(T.__webglDepthRenderbuffer)}const H=N.textures;for(let ee=0,J=H.length;ee<J;ee++){const ne=i.get(H[ee]);ne.__webglTexture&&(n.deleteTexture(ne.__webglTexture),o.memory.textures--),i.remove(H[ee])}i.remove(N)}let M=0;function L(){M=0}function G(){const N=M;return N>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+r.maxTextures),M+=1,N}function B(N){const T=[];return T.push(N.wrapS),T.push(N.wrapT),T.push(N.wrapR||0),T.push(N.magFilter),T.push(N.minFilter),T.push(N.anisotropy),T.push(N.internalFormat),T.push(N.format),T.push(N.type),T.push(N.generateMipmaps),T.push(N.premultiplyAlpha),T.push(N.flipY),T.push(N.unpackAlignment),T.push(N.colorSpace),T.join()}function j(N,T){const H=i.get(N);if(N.isVideoTexture&&Ue(N),N.isRenderTargetTexture===!1&&N.version>0&&H.__version!==N.version){const ee=N.image;if(ee===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ee.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{qe(H,N,T);return}}t.bindTexture(n.TEXTURE_2D,H.__webglTexture,n.TEXTURE0+T)}function U(N,T){const H=i.get(N);if(N.version>0&&H.__version!==N.version){qe(H,N,T);return}t.bindTexture(n.TEXTURE_2D_ARRAY,H.__webglTexture,n.TEXTURE0+T)}function z(N,T){const H=i.get(N);if(N.version>0&&H.__version!==N.version){qe(H,N,T);return}t.bindTexture(n.TEXTURE_3D,H.__webglTexture,n.TEXTURE0+T)}function Z(N,T){const H=i.get(N);if(N.version>0&&H.__version!==N.version){X(H,N,T);return}t.bindTexture(n.TEXTURE_CUBE_MAP,H.__webglTexture,n.TEXTURE0+T)}const D={[sl]:n.REPEAT,[Xn]:n.CLAMP_TO_EDGE,[ol]:n.MIRRORED_REPEAT},$={[Gt]:n.NEAREST,[Hm]:n.NEAREST_MIPMAP_NEAREST,[fo]:n.NEAREST_MIPMAP_LINEAR,[Ut]:n.LINEAR,[Pa]:n.LINEAR_MIPMAP_NEAREST,[yi]:n.LINEAR_MIPMAP_LINEAR},K={[KS]:n.NEVER,[iM]:n.ALWAYS,[JS]:n.LESS,[Qm]:n.LEQUAL,[QS]:n.EQUAL,[nM]:n.GEQUAL,[eM]:n.GREATER,[tM]:n.NOTEQUAL};function se(N,T){if(T.type===Sn&&e.has("OES_texture_float_linear")===!1&&(T.magFilter===Ut||T.magFilter===Pa||T.magFilter===fo||T.magFilter===yi||T.minFilter===Ut||T.minFilter===Pa||T.minFilter===fo||T.minFilter===yi)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(N,n.TEXTURE_WRAP_S,D[T.wrapS]),n.texParameteri(N,n.TEXTURE_WRAP_T,D[T.wrapT]),(N===n.TEXTURE_3D||N===n.TEXTURE_2D_ARRAY)&&n.texParameteri(N,n.TEXTURE_WRAP_R,D[T.wrapR]),n.texParameteri(N,n.TEXTURE_MAG_FILTER,$[T.magFilter]),n.texParameteri(N,n.TEXTURE_MIN_FILTER,$[T.minFilter]),T.compareFunction&&(n.texParameteri(N,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(N,n.TEXTURE_COMPARE_FUNC,K[T.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(T.magFilter===Gt||T.minFilter!==fo&&T.minFilter!==yi||T.type===Sn&&e.has("OES_texture_float_linear")===!1)return;if(T.anisotropy>1||i.get(T).__currentAnisotropy){const H=e.get("EXT_texture_filter_anisotropic");n.texParameterf(N,H.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(T.anisotropy,r.getMaxAnisotropy())),i.get(T).__currentAnisotropy=T.anisotropy}}}function Ae(N,T){let H=!1;N.__webglInit===void 0&&(N.__webglInit=!0,T.addEventListener("dispose",R));const ee=T.source;let J=d.get(ee);J===void 0&&(J={},d.set(ee,J));const ne=B(T);if(ne!==N.__cacheKey){J[ne]===void 0&&(J[ne]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,H=!0),J[ne].usedTimes++;const Le=J[N.__cacheKey];Le!==void 0&&(J[N.__cacheKey].usedTimes--,Le.usedTimes===0&&A(T)),N.__cacheKey=ne,N.__webglTexture=J[ne].texture}return H}function qe(N,T,H){let ee=n.TEXTURE_2D;(T.isDataArrayTexture||T.isCompressedArrayTexture)&&(ee=n.TEXTURE_2D_ARRAY),T.isData3DTexture&&(ee=n.TEXTURE_3D);const J=Ae(N,T),ne=T.source;t.bindTexture(ee,N.__webglTexture,n.TEXTURE0+H);const Le=i.get(ne);if(ne.version!==Le.__version||J===!0){t.activeTexture(n.TEXTURE0+H);const pe=rt.getPrimaries(rt.workingColorSpace),Me=T.colorSpace===Fi?null:rt.getPrimaries(T.colorSpace),We=T.colorSpace===Fi||pe===Me?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,T.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,T.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,T.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,We);let ae=x(T.image,!1,r.maxTextureSize);ae=me(T,ae);const Se=s.convert(T.format,T.colorSpace),Je=s.convert(T.type);let Ve=v(T.internalFormat,Se,Je,T.colorSpace,T.isVideoTexture);se(ee,T);let Te;const Ge=T.mipmaps,Ze=T.isVideoTexture!==!0,vt=Le.__version===void 0||J===!0,k=ne.dataReady,ce=_(T,ae);if(T.isDepthTexture)Ve=y(T.format===ws,T.type),vt&&(Ze?t.texStorage2D(n.TEXTURE_2D,1,Ve,ae.width,ae.height):t.texImage2D(n.TEXTURE_2D,0,Ve,ae.width,ae.height,0,Se,Je,null));else if(T.isDataTexture)if(Ge.length>0){Ze&&vt&&t.texStorage2D(n.TEXTURE_2D,ce,Ve,Ge[0].width,Ge[0].height);for(let q=0,te=Ge.length;q<te;q++)Te=Ge[q],Ze?k&&t.texSubImage2D(n.TEXTURE_2D,q,0,0,Te.width,Te.height,Se,Je,Te.data):t.texImage2D(n.TEXTURE_2D,q,Ve,Te.width,Te.height,0,Se,Je,Te.data);T.generateMipmaps=!1}else Ze?(vt&&t.texStorage2D(n.TEXTURE_2D,ce,Ve,ae.width,ae.height),k&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,ae.width,ae.height,Se,Je,ae.data)):t.texImage2D(n.TEXTURE_2D,0,Ve,ae.width,ae.height,0,Se,Je,ae.data);else if(T.isCompressedTexture)if(T.isCompressedArrayTexture){Ze&&vt&&t.texStorage3D(n.TEXTURE_2D_ARRAY,ce,Ve,Ge[0].width,Ge[0].height,ae.depth);for(let q=0,te=Ge.length;q<te;q++)if(Te=Ge[q],T.format!==dn)if(Se!==null)if(Ze){if(k)if(T.layerUpdates.size>0){const he=Op(Te.width,Te.height,T.format,T.type);for(const Oe of T.layerUpdates){const Qe=Te.data.subarray(Oe*he/Te.data.BYTES_PER_ELEMENT,(Oe+1)*he/Te.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,q,0,0,Oe,Te.width,Te.height,1,Se,Qe,0,0)}T.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,q,0,0,0,Te.width,Te.height,ae.depth,Se,Te.data,0,0)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,q,Ve,Te.width,Te.height,ae.depth,0,Te.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ze?k&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,q,0,0,0,Te.width,Te.height,ae.depth,Se,Je,Te.data):t.texImage3D(n.TEXTURE_2D_ARRAY,q,Ve,Te.width,Te.height,ae.depth,0,Se,Je,Te.data)}else{Ze&&vt&&t.texStorage2D(n.TEXTURE_2D,ce,Ve,Ge[0].width,Ge[0].height);for(let q=0,te=Ge.length;q<te;q++)Te=Ge[q],T.format!==dn?Se!==null?Ze?k&&t.compressedTexSubImage2D(n.TEXTURE_2D,q,0,0,Te.width,Te.height,Se,Te.data):t.compressedTexImage2D(n.TEXTURE_2D,q,Ve,Te.width,Te.height,0,Te.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ze?k&&t.texSubImage2D(n.TEXTURE_2D,q,0,0,Te.width,Te.height,Se,Je,Te.data):t.texImage2D(n.TEXTURE_2D,q,Ve,Te.width,Te.height,0,Se,Je,Te.data)}else if(T.isDataArrayTexture)if(Ze){if(vt&&t.texStorage3D(n.TEXTURE_2D_ARRAY,ce,Ve,ae.width,ae.height,ae.depth),k)if(T.layerUpdates.size>0){const q=Op(ae.width,ae.height,T.format,T.type);for(const te of T.layerUpdates){const he=ae.data.subarray(te*q/ae.data.BYTES_PER_ELEMENT,(te+1)*q/ae.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,te,ae.width,ae.height,1,Se,Je,he)}T.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,ae.width,ae.height,ae.depth,Se,Je,ae.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,Ve,ae.width,ae.height,ae.depth,0,Se,Je,ae.data);else if(T.isData3DTexture)Ze?(vt&&t.texStorage3D(n.TEXTURE_3D,ce,Ve,ae.width,ae.height,ae.depth),k&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,ae.width,ae.height,ae.depth,Se,Je,ae.data)):t.texImage3D(n.TEXTURE_3D,0,Ve,ae.width,ae.height,ae.depth,0,Se,Je,ae.data);else if(T.isFramebufferTexture){if(vt)if(Ze)t.texStorage2D(n.TEXTURE_2D,ce,Ve,ae.width,ae.height);else{let q=ae.width,te=ae.height;for(let he=0;he<ce;he++)t.texImage2D(n.TEXTURE_2D,he,Ve,q,te,0,Se,Je,null),q>>=1,te>>=1}}else if(Ge.length>0){if(Ze&&vt){const q=be(Ge[0]);t.texStorage2D(n.TEXTURE_2D,ce,Ve,q.width,q.height)}for(let q=0,te=Ge.length;q<te;q++)Te=Ge[q],Ze?k&&t.texSubImage2D(n.TEXTURE_2D,q,0,0,Se,Je,Te):t.texImage2D(n.TEXTURE_2D,q,Ve,Se,Je,Te);T.generateMipmaps=!1}else if(Ze){if(vt){const q=be(ae);t.texStorage2D(n.TEXTURE_2D,ce,Ve,q.width,q.height)}k&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,Se,Je,ae)}else t.texImage2D(n.TEXTURE_2D,0,Ve,Se,Je,ae);g(T)&&f(ee),Le.__version=ne.version,T.onUpdate&&T.onUpdate(T)}N.__version=T.version}function X(N,T,H){if(T.image.length!==6)return;const ee=Ae(N,T),J=T.source;t.bindTexture(n.TEXTURE_CUBE_MAP,N.__webglTexture,n.TEXTURE0+H);const ne=i.get(J);if(J.version!==ne.__version||ee===!0){t.activeTexture(n.TEXTURE0+H);const Le=rt.getPrimaries(rt.workingColorSpace),pe=T.colorSpace===Fi?null:rt.getPrimaries(T.colorSpace),Me=T.colorSpace===Fi||Le===pe?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,T.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,T.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,T.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Me);const We=T.isCompressedTexture||T.image[0].isCompressedTexture,ae=T.image[0]&&T.image[0].isDataTexture,Se=[];for(let te=0;te<6;te++)!We&&!ae?Se[te]=x(T.image[te],!0,r.maxCubemapSize):Se[te]=ae?T.image[te].image:T.image[te],Se[te]=me(T,Se[te]);const Je=Se[0],Ve=s.convert(T.format,T.colorSpace),Te=s.convert(T.type),Ge=v(T.internalFormat,Ve,Te,T.colorSpace),Ze=T.isVideoTexture!==!0,vt=ne.__version===void 0||ee===!0,k=J.dataReady;let ce=_(T,Je);se(n.TEXTURE_CUBE_MAP,T);let q;if(We){Ze&&vt&&t.texStorage2D(n.TEXTURE_CUBE_MAP,ce,Ge,Je.width,Je.height);for(let te=0;te<6;te++){q=Se[te].mipmaps;for(let he=0;he<q.length;he++){const Oe=q[he];T.format!==dn?Ve!==null?Ze?k&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+te,he,0,0,Oe.width,Oe.height,Ve,Oe.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+te,he,Ge,Oe.width,Oe.height,0,Oe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ze?k&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+te,he,0,0,Oe.width,Oe.height,Ve,Te,Oe.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+te,he,Ge,Oe.width,Oe.height,0,Ve,Te,Oe.data)}}}else{if(q=T.mipmaps,Ze&&vt){q.length>0&&ce++;const te=be(Se[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,ce,Ge,te.width,te.height)}for(let te=0;te<6;te++)if(ae){Ze?k&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,0,0,Se[te].width,Se[te].height,Ve,Te,Se[te].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,Ge,Se[te].width,Se[te].height,0,Ve,Te,Se[te].data);for(let he=0;he<q.length;he++){const Qe=q[he].image[te].image;Ze?k&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+te,he+1,0,0,Qe.width,Qe.height,Ve,Te,Qe.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+te,he+1,Ge,Qe.width,Qe.height,0,Ve,Te,Qe.data)}}else{Ze?k&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,0,0,Ve,Te,Se[te]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,Ge,Ve,Te,Se[te]);for(let he=0;he<q.length;he++){const Oe=q[he];Ze?k&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+te,he+1,0,0,Ve,Te,Oe.image[te]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+te,he+1,Ge,Ve,Te,Oe.image[te])}}}g(T)&&f(n.TEXTURE_CUBE_MAP),ne.__version=J.version,T.onUpdate&&T.onUpdate(T)}N.__version=T.version}function oe(N,T,H,ee,J,ne){const Le=s.convert(H.format,H.colorSpace),pe=s.convert(H.type),Me=v(H.internalFormat,Le,pe,H.colorSpace);if(!i.get(T).__hasExternalTextures){const ae=Math.max(1,T.width>>ne),Se=Math.max(1,T.height>>ne);J===n.TEXTURE_3D||J===n.TEXTURE_2D_ARRAY?t.texImage3D(J,ne,Me,ae,Se,T.depth,0,Le,pe,null):t.texImage2D(J,ne,Me,ae,Se,0,Le,pe,null)}t.bindFramebuffer(n.FRAMEBUFFER,N),Y(T)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,ee,J,i.get(H).__webglTexture,0,xe(T)):(J===n.TEXTURE_2D||J>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&J<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,ee,J,i.get(H).__webglTexture,ne),t.bindFramebuffer(n.FRAMEBUFFER,null)}function ve(N,T,H){if(n.bindRenderbuffer(n.RENDERBUFFER,N),T.depthBuffer){const ee=T.depthTexture,J=ee&&ee.isDepthTexture?ee.type:null,ne=y(T.stencilBuffer,J),Le=T.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,pe=xe(T);Y(T)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,pe,ne,T.width,T.height):H?n.renderbufferStorageMultisample(n.RENDERBUFFER,pe,ne,T.width,T.height):n.renderbufferStorage(n.RENDERBUFFER,ne,T.width,T.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,Le,n.RENDERBUFFER,N)}else{const ee=T.textures;for(let J=0;J<ee.length;J++){const ne=ee[J],Le=s.convert(ne.format,ne.colorSpace),pe=s.convert(ne.type),Me=v(ne.internalFormat,Le,pe,ne.colorSpace),We=xe(T);H&&Y(T)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,We,Me,T.width,T.height):Y(T)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,We,Me,T.width,T.height):n.renderbufferStorage(n.RENDERBUFFER,Me,T.width,T.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function de(N,T){if(T&&T.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(n.FRAMEBUFFER,N),!(T.depthTexture&&T.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(T.depthTexture).__webglTexture||T.depthTexture.image.width!==T.width||T.depthTexture.image.height!==T.height)&&(T.depthTexture.image.width=T.width,T.depthTexture.image.height=T.height,T.depthTexture.needsUpdate=!0),j(T.depthTexture,0);const ee=i.get(T.depthTexture).__webglTexture,J=xe(T);if(T.depthTexture.format===ps)Y(T)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,ee,0,J):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,ee,0);else if(T.depthTexture.format===ws)Y(T)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,ee,0,J):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,ee,0);else throw new Error("Unknown depthTexture format")}function De(N){const T=i.get(N),H=N.isWebGLCubeRenderTarget===!0;if(T.__boundDepthTexture!==N.depthTexture){const ee=N.depthTexture;if(T.__depthDisposeCallback&&T.__depthDisposeCallback(),ee){const J=()=>{delete T.__boundDepthTexture,delete T.__depthDisposeCallback,ee.removeEventListener("dispose",J)};ee.addEventListener("dispose",J),T.__depthDisposeCallback=J}T.__boundDepthTexture=ee}if(N.depthTexture&&!T.__autoAllocateDepthBuffer){if(H)throw new Error("target.depthTexture not supported in Cube render targets");de(T.__webglFramebuffer,N)}else if(H){T.__webglDepthbuffer=[];for(let ee=0;ee<6;ee++)if(t.bindFramebuffer(n.FRAMEBUFFER,T.__webglFramebuffer[ee]),T.__webglDepthbuffer[ee]===void 0)T.__webglDepthbuffer[ee]=n.createRenderbuffer(),ve(T.__webglDepthbuffer[ee],N,!1);else{const J=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ne=T.__webglDepthbuffer[ee];n.bindRenderbuffer(n.RENDERBUFFER,ne),n.framebufferRenderbuffer(n.FRAMEBUFFER,J,n.RENDERBUFFER,ne)}}else if(t.bindFramebuffer(n.FRAMEBUFFER,T.__webglFramebuffer),T.__webglDepthbuffer===void 0)T.__webglDepthbuffer=n.createRenderbuffer(),ve(T.__webglDepthbuffer,N,!1);else{const ee=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,J=T.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,J),n.framebufferRenderbuffer(n.FRAMEBUFFER,ee,n.RENDERBUFFER,J)}t.bindFramebuffer(n.FRAMEBUFFER,null)}function He(N,T,H){const ee=i.get(N);T!==void 0&&oe(ee.__webglFramebuffer,N,N.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),H!==void 0&&De(N)}function Be(N){const T=N.texture,H=i.get(N),ee=i.get(T);N.addEventListener("dispose",w);const J=N.textures,ne=N.isWebGLCubeRenderTarget===!0,Le=J.length>1;if(Le||(ee.__webglTexture===void 0&&(ee.__webglTexture=n.createTexture()),ee.__version=T.version,o.memory.textures++),ne){H.__webglFramebuffer=[];for(let pe=0;pe<6;pe++)if(T.mipmaps&&T.mipmaps.length>0){H.__webglFramebuffer[pe]=[];for(let Me=0;Me<T.mipmaps.length;Me++)H.__webglFramebuffer[pe][Me]=n.createFramebuffer()}else H.__webglFramebuffer[pe]=n.createFramebuffer()}else{if(T.mipmaps&&T.mipmaps.length>0){H.__webglFramebuffer=[];for(let pe=0;pe<T.mipmaps.length;pe++)H.__webglFramebuffer[pe]=n.createFramebuffer()}else H.__webglFramebuffer=n.createFramebuffer();if(Le)for(let pe=0,Me=J.length;pe<Me;pe++){const We=i.get(J[pe]);We.__webglTexture===void 0&&(We.__webglTexture=n.createTexture(),o.memory.textures++)}if(N.samples>0&&Y(N)===!1){H.__webglMultisampledFramebuffer=n.createFramebuffer(),H.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,H.__webglMultisampledFramebuffer);for(let pe=0;pe<J.length;pe++){const Me=J[pe];H.__webglColorRenderbuffer[pe]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,H.__webglColorRenderbuffer[pe]);const We=s.convert(Me.format,Me.colorSpace),ae=s.convert(Me.type),Se=v(Me.internalFormat,We,ae,Me.colorSpace,N.isXRRenderTarget===!0),Je=xe(N);n.renderbufferStorageMultisample(n.RENDERBUFFER,Je,Se,N.width,N.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+pe,n.RENDERBUFFER,H.__webglColorRenderbuffer[pe])}n.bindRenderbuffer(n.RENDERBUFFER,null),N.depthBuffer&&(H.__webglDepthRenderbuffer=n.createRenderbuffer(),ve(H.__webglDepthRenderbuffer,N,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(ne){t.bindTexture(n.TEXTURE_CUBE_MAP,ee.__webglTexture),se(n.TEXTURE_CUBE_MAP,T);for(let pe=0;pe<6;pe++)if(T.mipmaps&&T.mipmaps.length>0)for(let Me=0;Me<T.mipmaps.length;Me++)oe(H.__webglFramebuffer[pe][Me],N,T,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Me);else oe(H.__webglFramebuffer[pe],N,T,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0);g(T)&&f(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Le){for(let pe=0,Me=J.length;pe<Me;pe++){const We=J[pe],ae=i.get(We);t.bindTexture(n.TEXTURE_2D,ae.__webglTexture),se(n.TEXTURE_2D,We),oe(H.__webglFramebuffer,N,We,n.COLOR_ATTACHMENT0+pe,n.TEXTURE_2D,0),g(We)&&f(n.TEXTURE_2D)}t.unbindTexture()}else{let pe=n.TEXTURE_2D;if((N.isWebGL3DRenderTarget||N.isWebGLArrayRenderTarget)&&(pe=N.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(pe,ee.__webglTexture),se(pe,T),T.mipmaps&&T.mipmaps.length>0)for(let Me=0;Me<T.mipmaps.length;Me++)oe(H.__webglFramebuffer[Me],N,T,n.COLOR_ATTACHMENT0,pe,Me);else oe(H.__webglFramebuffer,N,T,n.COLOR_ATTACHMENT0,pe,0);g(T)&&f(pe),t.unbindTexture()}N.depthBuffer&&De(N)}function it(N){const T=N.textures;for(let H=0,ee=T.length;H<ee;H++){const J=T[H];if(g(J)){const ne=N.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:n.TEXTURE_2D,Le=i.get(J).__webglTexture;t.bindTexture(ne,Le),f(ne),t.unbindTexture()}}}const P=[],le=[];function ie(N){if(N.samples>0){if(Y(N)===!1){const T=N.textures,H=N.width,ee=N.height;let J=n.COLOR_BUFFER_BIT;const ne=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Le=i.get(N),pe=T.length>1;if(pe)for(let Me=0;Me<T.length;Me++)t.bindFramebuffer(n.FRAMEBUFFER,Le.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Me,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,Le.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Me,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,Le.__webglMultisampledFramebuffer),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Le.__webglFramebuffer);for(let Me=0;Me<T.length;Me++){if(N.resolveDepthBuffer&&(N.depthBuffer&&(J|=n.DEPTH_BUFFER_BIT),N.stencilBuffer&&N.resolveStencilBuffer&&(J|=n.STENCIL_BUFFER_BIT)),pe){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,Le.__webglColorRenderbuffer[Me]);const We=i.get(T[Me]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,We,0)}n.blitFramebuffer(0,0,H,ee,0,0,H,ee,J,n.NEAREST),l===!0&&(P.length=0,le.length=0,P.push(n.COLOR_ATTACHMENT0+Me),N.depthBuffer&&N.resolveDepthBuffer===!1&&(P.push(ne),le.push(ne),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,le)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,P))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),pe)for(let Me=0;Me<T.length;Me++){t.bindFramebuffer(n.FRAMEBUFFER,Le.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Me,n.RENDERBUFFER,Le.__webglColorRenderbuffer[Me]);const We=i.get(T[Me]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,Le.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Me,n.TEXTURE_2D,We,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Le.__webglMultisampledFramebuffer)}else if(N.depthBuffer&&N.resolveDepthBuffer===!1&&l){const T=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[T])}}}function xe(N){return Math.min(r.maxSamples,N.samples)}function Y(N){const T=i.get(N);return N.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&T.__useRenderToTexture!==!1}function Ue(N){const T=o.render.frame;u.get(N)!==T&&(u.set(N,T),N.update())}function me(N,T){const H=N.colorSpace,ee=N.format,J=N.type;return N.isCompressedTexture===!0||N.isVideoTexture===!0||H!==tr&&H!==Fi&&(rt.getTransfer(H)===ft?(ee!==dn||J!==Ei)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",H)),T}function be(N){return typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement?(c.width=N.naturalWidth||N.width,c.height=N.naturalHeight||N.height):typeof VideoFrame<"u"&&N instanceof VideoFrame?(c.width=N.displayWidth,c.height=N.displayHeight):(c.width=N.width,c.height=N.height),c}this.allocateTextureUnit=G,this.resetTextureUnits=L,this.setTexture2D=j,this.setTexture2DArray=U,this.setTexture3D=z,this.setTextureCube=Z,this.rebindTextures=He,this.setupRenderTarget=Be,this.updateRenderTargetMipmap=it,this.updateMultisampleRenderTarget=ie,this.setupDepthRenderbuffer=De,this.setupFrameBufferTexture=oe,this.useMultisampledRTT=Y}function vM(n,e){function t(i,r=Fi){let s;const o=rt.getTransfer(r);if(i===Ei)return n.UNSIGNED_BYTE;if(i===Nd)return n.UNSIGNED_SHORT_4_4_4_4;if(i===Ld)return n.UNSIGNED_SHORT_5_5_5_1;if(i===jm)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===Gm)return n.BYTE;if(i===Wm)return n.SHORT;if(i===Do)return n.UNSIGNED_SHORT;if(i===Id)return n.INT;if(i===Ji)return n.UNSIGNED_INT;if(i===Sn)return n.FLOAT;if(i===Ho)return n.HALF_FLOAT;if(i===Xm)return n.ALPHA;if(i===$m)return n.RGB;if(i===dn)return n.RGBA;if(i===Ym)return n.LUMINANCE;if(i===qm)return n.LUMINANCE_ALPHA;if(i===ps)return n.DEPTH_COMPONENT;if(i===ws)return n.DEPTH_STENCIL;if(i===Dd)return n.RED;if(i===Pl)return n.RED_INTEGER;if(i===Zm)return n.RG;if(i===Ud)return n.RG_INTEGER;if(i===kd)return n.RGBA_INTEGER;if(i===Ia||i===Na||i===La||i===Da)if(o===ft)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===Ia)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Na)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===La)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Da)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===Ia)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Na)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===La)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Da)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===ku||i===Ou||i===Fu||i===Bu)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===ku)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===Ou)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Fu)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Bu)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===zu||i===Vu||i===Hu)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===zu||i===Vu)return o===ft?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===Hu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===Gu||i===Wu||i===ju||i===Xu||i===$u||i===Yu||i===qu||i===Zu||i===Ku||i===Ju||i===Qu||i===ed||i===td||i===nd)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===Gu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===Wu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===ju)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===Xu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===$u)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Yu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===qu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===Zu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Ku)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Ju)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Qu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===ed)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===td)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===nd)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Ua||i===id||i===rd)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===Ua)return o===ft?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===id)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===rd)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===Km||i===sd||i===od||i===ad)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===Ua)return s.COMPRESSED_RED_RGTC1_EXT;if(i===sd)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===od)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===ad)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===Ms?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}class yM extends Yt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class go extends nt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const hI={type:"move"};class yf{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new go,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 go,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new I,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new I),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new go,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new I,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new I),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const x of e.hand.values()){const g=t.getJointPose(x,i),f=this._getHandJoint(c,x);g!==null&&(f.matrix.fromArray(g.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=g.radius),f.visible=g!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],d=u.position.distanceTo(h.position),p=.02,m=.005;c.inputState.pinching&&d>p+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=p-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),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&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(hI)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new go;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const fI=`
3875
3875
  void main() {
3876
3876
 
3877
3877
  gl_Position = vec4( position, 1.0 );
@@ -3895,6 +3895,6 @@ void main() {
3895
3895
 
3896
3896
  }
3897
3897
 
3898
- }`;class mI{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){const r=new Ct,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new ci({vertexShader:fI,fragmentShader:pI,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new kt(new Wo(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class gI extends Ti{constructor(e,t){super();const i=this;let r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,h=null,d=null,p=null,m=null;const x=new mI,g=t.getContextAttributes();let f=null,v=null;const y=[],_=[],C=new Q;let w=null;const E=new Yt;E.layers.enable(1),E.viewport=new ct;const A=new Yt;A.layers.enable(2),A.viewport=new ct;const b=[E,A],M=new yM;M.layers.enable(1),M.layers.enable(2);let L=null,G=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(X){let oe=y[X];return oe===void 0&&(oe=new yf,y[X]=oe),oe.getTargetRaySpace()},this.getControllerGrip=function(X){let oe=y[X];return oe===void 0&&(oe=new yf,y[X]=oe),oe.getGripSpace()},this.getHand=function(X){let oe=y[X];return oe===void 0&&(oe=new yf,y[X]=oe),oe.getHandSpace()};function B(X){const oe=_.indexOf(X.inputSource);if(oe===-1)return;const ve=y[oe];ve!==void 0&&(ve.update(X.inputSource,X.frame,c||o),ve.dispatchEvent({type:X.type,data:X.inputSource}))}function j(){r.removeEventListener("select",B),r.removeEventListener("selectstart",B),r.removeEventListener("selectend",B),r.removeEventListener("squeeze",B),r.removeEventListener("squeezestart",B),r.removeEventListener("squeezeend",B),r.removeEventListener("end",j),r.removeEventListener("inputsourceschange",U);for(let X=0;X<y.length;X++){const oe=_[X];oe!==null&&(_[X]=null,y[X].disconnect(oe))}L=null,G=null,x.reset(),e.setRenderTarget(f),p=null,d=null,h=null,r=null,v=null,qe.stop(),i.isPresenting=!1,e.setPixelRatio(w),e.setSize(C.width,C.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(X){s=X,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(X){a=X,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(X){c=X},this.getBaseLayer=function(){return d!==null?d:p},this.getBinding=function(){return h},this.getFrame=function(){return m},this.getSession=function(){return r},this.setSession=async function(X){if(r=X,r!==null){if(f=e.getRenderTarget(),r.addEventListener("select",B),r.addEventListener("selectstart",B),r.addEventListener("selectend",B),r.addEventListener("squeeze",B),r.addEventListener("squeezestart",B),r.addEventListener("squeezeend",B),r.addEventListener("end",j),r.addEventListener("inputsourceschange",U),g.xrCompatible!==!0&&await t.makeXRCompatible(),w=e.getPixelRatio(),e.getSize(C),r.renderState.layers===void 0){const oe={antialias:g.antialias,alpha:!0,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(r,t,oe),r.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),v=new li(p.framebufferWidth,p.framebufferHeight,{format:dn,type:Ei,colorSpace:e.outputColorSpace,stencilBuffer:g.stencil})}else{let oe=null,ve=null,de=null;g.depth&&(de=g.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,oe=g.stencil?ws:ps,ve=g.stencil?Ms:Ji);const De={colorFormat:t.RGBA8,depthFormat:de,scaleFactor:s};h=new XRWebGLBinding(r,t),d=h.createProjectionLayer(De),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),v=new li(d.textureWidth,d.textureHeight,{format:dn,type:Ei,depthTexture:new rg(d.textureWidth,d.textureHeight,ve,void 0,void 0,void 0,void 0,void 0,void 0,oe),stencilBuffer:g.stencil,colorSpace:e.outputColorSpace,samples:g.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1})}v.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await r.requestReferenceSpace(a),qe.setContext(r),qe.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return x.getDepthTexture()};function U(X){for(let oe=0;oe<X.removed.length;oe++){const ve=X.removed[oe],de=_.indexOf(ve);de>=0&&(_[de]=null,y[de].disconnect(ve))}for(let oe=0;oe<X.added.length;oe++){const ve=X.added[oe];let de=_.indexOf(ve);if(de===-1){for(let He=0;He<y.length;He++)if(He>=_.length){_.push(ve),de=He;break}else if(_[He]===null){_[He]=ve,de=He;break}if(de===-1)break}const De=y[de];De&&De.connect(ve)}}const z=new I,Z=new I;function D(X,oe,ve){z.setFromMatrixPosition(oe.matrixWorld),Z.setFromMatrixPosition(ve.matrixWorld);const de=z.distanceTo(Z),De=oe.projectionMatrix.elements,He=ve.projectionMatrix.elements,Be=De[14]/(De[10]-1),it=De[14]/(De[10]+1),P=(De[9]+1)/De[5],le=(De[9]-1)/De[5],ie=(De[8]-1)/De[0],ge=(He[8]+1)/He[0],Y=Be*ie,Ue=Be*ge,me=de/(-ie+ge),be=me*-ie;if(oe.matrixWorld.decompose(X.position,X.quaternion,X.scale),X.translateX(be),X.translateZ(me),X.matrixWorld.compose(X.position,X.quaternion,X.scale),X.matrixWorldInverse.copy(X.matrixWorld).invert(),De[10]===-1)X.projectionMatrix.copy(oe.projectionMatrix),X.projectionMatrixInverse.copy(oe.projectionMatrixInverse);else{const N=Be+me,T=it+me,H=Y-be,ee=Ue+(de-be),J=P*it/T*N,ne=le*it/T*N;X.projectionMatrix.makePerspective(H,ee,J,ne,N,T),X.projectionMatrixInverse.copy(X.projectionMatrix).invert()}}function $(X,oe){oe===null?X.matrixWorld.copy(X.matrix):X.matrixWorld.multiplyMatrices(oe.matrixWorld,X.matrix),X.matrixWorldInverse.copy(X.matrixWorld).invert()}this.updateCamera=function(X){if(r===null)return;let oe=X.near,ve=X.far;x.texture!==null&&(x.depthNear>0&&(oe=x.depthNear),x.depthFar>0&&(ve=x.depthFar)),M.near=A.near=E.near=oe,M.far=A.far=E.far=ve,(L!==M.near||G!==M.far)&&(r.updateRenderState({depthNear:M.near,depthFar:M.far}),L=M.near,G=M.far);const de=X.parent,De=M.cameras;$(M,de);for(let He=0;He<De.length;He++)$(De[He],de);De.length===2?D(M,E,A):M.projectionMatrix.copy(E.projectionMatrix),K(X,M,de)};function K(X,oe,ve){ve===null?X.matrix.copy(oe.matrixWorld):(X.matrix.copy(ve.matrixWorld),X.matrix.invert(),X.matrix.multiply(oe.matrixWorld)),X.matrix.decompose(X.position,X.quaternion,X.scale),X.updateMatrixWorld(!0),X.projectionMatrix.copy(oe.projectionMatrix),X.projectionMatrixInverse.copy(oe.projectionMatrixInverse),X.isPerspectiveCamera&&(X.fov=Uo*2*Math.atan(1/X.projectionMatrix.elements[5]),X.zoom=1)}this.getCamera=function(){return M},this.getFoveation=function(){if(!(d===null&&p===null))return l},this.setFoveation=function(X){l=X,d!==null&&(d.fixedFoveation=X),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=X)},this.hasDepthSensing=function(){return x.texture!==null},this.getDepthSensingMesh=function(){return x.getMesh(M)};let se=null;function Te(X,oe){if(u=oe.getViewerPose(c||o),m=oe,u!==null){const ve=u.views;p!==null&&(e.setRenderTargetFramebuffer(v,p.framebuffer),e.setRenderTarget(v));let de=!1;ve.length!==M.cameras.length&&(M.cameras.length=0,de=!0);for(let He=0;He<ve.length;He++){const Be=ve[He];let it=null;if(p!==null)it=p.getViewport(Be);else{const le=h.getViewSubImage(d,Be);it=le.viewport,He===0&&(e.setRenderTargetTextures(v,le.colorTexture,d.ignoreDepthValues?void 0:le.depthStencilTexture),e.setRenderTarget(v))}let P=b[He];P===void 0&&(P=new Yt,P.layers.enable(He),P.viewport=new ct,b[He]=P),P.matrix.fromArray(Be.transform.matrix),P.matrix.decompose(P.position,P.quaternion,P.scale),P.projectionMatrix.fromArray(Be.projectionMatrix),P.projectionMatrixInverse.copy(P.projectionMatrix).invert(),P.viewport.set(it.x,it.y,it.width,it.height),He===0&&(M.matrix.copy(P.matrix),M.matrix.decompose(M.position,M.quaternion,M.scale)),de===!0&&M.cameras.push(P)}const De=r.enabledFeatures;if(De&&De.includes("depth-sensing")){const He=h.getDepthInformation(ve[0]);He&&He.isValid&&He.texture&&x.init(e,He,r.renderState)}}for(let ve=0;ve<y.length;ve++){const de=_[ve],De=y[ve];de!==null&&De!==void 0&&De.update(de,oe,c||o)}se&&se(X,oe),oe.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:oe}),m=null}const qe=new fM;qe.setAnimationLoop(Te),this.setAnimationLoop=function(X){se=X},this.dispose=function(){}}}const Xr=new On,xI=new ke;function vI(n,e){function t(g,f){g.matrixAutoUpdate===!0&&g.updateMatrix(),f.value.copy(g.matrix)}function i(g,f){f.color.getRGB(g.fogColor.value,cM(n)),f.isFog?(g.fogNear.value=f.near,g.fogFar.value=f.far):f.isFogExp2&&(g.fogDensity.value=f.density)}function r(g,f,v,y,_){f.isMeshBasicMaterial||f.isMeshLambertMaterial?s(g,f):f.isMeshToonMaterial?(s(g,f),h(g,f)):f.isMeshPhongMaterial?(s(g,f),u(g,f)):f.isMeshStandardMaterial?(s(g,f),d(g,f),f.isMeshPhysicalMaterial&&p(g,f,_)):f.isMeshMatcapMaterial?(s(g,f),m(g,f)):f.isMeshDepthMaterial?s(g,f):f.isMeshDistanceMaterial?(s(g,f),x(g,f)):f.isMeshNormalMaterial?s(g,f):f.isLineBasicMaterial?(o(g,f),f.isLineDashedMaterial&&a(g,f)):f.isPointsMaterial?l(g,f,v,y):f.isSpriteMaterial?c(g,f):f.isShadowMaterial?(g.color.value.copy(f.color),g.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function s(g,f){g.opacity.value=f.opacity,f.color&&g.diffuse.value.copy(f.color),f.emissive&&g.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(g.map.value=f.map,t(f.map,g.mapTransform)),f.alphaMap&&(g.alphaMap.value=f.alphaMap,t(f.alphaMap,g.alphaMapTransform)),f.bumpMap&&(g.bumpMap.value=f.bumpMap,t(f.bumpMap,g.bumpMapTransform),g.bumpScale.value=f.bumpScale,f.side===fn&&(g.bumpScale.value*=-1)),f.normalMap&&(g.normalMap.value=f.normalMap,t(f.normalMap,g.normalMapTransform),g.normalScale.value.copy(f.normalScale),f.side===fn&&g.normalScale.value.negate()),f.displacementMap&&(g.displacementMap.value=f.displacementMap,t(f.displacementMap,g.displacementMapTransform),g.displacementScale.value=f.displacementScale,g.displacementBias.value=f.displacementBias),f.emissiveMap&&(g.emissiveMap.value=f.emissiveMap,t(f.emissiveMap,g.emissiveMapTransform)),f.specularMap&&(g.specularMap.value=f.specularMap,t(f.specularMap,g.specularMapTransform)),f.alphaTest>0&&(g.alphaTest.value=f.alphaTest);const v=e.get(f),y=v.envMap,_=v.envMapRotation;y&&(g.envMap.value=y,Xr.copy(_),Xr.x*=-1,Xr.y*=-1,Xr.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(Xr.y*=-1,Xr.z*=-1),g.envMapRotation.value.setFromMatrix4(xI.makeRotationFromEuler(Xr)),g.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=f.reflectivity,g.ior.value=f.ior,g.refractionRatio.value=f.refractionRatio),f.lightMap&&(g.lightMap.value=f.lightMap,g.lightMapIntensity.value=f.lightMapIntensity,t(f.lightMap,g.lightMapTransform)),f.aoMap&&(g.aoMap.value=f.aoMap,g.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,g.aoMapTransform))}function o(g,f){g.diffuse.value.copy(f.color),g.opacity.value=f.opacity,f.map&&(g.map.value=f.map,t(f.map,g.mapTransform))}function a(g,f){g.dashSize.value=f.dashSize,g.totalSize.value=f.dashSize+f.gapSize,g.scale.value=f.scale}function l(g,f,v,y){g.diffuse.value.copy(f.color),g.opacity.value=f.opacity,g.size.value=f.size*v,g.scale.value=y*.5,f.map&&(g.map.value=f.map,t(f.map,g.uvTransform)),f.alphaMap&&(g.alphaMap.value=f.alphaMap,t(f.alphaMap,g.alphaMapTransform)),f.alphaTest>0&&(g.alphaTest.value=f.alphaTest)}function c(g,f){g.diffuse.value.copy(f.color),g.opacity.value=f.opacity,g.rotation.value=f.rotation,f.map&&(g.map.value=f.map,t(f.map,g.mapTransform)),f.alphaMap&&(g.alphaMap.value=f.alphaMap,t(f.alphaMap,g.alphaMapTransform)),f.alphaTest>0&&(g.alphaTest.value=f.alphaTest)}function u(g,f){g.specular.value.copy(f.specular),g.shininess.value=Math.max(f.shininess,1e-4)}function h(g,f){f.gradientMap&&(g.gradientMap.value=f.gradientMap)}function d(g,f){g.metalness.value=f.metalness,f.metalnessMap&&(g.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,g.metalnessMapTransform)),g.roughness.value=f.roughness,f.roughnessMap&&(g.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,g.roughnessMapTransform)),f.envMap&&(g.envMapIntensity.value=f.envMapIntensity)}function p(g,f,v){g.ior.value=f.ior,f.sheen>0&&(g.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),g.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(g.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,g.sheenColorMapTransform)),f.sheenRoughnessMap&&(g.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,g.sheenRoughnessMapTransform))),f.clearcoat>0&&(g.clearcoat.value=f.clearcoat,g.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(g.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,g.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(g.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===fn&&g.clearcoatNormalScale.value.negate())),f.dispersion>0&&(g.dispersion.value=f.dispersion),f.iridescence>0&&(g.iridescence.value=f.iridescence,g.iridescenceIOR.value=f.iridescenceIOR,g.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(g.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,g.iridescenceMapTransform)),f.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),f.transmission>0&&(g.transmission.value=f.transmission,g.transmissionSamplerMap.value=v.texture,g.transmissionSamplerSize.value.set(v.width,v.height),f.transmissionMap&&(g.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,g.transmissionMapTransform)),g.thickness.value=f.thickness,f.thicknessMap&&(g.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=f.attenuationDistance,g.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(g.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(g.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=f.specularIntensity,g.specularColor.value.copy(f.specularColor),f.specularColorMap&&(g.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,g.specularColorMapTransform)),f.specularIntensityMap&&(g.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,g.specularIntensityMapTransform))}function m(g,f){f.matcap&&(g.matcap.value=f.matcap)}function x(g,f){const v=e.get(f).light;g.referencePosition.value.setFromMatrixPosition(v.matrixWorld),g.nearDistance.value=v.shadow.camera.near,g.farDistance.value=v.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function yI(n,e,t,i){let r={},s={},o=[];const a=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(v,y){const _=y.program;i.uniformBlockBinding(v,_)}function c(v,y){let _=r[v.id];_===void 0&&(m(v),_=u(v),r[v.id]=_,v.addEventListener("dispose",g));const C=y.program;i.updateUBOMapping(v,C);const w=e.render.frame;s[v.id]!==w&&(d(v),s[v.id]=w)}function u(v){const y=h();v.__bindingPointIndex=y;const _=n.createBuffer(),C=v.__size,w=v.usage;return n.bindBuffer(n.UNIFORM_BUFFER,_),n.bufferData(n.UNIFORM_BUFFER,C,w),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,y,_),_}function h(){for(let v=0;v<a;v++)if(o.indexOf(v)===-1)return o.push(v),v;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(v){const y=r[v.id],_=v.uniforms,C=v.__cache;n.bindBuffer(n.UNIFORM_BUFFER,y);for(let w=0,E=_.length;w<E;w++){const A=Array.isArray(_[w])?_[w]:[_[w]];for(let b=0,M=A.length;b<M;b++){const L=A[b];if(p(L,w,b,C)===!0){const G=L.__offset,B=Array.isArray(L.value)?L.value:[L.value];let j=0;for(let U=0;U<B.length;U++){const z=B[U],Z=x(z);typeof z=="number"||typeof z=="boolean"?(L.__data[0]=z,n.bufferSubData(n.UNIFORM_BUFFER,G+j,L.__data)):z.isMatrix3?(L.__data[0]=z.elements[0],L.__data[1]=z.elements[1],L.__data[2]=z.elements[2],L.__data[3]=0,L.__data[4]=z.elements[3],L.__data[5]=z.elements[4],L.__data[6]=z.elements[5],L.__data[7]=0,L.__data[8]=z.elements[6],L.__data[9]=z.elements[7],L.__data[10]=z.elements[8],L.__data[11]=0):(z.toArray(L.__data,j),j+=Z.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,G,L.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function p(v,y,_,C){const w=v.value,E=y+"_"+_;if(C[E]===void 0)return typeof w=="number"||typeof w=="boolean"?C[E]=w:C[E]=w.clone(),!0;{const A=C[E];if(typeof w=="number"||typeof w=="boolean"){if(A!==w)return C[E]=w,!0}else if(A.equals(w)===!1)return A.copy(w),!0}return!1}function m(v){const y=v.uniforms;let _=0;const C=16;for(let E=0,A=y.length;E<A;E++){const b=Array.isArray(y[E])?y[E]:[y[E]];for(let M=0,L=b.length;M<L;M++){const G=b[M],B=Array.isArray(G.value)?G.value:[G.value];for(let j=0,U=B.length;j<U;j++){const z=B[j],Z=x(z),D=_%C,$=D%Z.boundary,K=D+$;_+=$,K!==0&&C-K<Z.storage&&(_+=C-K),G.__data=new Float32Array(Z.storage/Float32Array.BYTES_PER_ELEMENT),G.__offset=_,_+=Z.storage}}}const w=_%C;return w>0&&(_+=C-w),v.__size=_,v.__cache={},this}function x(v){const y={boundary:0,storage:0};return typeof v=="number"||typeof v=="boolean"?(y.boundary=4,y.storage=4):v.isVector2?(y.boundary=8,y.storage=8):v.isVector3||v.isColor?(y.boundary=16,y.storage=12):v.isVector4?(y.boundary=16,y.storage=16):v.isMatrix3?(y.boundary=48,y.storage=48):v.isMatrix4?(y.boundary=64,y.storage=64):v.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",v),y}function g(v){const y=v.target;y.removeEventListener("dispose",g);const _=o.indexOf(y.__bindingPointIndex);o.splice(_,1),n.deleteBuffer(r[y.id]),delete r[y.id],delete s[y.id]}function f(){for(const v in r)n.deleteBuffer(r[v]);o=[],r={},s={}}return{bind:l,update:c,dispose:f}}class _I{constructor(e={}){const{canvas:t=sM(),context:i=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let d;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=i.getContextAttributes().alpha}else d=o;const p=new Uint32Array(4),m=new Int32Array(4);let x=null,g=null;const f=[],v=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Hn,this.toneMapping=ji,this.toneMappingExposure=1;const y=this;let _=!1,C=0,w=0,E=null,A=-1,b=null;const M=new ct,L=new ct;let G=null;const B=new _e(0);let j=0,U=t.width,z=t.height,Z=1,D=null,$=null;const K=new ct(0,0,U,z),se=new ct(0,0,U,z);let Te=!1;const qe=new Nl;let X=!1,oe=!1;const ve=new ke,de=new I,De=new ct,He={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Be=!1;function it(){return E===null?Z:1}let P=i;function le(R,O){return t.getContext(R,O)}try{const R={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Rd}`),t.addEventListener("webglcontextlost",q,!1),t.addEventListener("webglcontextrestored",te,!1),t.addEventListener("webglcontextcreationerror",he,!1),P===null){const O="webgl2";if(P=le(O,R),P===null)throw le(O)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(R){throw console.error("THREE.WebGLRenderer: "+R.message),R}let ie,ge,Y,Ue,me,be,N,T,H,ee,J,ne,Le,pe,Me,We,ae,Se,Je,Ve,Ee,Ge,Ze,vt;function k(){ie=new T2(P),ie.init(),Ge=new vM(P,ie),ge=new _2(P,ie,e,Ge),Y=new sI(P),Ue=new R2(P),me=new $P,be=new dI(P,ie,Y,me,ge,Ge,Ue),N=new M2(y),T=new E2(y),H=new kA(P),Ze=new v2(P,H),ee=new A2(P,H,Ue,Ze),J=new I2(P,ee,H,Ue),Je=new P2(P,ge,be),We=new S2(me),ne=new XP(y,N,T,ie,ge,Ze,We),Le=new vI(y,me),pe=new qP,Me=new tI(ie),Se=new x2(y,N,T,Y,J,d,l),ae=new rI(y,J,ge),vt=new yI(P,Ue,ge,Y),Ve=new y2(P,ie,Ue),Ee=new C2(P,ie,Ue),Ue.programs=ne.programs,y.capabilities=ge,y.extensions=ie,y.properties=me,y.renderLists=pe,y.shadowMap=ae,y.state=Y,y.info=Ue}k();const ce=new gI(y,P);this.xr=ce,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){const R=ie.get("WEBGL_lose_context");R&&R.loseContext()},this.forceContextRestore=function(){const R=ie.get("WEBGL_lose_context");R&&R.restoreContext()},this.getPixelRatio=function(){return Z},this.setPixelRatio=function(R){R!==void 0&&(Z=R,this.setSize(U,z,!1))},this.getSize=function(R){return R.set(U,z)},this.setSize=function(R,O,V=!0){if(ce.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}U=R,z=O,t.width=Math.floor(R*Z),t.height=Math.floor(O*Z),V===!0&&(t.style.width=R+"px",t.style.height=O+"px"),this.setViewport(0,0,R,O)},this.getDrawingBufferSize=function(R){return R.set(U*Z,z*Z).floor()},this.setDrawingBufferSize=function(R,O,V){U=R,z=O,Z=V,t.width=Math.floor(R*V),t.height=Math.floor(O*V),this.setViewport(0,0,R,O)},this.getCurrentViewport=function(R){return R.copy(M)},this.getViewport=function(R){return R.copy(K)},this.setViewport=function(R,O,V,W){R.isVector4?K.set(R.x,R.y,R.z,R.w):K.set(R,O,V,W),Y.viewport(M.copy(K).multiplyScalar(Z).round())},this.getScissor=function(R){return R.copy(se)},this.setScissor=function(R,O,V,W){R.isVector4?se.set(R.x,R.y,R.z,R.w):se.set(R,O,V,W),Y.scissor(L.copy(se).multiplyScalar(Z).round())},this.getScissorTest=function(){return Te},this.setScissorTest=function(R){Y.setScissorTest(Te=R)},this.setOpaqueSort=function(R){D=R},this.setTransparentSort=function(R){$=R},this.getClearColor=function(R){return R.copy(Se.getClearColor())},this.setClearColor=function(){Se.setClearColor.apply(Se,arguments)},this.getClearAlpha=function(){return Se.getClearAlpha()},this.setClearAlpha=function(){Se.setClearAlpha.apply(Se,arguments)},this.clear=function(R=!0,O=!0,V=!0){let W=0;if(R){let F=!1;if(E!==null){const ue=E.texture.format;F=ue===kd||ue===Ud||ue===Rl}if(F){const ue=E.texture.type,ye=ue===Ei||ue===Ji||ue===Do||ue===Ms||ue===Nd||ue===Ld,Ce=Se.getClearColor(),Re=Se.getClearAlpha(),Fe=Ce.r,ze=Ce.g,Ie=Ce.b;ye?(p[0]=Fe,p[1]=ze,p[2]=Ie,p[3]=Re,P.clearBufferuiv(P.COLOR,0,p)):(m[0]=Fe,m[1]=ze,m[2]=Ie,m[3]=Re,P.clearBufferiv(P.COLOR,0,m))}else W|=P.COLOR_BUFFER_BIT}O&&(W|=P.DEPTH_BUFFER_BIT),V&&(W|=P.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),P.clear(W)},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(){t.removeEventListener("webglcontextlost",q,!1),t.removeEventListener("webglcontextrestored",te,!1),t.removeEventListener("webglcontextcreationerror",he,!1),pe.dispose(),Me.dispose(),me.dispose(),N.dispose(),T.dispose(),J.dispose(),Ze.dispose(),vt.dispose(),ne.dispose(),ce.dispose(),ce.removeEventListener("sessionstart",hi),ce.removeEventListener("sessionend",Ag),zr.stop()};function q(R){R.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),_=!0}function te(){console.log("THREE.WebGLRenderer: Context Restored."),_=!1;const R=Ue.autoReset,O=ae.enabled,V=ae.autoUpdate,W=ae.needsUpdate,F=ae.type;k(),Ue.autoReset=R,ae.enabled=O,ae.autoUpdate=V,ae.needsUpdate=W,ae.type=F}function he(R){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",R.statusMessage)}function Oe(R){const O=R.target;O.removeEventListener("dispose",Oe),Qe(O)}function Qe(R){It(R),me.remove(R)}function It(R){const O=me.get(R).programs;O!==void 0&&(O.forEach(function(V){ne.releaseProgram(V)}),R.isShaderMaterial&&ne.releaseShaderCache(R))}this.renderBufferDirect=function(R,O,V,W,F,ue){O===null&&(O=He);const ye=F.isMesh&&F.matrixWorld.determinant()<0,Ce=vw(R,O,V,W,F);Y.setMaterial(W,ye);let Re=V.index,Fe=1;if(W.wireframe===!0){if(Re=ee.getWireframeAttribute(V),Re===void 0)return;Fe=2}const ze=V.drawRange,Ie=V.attributes.position;let ot=ze.start*Fe,wt=(ze.start+ze.count)*Fe;ue!==null&&(ot=Math.max(ot,ue.start*Fe),wt=Math.min(wt,(ue.start+ue.count)*Fe)),Re!==null?(ot=Math.max(ot,0),wt=Math.min(wt,Re.count)):Ie!=null&&(ot=Math.max(ot,0),wt=Math.min(wt,Ie.count));const bt=wt-ot;if(bt<0||bt===1/0)return;Ze.setup(F,W,Ce,V,Re);let An,at=Ve;if(Re!==null&&(An=H.get(Re),at=Ee,at.setIndex(An)),F.isMesh)W.wireframe===!0?(Y.setLineWidth(W.wireframeLinewidth*it()),at.setMode(P.LINES)):at.setMode(P.TRIANGLES);else if(F.isLine){let Ne=W.linewidth;Ne===void 0&&(Ne=1),Y.setLineWidth(Ne*it()),F.isLineSegments?at.setMode(P.LINES):F.isLineLoop?at.setMode(P.LINE_LOOP):at.setMode(P.LINE_STRIP)}else F.isPoints?at.setMode(P.POINTS):F.isSprite&&at.setMode(P.TRIANGLES);if(F.isBatchedMesh)if(F._multiDrawInstances!==null)at.renderMultiDrawInstances(F._multiDrawStarts,F._multiDrawCounts,F._multiDrawCount,F._multiDrawInstances);else if(ie.get("WEBGL_multi_draw"))at.renderMultiDraw(F._multiDrawStarts,F._multiDrawCounts,F._multiDrawCount);else{const Ne=F._multiDrawStarts,Xt=F._multiDrawCounts,lt=F._multiDrawCount,Zn=Re?H.get(Re).bytesPerElement:1,Is=me.get(W).currentProgram.getUniforms();for(let Cn=0;Cn<lt;Cn++)Is.setValue(P,"_gl_DrawID",Cn),at.render(Ne[Cn]/Zn,Xt[Cn])}else if(F.isInstancedMesh)at.renderInstances(ot,bt,F.count);else if(V.isInstancedBufferGeometry){const Ne=V._maxInstanceCount!==void 0?V._maxInstanceCount:1/0,Xt=Math.min(V.instanceCount,Ne);at.renderInstances(ot,bt,Xt)}else at.render(ot,bt)};function jt(R,O,V){R.transparent===!0&&R.side===vi&&R.forceSinglePass===!1?(R.side=fn,R.needsUpdate=!0,Bl(R,O,V),R.side=Zi,R.needsUpdate=!0,Bl(R,O,V),R.side=vi):Bl(R,O,V)}this.compile=function(R,O,V=null){V===null&&(V=R),g=Me.get(V),g.init(O),v.push(g),V.traverseVisible(function(F){F.isLight&&F.layers.test(O.layers)&&(g.pushLight(F),F.castShadow&&g.pushShadow(F))}),R!==V&&R.traverseVisible(function(F){F.isLight&&F.layers.test(O.layers)&&(g.pushLight(F),F.castShadow&&g.pushShadow(F))}),g.setupLights();const W=new Set;return R.traverse(function(F){const ue=F.material;if(ue)if(Array.isArray(ue))for(let ye=0;ye<ue.length;ye++){const Ce=ue[ye];jt(Ce,V,F),W.add(Ce)}else jt(ue,V,F),W.add(ue)}),v.pop(),g=null,W},this.compileAsync=function(R,O,V=null){const W=this.compile(R,O,V);return new Promise(F=>{function ue(){if(W.forEach(function(ye){me.get(ye).currentProgram.isReady()&&W.delete(ye)}),W.size===0){F(R);return}setTimeout(ue,10)}ie.get("KHR_parallel_shader_compile")!==null?ue():setTimeout(ue,10)})};let st=null;function Ci(R){st&&st(R)}function hi(){zr.stop()}function Ag(){zr.start()}const zr=new fM;zr.setAnimationLoop(Ci),typeof self<"u"&&zr.setContext(self),this.setAnimationLoop=function(R){st=R,ce.setAnimationLoop(R),R===null?zr.stop():zr.start()},ce.addEventListener("sessionstart",hi),ce.addEventListener("sessionend",Ag),this.render=function(R,O){if(O!==void 0&&O.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(_===!0)return;if(R.matrixWorldAutoUpdate===!0&&R.updateMatrixWorld(),O.parent===null&&O.matrixWorldAutoUpdate===!0&&O.updateMatrixWorld(),ce.enabled===!0&&ce.isPresenting===!0&&(ce.cameraAutoUpdate===!0&&ce.updateCamera(O),O=ce.getCamera()),R.isScene===!0&&R.onBeforeRender(y,R,O,E),g=Me.get(R,v.length),g.init(O),v.push(g),ve.multiplyMatrices(O.projectionMatrix,O.matrixWorldInverse),qe.setFromProjectionMatrix(ve),oe=this.localClippingEnabled,X=We.init(this.clippingPlanes,oe),x=pe.get(R,f.length),x.init(),f.push(x),ce.enabled===!0&&ce.isPresenting===!0){const ue=y.xr.getDepthSensingMesh();ue!==null&&dh(ue,O,-1/0,y.sortObjects)}dh(R,O,0,y.sortObjects),x.finish(),y.sortObjects===!0&&x.sort(D,$),Be=ce.enabled===!1||ce.isPresenting===!1||ce.hasDepthSensing()===!1,Be&&Se.addToRenderList(x,R),this.info.render.frame++,X===!0&&We.beginShadows();const V=g.state.shadowsArray;ae.render(V,R,O),X===!0&&We.endShadows(),this.info.autoReset===!0&&this.info.reset();const W=x.opaque,F=x.transmissive;if(g.setupLights(),O.isArrayCamera){const ue=O.cameras;if(F.length>0)for(let ye=0,Ce=ue.length;ye<Ce;ye++){const Re=ue[ye];Rg(W,F,R,Re)}Be&&Se.render(R);for(let ye=0,Ce=ue.length;ye<Ce;ye++){const Re=ue[ye];Cg(x,R,Re,Re.viewport)}}else F.length>0&&Rg(W,F,R,O),Be&&Se.render(R),Cg(x,R,O);E!==null&&(be.updateMultisampleRenderTarget(E),be.updateRenderTargetMipmap(E)),R.isScene===!0&&R.onAfterRender(y,R,O),Ze.resetDefaultState(),A=-1,b=null,v.pop(),v.length>0?(g=v[v.length-1],X===!0&&We.setGlobalState(y.clippingPlanes,g.state.camera)):g=null,f.pop(),f.length>0?x=f[f.length-1]:x=null};function dh(R,O,V,W){if(R.visible===!1)return;if(R.layers.test(O.layers)){if(R.isGroup)V=R.renderOrder;else if(R.isLOD)R.autoUpdate===!0&&R.update(O);else if(R.isLight)g.pushLight(R),R.castShadow&&g.pushShadow(R);else if(R.isSprite){if(!R.frustumCulled||qe.intersectsSprite(R)){W&&De.setFromMatrixPosition(R.matrixWorld).applyMatrix4(ve);const ye=J.update(R),Ce=R.material;Ce.visible&&x.push(R,ye,Ce,V,De.z,null)}}else if((R.isMesh||R.isLine||R.isPoints)&&(!R.frustumCulled||qe.intersectsObject(R))){const ye=J.update(R),Ce=R.material;if(W&&(R.boundingSphere!==void 0?(R.boundingSphere===null&&R.computeBoundingSphere(),De.copy(R.boundingSphere.center)):(ye.boundingSphere===null&&ye.computeBoundingSphere(),De.copy(ye.boundingSphere.center)),De.applyMatrix4(R.matrixWorld).applyMatrix4(ve)),Array.isArray(Ce)){const Re=ye.groups;for(let Fe=0,ze=Re.length;Fe<ze;Fe++){const Ie=Re[Fe],ot=Ce[Ie.materialIndex];ot&&ot.visible&&x.push(R,ye,ot,V,De.z,Ie)}}else Ce.visible&&x.push(R,ye,Ce,V,De.z,null)}}const ue=R.children;for(let ye=0,Ce=ue.length;ye<Ce;ye++)dh(ue[ye],O,V,W)}function Cg(R,O,V,W){const F=R.opaque,ue=R.transmissive,ye=R.transparent;g.setupLightsView(V),X===!0&&We.setGlobalState(y.clippingPlanes,V),W&&Y.viewport(M.copy(W)),F.length>0&&Fl(F,O,V),ue.length>0&&Fl(ue,O,V),ye.length>0&&Fl(ye,O,V),Y.buffers.depth.setTest(!0),Y.buffers.depth.setMask(!0),Y.buffers.color.setMask(!0),Y.setPolygonOffset(!1)}function Rg(R,O,V,W){if((V.isScene===!0?V.overrideMaterial:null)!==null)return;g.state.transmissionRenderTarget[W.id]===void 0&&(g.state.transmissionRenderTarget[W.id]=new li(1,1,{generateMipmaps:!0,type:ie.has("EXT_color_buffer_half_float")||ie.has("EXT_color_buffer_float")?Ho:Ei,minFilter:yi,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:rt.workingColorSpace}));const ue=g.state.transmissionRenderTarget[W.id],ye=W.viewport||M;ue.setSize(ye.z,ye.w);const Ce=y.getRenderTarget();y.setRenderTarget(ue),y.getClearColor(B),j=y.getClearAlpha(),j<1&&y.setClearColor(16777215,.5),y.clear(),Be&&Se.render(V);const Re=y.toneMapping;y.toneMapping=ji;const Fe=W.viewport;if(W.viewport!==void 0&&(W.viewport=void 0),g.setupLightsView(W),X===!0&&We.setGlobalState(y.clippingPlanes,W),Fl(R,V,W),be.updateMultisampleRenderTarget(ue),be.updateRenderTargetMipmap(ue),ie.has("WEBGL_multisampled_render_to_texture")===!1){let ze=!1;for(let Ie=0,ot=O.length;Ie<ot;Ie++){const wt=O[Ie],bt=wt.object,An=wt.geometry,at=wt.material,Ne=wt.group;if(at.side===vi&&bt.layers.test(W.layers)){const Xt=at.side;at.side=fn,at.needsUpdate=!0,Pg(bt,V,W,An,at,Ne),at.side=Xt,at.needsUpdate=!0,ze=!0}}ze===!0&&(be.updateMultisampleRenderTarget(ue),be.updateRenderTargetMipmap(ue))}y.setRenderTarget(Ce),y.setClearColor(B,j),Fe!==void 0&&(W.viewport=Fe),y.toneMapping=Re}function Fl(R,O,V){const W=O.isScene===!0?O.overrideMaterial:null;for(let F=0,ue=R.length;F<ue;F++){const ye=R[F],Ce=ye.object,Re=ye.geometry,Fe=W===null?ye.material:W,ze=ye.group;Ce.layers.test(V.layers)&&Pg(Ce,O,V,Re,Fe,ze)}}function Pg(R,O,V,W,F,ue){R.onBeforeRender(y,O,V,W,F,ue),R.modelViewMatrix.multiplyMatrices(V.matrixWorldInverse,R.matrixWorld),R.normalMatrix.getNormalMatrix(R.modelViewMatrix),F.onBeforeRender(y,O,V,W,R,ue),F.transparent===!0&&F.side===vi&&F.forceSinglePass===!1?(F.side=fn,F.needsUpdate=!0,y.renderBufferDirect(V,O,W,F,R,ue),F.side=Zi,F.needsUpdate=!0,y.renderBufferDirect(V,O,W,F,R,ue),F.side=vi):y.renderBufferDirect(V,O,W,F,R,ue),R.onAfterRender(y,O,V,W,F,ue)}function Bl(R,O,V){O.isScene!==!0&&(O=He);const W=me.get(R),F=g.state.lights,ue=g.state.shadowsArray,ye=F.state.version,Ce=ne.getParameters(R,F.state,ue,O,V),Re=ne.getProgramCacheKey(Ce);let Fe=W.programs;W.environment=R.isMeshStandardMaterial?O.environment:null,W.fog=O.fog,W.envMap=(R.isMeshStandardMaterial?T:N).get(R.envMap||W.environment),W.envMapRotation=W.environment!==null&&R.envMap===null?O.environmentRotation:R.envMapRotation,Fe===void 0&&(R.addEventListener("dispose",Oe),Fe=new Map,W.programs=Fe);let ze=Fe.get(Re);if(ze!==void 0){if(W.currentProgram===ze&&W.lightsStateVersion===ye)return Ng(R,Ce),ze}else Ce.uniforms=ne.getUniforms(R),R.onBeforeCompile(Ce,y),ze=ne.acquireProgram(Ce,Re),Fe.set(Re,ze),W.uniforms=Ce.uniforms;const Ie=W.uniforms;return(!R.isShaderMaterial&&!R.isRawShaderMaterial||R.clipping===!0)&&(Ie.clippingPlanes=We.uniform),Ng(R,Ce),W.needsLights=_w(R),W.lightsStateVersion=ye,W.needsLights&&(Ie.ambientLightColor.value=F.state.ambient,Ie.lightProbe.value=F.state.probe,Ie.directionalLights.value=F.state.directional,Ie.directionalLightShadows.value=F.state.directionalShadow,Ie.spotLights.value=F.state.spot,Ie.spotLightShadows.value=F.state.spotShadow,Ie.rectAreaLights.value=F.state.rectArea,Ie.ltc_1.value=F.state.rectAreaLTC1,Ie.ltc_2.value=F.state.rectAreaLTC2,Ie.pointLights.value=F.state.point,Ie.pointLightShadows.value=F.state.pointShadow,Ie.hemisphereLights.value=F.state.hemi,Ie.directionalShadowMap.value=F.state.directionalShadowMap,Ie.directionalShadowMatrix.value=F.state.directionalShadowMatrix,Ie.spotShadowMap.value=F.state.spotShadowMap,Ie.spotLightMatrix.value=F.state.spotLightMatrix,Ie.spotLightMap.value=F.state.spotLightMap,Ie.pointShadowMap.value=F.state.pointShadowMap,Ie.pointShadowMatrix.value=F.state.pointShadowMatrix),W.currentProgram=ze,W.uniformsList=null,ze}function Ig(R){if(R.uniformsList===null){const O=R.currentProgram.getUniforms();R.uniformsList=lu.seqWithValue(O.seq,R.uniforms)}return R.uniformsList}function Ng(R,O){const V=me.get(R);V.outputColorSpace=O.outputColorSpace,V.batching=O.batching,V.batchingColor=O.batchingColor,V.instancing=O.instancing,V.instancingColor=O.instancingColor,V.instancingMorph=O.instancingMorph,V.skinning=O.skinning,V.morphTargets=O.morphTargets,V.morphNormals=O.morphNormals,V.morphColors=O.morphColors,V.morphTargetsCount=O.morphTargetsCount,V.numClippingPlanes=O.numClippingPlanes,V.numIntersection=O.numClipIntersection,V.vertexAlphas=O.vertexAlphas,V.vertexTangents=O.vertexTangents,V.toneMapping=O.toneMapping}function vw(R,O,V,W,F){O.isScene!==!0&&(O=He),be.resetTextureUnits();const ue=O.fog,ye=W.isMeshStandardMaterial?O.environment:null,Ce=E===null?y.outputColorSpace:E.isXRRenderTarget===!0?E.texture.colorSpace:tr,Re=(W.isMeshStandardMaterial?T:N).get(W.envMap||ye),Fe=W.vertexColors===!0&&!!V.attributes.color&&V.attributes.color.itemSize===4,ze=!!V.attributes.tangent&&(!!W.normalMap||W.anisotropy>0),Ie=!!V.morphAttributes.position,ot=!!V.morphAttributes.normal,wt=!!V.morphAttributes.color;let bt=ji;W.toneMapped&&(E===null||E.isXRRenderTarget===!0)&&(bt=y.toneMapping);const An=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,at=An!==void 0?An.length:0,Ne=me.get(W),Xt=g.state.lights;if(X===!0&&(oe===!0||R!==b)){const zn=R===b&&W.id===A;We.setState(W,R,zn)}let lt=!1;W.version===Ne.__version?(Ne.needsLights&&Ne.lightsStateVersion!==Xt.state.version||Ne.outputColorSpace!==Ce||F.isBatchedMesh&&Ne.batching===!1||!F.isBatchedMesh&&Ne.batching===!0||F.isBatchedMesh&&Ne.batchingColor===!0&&F.colorTexture===null||F.isBatchedMesh&&Ne.batchingColor===!1&&F.colorTexture!==null||F.isInstancedMesh&&Ne.instancing===!1||!F.isInstancedMesh&&Ne.instancing===!0||F.isSkinnedMesh&&Ne.skinning===!1||!F.isSkinnedMesh&&Ne.skinning===!0||F.isInstancedMesh&&Ne.instancingColor===!0&&F.instanceColor===null||F.isInstancedMesh&&Ne.instancingColor===!1&&F.instanceColor!==null||F.isInstancedMesh&&Ne.instancingMorph===!0&&F.morphTexture===null||F.isInstancedMesh&&Ne.instancingMorph===!1&&F.morphTexture!==null||Ne.envMap!==Re||W.fog===!0&&Ne.fog!==ue||Ne.numClippingPlanes!==void 0&&(Ne.numClippingPlanes!==We.numPlanes||Ne.numIntersection!==We.numIntersection)||Ne.vertexAlphas!==Fe||Ne.vertexTangents!==ze||Ne.morphTargets!==Ie||Ne.morphNormals!==ot||Ne.morphColors!==wt||Ne.toneMapping!==bt||Ne.morphTargetsCount!==at)&&(lt=!0):(lt=!0,Ne.__version=W.version);let Zn=Ne.currentProgram;lt===!0&&(Zn=Bl(W,O,F));let Is=!1,Cn=!1,hh=!1;const Nt=Zn.getUniforms(),nr=Ne.uniforms;if(Y.useProgram(Zn.program)&&(Is=!0,Cn=!0,hh=!0),W.id!==A&&(A=W.id,Cn=!0),Is||b!==R){Nt.setValue(P,"projectionMatrix",R.projectionMatrix),Nt.setValue(P,"viewMatrix",R.matrixWorldInverse);const zn=Nt.map.cameraPosition;zn!==void 0&&zn.setValue(P,de.setFromMatrixPosition(R.matrixWorld)),ge.logarithmicDepthBuffer&&Nt.setValue(P,"logDepthBufFC",2/(Math.log(R.far+1)/Math.LN2)),(W.isMeshPhongMaterial||W.isMeshToonMaterial||W.isMeshLambertMaterial||W.isMeshBasicMaterial||W.isMeshStandardMaterial||W.isShaderMaterial)&&Nt.setValue(P,"isOrthographic",R.isOrthographicCamera===!0),b!==R&&(b=R,Cn=!0,hh=!0)}if(F.isSkinnedMesh){Nt.setOptional(P,F,"bindMatrix"),Nt.setOptional(P,F,"bindMatrixInverse");const zn=F.skeleton;zn&&(zn.boneTexture===null&&zn.computeBoneTexture(),Nt.setValue(P,"boneTexture",zn.boneTexture,be))}F.isBatchedMesh&&(Nt.setOptional(P,F,"batchingTexture"),Nt.setValue(P,"batchingTexture",F._matricesTexture,be),Nt.setOptional(P,F,"batchingIdTexture"),Nt.setValue(P,"batchingIdTexture",F._indirectTexture,be),Nt.setOptional(P,F,"batchingColorTexture"),F._colorsTexture!==null&&Nt.setValue(P,"batchingColorTexture",F._colorsTexture,be));const fh=V.morphAttributes;if((fh.position!==void 0||fh.normal!==void 0||fh.color!==void 0)&&Je.update(F,V,Zn),(Cn||Ne.receiveShadow!==F.receiveShadow)&&(Ne.receiveShadow=F.receiveShadow,Nt.setValue(P,"receiveShadow",F.receiveShadow)),W.isMeshGouraudMaterial&&W.envMap!==null&&(nr.envMap.value=Re,nr.flipEnvMap.value=Re.isCubeTexture&&Re.isRenderTargetTexture===!1?-1:1),W.isMeshStandardMaterial&&W.envMap===null&&O.environment!==null&&(nr.envMapIntensity.value=O.environmentIntensity),Cn&&(Nt.setValue(P,"toneMappingExposure",y.toneMappingExposure),Ne.needsLights&&yw(nr,hh),ue&&W.fog===!0&&Le.refreshFogUniforms(nr,ue),Le.refreshMaterialUniforms(nr,W,Z,z,g.state.transmissionRenderTarget[R.id]),lu.upload(P,Ig(Ne),nr,be)),W.isShaderMaterial&&W.uniformsNeedUpdate===!0&&(lu.upload(P,Ig(Ne),nr,be),W.uniformsNeedUpdate=!1),W.isSpriteMaterial&&Nt.setValue(P,"center",F.center),Nt.setValue(P,"modelViewMatrix",F.modelViewMatrix),Nt.setValue(P,"normalMatrix",F.normalMatrix),Nt.setValue(P,"modelMatrix",F.matrixWorld),W.isShaderMaterial||W.isRawShaderMaterial){const zn=W.uniformsGroups;for(let ph=0,Sw=zn.length;ph<Sw;ph++){const Lg=zn[ph];vt.update(Lg,Zn),vt.bind(Lg,Zn)}}return Zn}function yw(R,O){R.ambientLightColor.needsUpdate=O,R.lightProbe.needsUpdate=O,R.directionalLights.needsUpdate=O,R.directionalLightShadows.needsUpdate=O,R.pointLights.needsUpdate=O,R.pointLightShadows.needsUpdate=O,R.spotLights.needsUpdate=O,R.spotLightShadows.needsUpdate=O,R.rectAreaLights.needsUpdate=O,R.hemisphereLights.needsUpdate=O}function _w(R){return R.isMeshLambertMaterial||R.isMeshToonMaterial||R.isMeshPhongMaterial||R.isMeshStandardMaterial||R.isShadowMaterial||R.isShaderMaterial&&R.lights===!0}this.getActiveCubeFace=function(){return C},this.getActiveMipmapLevel=function(){return w},this.getRenderTarget=function(){return E},this.setRenderTargetTextures=function(R,O,V){me.get(R.texture).__webglTexture=O,me.get(R.depthTexture).__webglTexture=V;const W=me.get(R);W.__hasExternalTextures=!0,W.__autoAllocateDepthBuffer=V===void 0,W.__autoAllocateDepthBuffer||ie.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),W.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(R,O){const V=me.get(R);V.__webglFramebuffer=O,V.__useDefaultFramebuffer=O===void 0},this.setRenderTarget=function(R,O=0,V=0){E=R,C=O,w=V;let W=!0,F=null,ue=!1,ye=!1;if(R){const Re=me.get(R);if(Re.__useDefaultFramebuffer!==void 0)Y.bindFramebuffer(P.FRAMEBUFFER,null),W=!1;else if(Re.__webglFramebuffer===void 0)be.setupRenderTarget(R);else if(Re.__hasExternalTextures)be.rebindTextures(R,me.get(R.texture).__webglTexture,me.get(R.depthTexture).__webglTexture);else if(R.depthBuffer){const Ie=R.depthTexture;if(Re.__boundDepthTexture!==Ie){if(Ie!==null&&me.has(Ie)&&(R.width!==Ie.image.width||R.height!==Ie.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");be.setupDepthRenderbuffer(R)}}const Fe=R.texture;(Fe.isData3DTexture||Fe.isDataArrayTexture||Fe.isCompressedArrayTexture)&&(ye=!0);const ze=me.get(R).__webglFramebuffer;R.isWebGLCubeRenderTarget?(Array.isArray(ze[O])?F=ze[O][V]:F=ze[O],ue=!0):R.samples>0&&be.useMultisampledRTT(R)===!1?F=me.get(R).__webglMultisampledFramebuffer:Array.isArray(ze)?F=ze[V]:F=ze,M.copy(R.viewport),L.copy(R.scissor),G=R.scissorTest}else M.copy(K).multiplyScalar(Z).floor(),L.copy(se).multiplyScalar(Z).floor(),G=Te;if(Y.bindFramebuffer(P.FRAMEBUFFER,F)&&W&&Y.drawBuffers(R,F),Y.viewport(M),Y.scissor(L),Y.setScissorTest(G),ue){const Re=me.get(R.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+O,Re.__webglTexture,V)}else if(ye){const Re=me.get(R.texture),Fe=O||0;P.framebufferTextureLayer(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,Re.__webglTexture,V||0,Fe)}A=-1},this.readRenderTargetPixels=function(R,O,V,W,F,ue,ye){if(!(R&&R.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ce=me.get(R).__webglFramebuffer;if(R.isWebGLCubeRenderTarget&&ye!==void 0&&(Ce=Ce[ye]),Ce){Y.bindFramebuffer(P.FRAMEBUFFER,Ce);try{const Re=R.texture,Fe=Re.format,ze=Re.type;if(!ge.textureFormatReadable(Fe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ge.textureTypeReadable(ze)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}O>=0&&O<=R.width-W&&V>=0&&V<=R.height-F&&P.readPixels(O,V,W,F,Ge.convert(Fe),Ge.convert(ze),ue)}finally{const Re=E!==null?me.get(E).__webglFramebuffer:null;Y.bindFramebuffer(P.FRAMEBUFFER,Re)}}},this.readRenderTargetPixelsAsync=async function(R,O,V,W,F,ue,ye){if(!(R&&R.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Ce=me.get(R).__webglFramebuffer;if(R.isWebGLCubeRenderTarget&&ye!==void 0&&(Ce=Ce[ye]),Ce){Y.bindFramebuffer(P.FRAMEBUFFER,Ce);try{const Re=R.texture,Fe=Re.format,ze=Re.type;if(!ge.textureFormatReadable(Fe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ge.textureTypeReadable(ze))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(O>=0&&O<=R.width-W&&V>=0&&V<=R.height-F){const Ie=P.createBuffer();P.bindBuffer(P.PIXEL_PACK_BUFFER,Ie),P.bufferData(P.PIXEL_PACK_BUFFER,ue.byteLength,P.STREAM_READ),P.readPixels(O,V,W,F,Ge.convert(Fe),Ge.convert(ze),0),P.flush();const ot=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);await aA(P,ot,4);try{P.bindBuffer(P.PIXEL_PACK_BUFFER,Ie),P.getBufferSubData(P.PIXEL_PACK_BUFFER,0,ue)}finally{P.deleteBuffer(Ie),P.deleteSync(ot)}return ue}}finally{const Re=E!==null?me.get(E).__webglFramebuffer:null;Y.bindFramebuffer(P.FRAMEBUFFER,Re)}}},this.copyFramebufferToTexture=function(R,O=null,V=0){R.isTexture!==!0&&(bo("WebGLRenderer: copyFramebufferToTexture function signature has changed."),O=arguments[0]||null,R=arguments[1]);const W=Math.pow(2,-V),F=Math.floor(R.image.width*W),ue=Math.floor(R.image.height*W),ye=O!==null?O.x:0,Ce=O!==null?O.y:0;be.setTexture2D(R,0),P.copyTexSubImage2D(P.TEXTURE_2D,V,0,0,ye,Ce,F,ue),Y.unbindTexture()},this.copyTextureToTexture=function(R,O,V=null,W=null,F=0){R.isTexture!==!0&&(bo("WebGLRenderer: copyTextureToTexture function signature has changed."),W=arguments[0]||null,R=arguments[1],O=arguments[2],F=arguments[3]||0,V=null);let ue,ye,Ce,Re,Fe,ze;V!==null?(ue=V.max.x-V.min.x,ye=V.max.y-V.min.y,Ce=V.min.x,Re=V.min.y):(ue=R.image.width,ye=R.image.height,Ce=0,Re=0),W!==null?(Fe=W.x,ze=W.y):(Fe=0,ze=0);const Ie=Ge.convert(O.format),ot=Ge.convert(O.type);be.setTexture2D(O,0),P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,O.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,O.unpackAlignment);const wt=P.getParameter(P.UNPACK_ROW_LENGTH),bt=P.getParameter(P.UNPACK_IMAGE_HEIGHT),An=P.getParameter(P.UNPACK_SKIP_PIXELS),at=P.getParameter(P.UNPACK_SKIP_ROWS),Ne=P.getParameter(P.UNPACK_SKIP_IMAGES),Xt=R.isCompressedTexture?R.mipmaps[F]:R.image;P.pixelStorei(P.UNPACK_ROW_LENGTH,Xt.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,Xt.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Ce),P.pixelStorei(P.UNPACK_SKIP_ROWS,Re),R.isDataTexture?P.texSubImage2D(P.TEXTURE_2D,F,Fe,ze,ue,ye,Ie,ot,Xt.data):R.isCompressedTexture?P.compressedTexSubImage2D(P.TEXTURE_2D,F,Fe,ze,Xt.width,Xt.height,Ie,Xt.data):P.texSubImage2D(P.TEXTURE_2D,F,Fe,ze,ue,ye,Ie,ot,Xt),P.pixelStorei(P.UNPACK_ROW_LENGTH,wt),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,bt),P.pixelStorei(P.UNPACK_SKIP_PIXELS,An),P.pixelStorei(P.UNPACK_SKIP_ROWS,at),P.pixelStorei(P.UNPACK_SKIP_IMAGES,Ne),F===0&&O.generateMipmaps&&P.generateMipmap(P.TEXTURE_2D),Y.unbindTexture()},this.copyTextureToTexture3D=function(R,O,V=null,W=null,F=0){R.isTexture!==!0&&(bo("WebGLRenderer: copyTextureToTexture3D function signature has changed."),V=arguments[0]||null,W=arguments[1]||null,R=arguments[2],O=arguments[3],F=arguments[4]||0);let ue,ye,Ce,Re,Fe,ze,Ie,ot,wt;const bt=R.isCompressedTexture?R.mipmaps[F]:R.image;V!==null?(ue=V.max.x-V.min.x,ye=V.max.y-V.min.y,Ce=V.max.z-V.min.z,Re=V.min.x,Fe=V.min.y,ze=V.min.z):(ue=bt.width,ye=bt.height,Ce=bt.depth,Re=0,Fe=0,ze=0),W!==null?(Ie=W.x,ot=W.y,wt=W.z):(Ie=0,ot=0,wt=0);const An=Ge.convert(O.format),at=Ge.convert(O.type);let Ne;if(O.isData3DTexture)be.setTexture3D(O,0),Ne=P.TEXTURE_3D;else if(O.isDataArrayTexture||O.isCompressedArrayTexture)be.setTexture2DArray(O,0),Ne=P.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,O.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,O.unpackAlignment);const Xt=P.getParameter(P.UNPACK_ROW_LENGTH),lt=P.getParameter(P.UNPACK_IMAGE_HEIGHT),Zn=P.getParameter(P.UNPACK_SKIP_PIXELS),Is=P.getParameter(P.UNPACK_SKIP_ROWS),Cn=P.getParameter(P.UNPACK_SKIP_IMAGES);P.pixelStorei(P.UNPACK_ROW_LENGTH,bt.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,bt.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Re),P.pixelStorei(P.UNPACK_SKIP_ROWS,Fe),P.pixelStorei(P.UNPACK_SKIP_IMAGES,ze),R.isDataTexture||R.isData3DTexture?P.texSubImage3D(Ne,F,Ie,ot,wt,ue,ye,Ce,An,at,bt.data):O.isCompressedArrayTexture?P.compressedTexSubImage3D(Ne,F,Ie,ot,wt,ue,ye,Ce,An,bt.data):P.texSubImage3D(Ne,F,Ie,ot,wt,ue,ye,Ce,An,at,bt),P.pixelStorei(P.UNPACK_ROW_LENGTH,Xt),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,lt),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Zn),P.pixelStorei(P.UNPACK_SKIP_ROWS,Is),P.pixelStorei(P.UNPACK_SKIP_IMAGES,Cn),F===0&&O.generateMipmaps&&P.generateMipmap(Ne),Y.unbindTexture()},this.initRenderTarget=function(R){me.get(R).__webglFramebuffer===void 0&&be.setupRenderTarget(R)},this.initTexture=function(R){R.isCubeTexture?be.setTextureCube(R,0):R.isData3DTexture?be.setTexture3D(R,0):R.isDataArrayTexture||R.isCompressedArrayTexture?be.setTexture2DArray(R,0):be.setTexture2D(R,0),Y.unbindTexture()},this.resetState=function(){C=0,w=0,E=null,Y.reset(),Ze.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return _i}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Fd?"display-p3":"srgb",t.unpackColorSpace=rt.workingColorSpace===Pl?"display-p3":"srgb"}}class Wd{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new _e(e),this.density=t}clone(){return new Wd(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class jd{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new _e(e),this.near=t,this.far=i}clone(){return new jd(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}let _M=class extends nt{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 On,this.environmentIntensity=1,this.environmentRotation=new On,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,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 t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}};class Xd{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=hl,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Un()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return bo("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}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,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[i+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Un()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}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=Un()),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 an=new I;class bs{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)an.fromBufferAttribute(this,t),an.applyMatrix4(e),this.setXYZ(t,an.x,an.y,an.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)an.fromBufferAttribute(this,t),an.applyNormalMatrix(e),this.setXYZ(t,an.x,an.y,an.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)an.fromBufferAttribute(this,t),an.transformDirection(e),this.setXYZ(t,an.x,an.y,an.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=un(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Xe(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=Xe(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Xe(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Xe(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Xe(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=un(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=un(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=un(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=un(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array),r=Xe(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array),r=Xe(r,this.array),s=Xe(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,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 t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new ht(new this.array.constructor(t),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 bs(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 t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,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 ag extends on{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new _e(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 qs;const aa=new I,Zs=new I,Ks=new I,Js=new Q,la=new Q,SM=new ke,bc=new I,ca=new I,Ec=new I,X0=new Q,_f=new Q,$0=new Q;class MM extends nt{constructor(e=new ag){if(super(),this.isSprite=!0,this.type="Sprite",qs===void 0){qs=new Ye;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new Xd(t,5);qs.setIndex([0,1,2,0,2,3]),qs.setAttribute("position",new bs(i,3,0,!1)),qs.setAttribute("uv",new bs(i,2,3,!1))}this.geometry=qs,this.material=e,this.center=new Q(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Zs.setFromMatrixScale(this.matrixWorld),SM.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Ks.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Zs.multiplyScalar(-Ks.z);const i=this.material.rotation;let r,s;i!==0&&(s=Math.cos(i),r=Math.sin(i));const o=this.center;Tc(bc.set(-.5,-.5,0),Ks,o,Zs,r,s),Tc(ca.set(.5,-.5,0),Ks,o,Zs,r,s),Tc(Ec.set(.5,.5,0),Ks,o,Zs,r,s),X0.set(0,0),_f.set(1,0),$0.set(1,1);let a=e.ray.intersectTriangle(bc,ca,Ec,!1,aa);if(a===null&&(Tc(ca.set(-.5,.5,0),Ks,o,Zs,r,s),_f.set(0,1),a=e.ray.intersectTriangle(bc,Ec,ca,!1,aa),a===null))return;const l=e.ray.origin.distanceTo(aa);l<e.near||l>e.far||t.push({distance:l,point:aa.clone(),uv:Nn.getInterpolation(aa,bc,ca,Ec,X0,_f,$0,new Q),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Tc(n,e,t,i,r,s){Js.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(la.x=s*Js.x-r*Js.y,la.y=r*Js.x+s*Js.y):la.copy(Js),n.copy(e),n.x+=la.x,n.y+=la.y,n.applyMatrix4(SM)}const Ac=new I,Y0=new I;class wM extends nt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let i=0,r=t.length;i<r;i++){const s=t[i];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,i=0){t=Math.abs(t);const r=this.levels;let s;for(s=0;s<r.length&&!(t<r[s].distance);s++);return r.splice(s,0,{distance:t,hysteresis:i,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let i,r;for(i=1,r=t.length;i<r;i++){let s=t[i].distance;if(t[i].object.visible&&(s-=s*t[i].hysteresis),e<s)break}return t[i-1].object}return null}raycast(e,t){if(this.levels.length>0){Ac.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(Ac);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Ac.setFromMatrixPosition(e.matrixWorld),Y0.setFromMatrixPosition(this.matrixWorld);const i=Ac.distanceTo(Y0)/e.zoom;t[0].object.visible=!0;let r,s;for(r=1,s=t.length;r<s;r++){let o=t[r].distance;if(t[r].object.visible&&(o-=o*t[r].hysteresis),i>=o)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;r<s;r++)t[r].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const i=this.levels;for(let r=0,s=i.length;r<s;r++){const o=i[r];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const q0=new I,Z0=new ct,K0=new ct,SI=new I,J0=new ke,Cc=new I,Sf=new rn,Q0=new ke,Mf=new Go;class bM extends kt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Np,this.bindMatrix=new ke,this.bindMatrixInverse=new ke,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new pn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,Cc),this.boundingBox.expandByPoint(Cc)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new rn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,Cc),this.boundingSphere.expandByPoint(Cc)}copy(e,t){return super.copy(e,t),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,t){const i=this.material,r=this.matrixWorld;i!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Sf.copy(this.boundingSphere),Sf.applyMatrix4(r),e.ray.intersectsSphere(Sf)!==!1&&(Q0.copy(r).invert(),Mf.copy(e.ray).applyMatrix4(Q0),!(this.boundingBox!==null&&Mf.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,Mf)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new ct,t=this.geometry.attributes.skinWeight;for(let i=0,r=t.count;i<r;i++){e.fromBufferAttribute(t,i);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Np?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===WS?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const i=this.skeleton,r=this.geometry;Z0.fromBufferAttribute(r.attributes.skinIndex,e),K0.fromBufferAttribute(r.attributes.skinWeight,e),q0.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const o=K0.getComponent(s);if(o!==0){const a=Z0.getComponent(s);J0.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),t.addScaledVector(SI.copy(q0).applyMatrix4(J0),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}class lg extends nt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class wi extends Ct{constructor(e=null,t=1,i=1,r,s,o,a,l,c=Gt,u=Gt,h,d){super(null,o,a,l,c,u,r,s,h,d),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const ev=new ke,MI=new ke;class $d{constructor(e=[],t=[]){this.uuid=Un(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,r=this.bones.length;i<r;i++)this.boneInverses.push(new ke)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const i=new ke;this.bones[e]&&i.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&i.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){const e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:MI;ev.multiplyMatrices(a,t[s]),ev.toArray(i,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new $d(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 t=new Float32Array(e*e*4);t.set(this.boneMatrices);const i=new wi(t,e,e,dn,Sn);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){const r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,r=e.bones.length;i<r;i++){const s=e.bones[i];let o=t[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),o=new lg),this.bones.push(o),this.boneInverses.push(new ke().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,i=this.boneInverses;for(let r=0,s=t.length;r<s;r++){const o=t[r];e.bones.push(o.uuid);const a=i[r];e.boneInverses.push(a.toArray())}return e}}class Oo extends ht{constructor(e,t,i,r=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}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 Qs=new ke,tv=new ke,Rc=[],nv=new pn,wI=new ke,ua=new kt,da=new rn;class EM extends kt{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Oo(new Float32Array(i*16),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<i;r++)this.setMatrixAt(r,wI)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new pn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Qs),nv.copy(e.boundingBox).applyMatrix4(Qs),this.boundingBox.union(nv)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new rn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Qs),da.copy(e.boundingSphere).applyMatrix4(Qs),this.boundingSphere.union(da)}copy(e,t){return super.copy(e,t),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,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const i=t.morphTargetInfluences,r=this.morphTexture.source.data.data,s=i.length+1,o=e*s+1;for(let a=0;a<i.length;a++)i[a]=r[o+a]}raycast(e,t){const i=this.matrixWorld,r=this.count;if(ua.geometry=this.geometry,ua.material=this.material,ua.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),da.copy(this.boundingSphere),da.applyMatrix4(i),e.ray.intersectsSphere(da)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,Qs),tv.multiplyMatrices(i,Qs),ua.matrixWorld=tv,ua.raycast(e,Rc);for(let o=0,a=Rc.length;o<a;o++){const l=Rc[o];l.instanceId=s,l.object=this,t.push(l)}Rc.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Oo(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const i=t.morphTargetInfluences,r=i.length+1;this.morphTexture===null&&(this.morphTexture=new wi(new Float32Array(r*this.count),r,this.count,Dd,Sn));const s=this.morphTexture.source.data.data;let o=0;for(let c=0;c<i.length;c++)o+=i[c];const a=this.geometry.morphTargetsRelative?1:1-o,l=r*e;s[l]=a,s.set(i,l+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}function bI(n,e){return n.z-e.z}function EI(n,e){return e.z-n.z}class TI{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,i){const r=this.pool,s=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});const o=r[this.index];s.push(o),this.index++,o.start=e.start,o.count=e.count,o.z=t,o.index=i}reset(){this.list.length=0,this.index=0}}const dr=new ke,wf=new ke,AI=new ke,CI=new _e(1,1,1),iv=new ke,bf=new Nl,Pc=new pn,$r=new rn,ha=new I,rv=new I,RI=new I,Ef=new TI,tn=new kt,Ic=[];function PI(n,e,t=0){const i=e.itemSize;if(n.isInterleavedBufferAttribute||n.array.constructor!==e.array.constructor){const r=n.count;for(let s=0;s<r;s++)for(let o=0;o<i;o++)e.setComponent(s+t,o,n.getComponent(s,o))}else e.array.set(n.array,t*i);e.needsUpdate=!0}class TM extends kt{get maxInstanceCount(){return this._maxInstanceCount}constructor(e,t,i=t*2,r){super(new Ye,r),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawInfo=[],this._drawRanges=[],this._reservedRanges=[],this._bounds=[],this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=i,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 t=new Float32Array(e*e*4),i=new wi(t,e,e,dn,Sn);this._matricesTexture=i}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),i=new wi(t,e,e,Rl,Ji);this._indirectTexture=i}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),i=new wi(t,e,e,dn,Sn);i.colorSpace=rt.workingColorSpace,this._colorsTexture=i}_initializeGeometry(e){const t=this.geometry,i=this._maxVertexCount,r=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in e.attributes){const o=e.getAttribute(s),{array:a,itemSize:l,normalized:c}=o,u=new a.constructor(i*l),h=new ht(u,l,c);t.setAttribute(s,h)}if(e.getIndex()!==null){const s=i>65535?new Uint32Array(r):new Uint16Array(r);t.setIndex(new ht(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const i in t.attributes){if(!e.hasAttribute(i))throw new Error(`BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);const r=e.getAttribute(i),s=t.getAttribute(i);if(r.itemSize!==s.itemSize||r.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 pn);const e=this.boundingBox,t=this._drawInfo;e.makeEmpty();for(let i=0,r=t.length;i<r;i++){if(t[i].active===!1)continue;const s=t[i].geometryIndex;this.getMatrixAt(i,dr),this.getBoundingBoxAt(s,Pc).applyMatrix4(dr),e.union(Pc)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new rn);const e=this.boundingSphere,t=this._drawInfo;e.makeEmpty();for(let i=0,r=t.length;i<r;i++){if(t[i].active===!1)continue;const s=t[i].geometryIndex;this.getMatrixAt(i,dr),this.getBoundingSphereAt(s,$r).applyMatrix4(dr),e.union($r)}}addInstance(e){if(this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");this._drawInfo.push({visible:!0,active:!0,geometryIndex:e});const t=this._drawInfo.length-1,i=this._matricesTexture,r=i.image.data;AI.toArray(r,t*16),i.needsUpdate=!0;const s=this._colorsTexture;return s&&(CI.toArray(s.image.data,t*4),s.needsUpdate=!0),t}addGeometry(e,t=-1,i=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");const r={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]),t===-1?r.vertexCount=e.getAttribute("position").count:r.vertexCount=t,s===null?r.vertexStart=0:r.vertexStart=s.vertexStart+s.vertexCount;const c=e.getIndex(),u=c!==null;if(u&&(i===-1?r.indexCount=c.count:r.indexCount=i,s===null?r.indexStart=0:r.indexStart=s.indexStart+s.indexCount),r.indexStart!==-1&&r.indexStart+r.indexCount>this._maxIndexCount||r.vertexStart+r.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const h=this._geometryCount;return this._geometryCount++,o.push(r),a.push({start:u?r.indexStart:r.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new pn,sphereInitialized:!1,sphere:new rn}),this.setGeometryAt(h,e),h}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const i=this.geometry,r=i.getIndex()!==null,s=i.getIndex(),o=t.getIndex(),a=this._reservedRanges[e];if(r&&o.count>a.indexCount||t.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 p in i.attributes){const m=t.getAttribute(p),x=i.getAttribute(p);PI(m,x,l);const g=m.itemSize;for(let f=m.count,v=c;f<v;f++){const y=l+f;for(let _=0;_<g;_++)x.setComponent(y,_,0)}x.needsUpdate=!0,x.addUpdateRange(l*g,c*g)}if(r){const p=a.indexStart;for(let m=0;m<o.count;m++)s.setX(p+m,l+o.getX(m));for(let m=o.count,x=a.indexCount;m<x;m++)s.setX(p+m,l);s.needsUpdate=!0,s.addUpdateRange(p,a.indexCount)}const u=this._bounds[e];t.boundingBox!==null?(u.box.copy(t.boundingBox),u.boxInitialized=!0):u.boxInitialized=!1,t.boundingSphere!==null?(u.sphere.copy(t.boundingSphere),u.sphereInitialized=!0):u.sphereInitialized=!1;const h=this._drawRanges[e],d=t.getAttribute("position");return h.count=r?o.count:d.count,this._visibilityChanged=!0,e}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const i=this._bounds[e],r=i.box,s=this.geometry;if(i.boxInitialized===!1){r.makeEmpty();const o=s.index,a=s.attributes.position,l=this._drawRanges[e];for(let c=l.start,u=l.start+l.count;c<u;c++){let h=c;o&&(h=o.getX(h)),r.expandByPoint(ha.fromBufferAttribute(a,h))}i.boxInitialized=!0}return t.copy(r),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const i=this._bounds[e],r=i.sphere,s=this.geometry;if(i.sphereInitialized===!1){r.makeEmpty(),this.getBoundingBoxAt(e,Pc),Pc.getCenter(r.center);const o=s.index,a=s.attributes.position,l=this._drawRanges[e];let c=0;for(let u=l.start,h=l.start+l.count;u<h;u++){let d=u;o&&(d=o.getX(d)),ha.fromBufferAttribute(a,d),c=Math.max(c,r.center.distanceToSquared(ha))}r.radius=Math.sqrt(c),i.sphereInitialized=!0}return t.copy(r),t}setMatrixAt(e,t){const i=this._drawInfo,r=this._matricesTexture,s=this._matricesTexture.image.data;return e>=i.length||i[e].active===!1?this:(t.toArray(s,e*16),r.needsUpdate=!0,this)}getMatrixAt(e,t){const i=this._drawInfo,r=this._matricesTexture.image.data;return e>=i.length||i[e].active===!1?null:t.fromArray(r,e*16)}setColorAt(e,t){this._colorsTexture===null&&this._initColorsTexture();const i=this._colorsTexture,r=this._colorsTexture.image.data,s=this._drawInfo;return e>=s.length||s[e].active===!1?this:(t.toArray(r,e*4),i.needsUpdate=!0,this)}getColorAt(e,t){const i=this._colorsTexture.image.data,r=this._drawInfo;return e>=r.length||r[e].active===!1?null:t.fromArray(i,e*4)}setVisibleAt(e,t){const i=this._drawInfo;return e>=i.length||i[e].active===!1||i[e].visible===t?this:(i[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?!1:t[e].visible}raycast(e,t){const i=this._drawInfo,r=this._drawRanges,s=this.matrixWorld,o=this.geometry;tn.material=this.material,tn.geometry.index=o.index,tn.geometry.attributes=o.attributes,tn.geometry.boundingBox===null&&(tn.geometry.boundingBox=new pn),tn.geometry.boundingSphere===null&&(tn.geometry.boundingSphere=new rn);for(let a=0,l=i.length;a<l;a++){if(!i[a].visible||!i[a].active)continue;const c=i[a].geometryIndex,u=r[c];tn.geometry.setDrawRange(u.start,u.count),this.getMatrixAt(a,tn.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,tn.geometry.boundingBox),this.getBoundingSphereAt(c,tn.geometry.boundingSphere),tn.raycast(e,Ic);for(let h=0,d=Ic.length;h<d;h++){const p=Ic[h];p.object=this,p.batchId=a,t.push(p)}Ic.length=0}tn.material=null,tn.geometry.index=null,tn.geometry.attributes={},tn.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(t=>({...t})),this._reservedRanges=e._reservedRanges.map(t=>({...t})),this._drawInfo=e._drawInfo.map(t=>({...t})),this._bounds=e._bounds.map(t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.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,t,i,r,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=r.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=this._drawInfo,c=this._multiDrawStarts,u=this._multiDrawCounts,h=this._drawRanges,d=this.perObjectFrustumCulled,p=this._indirectTexture,m=p.image.data;d&&(iv.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),bf.setFromProjectionMatrix(iv,e.coordinateSystem));let x=0;if(this.sortObjects){wf.copy(this.matrixWorld).invert(),ha.setFromMatrixPosition(i.matrixWorld).applyMatrix4(wf),rv.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(wf);for(let v=0,y=l.length;v<y;v++)if(l[v].visible&&l[v].active){const _=l[v].geometryIndex;this.getMatrixAt(v,dr),this.getBoundingSphereAt(_,$r).applyMatrix4(dr);let C=!1;if(d&&(C=!bf.intersectsSphere($r)),!C){const w=RI.subVectors($r.center,ha).dot(rv);Ef.push(h[_],w,v)}}const g=Ef.list,f=this.customSort;f===null?g.sort(s.transparent?EI:bI):f.call(this,g,i);for(let v=0,y=g.length;v<y;v++){const _=g[v];c[x]=_.start*a,u[x]=_.count,m[x]=_.index,x++}Ef.reset()}else for(let g=0,f=l.length;g<f;g++)if(l[g].visible&&l[g].active){const v=l[g].geometryIndex;let y=!1;if(d&&(this.getMatrixAt(g,dr),this.getBoundingSphereAt(v,$r).applyMatrix4(dr),y=!bf.intersectsSphere($r)),!y){const _=h[v];c[x]=_.start*a,u[x]=_.count,m[x]=g,x++}}p.needsUpdate=!0,this._multiDrawCount=x,this._visibilityChanged=!1}onBeforeShadow(e,t,i,r,s,o){this.onBeforeRender(e,null,r,s,o)}}class xn extends on{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new _e(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 ld=new I,cd=new I,sv=new ke,fa=new Go,Nc=new rn,Tf=new I,ov=new I;class Nr extends nt{constructor(e=new Ye,t=new xn){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),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 t=e.attributes.position,i=[0];for(let r=1,s=t.count;r<s;r++)ld.fromBufferAttribute(t,r-1),cd.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=ld.distanceTo(cd);e.setAttribute("lineDistance",new Pe(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Nc.copy(i.boundingSphere),Nc.applyMatrix4(r),Nc.radius+=s,e.ray.intersectsSphere(Nc)===!1)return;sv.copy(r).invert(),fa.copy(e.ray).applyMatrix4(sv);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,u=i.index,d=i.attributes.position;if(u!==null){const p=Math.max(0,o.start),m=Math.min(u.count,o.start+o.count);for(let x=p,g=m-1;x<g;x+=c){const f=u.getX(x),v=u.getX(x+1),y=Lc(this,e,fa,l,f,v);y&&t.push(y)}if(this.isLineLoop){const x=u.getX(m-1),g=u.getX(p),f=Lc(this,e,fa,l,x,g);f&&t.push(f)}}else{const p=Math.max(0,o.start),m=Math.min(d.count,o.start+o.count);for(let x=p,g=m-1;x<g;x+=c){const f=Lc(this,e,fa,l,x,x+1);f&&t.push(f)}if(this.isLineLoop){const x=Lc(this,e,fa,l,m-1,p);x&&t.push(x)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function Lc(n,e,t,i,r,s){const o=n.geometry.attributes.position;if(ld.fromBufferAttribute(o,r),cd.fromBufferAttribute(o,s),t.distanceSqToSegment(ld,cd,Tf,ov)>i)return;Tf.applyMatrix4(n.matrixWorld);const l=e.ray.origin.distanceTo(Tf);if(!(l<e.near||l>e.far))return{distance:l,point:ov.clone().applyMatrix4(n.matrixWorld),index:r,face:null,faceIndex:null,object:n}}const av=new I,lv=new I;class Ai extends Nr{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[];for(let r=0,s=t.count;r<s;r+=2)av.fromBufferAttribute(t,r),lv.fromBufferAttribute(t,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+av.distanceTo(lv);e.setAttribute("lineDistance",new Pe(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class AM extends Nr{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class cg extends on{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new _e(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 cv=new ke,Fp=new Go,Dc=new rn,Uc=new I;class CM extends nt{constructor(e=new Ye,t=new cg){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Dc.copy(i.boundingSphere),Dc.applyMatrix4(r),Dc.radius+=s,e.ray.intersectsSphere(Dc)===!1)return;cv.copy(r).invert(),Fp.copy(e.ray).applyMatrix4(cv);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=i.index,h=i.attributes.position;if(c!==null){const d=Math.max(0,o.start),p=Math.min(c.count,o.start+o.count);for(let m=d,x=p;m<x;m++){const g=c.getX(m);Uc.fromBufferAttribute(h,g),uv(Uc,g,l,r,e,t,this)}}else{const d=Math.max(0,o.start),p=Math.min(h.count,o.start+o.count);for(let m=d,x=p;m<x;m++)Uc.fromBufferAttribute(h,m),uv(Uc,m,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function uv(n,e,t,i,r,s,o){const a=Fp.distanceSqToPoint(n);if(a<t){const l=new I;Fp.closestPointToPoint(n,l),l.applyMatrix4(i);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class II extends Ct{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Ut,this.magFilter=s!==void 0?s:Ut,this.generateMipmaps=!1;const u=this;function h(){u.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class NI extends Ct{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Gt,this.minFilter=Gt,this.generateMipmaps=!1,this.needsUpdate=!0}}class Yd extends Ct{constructor(e,t,i,r,s,o,a,l,c,u,h,d){super(null,o,a,l,c,u,r,s,h,d),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class LI extends Yd{constructor(e,t,i,r,s,o){super(e,t,i,s,o),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=Xn,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class DI extends Yd{constructor(e,t,i){super(void 0,e[0].width,e[0].height,t,i,Ki),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class UI extends Ct{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class ui{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let i,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let r=0;const s=i.length;let o;t?o=t:o=e*i[s-1];let a=0,l=s-1,c;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),c=i[r]-o,c<0)a=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,i[r]===o)return r/(s-1);const u=i[r],d=i[r+1]-u,p=(o-u)/d;return(r+p)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new Q:new I);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new I,r=[],s=[],o=[],a=new I,l=new ke;for(let p=0;p<=e;p++){const m=p/e;r[p]=this.getTangentAt(m,new I)}s[0]=new I,o[0]=new I;let c=Number.MAX_VALUE;const u=Math.abs(r[0].x),h=Math.abs(r[0].y),d=Math.abs(r[0].z);u<=c&&(c=u,i.set(1,0,0)),h<=c&&(c=h,i.set(0,1,0)),d<=c&&i.set(0,0,1),a.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let p=1;p<=e;p++){if(s[p]=s[p-1].clone(),o[p]=o[p-1].clone(),a.crossVectors(r[p-1],r[p]),a.length()>Number.EPSILON){a.normalize();const m=Math.acos(At(r[p-1].dot(r[p]),-1,1));s[p].applyMatrix4(l.makeRotationAxis(a,m))}o[p].crossVectors(r[p],s[p])}if(t===!0){let p=Math.acos(At(s[0].dot(s[e]),-1,1));p/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(p=-p);for(let m=1;m<=e;m++)s[m].applyMatrix4(l.makeRotationAxis(r[m],p*m)),o[m].crossVectors(r[m],s[m])}return{tangents:r,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 qd extends ui{constructor(e=0,t=0,i=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new Q){const i=t,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);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 u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),d=l-this.aX,p=c-this.aY;l=d*u-p*h+this.aX,c=d*h+p*u+this.aY}return i.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 RM extends qd{constructor(e,t,i,r,s,o){super(e,t,i,i,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function ug(){let n=0,e=0,t=0,i=0;function r(s,o,a,l){n=s,e=a,t=-3*s+3*o-2*a-l,i=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){r(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,h){let d=(o-s)/c-(a-s)/(c+u)+(a-o)/u,p=(a-o)/u-(l-o)/(u+h)+(l-a)/h;d*=u,p*=u,r(o,a,d,p)},calc:function(s){const o=s*s,a=o*s;return n+e*s+t*o+i*a}}}const kc=new I,Af=new ug,Cf=new ug,Rf=new ug;class PM extends ui{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new I){const i=t,r=this.points,s=r.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,u;this.closed||a>0?c=r[(a-1)%s]:(kc.subVectors(r[0],r[1]).add(r[0]),c=kc);const h=r[a%s],d=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(kc.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=kc),this.curveType==="centripetal"||this.curveType==="chordal"){const p=this.curveType==="chordal"?.5:.25;let m=Math.pow(c.distanceToSquared(h),p),x=Math.pow(h.distanceToSquared(d),p),g=Math.pow(d.distanceToSquared(u),p);x<1e-4&&(x=1),m<1e-4&&(m=x),g<1e-4&&(g=x),Af.initNonuniformCatmullRom(c.x,h.x,d.x,u.x,m,x,g),Cf.initNonuniformCatmullRom(c.y,h.y,d.y,u.y,m,x,g),Rf.initNonuniformCatmullRom(c.z,h.z,d.z,u.z,m,x,g)}else this.curveType==="catmullrom"&&(Af.initCatmullRom(c.x,h.x,d.x,u.x,this.tension),Cf.initCatmullRom(c.y,h.y,d.y,u.y,this.tension),Rf.initCatmullRom(c.z,h.z,d.z,u.z,this.tension));return i.set(Af.calc(l),Cf.calc(l),Rf.calc(l)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new I().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function dv(n,e,t,i,r){const s=(i-e)*.5,o=(r-t)*.5,a=n*n,l=n*a;return(2*t-2*i+s+o)*l+(-3*t+3*i-2*s-o)*a+s*n+t}function kI(n,e){const t=1-n;return t*t*e}function OI(n,e){return 2*(1-n)*n*e}function FI(n,e){return n*n*e}function Oa(n,e,t,i){return kI(n,e)+OI(n,t)+FI(n,i)}function BI(n,e){const t=1-n;return t*t*t*e}function zI(n,e){const t=1-n;return 3*t*t*n*e}function VI(n,e){return 3*(1-n)*n*n*e}function HI(n,e){return n*n*n*e}function Fa(n,e,t,i,r){return BI(n,e)+zI(n,t)+VI(n,i)+HI(n,r)}class dg extends ui{constructor(e=new Q,t=new Q,i=new Q,r=new Q){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new Q){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(Fa(e,r.x,s.x,o.x,a.x),Fa(e,r.y,s.y,o.y,a.y)),i}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 IM extends ui{constructor(e=new I,t=new I,i=new I,r=new I){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new I){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(Fa(e,r.x,s.x,o.x,a.x),Fa(e,r.y,s.y,o.y,a.y),Fa(e,r.z,s.z,o.z,a.z)),i}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 hg extends ui{constructor(e=new Q,t=new Q){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Q){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Q){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}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 NM extends ui{constructor(e=new I,t=new I){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new I){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new I){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}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 fg extends ui{constructor(e=new Q,t=new Q,i=new Q){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new Q){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(Oa(e,r.x,s.x,o.x),Oa(e,r.y,s.y,o.y)),i}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 pg extends ui{constructor(e=new I,t=new I,i=new I){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new I){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(Oa(e,r.x,s.x,o.x),Oa(e,r.y,s.y,o.y),Oa(e,r.z,s.z,o.z)),i}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 mg extends ui{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Q){const i=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,l=r[o===0?o:o-1],c=r[o],u=r[o>r.length-2?r.length-1:o+1],h=r[o>r.length-3?r.length-1:o+2];return i.set(dv(a,l.x,c.x,u.x,h.x),dv(a,l.y,c.y,u.y,h.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new Q().fromArray(r))}return this}}var ud=Object.freeze({__proto__:null,ArcCurve:RM,CatmullRomCurve3:PM,CubicBezierCurve:dg,CubicBezierCurve3:IM,EllipseCurve:qd,LineCurve:hg,LineCurve3:NM,QuadraticBezierCurve:fg,QuadraticBezierCurve3:pg,SplineCurve:mg});class LM extends ui{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const i=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new ud[i](t,e))}return this}getPoint(e,t){const i=e*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=i){const o=r[s]-i,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let i=0,r=this.curves.length;i<r;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let i;for(let r=0,s=this.curves;r<s.length;r++){const o=s[r],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 u=l[c];i&&i.equals(u)||(t.push(u),i=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){const r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(new ud[r.type]().fromJSON(r))}return this}}class ml extends LM{constructor(e){super(),this.type="Path",this.currentPoint=new Q,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const i=new hg(this.currentPoint.clone(),new Q(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){const s=new fg(this.currentPoint.clone(),new Q(e,t),new Q(i,r));return this.curves.push(s),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,s,o){const a=new dg(this.currentPoint.clone(),new Q(e,t),new Q(i,r),new Q(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),i=new mg(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,i,r,s,o),this}absarc(e,t,i,r,s,o){return this.absellipse(e,t,i,i,r,s,o),this}ellipse(e,t,i,r,s,o,a,l){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,i,r,s,o,a,l),this}absellipse(e,t,i,r,s,o,a,l){const c=new qd(e,t,i,r,s,o,a,l);if(this.curves.length>0){const h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Ll extends Ye{constructor(e=[new Q(0,-.5),new Q(.5,0),new Q(0,.5)],t=12,i=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=At(r,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],u=1/t,h=new I,d=new Q,p=new I,m=new I,x=new I;let g=0,f=0;for(let v=0;v<=e.length-1;v++)switch(v){case 0:g=e[v+1].x-e[v].x,f=e[v+1].y-e[v].y,p.x=f*1,p.y=-g,p.z=f*0,x.copy(p),p.normalize(),l.push(p.x,p.y,p.z);break;case e.length-1:l.push(x.x,x.y,x.z);break;default:g=e[v+1].x-e[v].x,f=e[v+1].y-e[v].y,p.x=f*1,p.y=-g,p.z=f*0,m.copy(p),p.x+=x.x,p.y+=x.y,p.z+=x.z,p.normalize(),l.push(p.x,p.y,p.z),x.copy(m)}for(let v=0;v<=t;v++){const y=i+v*u*r,_=Math.sin(y),C=Math.cos(y);for(let w=0;w<=e.length-1;w++){h.x=e[w].x*_,h.y=e[w].y,h.z=e[w].x*C,o.push(h.x,h.y,h.z),d.x=v/t,d.y=w/(e.length-1),a.push(d.x,d.y);const E=l[3*w+0]*_,A=l[3*w+1],b=l[3*w+0]*C;c.push(E,A,b)}}for(let v=0;v<t;v++)for(let y=0;y<e.length-1;y++){const _=y+v*e.length,C=_,w=_+e.length,E=_+e.length+1,A=_+1;s.push(C,w,A),s.push(E,A,w)}this.setIndex(s),this.setAttribute("position",new Pe(o,3)),this.setAttribute("uv",new Pe(a,2)),this.setAttribute("normal",new Pe(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ll(e.points,e.segments,e.phiStart,e.phiLength)}}class Zd extends Ll{constructor(e=1,t=1,i=4,r=8){const s=new ml;s.absarc(0,-t/2,e,Math.PI*1.5,0),s.absarc(0,t/2,e,0,Math.PI*.5),super(s.getPoints(i),r),this.type="CapsuleGeometry",this.parameters={radius:e,length:t,capSegments:i,radialSegments:r}}static fromJSON(e){return new Zd(e.radius,e.length,e.capSegments,e.radialSegments)}}class Kd extends Ye{constructor(e=1,t=32,i=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},t=Math.max(3,t);const s=[],o=[],a=[],l=[],c=new I,u=new Q;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let h=0,d=3;h<=t;h++,d+=3){const p=i+h/t*r;c.x=e*Math.cos(p),c.y=e*Math.sin(p),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[d]/e+1)/2,u.y=(o[d+1]/e+1)/2,l.push(u.x,u.y)}for(let h=1;h<=t;h++)s.push(h,h+1,0);this.setIndex(s),this.setAttribute("position",new Pe(o,3)),this.setAttribute("normal",new Pe(a,3)),this.setAttribute("uv",new Pe(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Kd(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Xo extends Ye{constructor(e=1,t=1,i=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const u=[],h=[],d=[],p=[];let m=0;const x=[],g=i/2;let f=0;v(),o===!1&&(e>0&&y(!0),t>0&&y(!1)),this.setIndex(u),this.setAttribute("position",new Pe(h,3)),this.setAttribute("normal",new Pe(d,3)),this.setAttribute("uv",new Pe(p,2));function v(){const _=new I,C=new I;let w=0;const E=(t-e)/i;for(let A=0;A<=s;A++){const b=[],M=A/s,L=M*(t-e)+e;for(let G=0;G<=r;G++){const B=G/r,j=B*l+a,U=Math.sin(j),z=Math.cos(j);C.x=L*U,C.y=-M*i+g,C.z=L*z,h.push(C.x,C.y,C.z),_.set(U,E,z).normalize(),d.push(_.x,_.y,_.z),p.push(B,1-M),b.push(m++)}x.push(b)}for(let A=0;A<r;A++)for(let b=0;b<s;b++){const M=x[b][A],L=x[b+1][A],G=x[b+1][A+1],B=x[b][A+1];u.push(M,L,B),u.push(L,G,B),w+=6}c.addGroup(f,w,0),f+=w}function y(_){const C=m,w=new Q,E=new I;let A=0;const b=_===!0?e:t,M=_===!0?1:-1;for(let G=1;G<=r;G++)h.push(0,g*M,0),d.push(0,M,0),p.push(.5,.5),m++;const L=m;for(let G=0;G<=r;G++){const j=G/r*l+a,U=Math.cos(j),z=Math.sin(j);E.x=b*z,E.y=g*M,E.z=b*U,h.push(E.x,E.y,E.z),d.push(0,M,0),w.x=U*.5+.5,w.y=z*.5*M+.5,p.push(w.x,w.y),m++}for(let G=0;G<r;G++){const B=C+G,j=L+G;_===!0?u.push(j,j+1,B):u.push(j+1,j,B),A+=3}c.addGroup(f,A,_===!0?1:2),f+=A}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Xo(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Jd extends Xo{constructor(e=1,t=1,i=32,r=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,i,r,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new Jd(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Fr extends Ye{constructor(e=[],t=[],i=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:r};const s=[],o=[];a(r),c(i),u(),this.setAttribute("position",new Pe(s,3)),this.setAttribute("normal",new Pe(s.slice(),3)),this.setAttribute("uv",new Pe(o,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function a(v){const y=new I,_=new I,C=new I;for(let w=0;w<t.length;w+=3)p(t[w+0],y),p(t[w+1],_),p(t[w+2],C),l(y,_,C,v)}function l(v,y,_,C){const w=C+1,E=[];for(let A=0;A<=w;A++){E[A]=[];const b=v.clone().lerp(_,A/w),M=y.clone().lerp(_,A/w),L=w-A;for(let G=0;G<=L;G++)G===0&&A===w?E[A][G]=b:E[A][G]=b.clone().lerp(M,G/L)}for(let A=0;A<w;A++)for(let b=0;b<2*(w-A)-1;b++){const M=Math.floor(b/2);b%2===0?(d(E[A][M+1]),d(E[A+1][M]),d(E[A][M])):(d(E[A][M+1]),d(E[A+1][M+1]),d(E[A+1][M]))}}function c(v){const y=new I;for(let _=0;_<s.length;_+=3)y.x=s[_+0],y.y=s[_+1],y.z=s[_+2],y.normalize().multiplyScalar(v),s[_+0]=y.x,s[_+1]=y.y,s[_+2]=y.z}function u(){const v=new I;for(let y=0;y<s.length;y+=3){v.x=s[y+0],v.y=s[y+1],v.z=s[y+2];const _=g(v)/2/Math.PI+.5,C=f(v)/Math.PI+.5;o.push(_,1-C)}m(),h()}function h(){for(let v=0;v<o.length;v+=6){const y=o[v+0],_=o[v+2],C=o[v+4],w=Math.max(y,_,C),E=Math.min(y,_,C);w>.9&&E<.1&&(y<.2&&(o[v+0]+=1),_<.2&&(o[v+2]+=1),C<.2&&(o[v+4]+=1))}}function d(v){s.push(v.x,v.y,v.z)}function p(v,y){const _=v*3;y.x=e[_+0],y.y=e[_+1],y.z=e[_+2]}function m(){const v=new I,y=new I,_=new I,C=new I,w=new Q,E=new Q,A=new Q;for(let b=0,M=0;b<s.length;b+=9,M+=6){v.set(s[b+0],s[b+1],s[b+2]),y.set(s[b+3],s[b+4],s[b+5]),_.set(s[b+6],s[b+7],s[b+8]),w.set(o[M+0],o[M+1]),E.set(o[M+2],o[M+3]),A.set(o[M+4],o[M+5]),C.copy(v).add(y).add(_).divideScalar(3);const L=g(C);x(w,M+0,v,L),x(E,M+2,y,L),x(A,M+4,_,L)}}function x(v,y,_,C){C<0&&v.x===1&&(o[y]=v.x-1),_.x===0&&_.z===0&&(o[y]=C/2/Math.PI+.5)}function g(v){return Math.atan2(v.z,-v.x)}function f(v){return Math.atan2(-v.y,Math.sqrt(v.x*v.x+v.z*v.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Fr(e.vertices,e.indices,e.radius,e.details)}}class Qd extends Fr{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=1/i,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,-r,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,0,r],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,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Qd(e.radius,e.detail)}}const Oc=new I,Fc=new I,Pf=new I,Bc=new Nn;class DM extends Ye{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(ms*t),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,c=[0,0,0],u=["a","b","c"],h=new Array(3),d={},p=[];for(let m=0;m<l;m+=3){o?(c[0]=o.getX(m),c[1]=o.getX(m+1),c[2]=o.getX(m+2)):(c[0]=m,c[1]=m+1,c[2]=m+2);const{a:x,b:g,c:f}=Bc;if(x.fromBufferAttribute(a,c[0]),g.fromBufferAttribute(a,c[1]),f.fromBufferAttribute(a,c[2]),Bc.getNormal(Pf),h[0]=`${Math.round(x.x*r)},${Math.round(x.y*r)},${Math.round(x.z*r)}`,h[1]=`${Math.round(g.x*r)},${Math.round(g.y*r)},${Math.round(g.z*r)}`,h[2]=`${Math.round(f.x*r)},${Math.round(f.y*r)},${Math.round(f.z*r)}`,!(h[0]===h[1]||h[1]===h[2]||h[2]===h[0]))for(let v=0;v<3;v++){const y=(v+1)%3,_=h[v],C=h[y],w=Bc[u[v]],E=Bc[u[y]],A=`${_}_${C}`,b=`${C}_${_}`;b in d&&d[b]?(Pf.dot(d[b].normal)<=s&&(p.push(w.x,w.y,w.z),p.push(E.x,E.y,E.z)),d[b]=null):A in d||(d[A]={index0:c[v],index1:c[y],normal:Pf.clone()})}}for(const m in d)if(d[m]){const{index0:x,index1:g}=d[m];Oc.fromBufferAttribute(a,x),Fc.fromBufferAttribute(a,g),p.push(Oc.x,Oc.y,Oc.z),p.push(Fc.x,Fc.y,Fc.z)}this.setAttribute("position",new Pe(p,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class gs extends ml{constructor(e){super(e),this.uuid=Un(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){const r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(new ml().fromJSON(r))}return this}}const GI={triangulate:function(n,e,t=2){const i=e&&e.length,r=i?e[0]*t:n.length;let s=UM(n,0,r,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c,u,h,d,p;if(i&&(s=YI(n,e,s,t)),n.length>80*t){a=c=n[0],l=u=n[1];for(let m=t;m<r;m+=t)h=n[m],d=n[m+1],h<a&&(a=h),d<l&&(l=d),h>c&&(c=h),d>u&&(u=d);p=Math.max(c-a,u-l),p=p!==0?32767/p:0}return gl(s,o,t,a,l,p,0),o}};function UM(n,e,t,i,r){let s,o;if(r===sN(n,e,t,i)>0)for(s=e;s<t;s+=i)o=hv(s,n[s],n[s+1],o);else for(s=t-i;s>=e;s-=i)o=hv(s,n[s],n[s+1],o);return o&&eh(o,o.next)&&(vl(o),o=o.next),o}function Es(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(eh(t,t.next)||_t(t.prev,t,t.next)===0)){if(vl(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function gl(n,e,t,i,r,s,o){if(!n)return;!o&&s&&QI(n,i,r,s);let a=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,s?jI(n,i,r,s):WI(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(c.i/t|0),vl(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=XI(Es(n),e,t),gl(n,e,t,i,r,s,2)):o===2&&$I(n,e,t,i,r,s):gl(Es(n),e,t,i,r,s,1);break}}}function WI(n){const e=n.prev,t=n,i=n.next;if(_t(e,t,i)>=0)return!1;const r=e.x,s=t.x,o=i.x,a=e.y,l=t.y,c=i.y,u=r<s?r<o?r:o:s<o?s:o,h=a<l?a<c?a:c:l<c?l:c,d=r>s?r>o?r:o:s>o?s:o,p=a>l?a>c?a:c:l>c?l:c;let m=i.next;for(;m!==e;){if(m.x>=u&&m.x<=d&&m.y>=h&&m.y<=p&&xo(r,a,s,l,o,c,m.x,m.y)&&_t(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function jI(n,e,t,i){const r=n.prev,s=n,o=n.next;if(_t(r,s,o)>=0)return!1;const a=r.x,l=s.x,c=o.x,u=r.y,h=s.y,d=o.y,p=a<l?a<c?a:c:l<c?l:c,m=u<h?u<d?u:d:h<d?h:d,x=a>l?a>c?a:c:l>c?l:c,g=u>h?u>d?u:d:h>d?h:d,f=Bp(p,m,e,t,i),v=Bp(x,g,e,t,i);let y=n.prevZ,_=n.nextZ;for(;y&&y.z>=f&&_&&_.z<=v;){if(y.x>=p&&y.x<=x&&y.y>=m&&y.y<=g&&y!==r&&y!==o&&xo(a,u,l,h,c,d,y.x,y.y)&&_t(y.prev,y,y.next)>=0||(y=y.prevZ,_.x>=p&&_.x<=x&&_.y>=m&&_.y<=g&&_!==r&&_!==o&&xo(a,u,l,h,c,d,_.x,_.y)&&_t(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;y&&y.z>=f;){if(y.x>=p&&y.x<=x&&y.y>=m&&y.y<=g&&y!==r&&y!==o&&xo(a,u,l,h,c,d,y.x,y.y)&&_t(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;_&&_.z<=v;){if(_.x>=p&&_.x<=x&&_.y>=m&&_.y<=g&&_!==r&&_!==o&&xo(a,u,l,h,c,d,_.x,_.y)&&_t(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function XI(n,e,t){let i=n;do{const r=i.prev,s=i.next.next;!eh(r,s)&&kM(r,i,i.next,s)&&xl(r,s)&&xl(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),vl(i),vl(i.next),i=n=s),i=i.next}while(i!==n);return Es(i)}function $I(n,e,t,i,r,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&nN(o,a)){let l=OM(o,a);o=Es(o,o.next),l=Es(l,l.next),gl(o,e,t,i,r,s,0),gl(l,e,t,i,r,s,0);return}a=a.next}o=o.next}while(o!==n)}function YI(n,e,t,i){const r=[];let s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*i,l=s<o-1?e[s+1]*i:n.length,c=UM(n,a,l,i,!1),c===c.next&&(c.steiner=!0),r.push(tN(c));for(r.sort(qI),s=0;s<r.length;s++)t=ZI(r[s],t);return t}function qI(n,e){return n.x-e.x}function ZI(n,e){const t=KI(n,e);if(!t)return e;const i=OM(t,n);return Es(i,i.next),Es(t,t.next)}function KI(n,e){let t=e,i=-1/0,r;const s=n.x,o=n.y;do{if(o<=t.y&&o>=t.next.y&&t.next.y!==t.y){const d=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=s&&d>i&&(i=d,r=t.x<t.next.x?t:t.next,d===s))return r}t=t.next}while(t!==e);if(!r)return null;const a=r,l=r.x,c=r.y;let u=1/0,h;t=r;do s>=t.x&&t.x>=l&&s!==t.x&&xo(o<c?s:i,o,l,c,o<c?i:s,o,t.x,t.y)&&(h=Math.abs(o-t.y)/(s-t.x),xl(t,n)&&(h<u||h===u&&(t.x>r.x||t.x===r.x&&JI(r,t)))&&(r=t,u=h)),t=t.next;while(t!==a);return r}function JI(n,e){return _t(n.prev,n,e.prev)<0&&_t(e.next,n,n.next)<0}function QI(n,e,t,i){let r=n;do r.z===0&&(r.z=Bp(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,eN(r)}function eN(n){let e,t,i,r,s,o,a,l,c=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,i=t,a=0,e=0;e<c&&(a++,i=i.nextZ,!!i);e++);for(l=c;a>0||l>0&&i;)a!==0&&(l===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,c*=2}while(o>1);return n}function Bp(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function tN(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function xo(n,e,t,i,r,s,o,a){return(r-o)*(e-a)>=(n-o)*(s-a)&&(n-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(i-a)}function nN(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!iN(n,e)&&(xl(n,e)&&xl(e,n)&&rN(n,e)&&(_t(n.prev,n,e.prev)||_t(n,e.prev,e))||eh(n,e)&&_t(n.prev,n,n.next)>0&&_t(e.prev,e,e.next)>0)}function _t(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function eh(n,e){return n.x===e.x&&n.y===e.y}function kM(n,e,t,i){const r=Vc(_t(n,e,t)),s=Vc(_t(n,e,i)),o=Vc(_t(t,i,n)),a=Vc(_t(t,i,e));return!!(r!==s&&o!==a||r===0&&zc(n,t,e)||s===0&&zc(n,i,e)||o===0&&zc(t,n,i)||a===0&&zc(t,e,i))}function zc(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function Vc(n){return n>0?1:n<0?-1:0}function iN(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&kM(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function xl(n,e){return _t(n.prev,n,n.next)<0?_t(n,e,n.next)>=0&&_t(n,n.prev,e)>=0:_t(n,e,n.prev)<0||_t(n,n.next,e)<0}function rN(n,e){let t=n,i=!1;const r=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function OM(n,e){const t=new zp(n.i,n.x,n.y),i=new zp(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function hv(n,e,t,i){const r=new zp(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function vl(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function zp(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function sN(n,e,t,i){let r=0;for(let s=e,o=t-i;s<t;s+=i)r+=(n[o]-n[s])*(n[s+1]+n[o+1]),o=s;return r}class bi{static area(e){const t=e.length;let i=0;for(let r=t-1,s=0;s<t;r=s++)i+=e[r].x*e[s].y-e[s].x*e[r].y;return i*.5}static isClockWise(e){return bi.area(e)<0}static triangulateShape(e,t){const i=[],r=[],s=[];fv(e),pv(i,e);let o=e.length;t.forEach(fv);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,pv(i,t[l]);const a=GI.triangulate(i,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function fv(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function pv(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}class th extends Ye{constructor(e=new gs([new Q(.5,.5),new Q(-.5,.5),new Q(-.5,-.5),new Q(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const i=this,r=[],s=[];for(let a=0,l=e.length;a<l;a++){const c=e[a];o(c)}this.setAttribute("position",new Pe(r,3)),this.setAttribute("uv",new Pe(s,2)),this.computeVertexNormals();function o(a){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,h=t.depth!==void 0?t.depth:1;let d=t.bevelEnabled!==void 0?t.bevelEnabled:!0,p=t.bevelThickness!==void 0?t.bevelThickness:.2,m=t.bevelSize!==void 0?t.bevelSize:p-.1,x=t.bevelOffset!==void 0?t.bevelOffset:0,g=t.bevelSegments!==void 0?t.bevelSegments:3;const f=t.extrudePath,v=t.UVGenerator!==void 0?t.UVGenerator:oN;let y,_=!1,C,w,E,A;f&&(y=f.getSpacedPoints(u),_=!0,d=!1,C=f.computeFrenetFrames(u,!1),w=new I,E=new I,A=new I),d||(g=0,p=0,m=0,x=0);const b=a.extractPoints(c);let M=b.shape;const L=b.holes;if(!bi.isClockWise(M)){M=M.reverse();for(let P=0,le=L.length;P<le;P++){const ie=L[P];bi.isClockWise(ie)&&(L[P]=ie.reverse())}}const B=bi.triangulateShape(M,L),j=M;for(let P=0,le=L.length;P<le;P++){const ie=L[P];M=M.concat(ie)}function U(P,le,ie){return le||console.error("THREE.ExtrudeGeometry: vec does not exist"),P.clone().addScaledVector(le,ie)}const z=M.length,Z=B.length;function D(P,le,ie){let ge,Y,Ue;const me=P.x-le.x,be=P.y-le.y,N=ie.x-P.x,T=ie.y-P.y,H=me*me+be*be,ee=me*T-be*N;if(Math.abs(ee)>Number.EPSILON){const J=Math.sqrt(H),ne=Math.sqrt(N*N+T*T),Le=le.x-be/J,pe=le.y+me/J,Me=ie.x-T/ne,We=ie.y+N/ne,ae=((Me-Le)*T-(We-pe)*N)/(me*T-be*N);ge=Le+me*ae-P.x,Y=pe+be*ae-P.y;const Se=ge*ge+Y*Y;if(Se<=2)return new Q(ge,Y);Ue=Math.sqrt(Se/2)}else{let J=!1;me>Number.EPSILON?N>Number.EPSILON&&(J=!0):me<-Number.EPSILON?N<-Number.EPSILON&&(J=!0):Math.sign(be)===Math.sign(T)&&(J=!0),J?(ge=-be,Y=me,Ue=Math.sqrt(H)):(ge=me,Y=be,Ue=Math.sqrt(H/2))}return new Q(ge/Ue,Y/Ue)}const $=[];for(let P=0,le=j.length,ie=le-1,ge=P+1;P<le;P++,ie++,ge++)ie===le&&(ie=0),ge===le&&(ge=0),$[P]=D(j[P],j[ie],j[ge]);const K=[];let se,Te=$.concat();for(let P=0,le=L.length;P<le;P++){const ie=L[P];se=[];for(let ge=0,Y=ie.length,Ue=Y-1,me=ge+1;ge<Y;ge++,Ue++,me++)Ue===Y&&(Ue=0),me===Y&&(me=0),se[ge]=D(ie[ge],ie[Ue],ie[me]);K.push(se),Te=Te.concat(se)}for(let P=0;P<g;P++){const le=P/g,ie=p*Math.cos(le*Math.PI/2),ge=m*Math.sin(le*Math.PI/2)+x;for(let Y=0,Ue=j.length;Y<Ue;Y++){const me=U(j[Y],$[Y],ge);de(me.x,me.y,-ie)}for(let Y=0,Ue=L.length;Y<Ue;Y++){const me=L[Y];se=K[Y];for(let be=0,N=me.length;be<N;be++){const T=U(me[be],se[be],ge);de(T.x,T.y,-ie)}}}const qe=m+x;for(let P=0;P<z;P++){const le=d?U(M[P],Te[P],qe):M[P];_?(E.copy(C.normals[0]).multiplyScalar(le.x),w.copy(C.binormals[0]).multiplyScalar(le.y),A.copy(y[0]).add(E).add(w),de(A.x,A.y,A.z)):de(le.x,le.y,0)}for(let P=1;P<=u;P++)for(let le=0;le<z;le++){const ie=d?U(M[le],Te[le],qe):M[le];_?(E.copy(C.normals[P]).multiplyScalar(ie.x),w.copy(C.binormals[P]).multiplyScalar(ie.y),A.copy(y[P]).add(E).add(w),de(A.x,A.y,A.z)):de(ie.x,ie.y,h/u*P)}for(let P=g-1;P>=0;P--){const le=P/g,ie=p*Math.cos(le*Math.PI/2),ge=m*Math.sin(le*Math.PI/2)+x;for(let Y=0,Ue=j.length;Y<Ue;Y++){const me=U(j[Y],$[Y],ge);de(me.x,me.y,h+ie)}for(let Y=0,Ue=L.length;Y<Ue;Y++){const me=L[Y];se=K[Y];for(let be=0,N=me.length;be<N;be++){const T=U(me[be],se[be],ge);_?de(T.x,T.y+y[u-1].y,y[u-1].x+ie):de(T.x,T.y,h+ie)}}}X(),oe();function X(){const P=r.length/3;if(d){let le=0,ie=z*le;for(let ge=0;ge<Z;ge++){const Y=B[ge];De(Y[2]+ie,Y[1]+ie,Y[0]+ie)}le=u+g*2,ie=z*le;for(let ge=0;ge<Z;ge++){const Y=B[ge];De(Y[0]+ie,Y[1]+ie,Y[2]+ie)}}else{for(let le=0;le<Z;le++){const ie=B[le];De(ie[2],ie[1],ie[0])}for(let le=0;le<Z;le++){const ie=B[le];De(ie[0]+z*u,ie[1]+z*u,ie[2]+z*u)}}i.addGroup(P,r.length/3-P,0)}function oe(){const P=r.length/3;let le=0;ve(j,le),le+=j.length;for(let ie=0,ge=L.length;ie<ge;ie++){const Y=L[ie];ve(Y,le),le+=Y.length}i.addGroup(P,r.length/3-P,1)}function ve(P,le){let ie=P.length;for(;--ie>=0;){const ge=ie;let Y=ie-1;Y<0&&(Y=P.length-1);for(let Ue=0,me=u+g*2;Ue<me;Ue++){const be=z*Ue,N=z*(Ue+1),T=le+ge+be,H=le+Y+be,ee=le+Y+N,J=le+ge+N;He(T,H,ee,J)}}}function de(P,le,ie){l.push(P),l.push(le),l.push(ie)}function De(P,le,ie){Be(P),Be(le),Be(ie);const ge=r.length/3,Y=v.generateTopUV(i,r,ge-3,ge-2,ge-1);it(Y[0]),it(Y[1]),it(Y[2])}function He(P,le,ie,ge){Be(P),Be(le),Be(ge),Be(le),Be(ie),Be(ge);const Y=r.length/3,Ue=v.generateSideWallUV(i,r,Y-6,Y-3,Y-2,Y-1);it(Ue[0]),it(Ue[1]),it(Ue[3]),it(Ue[1]),it(Ue[2]),it(Ue[3])}function Be(P){r.push(l[P*3+0]),r.push(l[P*3+1]),r.push(l[P*3+2])}function it(P){s.push(P.x),s.push(P.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,i=this.parameters.options;return aN(t,i,e)}static fromJSON(e,t){const i=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=t[e.shapes[s]];i.push(a)}const r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new ud[r.type]().fromJSON(r)),new th(i,e.options)}}const oN={generateTopUV:function(n,e,t,i,r){const s=e[t*3],o=e[t*3+1],a=e[i*3],l=e[i*3+1],c=e[r*3],u=e[r*3+1];return[new Q(s,o),new Q(a,l),new Q(c,u)]},generateSideWallUV:function(n,e,t,i,r,s){const o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[i*3],u=e[i*3+1],h=e[i*3+2],d=e[r*3],p=e[r*3+1],m=e[r*3+2],x=e[s*3],g=e[s*3+1],f=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new Q(o,1-l),new Q(c,1-h),new Q(d,1-m),new Q(x,1-f)]:[new Q(a,1-l),new Q(u,1-h),new Q(p,1-m),new Q(g,1-f)]}};function aN(n,e,t){if(t.shapes=[],Array.isArray(n))for(let i=0,r=n.length;i<r;i++){const s=n[i];t.shapes.push(s.uuid)}else t.shapes.push(n.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class nh extends Fr{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,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(r,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new nh(e.radius,e.detail)}}class Dl extends Fr{constructor(e=1,t=0){const i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[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(i,r,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Dl(e.radius,e.detail)}}class ih extends Ye{constructor(e=.5,t=1,i=32,r=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:r,thetaStart:s,thetaLength:o},i=Math.max(3,i),r=Math.max(1,r);const a=[],l=[],c=[],u=[];let h=e;const d=(t-e)/r,p=new I,m=new Q;for(let x=0;x<=r;x++){for(let g=0;g<=i;g++){const f=s+g/i*o;p.x=h*Math.cos(f),p.y=h*Math.sin(f),l.push(p.x,p.y,p.z),c.push(0,0,1),m.x=(p.x/t+1)/2,m.y=(p.y/t+1)/2,u.push(m.x,m.y)}h+=d}for(let x=0;x<r;x++){const g=x*(i+1);for(let f=0;f<i;f++){const v=f+g,y=v,_=v+i+1,C=v+i+2,w=v+1;a.push(y,_,w),a.push(_,C,w)}}this.setIndex(a),this.setAttribute("position",new Pe(l,3)),this.setAttribute("normal",new Pe(c,3)),this.setAttribute("uv",new Pe(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ih(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class rh extends Ye{constructor(e=new gs([new Q(0,.5),new Q(-.5,-.5),new Q(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const i=[],r=[],s=[],o=[];let a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let u=0;u<e.length;u++)c(e[u]),this.addGroup(a,l,u),a+=l,l=0;this.setIndex(i),this.setAttribute("position",new Pe(r,3)),this.setAttribute("normal",new Pe(s,3)),this.setAttribute("uv",new Pe(o,2));function c(u){const h=r.length/3,d=u.extractPoints(t);let p=d.shape;const m=d.holes;bi.isClockWise(p)===!1&&(p=p.reverse());for(let g=0,f=m.length;g<f;g++){const v=m[g];bi.isClockWise(v)===!0&&(m[g]=v.reverse())}const x=bi.triangulateShape(p,m);for(let g=0,f=m.length;g<f;g++){const v=m[g];p=p.concat(v)}for(let g=0,f=p.length;g<f;g++){const v=p[g];r.push(v.x,v.y,0),s.push(0,0,1),o.push(v.x,v.y)}for(let g=0,f=x.length;g<f;g++){const v=x[g],y=v[0]+h,_=v[1]+h,C=v[2]+h;i.push(y,_,C),l+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return lN(t,e)}static fromJSON(e,t){const i=[];for(let r=0,s=e.shapes.length;r<s;r++){const o=t[e.shapes[r]];i.push(o)}return new rh(i,e.curveSegments)}}function lN(n,e){if(e.shapes=[],Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const r=n[t];e.shapes.push(r.uuid)}else e.shapes.push(n.uuid);return e}class Ul extends Ye{constructor(e=1,t=32,i=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const l=Math.min(o+a,Math.PI);let c=0;const u=[],h=new I,d=new I,p=[],m=[],x=[],g=[];for(let f=0;f<=i;f++){const v=[],y=f/i;let _=0;f===0&&o===0?_=.5/t:f===i&&l===Math.PI&&(_=-.5/t);for(let C=0;C<=t;C++){const w=C/t;h.x=-e*Math.cos(r+w*s)*Math.sin(o+y*a),h.y=e*Math.cos(o+y*a),h.z=e*Math.sin(r+w*s)*Math.sin(o+y*a),m.push(h.x,h.y,h.z),d.copy(h).normalize(),x.push(d.x,d.y,d.z),g.push(w+_,1-y),v.push(c++)}u.push(v)}for(let f=0;f<i;f++)for(let v=0;v<t;v++){const y=u[f][v+1],_=u[f][v],C=u[f+1][v],w=u[f+1][v+1];(f!==0||o>0)&&p.push(y,_,w),(f!==i-1||l<Math.PI)&&p.push(_,C,w)}this.setIndex(p),this.setAttribute("position",new Pe(m,3)),this.setAttribute("normal",new Pe(x,3)),this.setAttribute("uv",new Pe(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ul(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class sh extends Fr{constructor(e=1,t=0){const i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];super(i,r,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new sh(e.radius,e.detail)}}class oh extends Ye{constructor(e=1,t=.4,i=12,r=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:s},i=Math.floor(i),r=Math.floor(r);const o=[],a=[],l=[],c=[],u=new I,h=new I,d=new I;for(let p=0;p<=i;p++)for(let m=0;m<=r;m++){const x=m/r*s,g=p/i*Math.PI*2;h.x=(e+t*Math.cos(g))*Math.cos(x),h.y=(e+t*Math.cos(g))*Math.sin(x),h.z=t*Math.sin(g),a.push(h.x,h.y,h.z),u.x=e*Math.cos(x),u.y=e*Math.sin(x),d.subVectors(h,u).normalize(),l.push(d.x,d.y,d.z),c.push(m/r),c.push(p/i)}for(let p=1;p<=i;p++)for(let m=1;m<=r;m++){const x=(r+1)*p+m-1,g=(r+1)*(p-1)+m-1,f=(r+1)*(p-1)+m,v=(r+1)*p+m;o.push(x,g,v),o.push(g,f,v)}this.setIndex(o),this.setAttribute("position",new Pe(a,3)),this.setAttribute("normal",new Pe(l,3)),this.setAttribute("uv",new Pe(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new oh(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class ah extends Ye{constructor(e=1,t=.4,i=64,r=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:s,q:o},i=Math.floor(i),r=Math.floor(r);const a=[],l=[],c=[],u=[],h=new I,d=new I,p=new I,m=new I,x=new I,g=new I,f=new I;for(let y=0;y<=i;++y){const _=y/i*s*Math.PI*2;v(_,s,o,e,p),v(_+.01,s,o,e,m),g.subVectors(m,p),f.addVectors(m,p),x.crossVectors(g,f),f.crossVectors(x,g),x.normalize(),f.normalize();for(let C=0;C<=r;++C){const w=C/r*Math.PI*2,E=-t*Math.cos(w),A=t*Math.sin(w);h.x=p.x+(E*f.x+A*x.x),h.y=p.y+(E*f.y+A*x.y),h.z=p.z+(E*f.z+A*x.z),l.push(h.x,h.y,h.z),d.subVectors(h,p).normalize(),c.push(d.x,d.y,d.z),u.push(y/i),u.push(C/r)}}for(let y=1;y<=i;y++)for(let _=1;_<=r;_++){const C=(r+1)*(y-1)+(_-1),w=(r+1)*y+(_-1),E=(r+1)*y+_,A=(r+1)*(y-1)+_;a.push(C,w,A),a.push(w,E,A)}this.setIndex(a),this.setAttribute("position",new Pe(l,3)),this.setAttribute("normal",new Pe(c,3)),this.setAttribute("uv",new Pe(u,2));function v(y,_,C,w,E){const A=Math.cos(y),b=Math.sin(y),M=C/_*y,L=Math.cos(M);E.x=w*(2+L)*.5*A,E.y=w*(2+L)*b*.5,E.z=w*Math.sin(M)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ah(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class lh extends Ye{constructor(e=new pg(new I(-1,-1,0),new I(-1,1,0),new I(1,1,0)),t=64,i=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:r,closed:s};const o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new I,l=new I,c=new Q;let u=new I;const h=[],d=[],p=[],m=[];x(),this.setIndex(m),this.setAttribute("position",new Pe(h,3)),this.setAttribute("normal",new Pe(d,3)),this.setAttribute("uv",new Pe(p,2));function x(){for(let y=0;y<t;y++)g(y);g(s===!1?t:0),v(),f()}function g(y){u=e.getPointAt(y/t,u);const _=o.normals[y],C=o.binormals[y];for(let w=0;w<=r;w++){const E=w/r*Math.PI*2,A=Math.sin(E),b=-Math.cos(E);l.x=b*_.x+A*C.x,l.y=b*_.y+A*C.y,l.z=b*_.z+A*C.z,l.normalize(),d.push(l.x,l.y,l.z),a.x=u.x+i*l.x,a.y=u.y+i*l.y,a.z=u.z+i*l.z,h.push(a.x,a.y,a.z)}}function f(){for(let y=1;y<=t;y++)for(let _=1;_<=r;_++){const C=(r+1)*(y-1)+(_-1),w=(r+1)*y+(_-1),E=(r+1)*y+_,A=(r+1)*(y-1)+_;m.push(C,w,A),m.push(w,E,A)}}function v(){for(let y=0;y<=t;y++)for(let _=0;_<=r;_++)c.x=y/t,c.y=_/r,p.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 lh(new ud[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class FM extends Ye{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],i=new Set,r=new I,s=new I;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,u=l.length;c<u;++c){const h=l[c],d=h.start,p=h.count;for(let m=d,x=d+p;m<x;m+=3)for(let g=0;g<3;g++){const f=a.getX(m+g),v=a.getX(m+(g+1)%3);r.fromBufferAttribute(o,f),s.fromBufferAttribute(o,v),mv(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.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 u=3*a+c,h=3*a+(c+1)%3;r.fromBufferAttribute(o,u),s.fromBufferAttribute(o,h),mv(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Pe(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function mv(n,e,t){const i=`${n.x},${n.y},${n.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${n.x},${n.y},${n.z}`;return t.has(i)===!0||t.has(r)===!0?!1:(t.add(i),t.add(r),!0)}var gv=Object.freeze({__proto__:null,BoxGeometry:Cs,CapsuleGeometry:Zd,CircleGeometry:Kd,ConeGeometry:Jd,CylinderGeometry:Xo,DodecahedronGeometry:Qd,EdgesGeometry:DM,ExtrudeGeometry:th,IcosahedronGeometry:nh,LatheGeometry:Ll,OctahedronGeometry:Dl,PlaneGeometry:Wo,PolyhedronGeometry:Fr,RingGeometry:ih,ShapeGeometry:rh,SphereGeometry:Ul,TetrahedronGeometry:sh,TorusGeometry:oh,TorusKnotGeometry:ah,TubeGeometry:lh,WireframeGeometry:FM});class BM extends on{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new _e(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 zM extends ci{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class gg extends on{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new _e(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 _e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new Q(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 On,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 VM extends gg{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 Q(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return At(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new _e(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 _e(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new _e(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 HM extends on{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new _e(16777215),this.specular=new _e(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new Q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new On,this.combine=Cl,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 GM extends on{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new _e(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new Q(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 WM extends on{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new Q(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 jM extends on{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new _e(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new Q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new On,this.combine=Cl,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 XM extends on{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new _e(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new Q(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 $M extends xn{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 us(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function YM(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function qM(n){function e(r,s){return n[r]-n[s]}const t=n.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i}function Vp(n,e,t){const i=n.length,r=new n.constructor(i);for(let s=0,o=0;o!==i;++s){const a=t[s]*e;for(let l=0;l!==e;++l)r[o++]=n[a+l]}return r}function xg(n,e,t,i){let r=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[r++];if(s===void 0)return;let o=s[i];if(o!==void 0)if(Array.isArray(o))do o=s[i],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[r++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[i],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[r++];while(s!==void 0);else do o=s[i],o!==void 0&&(e.push(s.time),t.push(o)),s=n[r++];while(s!==void 0)}function cN(n,e,t,i,r=30){const s=n.clone();s.name=e;const o=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],u=c.getValueSize(),h=[],d=[];for(let p=0;p<c.times.length;++p){const m=c.times[p]*r;if(!(m<t||m>=i)){h.push(c.times[p]);for(let x=0;x<u;++x)d.push(c.values[p*u+x])}}h.length!==0&&(c.times=us(h,c.times.constructor),c.values=us(d,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 uN(n,e=0,t=n,i=30){i<=0&&(i=30);const r=t.tracks.length,s=e/i;for(let o=0;o<r;++o){const a=t.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;const c=n.tracks.find(function(f){return f.name===a.name&&f.ValueTypeName===l});if(c===void 0)continue;let u=0;const h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=h/3);let d=0;const p=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=p/3);const m=a.times.length-1;let x;if(s<=a.times[0]){const f=u,v=h-u;x=a.values.slice(f,v)}else if(s>=a.times[m]){const f=m*h+u,v=f+h-u;x=a.values.slice(f,v)}else{const f=a.createInterpolant(),v=u,y=h-u;f.evaluate(s),x=f.resultBuffer.slice(v,y)}l==="quaternion"&&new En().fromArray(x).normalize().conjugate().toArray(x);const g=c.times.length;for(let f=0;f<g;++f){const v=f*p+d;if(l==="quaternion")En.multiplyQuaternionsFlat(c.values,v,x,0,c.values,v);else{const y=p-d*2;for(let _=0;_<y;++_)c.values[v+_]-=x[_]}}}return n.blendMode=Km,n}const dN={convertArray:us,isTypedArray:YM,getKeyframeOrder:qM,sortedArray:Vp,flattenJSON:xg,subclip:cN,makeClipAdditive:uN};class kl{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,r=t[i],s=t[i-1];e:{t:{let o;n:{i:if(!(e<r)){for(let a=i+2;;){if(r===void 0){if(e<s)break i;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(s=r,r=t[++i],e<r)break t}o=t.length;break n}if(!(e>=s)){const a=t[1];e<a&&(i=2,s=a);for(let l=i-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===l)break;if(r=s,s=t[--i-1],e>=s)break t}o=i,i=0;break n}break e}for(;i<o;){const a=i+o>>>1;e<t[a]?o=a:i=a+1}if(r=t[i],s=t[i-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,r)}return this.interpolate_(i,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=i[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class ZM extends kl{constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:as,endingEnd:as}}intervalChanged_(e,t,i){const r=this.parameterPositions;let s=e-2,o=e+1,a=r[s],l=r[o];if(a===void 0)switch(this.getSettings_().endingStart){case ls:s=e,a=2*t-i;break;case ll:s=r.length-2,a=t+r[s]-r[s+1];break;default:s=e,a=i}if(l===void 0)switch(this.getSettings_().endingEnd){case ls:o=e,l=2*i-t;break;case ll:o=1,l=i+r[1]-r[0];break;default:o=e-1,l=t}const c=(i-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-i),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,h=this._offsetNext,d=this._weightPrev,p=this._weightNext,m=(i-t)/(r-t),x=m*m,g=x*m,f=-d*g+2*d*x-d*m,v=(1+d)*g+(-1.5-2*d)*x+(-.5+d)*m+1,y=(-1-p)*g+(1.5+p)*x+.5*m,_=p*g-p*x;for(let C=0;C!==a;++C)s[C]=f*o[u+C]+v*o[c+C]+y*o[l+C]+_*o[h+C];return s}}class vg extends kl{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(i-t)/(r-t),h=1-u;for(let d=0;d!==a;++d)s[d]=o[c+d]*h+o[l+d]*u;return s}}class KM extends kl{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class di{constructor(e,t,i,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=us(t,this.TimeBufferType),this.values=us(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:us(e.times,Array),values:us(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new KM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new vg(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new ZM(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case al:t=this.InterpolantFactoryMethodDiscrete;break;case ad:t=this.InterpolantFactoryMethodLinear;break;case au:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const i="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(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return al;case this.InterpolantFactoryMethodLinear:return ad;case this.InterpolantFactoryMethodSmooth:return au}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){const i=this.times,r=i.length;let s=0,o=r-1;for(;s!==r&&i[s]<e;)++s;for(;o!==-1&&i[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=i.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,r=this.values,s=i.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=i[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(r!==void 0&&YM(r))for(let a=0,l=r.length;a!==l;++a){const c=r[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(),t=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===au,s=e.length-1;let o=1;for(let a=1;a<s;++a){let l=!1;const c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(r)l=!0;else{const h=a*i,d=h-i,p=h+i;for(let m=0;m!==i;++m){const x=t[h+m];if(x!==t[d+m]||x!==t[p+m]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];const h=a*i,d=o*i;for(let p=0;p!==i;++p)t[d+p]=t[h+p]}++o}}if(s>0){e[o]=e[s];for(let a=s*i,l=o*i,c=0;c!==i;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}di.prototype.TimeBufferType=Float32Array;di.prototype.ValueBufferType=Float32Array;di.prototype.DefaultInterpolation=ad;class Rs extends di{constructor(e,t,i){super(e,t,i)}}Rs.prototype.ValueTypeName="bool";Rs.prototype.ValueBufferType=Array;Rs.prototype.DefaultInterpolation=al;Rs.prototype.InterpolantFactoryMethodLinear=void 0;Rs.prototype.InterpolantFactoryMethodSmooth=void 0;class yg extends di{}yg.prototype.ValueTypeName="color";class yl extends di{}yl.prototype.ValueTypeName="number";class JM extends kl{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-t)/(r-t);let c=e*a;for(let u=c+a;c!==u;c+=4)En.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Ol extends di{InterpolantFactoryMethodLinear(e){return new JM(this.times,this.values,this.getValueSize(),e)}}Ol.prototype.ValueTypeName="quaternion";Ol.prototype.InterpolantFactoryMethodSmooth=void 0;class Ps extends di{constructor(e,t,i){super(e,t,i)}}Ps.prototype.ValueTypeName="string";Ps.prototype.ValueBufferType=Array;Ps.prototype.DefaultInterpolation=al;Ps.prototype.InterpolantFactoryMethodLinear=void 0;Ps.prototype.InterpolantFactoryMethodSmooth=void 0;class _l extends di{}_l.prototype.ValueTypeName="vector";class Sl{constructor(e="",t=-1,i=[],r=Od){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=Un(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(fN(i[o]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=i.length;s!==o;++s)t.push(di.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.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 u=qM(l);l=Vp(l,1,u),c=Vp(c,1,u),!r&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new yl(".morphTargetInfluences["+t[a].name+"]",l,c).scale(1/i))}return new this(e,-1,o)}static findByName(e,t){let i=e;if(!Array.isArray(e)){const r=e;i=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<i.length;r++)if(i[r].name===t)return i[r];return null}static CreateClipsFromMorphTargetSequences(e,t,i){const r={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){const c=e[a],u=c.name.match(s);if(u&&u.length>1){const h=u[1];let d=r[h];d||(r[h]=d=[]),d.push(c)}}const o=[];for(const a in r)o.push(this.CreateFromMorphTargetSequence(a,r[a],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(h,d,p,m,x){if(p.length!==0){const g=[],f=[];xg(p,g,f,m),g.length!==0&&x.push(new h(d,g,f))}},r=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h<c.length;h++){const d=c[h].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const p={};let m;for(m=0;m<d.length;m++)if(d[m].morphTargets)for(let x=0;x<d[m].morphTargets.length;x++)p[d[m].morphTargets[x]]=-1;for(const x in p){const g=[],f=[];for(let v=0;v!==d[m].morphTargets.length;++v){const y=d[m];g.push(y.time),f.push(y.morphTarget===x?1:0)}r.push(new yl(".morphTargetInfluence["+x+"]",g,f))}l=p.length*o}else{const p=".bones["+t[h].name+"]";i(_l,p+".position",d,"pos",r),i(Ol,p+".quaternion",d,"rot",r),i(_l,p+".scale",d,"scl",r)}}return r.length===0?null:new this(s,l,r,a)}resetDuration(){const e=this.tracks;let t=0;for(let i=0,r=e.length;i!==r;++i){const s=this.tracks[i];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,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 t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function hN(n){switch(n.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return yl;case"vector":case"vector2":case"vector3":case"vector4":return _l;case"color":return yg;case"quaternion":return Ol;case"bool":case"boolean":return Rs;case"string":return Ps}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+n)}function fN(n){if(n.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=hN(n.type);if(n.times===void 0){const t=[],i=[];xg(n.keys,t,i,"value"),n.times=t,n.values=i}return e.parse!==void 0?e.parse(n):new e(n.name,n.times,n.values,n.interpolation)}const Hi={enabled:!1,files:{},add:function(n,e){this.enabled!==!1&&(this.files[n]=e)},get:function(n){if(this.enabled!==!1)return this.files[n]},remove:function(n){delete this.files[n]},clear:function(){this.files={}}};class _g{constructor(e,t,i){const r=this;let s=!1,o=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(u){a++,s===!1&&r.onStart!==void 0&&r.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,r.onProgress!==void 0&&r.onProgress(u,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,h){return c.push(u,h),this},this.removeHandler=function(u){const h=c.indexOf(u);return h!==-1&&c.splice(h,2),this},this.getHandler=function(u){for(let h=0,d=c.length;h<d;h+=2){const p=c[h],m=c[h+1];if(p.global&&(p.lastIndex=0),p.test(u))return m}return null}}}const QM=new _g;class Tn{constructor(e){this.manager=e!==void 0?e:QM,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const i=this;return new Promise(function(r,s){i.load(e,r,t,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}}Tn.DEFAULT_MATERIAL_NAME="__DEFAULT";const Ui={};class pN extends Error{constructor(e,t){super(e),this.response=t}}class Qi extends Tn{constructor(e){super(e)}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Hi.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Ui[e]!==void 0){Ui[e].push({onLoad:t,onProgress:i,onError:r});return}Ui[e]=[],Ui[e].push({onLoad:t,onProgress:i,onError:r});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 u=Ui[e],h=c.body.getReader(),d=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),p=d?parseInt(d):0,m=p!==0;let x=0;const g=new ReadableStream({start(f){v();function v(){h.read().then(({done:y,value:_})=>{if(y)f.close();else{x+=_.byteLength;const C=new ProgressEvent("progress",{lengthComputable:m,loaded:x,total:p});for(let w=0,E=u.length;w<E;w++){const A=u[w];A.onProgress&&A.onProgress(C)}f.enqueue(_),v()}},y=>{f.error(y)})}}});return new Response(g)}else throw new pN(`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(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a===void 0)return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),d=h&&h[1]?h[1].toLowerCase():void 0,p=new TextDecoder(d);return c.arrayBuffer().then(m=>p.decode(m))}}}).then(c=>{Hi.add(e,c);const u=Ui[e];delete Ui[e];for(let h=0,d=u.length;h<d;h++){const p=u[h];p.onLoad&&p.onLoad(c)}}).catch(c=>{const u=Ui[e];if(u===void 0)throw this.manager.itemError(e),c;delete Ui[e];for(let h=0,d=u.length;h<d;h++){const p=u[h];p.onError&&p.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 mN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Qi(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=[];for(let i=0;i<e.length;i++){const r=Sl.parse(e[i]);t.push(r)}return t}}class gN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=[],a=new Yd,l=new Qi(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function u(h){l.load(e[h],function(d){const p=s.parse(d,!0);o[h]={width:p.width,height:p.height,format:p.format,mipmaps:p.mipmaps},c+=1,c===6&&(p.mipmapCount===1&&(a.minFilter=Ut),a.image=o,a.format=p.format,a.needsUpdate=!0,t&&t(a))},i,r)}if(Array.isArray(e))for(let h=0,d=e.length;h<d;++h)u(h);else l.load(e,function(h){const d=s.parse(h,!0);if(d.isCubemap){const p=d.mipmaps.length/d.mipmapCount;for(let m=0;m<p;m++){o[m]={mipmaps:[]};for(let x=0;x<d.mipmapCount;x++)o[m].mipmaps.push(d.mipmaps[m*d.mipmapCount+x]),o[m].format=d.format,o[m].width=d.width,o[m].height=d.height}a.image=o}else a.image.width=d.width,a.image.height=d.height,a.mipmaps=d.mipmaps;d.mipmapCount===1&&(a.minFilter=Ut),a.format=d.format,a.needsUpdate=!0,t&&t(a)},i,r);return a}}class Ml extends Tn{constructor(e){super(e)}load(e,t,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Hi.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=pl("img");function l(){u(),Hi.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(h){u(),r&&r(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){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 xN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=new Il;s.colorSpace=Hn;const o=new Ml(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(u){s.images[c]=u,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,r)}for(let c=0;c<e.length;++c)l(c);return s}}class vN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new wi,a=new Qi(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(u){if(r!==void 0)r(u);else{console.error(u);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:Xn,o.wrapT=c.wrapT!==void 0?c.wrapT:Xn,o.magFilter=c.magFilter!==void 0?c.magFilter:Ut,o.minFilter=c.minFilter!==void 0?c.minFilter:Ut,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=yi),c.mipmapCount===1&&(o.minFilter=Ut),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,t&&t(o,c)},i,r),o}}class yN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=new Ct,o=new Ml(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},i,r),s}}class Br extends nt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new _e(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}class ew extends Br{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(nt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new _e(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const If=new ke,xv=new I,vv=new I;class Sg{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Q(512,512),this.map=null,this.mapPass=null,this.matrix=new ke,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Nl,this._frameExtents=new Q(1,1),this._viewportCount=1,this._viewports=[new ct(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;xv.setFromMatrixPosition(e.matrixWorld),t.position.copy(xv),vv.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(vv),t.updateMatrixWorld(),If.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(If),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(If)}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 _N extends Sg{constructor(){super(new Yt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=Uo*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(i!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=i,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class tw extends Br{constructor(e,t,i=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(nt.DEFAULT_UP),this.updateMatrix(),this.target=new nt,this.distance=i,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new _N}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),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 yv=new ke,pa=new I,Nf=new I;class SN extends Sg{constructor(){super(new Yt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Q(4,2),this._viewportCount=6,this._viewports=[new ct(2,1,1,1),new ct(0,1,1,1),new ct(3,1,1,1),new ct(1,1,1,1),new ct(3,0,1,1),new ct(1,0,1,1)],this._cubeDirections=[new I(1,0,0),new I(-1,0,0),new I(0,0,1),new I(0,0,-1),new I(0,1,0),new I(0,-1,0)],this._cubeUps=[new I(0,1,0),new I(0,1,0),new I(0,1,0),new I(0,1,0),new I(0,0,1),new I(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,r=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),pa.setFromMatrixPosition(e.matrixWorld),i.position.copy(pa),Nf.copy(i.position),Nf.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(Nf),i.updateMatrixWorld(),r.makeTranslation(-pa.x,-pa.y,-pa.z),yv.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(yv)}}class nw extends Br{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new SN}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class MN extends Sg{constructor(){super(new Hd(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class iw extends Br{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(nt.DEFAULT_UP),this.updateMatrix(),this.target=new nt,this.shadow=new MN}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class rw extends Br{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class sw extends Br{constructor(e,t,i=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=i,this.height=r}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 t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class ow{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new I)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const i=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*i),t.addScaledVector(o[4],1.092548*(i*r)),t.addScaledVector(o[5],1.092548*(r*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(i*s)),t.addScaledVector(o[8],.546274*(i*i-r*r)),t}getIrradianceAt(e,t){const i=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*r),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*i),t.addScaledVector(o[4],2*.429043*i*r),t.addScaledVector(o[5],2*.429043*r*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*i*s),t.addScaledVector(o[8],.429043*(i*i-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(e.coefficients[i],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let i=0;i<9;i++)this.coefficients[i].lerp(e.coefficients[i],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){const i=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*i,t[4]=1.092548*i*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*i*s,t[8]=.546274*(i*i-r*r)}}class aw extends Br{constructor(e=new ow,t=1){super(void 0,t),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 t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class ch extends Tn{constructor(e){super(e),this.textures={}}load(e,t,i,r){const s=this,o=new Qi(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=this.textures;function i(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const r=ch.createMaterialFromType(e.type);if(e.uuid!==void 0&&(r.uuid=e.uuid),e.name!==void 0&&(r.name=e.name),e.color!==void 0&&r.color!==void 0&&r.color.setHex(e.color),e.roughness!==void 0&&(r.roughness=e.roughness),e.metalness!==void 0&&(r.metalness=e.metalness),e.sheen!==void 0&&(r.sheen=e.sheen),e.sheenColor!==void 0&&(r.sheenColor=new _e().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(r.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&r.emissive!==void 0&&r.emissive.setHex(e.emissive),e.specular!==void 0&&r.specular!==void 0&&r.specular.setHex(e.specular),e.specularIntensity!==void 0&&(r.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&r.specularColor!==void 0&&r.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(r.shininess=e.shininess),e.clearcoat!==void 0&&(r.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(r.dispersion=e.dispersion),e.iridescence!==void 0&&(r.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(r.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(r.transmission=e.transmission),e.thickness!==void 0&&(r.thickness=e.thickness),e.attenuationDistance!==void 0&&(r.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&r.attenuationColor!==void 0&&r.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(r.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(r.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(r.fog=e.fog),e.flatShading!==void 0&&(r.flatShading=e.flatShading),e.blending!==void 0&&(r.blending=e.blending),e.combine!==void 0&&(r.combine=e.combine),e.side!==void 0&&(r.side=e.side),e.shadowSide!==void 0&&(r.shadowSide=e.shadowSide),e.opacity!==void 0&&(r.opacity=e.opacity),e.transparent!==void 0&&(r.transparent=e.transparent),e.alphaTest!==void 0&&(r.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(r.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(r.depthFunc=e.depthFunc),e.depthTest!==void 0&&(r.depthTest=e.depthTest),e.depthWrite!==void 0&&(r.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(r.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(r.blendSrc=e.blendSrc),e.blendDst!==void 0&&(r.blendDst=e.blendDst),e.blendEquation!==void 0&&(r.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(r.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(r.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(r.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&r.blendColor!==void 0&&r.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(r.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(r.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(r.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(r.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(r.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(r.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(r.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(r.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(r.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(r.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(r.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(r.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(r.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(r.rotation=e.rotation),e.linewidth!==void 0&&(r.linewidth=e.linewidth),e.dashSize!==void 0&&(r.dashSize=e.dashSize),e.gapSize!==void 0&&(r.gapSize=e.gapSize),e.scale!==void 0&&(r.scale=e.scale),e.polygonOffset!==void 0&&(r.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(r.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(r.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(r.dithering=e.dithering),e.alphaToCoverage!==void 0&&(r.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(r.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(r.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(r.visible=e.visible),e.toneMapped!==void 0&&(r.toneMapped=e.toneMapped),e.userData!==void 0&&(r.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(r.uniforms[s]={},o.type){case"t":r.uniforms[s].value=i(o.value);break;case"c":r.uniforms[s].value=new _e().setHex(o.value);break;case"v2":r.uniforms[s].value=new Q().fromArray(o.value);break;case"v3":r.uniforms[s].value=new I().fromArray(o.value);break;case"v4":r.uniforms[s].value=new ct().fromArray(o.value);break;case"m3":r.uniforms[s].value=new je().fromArray(o.value);break;case"m4":r.uniforms[s].value=new ke().fromArray(o.value);break;default:r.uniforms[s].value=o.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)r.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(r.lights=e.lights),e.clipping!==void 0&&(r.clipping=e.clipping),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=i(e.map)),e.matcap!==void 0&&(r.matcap=i(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new Q().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=i(e.envMap)),e.envMapRotation!==void 0&&r.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new Q().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=i(e.thicknessMap)),e.anisotropyMap!==void 0&&(r.anisotropyMap=i(e.anisotropyMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=i(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:BM,SpriteMaterial:ag,RawShaderMaterial:zM,ShaderMaterial:ci,PointsMaterial:cg,MeshPhysicalMaterial:VM,MeshStandardMaterial:gg,MeshPhongMaterial:HM,MeshToonMaterial:GM,MeshNormalMaterial:WM,MeshLambertMaterial:jM,MeshDepthMaterial:sg,MeshDistanceMaterial:og,MeshBasicMaterial:Or,MeshMatcapMaterial:XM,LineDashedMaterial:$M,LineBasicMaterial:xn,Material:on};return new t[e]}}class Hp{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 t="";for(let i=0,r=e.length;i<r;i++)t+=String.fromCharCode(e[i]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class lw extends Ye{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 cw extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Qi(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t={},i={};function r(p,m){if(t[m]!==void 0)return t[m];const g=p.interleavedBuffers[m],f=s(p,g.buffer),v=po(g.type,f),y=new Xd(v,g.stride);return y.uuid=g.uuid,t[m]=y,y}function s(p,m){if(i[m]!==void 0)return i[m];const g=p.arrayBuffers[m],f=new Uint32Array(g).buffer;return i[m]=f,f}const o=e.isInstancedBufferGeometry?new lw:new Ye,a=e.data.index;if(a!==void 0){const p=po(a.type,a.array);o.setIndex(new ht(p,1))}const l=e.data.attributes;for(const p in l){const m=l[p];let x;if(m.isInterleavedBufferAttribute){const g=r(e.data,m.data);x=new bs(g,m.itemSize,m.offset,m.normalized)}else{const g=po(m.type,m.array),f=m.isInstancedBufferAttribute?Oo:ht;x=new f(g,m.itemSize,m.normalized)}m.name!==void 0&&(x.name=m.name),m.usage!==void 0&&x.setUsage(m.usage),o.setAttribute(p,x)}const c=e.data.morphAttributes;if(c)for(const p in c){const m=c[p],x=[];for(let g=0,f=m.length;g<f;g++){const v=m[g];let y;if(v.isInterleavedBufferAttribute){const _=r(e.data,v.data);y=new bs(_,v.itemSize,v.offset,v.normalized)}else{const _=po(v.type,v.array);y=new ht(_,v.itemSize,v.normalized)}v.name!==void 0&&(y.name=v.name),x.push(y)}o.morphAttributes[p]=x}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let p=0,m=h.length;p!==m;++p){const x=h[p];o.addGroup(x.start,x.count,x.materialIndex)}const d=e.data.boundingSphere;if(d!==void 0){const p=new I;d.center!==void 0&&p.fromArray(d.center),o.boundingSphere=new rn(p,d.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class wN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=this.path===""?Hp.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new Qi(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(h){r!==void 0&&r(h),console.error("THREE:ObjectLoader: Can't parse "+e+".",h.message);return}const u=c.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry"){r!==void 0&&r(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(c,t)},i,r)}async loadAsync(e,t){const i=this,r=this.path===""?Hp.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||r;const s=new Qi(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const o=await s.loadAsync(e,t),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 i.parseAsync(a)}parse(e,t){const i=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,r),o=this.parseImages(e.images,function(){t!==void 0&&t(c)}),a=this.parseTextures(e.textures,o),l=this.parseMaterials(e.materials,a),c=this.parseObject(e.object,s,l,a,i),u=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,u),this.bindLightTargets(c),t!==void 0){let h=!1;for(const d in o)if(o[d].data instanceof HTMLImageElement){h=!0;break}h===!1&&t(c)}return c}async parseAsync(e){const t=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),s=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,r,a,o,t),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),this.bindLightTargets(l),l}parseShapes(e){const t={};if(e!==void 0)for(let i=0,r=e.length;i<r;i++){const s=new gs().fromJSON(e[i]);t[s.uuid]=s}return t}parseSkeletons(e,t){const i={},r={};if(t.traverse(function(s){s.isBone&&(r[s.uuid]=s)}),e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=new $d().fromJSON(e[s],r);i[a.uuid]=a}return i}parseGeometries(e,t){const i={};if(e!==void 0){const r=new cw;for(let s=0,o=e.length;s<o;s++){let a;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":a=r.parse(l);break;default:l.type in gv?a=gv[l.type].fromJSON(l,t):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),i[l.uuid]=a}}return i}parseMaterials(e,t){const i={},r={};if(e!==void 0){const s=new ch;s.setTextures(t);for(let o=0,a=e.length;o<a;o++){const l=e[o];i[l.uuid]===void 0&&(i[l.uuid]=s.parse(l)),r[l.uuid]=i[l.uuid]}}return r}parseAnimations(e){const t={};if(e!==void 0)for(let i=0;i<e.length;i++){const r=e[i],s=Sl.parse(r);t[s.uuid]=s}return t}parseImages(e,t){const i=this,r={};let s;function o(l){return i.manager.itemStart(l),s.load(l,function(){i.manager.itemEnd(l)},void 0,function(){i.manager.itemError(l),i.manager.itemEnd(l)})}function a(l){if(typeof l=="string"){const c=l,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:i.resourcePath+c;return o(u)}else return l.data?{data:po(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new _g(t);s=new Ml(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c<u;c++){const h=e[c],d=h.url;if(Array.isArray(d)){const p=[];for(let m=0,x=d.length;m<x;m++){const g=d[m],f=a(g);f!==null&&(f instanceof HTMLImageElement?p.push(f):p.push(new wi(f.data,f.width,f.height)))}r[h.uuid]=new cs(p)}else{const p=a(h.url);r[h.uuid]=new cs(p)}}}return r}async parseImagesAsync(e){const t=this,i={};let r;async function s(o){if(typeof o=="string"){const a=o,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return await r.loadAsync(l)}else return o.data?{data:po(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){r=new Ml(this.manager),r.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 u=[];for(let h=0,d=c.length;h<d;h++){const p=c[h],m=await s(p);m!==null&&(m instanceof HTMLImageElement?u.push(m):u.push(new wi(m.data,m.width,m.height)))}i[l.uuid]=new cs(u)}else{const u=await s(l.url);i[l.uuid]=new cs(u)}}}return i}parseTextures(e,t){function i(s,o){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const r={};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),t[a.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",a.image);const l=t[a.image],c=l.data;let u;Array.isArray(c)?(u=new Il,c.length===6&&(u.needsUpdate=!0)):(c&&c.data?u=new wi:u=new Ct,c&&(u.needsUpdate=!0)),u.source=l,u.uuid=a.uuid,a.name!==void 0&&(u.name=a.name),a.mapping!==void 0&&(u.mapping=i(a.mapping,bN)),a.channel!==void 0&&(u.channel=a.channel),a.offset!==void 0&&u.offset.fromArray(a.offset),a.repeat!==void 0&&u.repeat.fromArray(a.repeat),a.center!==void 0&&u.center.fromArray(a.center),a.rotation!==void 0&&(u.rotation=a.rotation),a.wrap!==void 0&&(u.wrapS=i(a.wrap[0],_v),u.wrapT=i(a.wrap[1],_v)),a.format!==void 0&&(u.format=a.format),a.internalFormat!==void 0&&(u.internalFormat=a.internalFormat),a.type!==void 0&&(u.type=a.type),a.colorSpace!==void 0&&(u.colorSpace=a.colorSpace),a.minFilter!==void 0&&(u.minFilter=i(a.minFilter,Sv)),a.magFilter!==void 0&&(u.magFilter=i(a.magFilter,Sv)),a.anisotropy!==void 0&&(u.anisotropy=a.anisotropy),a.flipY!==void 0&&(u.flipY=a.flipY),a.generateMipmaps!==void 0&&(u.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(u.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(u.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(u.compareFunction=a.compareFunction),a.userData!==void 0&&(u.userData=a.userData),r[a.uuid]=u}return r}parseObject(e,t,i,r,s){let o;function a(d){return t[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",d),t[d]}function l(d){if(d!==void 0){if(Array.isArray(d)){const p=[];for(let m=0,x=d.length;m<x;m++){const g=d[m];i[g]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",g),p.push(i[g])}return p}return i[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",d),i[d]}}function c(d){return r[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",d),r[d]}let u,h;switch(e.type){case"Scene":o=new _M,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new _e(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 jd(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new Wd(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 Yt(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 Hd(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 rw(e.color,e.intensity);break;case"DirectionalLight":o=new iw(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new nw(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new sw(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new tw(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new ew(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new aw().fromJSON(e);break;case"SkinnedMesh":u=a(e.geometry),h=l(e.material),o=new bM(u,h),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":u=a(e.geometry),h=l(e.material),o=new kt(u,h);break;case"InstancedMesh":u=a(e.geometry),h=l(e.material);const d=e.count,p=e.instanceMatrix,m=e.instanceColor;o=new EM(u,h,d),o.instanceMatrix=new Oo(new Float32Array(p.array),16),m!==void 0&&(o.instanceColor=new Oo(new Float32Array(m.array),m.itemSize));break;case"BatchedMesh":u=a(e.geometry),h=l(e.material),o=new TM(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,h),o.geometry=u,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(x=>{const g=new pn;g.min.fromArray(x.boxMin),g.max.fromArray(x.boxMax);const f=new rn;return f.radius=x.sphereRadius,f.center.fromArray(x.sphereCenter),{boxInitialized:x.boxInitialized,box:g,sphereInitialized:x.sphereInitialized,sphere:f}}),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 wM;break;case"Line":o=new Nr(a(e.geometry),l(e.material));break;case"LineLoop":o=new AM(a(e.geometry),l(e.material));break;case"LineSegments":o=new Ai(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new CM(a(e.geometry),l(e.material));break;case"Sprite":o=new MM(l(e.material));break;case"Group":o=new go;break;case"Bone":o=new lg;break;default:o=new nt}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 d=e.children;for(let p=0;p<d.length;p++)o.add(this.parseObject(d[p],t,i,r,s))}if(e.animations!==void 0){const d=e.animations;for(let p=0;p<d.length;p++){const m=d[p];o.animations.push(s[m])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const d=e.levels;for(let p=0;p<d.length;p++){const m=d[p],x=o.getObjectByProperty("uuid",m.object);x!==void 0&&o.addLevel(x,m.distance,m.hysteresis)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(i){if(i.isSkinnedMesh===!0&&i.skeleton!==void 0){const r=t[i.skeleton];r===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",i.skeleton):i.bind(r,i.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const i=t.target,r=e.getObjectByProperty("uuid",i);r!==void 0?t.target=r:t.target=new nt}})}}const bN={UVMapping:Pd,CubeReflectionMapping:Ki,CubeRefractionMapping:Ir,EquirectangularReflectionMapping:il,EquirectangularRefractionMapping:rl,CubeUVReflectionMapping:Vo},_v={RepeatWrapping:sl,ClampToEdgeWrapping:Xn,MirroredRepeatWrapping:ol},Sv={NearestFilter:Gt,NearestMipmapNearestFilter:Vm,NearestMipmapLinearFilter:fo,LinearFilter:Ut,LinearMipmapNearestFilter:Pa,LinearMipmapLinearFilter:yi};class EN extends Tn{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,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Hi.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{t&&t(c),s.manager.itemEnd(e)}).catch(c=>{r&&r(c)});return}return setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;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 Hi.add(e,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){r&&r(c),Hi.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Hi.add(e,l),s.manager.itemStart(e)}}let Hc;class Mg{static getContext(){return Hc===void 0&&(Hc=new(window.AudioContext||window.webkitAudioContext)),Hc}static setContext(e){Hc=e}}class TN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Qi(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);Mg.getContext().decodeAudioData(c,function(h){t(h)}).catch(a)}catch(c){a(c)}},i,r);function a(l){r?r(l):console.error(l),s.manager.itemError(e)}}}const Mv=new ke,wv=new ke,Yr=new ke;class AN{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Yt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Yt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Yr.copy(e.projectionMatrix);const r=t.eyeSep/2,s=r*t.near/t.focus,o=t.near*Math.tan(ms*t.fov*.5)/t.zoom;let a,l;wv.elements[12]=-r,Mv.elements[12]=r,a=-o*t.aspect+s,l=o*t.aspect+s,Yr.elements[0]=2*t.near/(l-a),Yr.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Yr),a=-o*t.aspect-s,l=o*t.aspect-s,Yr.elements[0]=2*t.near/(l-a),Yr.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Yr)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(wv),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Mv)}}class uw{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=bv(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=bv();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function bv(){return(typeof performance>"u"?Date:performance).now()}const qr=new I,Ev=new En,CN=new I,Zr=new I;class RN extends nt{constructor(){super(),this.type="AudioListener",this.context=Mg.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new uw}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(qr,Ev,CN),Zr.set(0,0,-1).applyQuaternion(Ev),t.positionX){const r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(qr.x,r),t.positionY.linearRampToValueAtTime(qr.y,r),t.positionZ.linearRampToValueAtTime(qr.z,r),t.forwardX.linearRampToValueAtTime(Zr.x,r),t.forwardY.linearRampToValueAtTime(Zr.y,r),t.forwardZ.linearRampToValueAtTime(Zr.z,r),t.upX.linearRampToValueAtTime(i.x,r),t.upY.linearRampToValueAtTime(i.y,r),t.upZ.linearRampToValueAtTime(i.z,r)}else t.setPosition(qr.x,qr.y,qr.z),t.setOrientation(Zr.x,Zr.y,Zr.z,i.x,i.y,i.z)}}class dw extends nt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;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,t=this.filters.length;e<t;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 Kr=new I,Tv=new En,PN=new I,Jr=new I;class IN extends dw{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,t,i){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=i,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Kr,Tv,PN),Jr.set(0,0,1).applyQuaternion(Tv);const t=this.panner;if(t.positionX){const i=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Kr.x,i),t.positionY.linearRampToValueAtTime(Kr.y,i),t.positionZ.linearRampToValueAtTime(Kr.z,i),t.orientationX.linearRampToValueAtTime(Jr.x,i),t.orientationY.linearRampToValueAtTime(Jr.y,i),t.orientationZ.linearRampToValueAtTime(Jr.z,i)}else t.setPosition(Kr.x,Kr.y,Kr.z),t.setOrientation(Jr.x,Jr.y,Jr.z)}}class NN{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,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 t=this.getFrequencyData();for(let i=0;i<t.length;i++)e+=t[i];return e/t.length}}class hw{constructor(e,t,i){this.binding=e,this.valueSize=i;let r,s,o;switch(t){case"quaternion":r=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(i*6),this._workIndex=5;break;case"string":case"bool":r=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(i*5);break;default:r=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(i*5)}this._mixBufferRegion=r,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,t){const i=this.buffer,r=this.valueSize,s=e*r+r;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==r;++a)i[s+a]=i[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(i,s,0,a,r)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,i=this.valueSize,r=i*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,i=this.buffer,r=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(i,r,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(i,r,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(i[l]!==i[l+t]){a.setValue(i,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(t,r);for(let s=i,o=r;s!==o;++s)t[s]=t[r+s%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i<t;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[t+i]=this.buffer[e+i]}_select(e,t,i,r,s){if(r>=.5)for(let o=0;o!==s;++o)e[t+o]=e[i+o]}_slerp(e,t,i,r){En.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,s){const o=this._workIndex*s;En.multiplyQuaternionsFlat(e,o,e,t,e,i),En.slerpFlat(e,t,e,t,e,o,r)}_lerp(e,t,i,r,s){const o=1-r;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[i+a]*r}}_lerpAdditive(e,t,i,r,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[i+o]*r}}}const wg="\\[\\]\\.:\\/",LN=new RegExp("["+wg+"]","g"),bg="[^"+wg+"]",DN="[^"+wg.replace("\\.","")+"]",UN=/((?:WC+[\/:])*)/.source.replace("WC",bg),kN=/(WCOD+)?/.source.replace("WCOD",DN),ON=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",bg),FN=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",bg),BN=new RegExp("^"+UN+kN+ON+FN+"$"),zN=["material","materials","bones","map"];class VN{constructor(e,t,i){const r=i||et.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class et{constructor(e,t,i){this.path=t,this.parsedPath=i||et.parseTrackName(t),this.node=et.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new et.Composite(e,t,i):new et(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(LN,"")}static parseTrackName(e){const t=BN.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=i.nodeName.substring(r+1);zN.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(s){for(let o=0;o<s.length;o++){const a=s[o];if(a.name===t||a.uuid===t)return a;const l=i(a.children);if(l)return l}return null},r=i(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)e[t++]=i[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,i=t.objectName,r=t.propertyName;let s=t.propertyIndex;if(e||(e=et.findNode(this.rootNode,t.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(i){let c=t.objectIndex;switch(i){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 u=0;u<e.length;u++)if(e[u].name===c){c=u;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[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}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[r];if(o===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+r+" 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(r==="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=r;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}}et.Composite=VN;et.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};et.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};et.prototype.GetterByBindingType=[et.prototype._getValue_direct,et.prototype._getValue_array,et.prototype._getValue_arrayElement,et.prototype._getValue_toArray];et.prototype.SetterByBindingTypeAndVersioning=[[et.prototype._setValue_direct,et.prototype._setValue_direct_setNeedsUpdate,et.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[et.prototype._setValue_array,et.prototype._setValue_array_setNeedsUpdate,et.prototype._setValue_array_setMatrixWorldNeedsUpdate],[et.prototype._setValue_arrayElement,et.prototype._setValue_arrayElement_setNeedsUpdate,et.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[et.prototype._setValue_fromArray,et.prototype._setValue_fromArray_setNeedsUpdate,et.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class HN{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Un(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let i=0,r=arguments.length;i!==r;++i)e[arguments[i].uuid]=i;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,i=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length;let a,l=e.length,c=this.nCachedObjects_;for(let u=0,h=arguments.length;u!==h;++u){const d=arguments[u],p=d.uuid;let m=t[p];if(m===void 0){m=l++,t[p]=m,e.push(d);for(let x=0,g=o;x!==g;++x)s[x].push(new et(d,i[x],r[x]))}else if(m<c){a=e[m];const x=--c,g=e[x];t[g.uuid]=m,e[m]=g,t[p]=x,e[x]=d;for(let f=0,v=o;f!==v;++f){const y=s[f],_=y[x];let C=y[m];y[m]=_,C===void 0&&(C=new et(d,i[f],r[f])),y[x]=C}}else e[m]!==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,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const l=arguments[o],c=l.uuid,u=t[c];if(u!==void 0&&u>=s){const h=s++,d=e[h];t[d.uuid]=u,e[u]=d,t[c]=h,e[h]=l;for(let p=0,m=r;p!==m;++p){const x=i[p],g=x[h],f=x[u];x[u]=g,x[h]=f}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],u=c.uuid,h=t[u];if(h!==void 0)if(delete t[u],h<s){const d=--s,p=e[d],m=--o,x=e[m];t[p.uuid]=h,e[h]=p,t[x.uuid]=d,e[d]=x,e.pop();for(let g=0,f=r;g!==f;++g){const v=i[g],y=v[d],_=v[m];v[h]=y,v[d]=_,v.pop()}}else{const d=--o,p=e[d];d>0&&(t[p.uuid]=h),e[h]=p,e.pop();for(let m=0,x=r;m!==x;++m){const g=i[m];g[h]=g[d],g.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const i=this._bindingsIndicesByPath;let r=i[e];const s=this._bindings;if(r!==void 0)return s[r];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,h=new Array(c);r=s.length,i[e]=r,o.push(e),a.push(t),s.push(h);for(let d=u,p=l.length;d!==p;++d){const m=l[d];h[d]=new et(m,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const r=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=i,o[i]=l,o.pop(),s[i]=s[a],s.pop(),r[i]=r[a],r.pop()}}}class fw{constructor(e,t,i=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=r;const s=t.tracks,o=s.length,a=new Array(o),l={endingStart:as,endingEnd:as};for(let c=0;c!==o;++c){const u=s[c].createInterpolant(null);a[c]=u,u.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=XS,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){const r=this._clip.duration,s=e._clip.duration,o=s/r,a=r/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){const r=this._mixer,s=r.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+i,c[0]=e/o,c[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,i,r){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*i;l<0||i===0?t=0:(this._startTime=null,t=i*l)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Km:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case Od:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(r,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let r=this.time+e,s=this._loopCount;const o=i===$S;if(e===0)return s===-1?r:o&&(s&1)===1?t-r:r;if(i===jS){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,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)),r>=t||r<0){const a=Math.floor(r/t);r-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,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=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=r;if(o&&(s&1)===1)return t-r}return r}_setEndings(e,t,i){const r=this._interpolantSettings;i?(r.endingStart=ls,r.endingEnd=ls):(e?r.endingStart=this.zeroSlopeAtStart?ls:as:r.endingStart=ll,t?r.endingEnd=this.zeroSlopeAtEnd?ls:as:r.endingEnd=ll)}_scheduleFading(e,t,i){const r=this._mixer,s=r.time;let o=this._weightInterpolant;o===null&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=i,this}}const GN=new Float32Array(1);class WN extends Ti{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,r=e._clip.tracks,s=r.length,o=e._propertyBindings,a=e._interpolants,l=i.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==s;++h){const d=r[h],p=d.name;let m=u[p];if(m!==void 0)++m.referenceCount,o[h]=m;else{if(m=o[h],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,l,p));continue}const x=t&&t._propertyBindings[h].binding.parsedPath;m=new hw(et.create(i,p,x),d.ValueTypeName,d.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,l,p),o[h]=m}a[h].resultBuffer=m.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,i)}const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,i){const r=this._actions,s=this._actionsByClip;let o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=r.length,r.push(e),o.actionByRoot[i]=e}_removeInactiveAction(e){const t=this._actions,i=t[t.length-1],r=e._cacheIndex;i._cacheIndex=r,t[r]=i,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,o=this._actionsByClip,a=o[s],l=a.knownActions,c=l[l.length-1],u=e._byClipCacheIndex;c._byClipCacheIndex=u,l[u]=c,l.pop(),e._byClipCacheIndex=null;const h=a.actionByRoot,d=(e._localRoot||this._root).uuid;delete h[d],l.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,i=e._cacheIndex,r=this._nActiveActions++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackAction(e){const t=this._actions,i=e._cacheIndex,r=--this._nActiveActions,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_addInactiveBinding(e,t,i){const r=this._bindingsByRootAndName,s=this._bindings;let o=r[t];o===void 0&&(o={},r[t]=o),o[i]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,i=e.binding,r=i.rootNode.uuid,s=i.path,o=this._bindingsByRootAndName,a=o[r],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete a[s],Object.keys(a).length===0&&delete o[r]}_lendBinding(e){const t=this._bindings,i=e._cacheIndex,r=this._nActiveBindings++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackBinding(e){const t=this._bindings,i=e._cacheIndex,r=--this._nActiveBindings,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let i=e[t];return i===void 0&&(i=new vg(new Float32Array(2),new Float32Array(2),1,GN),i.__cacheIndex=t,e[t]=i),i}_takeBackControlInterpolant(e){const t=this._controlInterpolants,i=e.__cacheIndex,r=--this._nActiveControlInterpolants,s=t[r];e.__cacheIndex=r,t[r]=e,s.__cacheIndex=i,t[i]=s}clipAction(e,t,i){const r=t||this._root,s=r.uuid;let o=typeof e=="string"?Sl.findByName(r,e):e;const a=o!==null?o.uuid:e,l=this._actionsByClip[a];let c=null;if(i===void 0&&(o!==null?i=o.blendMode:i=Od),l!==void 0){const h=l.actionByRoot[s];if(h!==void 0&&h.blendMode===i)return h;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;const u=new fw(this,o,t,i);return this._bindAction(u,c),this._addInactiveAction(u,a,s),u}existingAction(e,t){const i=t||this._root,r=i.uuid,s=typeof e=="string"?Sl.findByName(i,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[r]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let i=t-1;i>=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,r=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==i;++c)t[c]._update(r,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 t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,i=e.uuid,r=this._actionsByClip,s=r[i];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 u=c._cacheIndex,h=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=u,t[u]=h,t.pop(),this._removeInactiveBindingsForAction(c)}delete r[i]}}uncacheRoot(e){const t=e.uuid,i=this._actionsByClip;for(const o in i){const a=i[o].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const r=this._bindingsByRootAndName,s=r[t];if(s!==void 0)for(const o in s){const a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const i=this.existingAction(e,t);i!==null&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class Eg{constructor(e){this.value=e}clone(){return new Eg(this.value.clone===void 0?this.value:this.value.clone())}}let jN=0;class XN extends Ti{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:jN++}),this.name="",this.usage=hl,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,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 t=e.uniforms;this.uniforms.length=0;for(let i=0,r=t.length;i<r;i++){const s=Array.isArray(t[i])?t[i]:[t[i]];for(let o=0;o<s.length;o++)this.uniforms.push(s[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class $N extends Xd{constructor(e,t,i=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class YN{constructor(e,t,i,r,s){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=i,this.elementSize=r,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const Av=new ke;class qN{constructor(e,t,i=0,r=1/0){this.ray=new Go(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new zd,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Av.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Av),this}intersectObject(e,t=!0,i=[]){return Gp(e,this,i,t),i.sort(Cv),i}intersectObjects(e,t=!0,i=[]){for(let r=0,s=e.length;r<s;r++)Gp(e[r],this,i,t);return i.sort(Cv),i}}function Cv(n,e){return n.distance-e.distance}function Gp(n,e,t,i){let r=!0;if(n.layers.test(e.layers)&&n.raycast(e,t)===!1&&(r=!1),r===!0&&i===!0){const s=n.children;for(let o=0,a=s.length;o<a;o++)Gp(s[o],e,t,!0)}}class ZN{constructor(e=1,t=0,i=0){return this.radius=e,this.phi=t,this.theta=i,this}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,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,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(At(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class KN{constructor(e=1,t=0,i=0){return this.radius=e,this.theta=t,this.y=i,this}set(e,t,i){return this.radius=e,this.theta=t,this.y=i,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,t,i){return this.radius=Math.sqrt(e*e+i*i),this.theta=Math.atan2(e,i),this.y=t,this}clone(){return new this.constructor().copy(this)}}class Tg{constructor(e,t,i,r){Tg.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,i,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let i=0;i<4;i++)this.elements[i]=e[i+t];return this}set(e,t,i,r){const s=this.elements;return s[0]=e,s[2]=t,s[1]=i,s[3]=r,this}}const Rv=new Q;class JN{constructor(e=new Q(1/0,1/0),t=new Q(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=Rv.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),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,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Rv).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 Pv=new I,Gc=new I;class QN{constructor(e=new I,t=new I){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Pv.subVectors(e,this.start),Gc.subVectors(this.end,this.start);const i=Gc.dot(Gc);let s=Gc.dot(Pv)/i;return t&&(s=At(s,0,1)),s}closestPointToPoint(e,t,i){const r=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(r).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 Iv=new I;class e3 extends nt{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new Ye,r=[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,u=a/l*Math.PI*2;r.push(Math.cos(c),Math.sin(c),1,Math.cos(u),Math.sin(u),1)}i.setAttribute("position",new Pe(r,3));const s=new xn({fog:!1,toneMapped:!1});this.cone=new Ai(i,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,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Iv.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Iv),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const hr=new I,Wc=new ke,Lf=new ke;class t3 extends Ai{constructor(e){const t=pw(e),i=new Ye,r=[],s=[],o=new _e(0,0,1),a=new _e(0,1,0);for(let c=0;c<t.length;c++){const u=t[c];u.parent&&u.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),s.push(o.r,o.g,o.b),s.push(a.r,a.g,a.b))}i.setAttribute("position",new Pe(r,3)),i.setAttribute("color",new Pe(s,3));const l=new xn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(i,l),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,i=this.geometry,r=i.getAttribute("position");Lf.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){const a=t[s];a.parent&&a.parent.isBone&&(Wc.multiplyMatrices(Lf,a.matrixWorld),hr.setFromMatrixPosition(Wc),r.setXYZ(o,hr.x,hr.y,hr.z),Wc.multiplyMatrices(Lf,a.parent.matrixWorld),hr.setFromMatrixPosition(Wc),r.setXYZ(o+1,hr.x,hr.y,hr.z),o+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function pw(n){const e=[];n.isBone===!0&&e.push(n);for(let t=0;t<n.children.length;t++)e.push.apply(e,pw(n.children[t]));return e}class n3 extends kt{constructor(e,t,i){const r=new Ul(t,4,2),s=new Or({wireframe:!0,fog:!1,toneMapped:!1});super(r,s),this.light=e,this.color=i,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 i3=new I,Nv=new _e,Lv=new _e;class r3 extends nt{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";const r=new Dl(t);r.rotateY(Math.PI*.5),this.material=new Or({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=r.getAttribute("position"),o=new Float32Array(s.count*3);r.setAttribute("color",new ht(o,3)),this.add(new kt(r,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 t=e.geometry.getAttribute("color");Nv.copy(this.light.color),Lv.copy(this.light.groundColor);for(let i=0,r=t.count;i<r;i++){const s=i<r/2?Nv:Lv;t.setXYZ(i,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(i3.setFromMatrixPosition(this.light.matrixWorld).negate())}}class s3 extends Ai{constructor(e=10,t=10,i=4473924,r=8947848){i=new _e(i),r=new _e(r);const s=t/2,o=e/t,a=e/2,l=[],c=[];for(let d=0,p=0,m=-a;d<=t;d++,m+=o){l.push(-a,0,m,a,0,m),l.push(m,0,-a,m,0,a);const x=d===s?i:r;x.toArray(c,p),p+=3,x.toArray(c,p),p+=3,x.toArray(c,p),p+=3,x.toArray(c,p),p+=3}const u=new Ye;u.setAttribute("position",new Pe(l,3)),u.setAttribute("color",new Pe(c,3));const h=new xn({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class o3 extends Ai{constructor(e=10,t=16,i=8,r=64,s=4473924,o=8947848){s=new _e(s),o=new _e(o);const a=[],l=[];if(t>1)for(let h=0;h<t;h++){const d=h/t*(Math.PI*2),p=Math.sin(d)*e,m=Math.cos(d)*e;a.push(0,0,0),a.push(p,0,m);const x=h&1?s:o;l.push(x.r,x.g,x.b),l.push(x.r,x.g,x.b)}for(let h=0;h<i;h++){const d=h&1?s:o,p=e-e/i*h;for(let m=0;m<r;m++){let x=m/r*(Math.PI*2),g=Math.sin(x)*p,f=Math.cos(x)*p;a.push(g,0,f),l.push(d.r,d.g,d.b),x=(m+1)/r*(Math.PI*2),g=Math.sin(x)*p,f=Math.cos(x)*p,a.push(g,0,f),l.push(d.r,d.g,d.b)}}const c=new Ye;c.setAttribute("position",new Pe(a,3)),c.setAttribute("color",new Pe(l,3));const u=new xn({vertexColors:!0,toneMapped:!1});super(c,u),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Dv=new I,jc=new I,Uv=new I;class a3 extends nt{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",t===void 0&&(t=1);let r=new Ye;r.setAttribute("position",new Pe([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new xn({fog:!1,toneMapped:!1});this.lightPlane=new Nr(r,s),this.add(this.lightPlane),r=new Ye,r.setAttribute("position",new Pe([0,0,0,0,0,1],3)),this.targetLine=new Nr(r,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),Dv.setFromMatrixPosition(this.light.matrixWorld),jc.setFromMatrixPosition(this.light.target.matrixWorld),Uv.subVectors(jc,Dv),this.lightPlane.lookAt(jc),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(jc),this.targetLine.scale.z=Uv.length()}}const Xc=new I,Et=new Vd;class l3 extends Ai{constructor(e){const t=new Ye,i=new xn({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],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(m,x){l(m),l(x)}function l(m){r.push(0,0,0),s.push(0,0,0),o[m]===void 0&&(o[m]=[]),o[m].push(r.length/3-1)}t.setAttribute("position",new Pe(r,3)),t.setAttribute("color",new Pe(s,3)),super(t,i),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 _e(16755200),u=new _e(16711680),h=new _e(43775),d=new _e(16777215),p=new _e(3355443);this.setColors(c,u,h,d,p)}setColors(e,t,i,r,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,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,i.r,i.g,i.b),a.setXYZ(33,i.r,i.g,i.b),a.setXYZ(34,i.r,i.g,i.b),a.setXYZ(35,i.r,i.g,i.b),a.setXYZ(36,i.r,i.g,i.b),a.setXYZ(37,i.r,i.g,i.b),a.setXYZ(38,r.r,r.g,r.b),a.setXYZ(39,r.r,r.g,r.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,t=this.pointMap,i=1,r=1;Et.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Rt("c",t,e,Et,0,0,-1),Rt("t",t,e,Et,0,0,1),Rt("n1",t,e,Et,-i,-r,-1),Rt("n2",t,e,Et,i,-r,-1),Rt("n3",t,e,Et,-i,r,-1),Rt("n4",t,e,Et,i,r,-1),Rt("f1",t,e,Et,-i,-r,1),Rt("f2",t,e,Et,i,-r,1),Rt("f3",t,e,Et,-i,r,1),Rt("f4",t,e,Et,i,r,1),Rt("u1",t,e,Et,i*.7,r*1.1,-1),Rt("u2",t,e,Et,-i*.7,r*1.1,-1),Rt("u3",t,e,Et,0,r*2,-1),Rt("cf1",t,e,Et,-i,0,1),Rt("cf2",t,e,Et,i,0,1),Rt("cf3",t,e,Et,0,-r,1),Rt("cf4",t,e,Et,0,r,1),Rt("cn1",t,e,Et,-i,0,-1),Rt("cn2",t,e,Et,i,0,-1),Rt("cn3",t,e,Et,0,-r,-1),Rt("cn4",t,e,Et,0,r,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Rt(n,e,t,i,r,s,o){Xc.set(r,s,o).unproject(i);const a=e[n];if(a!==void 0){const l=t.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],Xc.x,Xc.y,Xc.z)}}const $c=new pn;class c3 extends Ai{constructor(e,t=16776960){const i=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]),r=new Float32Array(8*3),s=new Ye;s.setIndex(new ht(i,1)),s.setAttribute("position",new ht(r,3)),super(s,new xn({color:t,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&&$c.setFromObject(this.object),$c.isEmpty())return;const t=$c.min,i=$c.max,r=this.geometry.attributes.position,s=r.array;s[0]=i.x,s[1]=i.y,s[2]=i.z,s[3]=t.x,s[4]=i.y,s[5]=i.z,s[6]=t.x,s[7]=t.y,s[8]=i.z,s[9]=i.x,s[10]=t.y,s[11]=i.z,s[12]=i.x,s[13]=i.y,s[14]=t.z,s[15]=t.x,s[16]=i.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=i.x,s[22]=t.y,s[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class u3 extends Ai{constructor(e,t=16776960){const i=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]),r=[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 Ye;s.setIndex(new ht(i,1)),s.setAttribute("position",new Pe(r,3)),super(s,new xn({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class d3 extends Nr{constructor(e,t=1,i=16776960){const r=i,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 Ye;o.setAttribute("position",new Pe(s,3)),o.computeBoundingSphere(),super(o,new xn({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const a=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new Ye;l.setAttribute("position",new Pe(a,3)),l.computeBoundingSphere(),this.add(new kt(l,new Or({color:r,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 kv=new I;let Yc,Df;class h3 extends nt{constructor(e=new I(0,0,1),t=new I(0,0,0),i=1,r=16776960,s=i*.2,o=s*.2){super(),this.type="ArrowHelper",Yc===void 0&&(Yc=new Ye,Yc.setAttribute("position",new Pe([0,0,0,0,1,0],3)),Df=new Xo(0,.5,1,5,1),Df.translate(0,-.5,0)),this.position.copy(t),this.line=new Nr(Yc,new xn({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new kt(Df,new Or({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(i,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{kv.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(kv,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),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 f3 extends Ai{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new Ye;r.setAttribute("position",new Pe(t,3)),r.setAttribute("color",new Pe(i,3));const s=new xn({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,i){const r=new _e,s=this.geometry.attributes.color.array;return r.set(e),r.toArray(s,0),r.toArray(s,3),r.set(t),r.toArray(s,6),r.toArray(s,9),r.set(i),r.toArray(s,12),r.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class p3{constructor(){this.type="ShapePath",this.color=new _e,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new ml,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,s,o){return this.currentPath.bezierCurveTo(e,t,i,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(f){const v=[];for(let y=0,_=f.length;y<_;y++){const C=f[y],w=new gs;w.curves=C.curves,v.push(w)}return v}function i(f,v){const y=v.length;let _=!1;for(let C=y-1,w=0;w<y;C=w++){let E=v[C],A=v[w],b=A.x-E.x,M=A.y-E.y;if(Math.abs(M)>Number.EPSILON){if(M<0&&(E=v[w],b=-b,A=v[C],M=-M),f.y<E.y||f.y>A.y)continue;if(f.y===E.y){if(f.x===E.x)return!0}else{const L=M*(f.x-E.x)-b*(f.y-E.y);if(L===0)return!0;if(L<0)continue;_=!_}}else{if(f.y!==E.y)continue;if(A.x<=f.x&&f.x<=E.x||E.x<=f.x&&f.x<=A.x)return!0}}return _}const r=bi.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 gs,l.curves=a.curves,c.push(l),c;let u=!r(s[0].getPoints());u=e?!u:u;const h=[],d=[];let p=[],m=0,x;d[m]=void 0,p[m]=[];for(let f=0,v=s.length;f<v;f++)a=s[f],x=a.getPoints(),o=r(x),o=e?!o:o,o?(!u&&d[m]&&m++,d[m]={s:new gs,p:x},d[m].s.curves=a.curves,u&&m++,p[m]=[]):p[m].push({h:a,p:x[0]});if(!d[0])return t(s);if(d.length>1){let f=!1,v=0;for(let y=0,_=d.length;y<_;y++)h[y]=[];for(let y=0,_=d.length;y<_;y++){const C=p[y];for(let w=0;w<C.length;w++){const E=C[w];let A=!0;for(let b=0;b<d.length;b++)i(E.p,d[b].p)&&(y!==b&&v++,A?(A=!1,h[b].push(E)):f=!0);A&&h[y].push(E)}}v>0&&f===!1&&(p=h)}let g;for(let f=0,v=d.length;f<v;f++){l=d[f].s,c.push(l),g=p[f];for(let y=0,_=g.length;y<_;y++)l.holes.push(g[y].h)}return c}}class m3 extends Ti{constructor(e,t){super(),this.object=e,this.domElement=t,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 g3 extends li{constructor(e=1,t=1,i=1,r={}){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,t,{...r,count:i}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Rd}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Rd);const J3=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:zS,AddEquation:vr,AddOperation:kS,AdditiveAnimationBlendMode:Km,AdditiveBlending:Rp,AgXToneMapping:HS,AlphaFormat:jm,AlwaysCompare:iM,AlwaysDepth:RS,AlwaysStencilFunc:Lp,AmbientLight:rw,AnimationAction:fw,AnimationClip:Sl,AnimationLoader:mN,AnimationMixer:WN,AnimationObjectGroup:HN,AnimationUtils:dN,ArcCurve:RM,ArrayCamera:yM,ArrowHelper:h3,AttachedBindMode:Np,Audio:dw,AudioAnalyser:NN,AudioContext:Mg,AudioListener:RN,AudioLoader:TN,AxesHelper:f3,BackSide:fn,BasicDepthPacking:YS,BasicShadowMap:cT,BatchedMesh:TM,Bone:lg,BooleanKeyframeTrack:Rs,Box2:JN,Box3:pn,Box3Helper:u3,BoxGeometry:Cs,BoxHelper:c3,BufferAttribute:ht,BufferGeometry:Ye,BufferGeometryLoader:cw,ByteType:Hm,Cache:Hi,Camera:Vd,CameraHelper:l3,CanvasTexture:UI,CapsuleGeometry:Zd,CatmullRomCurve3:PM,CineonToneMapping:BS,CircleGeometry:Kd,ClampToEdgeWrapping:Xn,Clock:uw,Color:_e,ColorKeyframeTrack:yg,ColorManagement:rt,CompressedArrayTexture:LI,CompressedCubeTexture:DI,CompressedTexture:Yd,CompressedTextureLoader:gN,ConeGeometry:Jd,ConstantAlphaFactor:TS,ConstantColorFactor:bS,Controls:m3,CubeCamera:dM,CubeReflectionMapping:Ki,CubeRefractionMapping:Ir,CubeTexture:Il,CubeTextureLoader:xN,CubeUVReflectionMapping:Vo,CubicBezierCurve:dg,CubicBezierCurve3:IM,CubicInterpolant:ZM,CullFaceBack:Cp,CullFaceFront:lS,CullFaceFrontBack:lT,CullFaceNone:aS,Curve:ui,CurvePath:LM,CustomBlending:uS,CustomToneMapping:VS,CylinderGeometry:Xo,Cylindrical:KN,Data3DTexture:eg,DataArrayTexture:Bd,DataTexture:wi,DataTextureLoader:vN,DataUtils:MA,DecrementStencilOp:wT,DecrementWrapStencilOp:ET,DefaultLoadingManager:QM,DepthFormat:ps,DepthStencilFormat:ws,DepthTexture:rg,DetachedBindMode:WS,DirectionalLight:iw,DirectionalLightHelper:a3,DiscreteInterpolant:KM,DisplayP3ColorSpace:Fd,DodecahedronGeometry:Qd,DoubleSide:vi,DstAlphaFactor:yS,DstColorFactor:SS,DynamicCopyUsage:zT,DynamicDrawUsage:DT,DynamicReadUsage:OT,EdgesGeometry:DM,EllipseCurve:qd,EqualCompare:QS,EqualDepth:IS,EqualStencilFunc:RT,EquirectangularReflectionMapping:il,EquirectangularRefractionMapping:rl,Euler:On,EventDispatcher:Ti,ExtrudeGeometry:th,FileLoader:Qi,Float16BufferAttribute:CA,Float32BufferAttribute:Pe,FloatType:Sn,Fog:jd,FogExp2:Wd,FramebufferTexture:NI,FrontSide:Zi,Frustum:Nl,GLBufferAttribute:YN,GLSL1:HT,GLSL3:Dp,GreaterCompare:eM,GreaterDepth:LS,GreaterEqualCompare:nM,GreaterEqualDepth:NS,GreaterEqualStencilFunc:LT,GreaterStencilFunc:IT,GridHelper:s3,Group:go,HalfFloatType:Ho,HemisphereLight:ew,HemisphereLightHelper:r3,IcosahedronGeometry:nh,ImageBitmapLoader:EN,ImageLoader:Ml,ImageUtils:oM,IncrementStencilOp:MT,IncrementWrapStencilOp:bT,InstancedBufferAttribute:Oo,InstancedBufferGeometry:lw,InstancedInterleavedBuffer:$N,InstancedMesh:EM,Int16BufferAttribute:TA,Int32BufferAttribute:AA,Int8BufferAttribute:wA,IntType:Id,InterleavedBuffer:Xd,InterleavedBufferAttribute:bs,Interpolant:kl,InterpolateDiscrete:al,InterpolateLinear:ad,InterpolateSmooth:au,InvertStencilOp:TT,KeepStencilOp:ts,KeyframeTrack:di,LOD:wM,LatheGeometry:Ll,Layers:zd,LessCompare:JS,LessDepth:PS,LessEqualCompare:Jm,LessEqualDepth:nl,LessEqualStencilFunc:PT,LessStencilFunc:CT,Light:Br,LightProbe:aw,Line:Nr,Line3:QN,LineBasicMaterial:xn,LineCurve:hg,LineCurve3:NM,LineDashedMaterial:$M,LineLoop:AM,LineSegments:Ai,LinearDisplayP3ColorSpace:Pl,LinearFilter:Ut,LinearInterpolant:vg,LinearMipMapLinearFilter:fT,LinearMipMapNearestFilter:hT,LinearMipmapLinearFilter:yi,LinearMipmapNearestFilter:Pa,LinearSRGBColorSpace:tr,LinearToneMapping:OS,LinearTransfer:cl,Loader:Tn,LoaderUtils:Hp,LoadingManager:_g,LoopOnce:jS,LoopPingPong:$S,LoopRepeat:XS,LuminanceAlphaFormat:Ym,LuminanceFormat:$m,MOUSE:oT,Material:on,MaterialLoader:ch,MathUtils:sA,Matrix2:Tg,Matrix3:je,Matrix4:ke,MaxEquation:pS,Mesh:kt,MeshBasicMaterial:Or,MeshDepthMaterial:sg,MeshDistanceMaterial:og,MeshLambertMaterial:jM,MeshMatcapMaterial:XM,MeshNormalMaterial:WM,MeshPhongMaterial:HM,MeshPhysicalMaterial:VM,MeshStandardMaterial:gg,MeshToonMaterial:GM,MinEquation:fS,MirroredRepeatWrapping:ol,MixOperation:US,MultiplyBlending:Ip,MultiplyOperation:Cl,NearestFilter:Gt,NearestMipMapLinearFilter:dT,NearestMipMapNearestFilter:uT,NearestMipmapLinearFilter:fo,NearestMipmapNearestFilter:Vm,NeutralToneMapping:GS,NeverCompare:KS,NeverDepth:CS,NeverStencilFunc:AT,NoBlending:Wi,NoColorSpace:Fi,NoToneMapping:ji,NormalAnimationBlendMode:Od,NormalBlending:fs,NotEqualCompare:tM,NotEqualDepth:DS,NotEqualStencilFunc:NT,NumberKeyframeTrack:yl,Object3D:nt,ObjectLoader:wN,ObjectSpaceNormalMap:ZS,OctahedronGeometry:Dl,OneFactor:gS,OneMinusConstantAlphaFactor:AS,OneMinusConstantColorFactor:ES,OneMinusDstAlphaFactor:_S,OneMinusDstColorFactor:MS,OneMinusSrcAlphaFactor:Du,OneMinusSrcColorFactor:vS,OrthographicCamera:Hd,P3Primaries:dl,PCFShadowMap:zm,PCFSoftShadowMap:cS,PMREMGenerator:Up,Path:ml,PerspectiveCamera:Yt,Plane:mr,PlaneGeometry:Wo,PlaneHelper:d3,PointLight:nw,PointLightHelper:n3,Points:CM,PointsMaterial:cg,PolarGridHelper:o3,PolyhedronGeometry:Fr,PositionalAudio:IN,PropertyBinding:et,PropertyMixer:hw,QuadraticBezierCurve:fg,QuadraticBezierCurve3:pg,Quaternion:En,QuaternionKeyframeTrack:Ol,QuaternionLinearInterpolant:JM,RED_GREEN_RGTC2_Format:sd,RED_RGTC1_Format:Zm,REVISION:Rd,RGBADepthPacking:qS,RGBAFormat:dn,RGBAIntegerFormat:kd,RGBA_ASTC_10x10_Format:Qu,RGBA_ASTC_10x5_Format:Zu,RGBA_ASTC_10x6_Format:Ku,RGBA_ASTC_10x8_Format:Ju,RGBA_ASTC_12x10_Format:ed,RGBA_ASTC_12x12_Format:td,RGBA_ASTC_4x4_Format:Hu,RGBA_ASTC_5x4_Format:Gu,RGBA_ASTC_5x5_Format:Wu,RGBA_ASTC_6x5_Format:ju,RGBA_ASTC_6x6_Format:Xu,RGBA_ASTC_8x5_Format:$u,RGBA_ASTC_8x6_Format:Yu,RGBA_ASTC_8x8_Format:qu,RGBA_BPTC_Format:Ua,RGBA_ETC2_EAC_Format:Vu,RGBA_PVRTC_2BPPV1_Format:Fu,RGBA_PVRTC_4BPPV1_Format:Ou,RGBA_S3TC_DXT1_Format:Na,RGBA_S3TC_DXT3_Format:La,RGBA_S3TC_DXT5_Format:Da,RGBDepthPacking:vT,RGBFormat:Xm,RGBIntegerFormat:pT,RGB_BPTC_SIGNED_Format:nd,RGB_BPTC_UNSIGNED_Format:id,RGB_ETC1_Format:Bu,RGB_ETC2_Format:zu,RGB_PVRTC_2BPPV1_Format:ku,RGB_PVRTC_4BPPV1_Format:Uu,RGB_S3TC_DXT1_Format:Ia,RGDepthPacking:yT,RGFormat:qm,RGIntegerFormat:Ud,RawShaderMaterial:zM,Ray:Go,Raycaster:qN,Rec709Primaries:ul,RectAreaLight:sw,RedFormat:Dd,RedIntegerFormat:Rl,ReinhardToneMapping:FS,RenderTarget:aM,RepeatWrapping:sl,ReplaceStencilOp:ST,ReverseSubtractEquation:hS,RingGeometry:ih,SIGNED_RED_GREEN_RGTC2_Format:od,SIGNED_RED_RGTC1_Format:rd,SRGBColorSpace:Hn,SRGBTransfer:ft,Scene:_M,ShaderChunk:$e,ShaderLib:ri,ShaderMaterial:ci,ShadowMaterial:BM,Shape:gs,ShapeGeometry:rh,ShapePath:p3,ShapeUtils:bi,ShortType:Gm,Skeleton:$d,SkeletonHelper:t3,SkinnedMesh:bM,Source:cs,Sphere:rn,SphereGeometry:Ul,Spherical:ZN,SphericalHarmonics3:ow,SplineCurve:mg,SpotLight:tw,SpotLightHelper:e3,Sprite:MM,SpriteMaterial:ag,SrcAlphaFactor:Lu,SrcAlphaSaturateFactor:wS,SrcColorFactor:xS,StaticCopyUsage:BT,StaticDrawUsage:hl,StaticReadUsage:kT,StereoCamera:AN,StreamCopyUsage:VT,StreamDrawUsage:UT,StreamReadUsage:FT,StringKeyframeTrack:Ps,SubtractEquation:dS,SubtractiveBlending:Pp,TOUCH:aT,TangentSpaceNormalMap:kr,TetrahedronGeometry:sh,Texture:Ct,TextureLoader:yN,TextureUtils:uI,TorusGeometry:oh,TorusKnotGeometry:ah,Triangle:Nn,TriangleFanDrawMode:xT,TriangleStripDrawMode:gT,TrianglesDrawMode:mT,TubeGeometry:lh,UVMapping:Pd,Uint16BufferAttribute:tg,Uint32BufferAttribute:ng,Uint8BufferAttribute:bA,Uint8ClampedBufferAttribute:EA,Uniform:Eg,UniformsGroup:XN,UniformsLib:fe,UniformsUtils:uM,UnsignedByteType:Ei,UnsignedInt248Type:Ms,UnsignedInt5999Type:Wm,UnsignedIntType:Ji,UnsignedShort4444Type:Nd,UnsignedShort5551Type:Ld,UnsignedShortType:Do,VSMShadowMap:gi,Vector2:Q,Vector3:I,Vector4:ct,VectorKeyframeTrack:_l,VideoTexture:II,WebGL3DRenderTarget:hA,WebGLArrayRenderTarget:dA,WebGLCoordinateSystem:_i,WebGLCubeRenderTarget:hM,WebGLMultipleRenderTargets:g3,WebGLRenderTarget:li,WebGLRenderer:_I,WebGLUtils:vM,WebGPUCoordinateSystem:fl,WireframeGeometry:FM,WrapAroundEnding:ll,ZeroCurvatureEnding:as,ZeroFactor:mS,ZeroSlopeEnding:ls,ZeroStencilOp:_T,createCanvasElement:sM},Symbol.toStringTag,{value:"Module"})),ut={controls:null,camera:null,initialPosition:null,initialTarget:null};function Q3(n,e){ut.controls=n,ut.camera=e,e&&!ut.initialPosition&&(ut.initialPosition=e.position.clone()),n&&!ut.initialTarget&&(ut.initialTarget=n.target.clone())}function eL(){ut.controls=null,ut.camera=null}const mw=1.18,Ov=2.5;function gw(n=mw){if(!ut.controls||!ut.camera)return;const e=new I().subVectors(ut.controls.target,ut.camera.position).multiplyScalar(1-1/n);ut.camera.position.add(e),ut.controls.update()}function x3(n=mw){gw(1/n)}function uh(n,e){if(!ut.controls||!ut.camera)return;const t=ut.camera,i=new I().subVectors(ut.controls.target,t.position).normalize(),r=new I().crossVectors(i,t.up).normalize(),s=new I().crossVectors(r,i).normalize(),o=new I().addScaledVector(r,n*Ov).addScaledVector(s,e*Ov);t.position.add(o),ut.controls.target.add(o),ut.controls.update()}const v3=()=>uh(-1,0),y3=()=>uh(1,0),_3=()=>uh(0,1),S3=()=>uh(0,-1);function M3(){!ut.controls||!ut.camera||(ut.initialPosition&&ut.camera.position.copy(ut.initialPosition),ut.initialTarget&&ut.controls.target.copy(ut.initialTarget),ut.controls.update())}function w3(){const n=xe(E=>E.selectedSessionId),e=xe(E=>E.sessions),t=xe(E=>E.goals),i=xe(E=>E.missions),r=xe(E=>E.chatBySessionId),s=xe(E=>E.selectSession),o=xe(E=>E.sendPromptTo),[a,l]=Ae.useState("chat"),[c,u]=Ae.useState(""),h=Ae.useRef(null),d=n?e[n]:null,p=Ae.useMemo(()=>n?r[n]??[]:[],[r,n]),m=Ae.useMemo(()=>d?Object.values(i).filter(E=>E.sessionId===d.id).sort((E,A)=>A.startedAt-E.startedAt):[],[i,d]),x=Ae.useMemo(()=>{if(d!=null&&d.currentMissionId)return i[d.currentMissionId]},[i,d]),g=d?ZE(d,x):null;if(Ae.useEffect(()=>{if(a!=="chat")return;const E=h.current;E&&(E.scrollTop=E.scrollHeight)},[a,p.length,n]),!d)return null;const f=d.origin==="internal",v=!!d.wrapperSocketPath,y=f||v,_=d.currentGoalId?t[d.currentGoalId]:void 0,C=d.budgetUsd&&d.budgetUsd>0?Math.min(100,d.costUsd/d.budgetUsd*100):null,w=()=>{c.trim()&&(o(d.id,c),u(""))};return S.jsxs("div",{className:"absolute top-16 right-0 bottom-0 w-full sm:w-[460px] bg-solix-panel border-l border-solix-border backdrop-blur-md flex flex-col z-20",children:[S.jsxs("div",{className:"px-4 py-3 border-b border-solix-border flex items-start justify-between",children:[S.jsxs("div",{className:"min-w-0",children:[S.jsx("div",{className:"text-xs uppercase tracking-wide text-slate-400",children:"Planet"}),S.jsx("div",{className:"text-lg font-semibold truncate",children:d.name??d.id.slice(0,8)}),S.jsxs("div",{className:"text-xs text-slate-400 mt-0.5 truncate",title:Bm[d.status]??void 0,children:[String(d.model)," · ",oS(d.status),d.origin==="external"?" · external":d.origin==="agentview"?" · agent view":" · internal",v&&S.jsx("span",{className:"ml-1.5 px-1.5 py-0.5 rounded text-[9px] uppercase tracking-wide border border-solix-accent/50 text-solix-accent",title:"Wrapped by `solix run` — UI prompts go to your terminal.",children:"wrapped"}),d.agentViewId&&S.jsx("span",{className:"ml-1.5 font-mono text-[9px] text-cyan-300/80",title:`Agent View id: ${d.agentViewId}`,children:d.agentViewId.slice(0,8)})]}),d.prUrl&&S.jsxs("a",{href:d.prUrl,target:"_blank",rel:"noopener noreferrer",className:"mt-1 inline-flex items-center gap-1.5 text-[11px] text-slate-300 hover:text-white border border-solix-border rounded px-2 py-0.5",title:`Open ${d.prUrl}`,children:[S.jsx("span",{children:"PR"}),S.jsx("span",{className:"text-slate-500 truncate max-w-[200px]",children:d.prUrl.replace(/^https?:\/\//,"")}),d.prCheckStatus&&S.jsx("span",{className:d.prCheckStatus==="success"?"text-solix-ok":d.prCheckStatus==="failure"?"text-solix-danger":"text-amber-300",children:d.prCheckStatus==="success"?"✓":d.prCheckStatus==="failure"?"✗":"⏳"})]}),d.agentViewSummary&&S.jsx("div",{className:"mt-1 text-[11px] text-slate-400 italic line-clamp-2",title:d.agentViewSummary,children:d.agentViewSummary}),_&&S.jsxs("div",{className:"mt-1 inline-flex items-center gap-1.5 text-[11px]",children:[S.jsx("span",{className:"inline-block w-2 h-2 rounded-full",style:{background:_.color}}),S.jsx("span",{className:"text-slate-300",children:_.name})]}),(d.budgetUsd!=null||d.costUsd>0)&&S.jsxs("div",{className:"mt-1.5",children:[S.jsxs("div",{className:"flex items-center justify-between text-[11px] text-slate-400",children:[S.jsx("span",{children:"cost"}),S.jsxs("span",{className:"font-mono",children:["$",d.costUsd.toFixed(2),d.budgetUsd!=null&&S.jsxs("span",{className:"text-slate-500",children:[" ","/ $",d.budgetUsd.toFixed(2)]})]})]}),C!=null&&S.jsx("div",{className:"mt-1 h-1.5 rounded-full bg-slate-800 overflow-hidden",children:S.jsx("div",{className:"h-full",style:{width:`${C}%`,background:C>=100?"#dc2626":C>=75?"#f59e0b":"#38bdf8"}})})]})]}),S.jsx("button",{onClick:()=>s(null),className:"text-slate-400 hover:text-slate-100","aria-label":"Close",children:"✕"})]}),g&&S.jsxs("div",{className:`px-4 py-2 border-b border-solix-border text-[11px] leading-snug ${g.severity==="danger"?"text-solix-danger bg-solix-danger/10":g.severity==="warn"?"text-solix-warn bg-solix-warn/10":"text-slate-300 bg-black/20"}`,children:[S.jsx("span",{className:"font-semibold mr-1",children:"Suggested:"}),g.text]}),S.jsxs("div",{className:"px-4 py-2 border-b border-solix-border",children:[S.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400",children:[S.jsx("span",{children:"context"}),S.jsxs("span",{children:[d.contextUsagePct.toFixed(0),"%"]})]}),S.jsx("div",{className:"mt-1 h-1.5 rounded-full bg-slate-800 overflow-hidden",children:S.jsx("div",{className:`h-full ${d.contextUsagePct>=90?"bg-solix-danger":d.contextUsagePct>=80?"bg-solix-warn":"bg-solix-accent"}`,style:{width:`${Math.min(100,d.contextUsagePct)}%`}})})]}),S.jsxs("div",{className:"flex border-b border-solix-border text-xs",children:[S.jsxs(Uf,{active:a==="chat",onClick:()=>l("chat"),children:["Chat ",p.length>0&&S.jsxs("span",{className:"opacity-60",children:["(",p.length,")"]})]}),S.jsxs(Uf,{active:a==="missions",onClick:()=>l("missions"),children:["Missions ",m.length>0&&S.jsxs("span",{className:"opacity-60",children:["(",m.length,")"]})]}),S.jsx(Uf,{active:a==="files",onClick:()=>l("files"),children:"Files"})]}),S.jsxs("div",{className:"flex-1 overflow-hidden",children:[a==="chat"&&S.jsx(b3,{chat:p,scrollRef:h,session:d}),a==="missions"&&S.jsx(E3,{missions:m}),a==="files"&&S.jsx(T3,{missions:m})]}),a==="chat"&&S.jsx("div",{className:"px-3 py-3 border-t border-solix-border",children:y?S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"flex gap-2",children:[S.jsx("textarea",{value:c,onChange:E=>u(E.target.value),onKeyDown:E=>{E.key==="Enter"&&(E.metaKey||E.ctrlKey)&&(E.preventDefault(),w())},placeholder:v?"Type a prompt — it goes straight into your terminal claude (Cmd/Ctrl+Enter)":"Send a prompt to this session… (Cmd/Ctrl+Enter)",rows:2,className:"flex-1 text-sm bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent resize-none"}),S.jsx("button",{onClick:w,disabled:!c.trim(),className:"px-3 py-2 rounded bg-solix-accent/20 border border-solix-accent text-solix-accent text-sm hover:bg-solix-accent/30 disabled:opacity-40",children:"Send"})]}),v&&S.jsxs("div",{className:"text-[10px] text-slate-500 italic mt-1.5",children:["Wrapped by ",S.jsx("code",{children:"solix run"}),". Don't type in the terminal while sending from here, or characters will interleave."]})]}):S.jsxs("div",{className:"text-xs text-slate-500",children:["External session — keep typing in your terminal. To send prompts from here instead, restart the session with"," ",S.jsx("code",{className:"bg-black/40 px-1 rounded",children:"solix run"}),"."]})})]})}function Uf({active:n,onClick:e,children:t}){return S.jsx("button",{onClick:e,className:`flex-1 px-3 py-2 ${n?"text-solix-accent border-b-2 border-solix-accent":"text-slate-400 hover:text-slate-200 border-b-2 border-transparent"}`,children:t})}function b3({chat:n,scrollRef:e,session:t}){return S.jsxs("div",{ref:e,className:"h-full overflow-y-auto p-4 space-y-3",children:[n.length===0&&S.jsxs("div",{className:"text-sm text-slate-500 italic",children:["No chat yet. Type a prompt to this session in your terminal — it will stream here as it happens.",S.jsxs("div",{className:"mt-2 text-[11px] text-slate-600",children:["Watching transcript at ",S.jsxs("code",{children:["~/.claude/projects/","<encoded>","/",t.id,".jsonl"]})]})]}),n.map(i=>S.jsx("div",{className:`flex ${i.role==="user"?"justify-end":"justify-start"}`,children:S.jsxs("div",{className:`max-w-[85%] rounded-lg px-3 py-2 text-sm ${i.role==="user"?"bg-solix-accent/15 border border-solix-accent/40 text-slate-100":"bg-black/40 border border-solix-border text-slate-200"}`,children:[S.jsxs("div",{className:"text-[10px] uppercase tracking-wide opacity-60 mb-1",children:[i.role,S.jsx("span",{className:"ml-2 text-slate-500",children:new Date(i.ts).toLocaleTimeString()})]}),S.jsx("div",{className:"whitespace-pre-wrap break-words leading-relaxed",children:i.content})]})},i.messageId))]})}function E3({missions:n}){return S.jsx("div",{className:"h-full overflow-y-auto p-4 space-y-3",children:n.length===0?S.jsx("div",{className:"text-sm text-slate-500 italic",children:"No missions yet."}):n.map(e=>S.jsxs("div",{className:"rounded border border-solix-border p-3 bg-black/30",children:[S.jsxs("div",{className:"flex items-center justify-between text-xs",children:[S.jsx("span",{className:`font-semibold ${e.status==="active"?"text-solix-warn":e.status==="completed"?"text-solix-ok":"text-slate-300"}`,children:e.shortName}),S.jsx("span",{className:"text-slate-500",children:new Date(e.startedAt).toLocaleTimeString()})]}),S.jsx("div",{className:"mt-1 text-sm text-slate-200 line-clamp-3",children:e.prompt}),S.jsxs("div",{className:"mt-2 flex gap-3 text-[10px] text-slate-500",children:[S.jsxs("span",{children:[e.metrics.toolCallCount," tools"]}),S.jsxs("span",{children:[e.metrics.subagentCount," subagents"]}),S.jsxs("span",{children:[e.filesTouched.length," files"]}),e.metrics.durationMs!==void 0&&S.jsxs("span",{children:[(e.metrics.durationMs/1e3).toFixed(1),"s"]})]})]},e.id))})}function T3({missions:n}){const e=Array.from(new Set(n.flatMap(t=>t.filesTouched))).sort();return S.jsx("div",{className:"h-full overflow-y-auto p-4",children:e.length===0?S.jsx("div",{className:"text-sm text-slate-500 italic",children:"No files touched yet."}):S.jsx("ul",{className:"space-y-1 text-xs font-mono text-slate-300",children:e.map(t=>S.jsx("li",{className:"truncate",children:t},t))})})}function A3(){const n=xe(g=>g.selectedAdvisorId),e=xe(g=>n?g.advisors[n]:null),t=xe(g=>g.selectedSessionId?g.sessions[g.selectedSessionId]:null),i=xe(g=>g.selectAdvisor),r=xe(g=>g.invokeAdvisor),s=xe(g=>g.pinAdvisor),o=xe(g=>g.unpinAdvisor),a=xe(g=>g.enableAdvisor),l=xe(g=>g.disableAdvisor),[c,u]=Ae.useState(""),[h,d]=Ae.useState(null),[p,m]=Ae.useState(!1);if(Ae.useEffect(()=>{if(!e){d(null);return}let g=!1;const f=new URLSearchParams;t&&f.set("targetSessionId",t.id),c.trim()&&f.set("prompt",c.trim());const v=f.toString();return fetch(`/api/advisors/${encodeURIComponent(e.id)}/preview${v?`?${v}`:""}`).then(y=>y.ok?y.json():null).then(y=>{g||d(y)}).catch(()=>{g||d(null)}),()=>{g=!0}},[e==null?void 0:e.id,t==null?void 0:t.id,c]),!e)return null;const x=()=>{r(e.id,c.trim()||void 0),u("")};return S.jsxs("div",{className:"absolute top-16 right-0 bottom-0 w-[420px] bg-solix-panel border-l border-solix-border backdrop-blur-md flex flex-col z-20",children:[S.jsxs("div",{className:"px-4 py-3 border-b border-solix-border flex items-start justify-between",children:[S.jsxs("div",{children:[S.jsx("div",{className:"text-xs uppercase tracking-wide text-amber-200/70",children:"Advisor"}),S.jsxs("div",{className:"text-lg font-semibold flex items-center gap-2",children:[S.jsx("span",{style:{color:e.color},children:e.glyph}),S.jsx("span",{children:e.codename}),e.pinned&&S.jsx("span",{className:"text-[10px] uppercase tracking-wider text-amber-300 border border-amber-300/40 rounded px-1.5 py-0.5",children:"pinned"}),!e.enabled&&S.jsx("span",{className:"text-[10px] uppercase tracking-wider text-cyan-300 border border-cyan-300/40 rounded px-1.5 py-0.5",children:"opt-in"})]}),S.jsxs("div",{className:"text-xs text-slate-400 mt-0.5",children:[e.name," · ",String(e.defaultModel)]})]}),S.jsx("button",{onClick:()=>i(null),className:"text-slate-400 hover:text-slate-100","aria-label":"Close",children:"✕"})]}),S.jsx("div",{className:"px-4 py-3 border-b border-solix-border text-sm text-slate-300 leading-relaxed",children:e.description}),e.requiredSkills.length>0&&S.jsxs("div",{className:"px-4 py-2 border-b border-solix-border",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500 mb-1",children:"requires skills"}),S.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.requiredSkills.map(g=>S.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-solix-accent/15 border border-solix-accent/40 text-solix-accent",children:g},g))})]}),S.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3 text-sm text-slate-300",children:[S.jsx("div",{className:"text-xs uppercase tracking-wide text-slate-400",children:"Invoke"}),S.jsx("div",{className:"text-xs text-slate-500",children:t?S.jsxs(S.Fragment,{children:["Will dispatch to"," ",S.jsx("span",{className:"text-slate-200",children:t.name??t.id.slice(0,8)})," ",S.jsxs("span",{className:"text-slate-500",children:["(",t.cwd,")"]})]}):S.jsx(S.Fragment,{children:"No planet focused. Click a user planet first to set a target."})}),S.jsx("textarea",{value:c,onChange:g=>u(g.target.value),placeholder:`Optional: hand ${e.codename} a specific brief…`,rows:4,className:"w-full text-sm bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent resize-none"}),h&&S.jsxs("div",{className:"rounded border border-solix-border bg-black/30",children:[S.jsxs("button",{onClick:()=>m(g=>!g),className:"w-full text-left px-2 py-1.5 text-xs flex items-center justify-between text-slate-400 hover:text-slate-100",children:[S.jsxs("span",{children:["Context envelope · ",h.recentMissionsCount," mission(s)",h.contextUsagePct!==null&&` · target at ${h.contextUsagePct.toFixed(0)}%`]}),S.jsx("span",{children:p?"▾":"▸"})]}),p&&S.jsx("pre",{className:"text-[10.5px] text-slate-300 whitespace-pre-wrap px-3 pb-3 max-h-72 overflow-auto leading-relaxed",children:h.prompt})]})]}),e.enabled?S.jsxs("div",{className:"px-4 py-3 border-t border-solix-border flex gap-2",children:[S.jsx("button",{onClick:x,className:"flex-1 py-2 rounded bg-solix-accent/20 border border-solix-accent text-solix-accent text-sm hover:bg-solix-accent/30",children:"Invoke"}),e.pinned?S.jsx("button",{onClick:()=>o(e.id),className:"px-3 py-2 rounded bg-amber-500/15 border border-amber-400/50 text-amber-200 text-sm hover:bg-amber-500/25",children:"Unpin"}):S.jsx("button",{onClick:()=>s(e.id),className:"px-3 py-2 rounded bg-amber-500/10 border border-amber-400/30 text-amber-200/80 text-sm hover:bg-amber-500/20",title:"Spawn an always-on session for this advisor",children:"Pin"}),S.jsx("button",{onClick:()=>l(e.id),className:"px-3 py-2 rounded border border-solix-border text-slate-400 text-sm hover:text-white hover:bg-solix-border/30",title:"Remove from crew (keeps it available as opt-in)",children:"Disable"})]}):S.jsxs("div",{className:"px-4 py-3 border-t border-solix-border flex flex-col gap-2",children:[S.jsx("button",{onClick:()=>a(e.id),className:"w-full py-2 rounded bg-cyan-500/20 border border-cyan-400/60 text-cyan-100 text-sm hover:bg-cyan-500/30",title:"Add this advisor to your crew (renders in the inner ring, selectable in + Task)",children:"+ Add to crew"}),S.jsx("button",{onClick:x,className:"w-full py-1.5 rounded border border-solix-border text-slate-300 text-xs hover:text-white hover:bg-solix-border/30",children:"Invoke once without adding"})]})]})}function C3(){const n=xe(c=>c.selectedSkillId),e=xe(c=>n?c.skills[n]:null),t=xe(c=>c.selectSkill),i=xe(c=>c.advisors),[r,s]=Ae.useState(null),[o,a]=Ae.useState(!1);if(Ae.useEffect(()=>{if(!n){s(null);return}let c=!1;return a(!0),fetch(`/api/skills/${encodeURIComponent(n)}`).then(u=>u.ok?u.json():null).then(u=>{c||s(u)}).catch(()=>{c||s(null)}).finally(()=>{c||a(!1)}),()=>{c=!0}},[n]),!e)return null;const l=Object.values(i).filter(c=>c.requiredSkills.some(u=>e.id.endsWith(`:${u}`)||e.id===u));return S.jsxs("div",{className:"absolute top-16 right-0 bottom-0 w-[480px] bg-solix-panel border-l border-solix-border backdrop-blur-md flex flex-col z-20",children:[S.jsxs("div",{className:"px-4 py-3 border-b border-solix-border flex items-start justify-between",children:[S.jsxs("div",{children:[S.jsxs("div",{className:"text-xs uppercase tracking-wide text-cyan-300/70",children:["Skill · ",e.source]}),S.jsx("div",{className:"text-lg font-semibold",children:e.name}),S.jsx("div",{className:"text-xs text-slate-400 mt-0.5 break-all",children:e.id})]}),S.jsx("button",{onClick:()=>t(null),className:"text-slate-400 hover:text-slate-100","aria-label":"Close",children:"✕"})]}),l.length>0&&S.jsxs("div",{className:"px-4 py-2 border-b border-solix-border",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500 mb-1",children:"required by"}),S.jsx("div",{className:"flex flex-wrap gap-1.5",children:l.map(c=>S.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded border border-amber-300/40 text-amber-200",children:[S.jsx("span",{className:"mr-1",children:c.glyph}),c.codename]},c.id))})]}),S.jsx("div",{className:"px-4 py-3 border-b border-solix-border text-sm text-slate-300 leading-relaxed",children:e.description}),S.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500 mb-2",children:"manifest"}),o&&S.jsx("div",{className:"text-sm text-slate-500 italic",children:"Loading…"}),r&&S.jsx("pre",{className:"text-[11px] text-slate-300 whitespace-pre-wrap break-words bg-black/40 p-3 rounded border border-solix-border",children:r.manifest})]}),S.jsx("div",{className:"px-4 py-3 border-t border-solix-border text-xs text-slate-500",children:e.installedInProjects.length===0?"Not installed in any project yet.":`Installed in ${e.installedInProjects.length} project(s).`})]})}const R3=["default","opus","sonnet","haiku"];function P3({open:n,onClose:e}){const t=xe(U=>U.projects),i=xe(U=>U.advisors),r=xe(U=>U.goals),s=xe(U=>U.launchTask),o=Object.values(t).sort((U,z)=>z.lastActiveAt-U.lastActiveAt),a=Ae.useMemo(()=>Object.values(i).filter(U=>U.enabled).sort((U,z)=>U.codename.localeCompare(z.codename)),[i]),[l,c]=Ae.useState(""),[u,h]=Ae.useState("default"),[d,p]=Ae.useState(null),[m,x]=Ae.useState(""),[g,f]=Ae.useState(""),[v,y]=Ae.useState(""),[_,C]=Ae.useState(""),[w,E]=Ae.useState(null),A=Object.values(r),[b,M]=Ae.useState(null),[L,G]=Ae.useState(!0);if(Ae.useEffect(()=>{if(!n)return;let U=!1;return fetch("/api/system/preflight").then(z=>z.ok?z.json():null).then(z=>{U||M(z)}).catch(()=>{}),()=>{U=!0}},[n]),Ae.useEffect(()=>{if(!n||l)return;const U=o[0];U&&c(U.cwd)},[n,o,l]),!n)return null;const B=()=>{const U=l.trim(),z=m.trim();if(!U||!z)return;const Z=d?a.find(X=>X.id===d):void 0,D=Z?`[Acting as ${Z.codename} — ${Z.name}. ${Z.description}]
3898
+ }`;class mI{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){const r=new Ct,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new ci({vertexShader:fI,fragmentShader:pI,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new kt(new Wo(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class gI extends Ti{constructor(e,t){super();const i=this;let r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,h=null,d=null,p=null,m=null;const x=new mI,g=t.getContextAttributes();let f=null,v=null;const y=[],_=[],R=new Q;let w=null;const E=new Yt;E.layers.enable(1),E.viewport=new ct;const A=new Yt;A.layers.enable(2),A.viewport=new ct;const b=[E,A],M=new yM;M.layers.enable(1),M.layers.enable(2);let L=null,G=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(X){let oe=y[X];return oe===void 0&&(oe=new yf,y[X]=oe),oe.getTargetRaySpace()},this.getControllerGrip=function(X){let oe=y[X];return oe===void 0&&(oe=new yf,y[X]=oe),oe.getGripSpace()},this.getHand=function(X){let oe=y[X];return oe===void 0&&(oe=new yf,y[X]=oe),oe.getHandSpace()};function B(X){const oe=_.indexOf(X.inputSource);if(oe===-1)return;const ve=y[oe];ve!==void 0&&(ve.update(X.inputSource,X.frame,c||o),ve.dispatchEvent({type:X.type,data:X.inputSource}))}function j(){r.removeEventListener("select",B),r.removeEventListener("selectstart",B),r.removeEventListener("selectend",B),r.removeEventListener("squeeze",B),r.removeEventListener("squeezestart",B),r.removeEventListener("squeezeend",B),r.removeEventListener("end",j),r.removeEventListener("inputsourceschange",U);for(let X=0;X<y.length;X++){const oe=_[X];oe!==null&&(_[X]=null,y[X].disconnect(oe))}L=null,G=null,x.reset(),e.setRenderTarget(f),p=null,d=null,h=null,r=null,v=null,qe.stop(),i.isPresenting=!1,e.setPixelRatio(w),e.setSize(R.width,R.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(X){s=X,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(X){a=X,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(X){c=X},this.getBaseLayer=function(){return d!==null?d:p},this.getBinding=function(){return h},this.getFrame=function(){return m},this.getSession=function(){return r},this.setSession=async function(X){if(r=X,r!==null){if(f=e.getRenderTarget(),r.addEventListener("select",B),r.addEventListener("selectstart",B),r.addEventListener("selectend",B),r.addEventListener("squeeze",B),r.addEventListener("squeezestart",B),r.addEventListener("squeezeend",B),r.addEventListener("end",j),r.addEventListener("inputsourceschange",U),g.xrCompatible!==!0&&await t.makeXRCompatible(),w=e.getPixelRatio(),e.getSize(R),r.renderState.layers===void 0){const oe={antialias:g.antialias,alpha:!0,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(r,t,oe),r.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),v=new li(p.framebufferWidth,p.framebufferHeight,{format:dn,type:Ei,colorSpace:e.outputColorSpace,stencilBuffer:g.stencil})}else{let oe=null,ve=null,de=null;g.depth&&(de=g.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,oe=g.stencil?ws:ps,ve=g.stencil?Ms:Ji);const De={colorFormat:t.RGBA8,depthFormat:de,scaleFactor:s};h=new XRWebGLBinding(r,t),d=h.createProjectionLayer(De),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),v=new li(d.textureWidth,d.textureHeight,{format:dn,type:Ei,depthTexture:new sg(d.textureWidth,d.textureHeight,ve,void 0,void 0,void 0,void 0,void 0,void 0,oe),stencilBuffer:g.stencil,colorSpace:e.outputColorSpace,samples:g.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1})}v.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await r.requestReferenceSpace(a),qe.setContext(r),qe.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return x.getDepthTexture()};function U(X){for(let oe=0;oe<X.removed.length;oe++){const ve=X.removed[oe],de=_.indexOf(ve);de>=0&&(_[de]=null,y[de].disconnect(ve))}for(let oe=0;oe<X.added.length;oe++){const ve=X.added[oe];let de=_.indexOf(ve);if(de===-1){for(let He=0;He<y.length;He++)if(He>=_.length){_.push(ve),de=He;break}else if(_[He]===null){_[He]=ve,de=He;break}if(de===-1)break}const De=y[de];De&&De.connect(ve)}}const z=new I,Z=new I;function D(X,oe,ve){z.setFromMatrixPosition(oe.matrixWorld),Z.setFromMatrixPosition(ve.matrixWorld);const de=z.distanceTo(Z),De=oe.projectionMatrix.elements,He=ve.projectionMatrix.elements,Be=De[14]/(De[10]-1),it=De[14]/(De[10]+1),P=(De[9]+1)/De[5],le=(De[9]-1)/De[5],ie=(De[8]-1)/De[0],xe=(He[8]+1)/He[0],Y=Be*ie,Ue=Be*xe,me=de/(-ie+xe),be=me*-ie;if(oe.matrixWorld.decompose(X.position,X.quaternion,X.scale),X.translateX(be),X.translateZ(me),X.matrixWorld.compose(X.position,X.quaternion,X.scale),X.matrixWorldInverse.copy(X.matrixWorld).invert(),De[10]===-1)X.projectionMatrix.copy(oe.projectionMatrix),X.projectionMatrixInverse.copy(oe.projectionMatrixInverse);else{const N=Be+me,T=it+me,H=Y-be,ee=Ue+(de-be),J=P*it/T*N,ne=le*it/T*N;X.projectionMatrix.makePerspective(H,ee,J,ne,N,T),X.projectionMatrixInverse.copy(X.projectionMatrix).invert()}}function $(X,oe){oe===null?X.matrixWorld.copy(X.matrix):X.matrixWorld.multiplyMatrices(oe.matrixWorld,X.matrix),X.matrixWorldInverse.copy(X.matrixWorld).invert()}this.updateCamera=function(X){if(r===null)return;let oe=X.near,ve=X.far;x.texture!==null&&(x.depthNear>0&&(oe=x.depthNear),x.depthFar>0&&(ve=x.depthFar)),M.near=A.near=E.near=oe,M.far=A.far=E.far=ve,(L!==M.near||G!==M.far)&&(r.updateRenderState({depthNear:M.near,depthFar:M.far}),L=M.near,G=M.far);const de=X.parent,De=M.cameras;$(M,de);for(let He=0;He<De.length;He++)$(De[He],de);De.length===2?D(M,E,A):M.projectionMatrix.copy(E.projectionMatrix),K(X,M,de)};function K(X,oe,ve){ve===null?X.matrix.copy(oe.matrixWorld):(X.matrix.copy(ve.matrixWorld),X.matrix.invert(),X.matrix.multiply(oe.matrixWorld)),X.matrix.decompose(X.position,X.quaternion,X.scale),X.updateMatrixWorld(!0),X.projectionMatrix.copy(oe.projectionMatrix),X.projectionMatrixInverse.copy(oe.projectionMatrixInverse),X.isPerspectiveCamera&&(X.fov=Uo*2*Math.atan(1/X.projectionMatrix.elements[5]),X.zoom=1)}this.getCamera=function(){return M},this.getFoveation=function(){if(!(d===null&&p===null))return l},this.setFoveation=function(X){l=X,d!==null&&(d.fixedFoveation=X),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=X)},this.hasDepthSensing=function(){return x.texture!==null},this.getDepthSensingMesh=function(){return x.getMesh(M)};let se=null;function Ae(X,oe){if(u=oe.getViewerPose(c||o),m=oe,u!==null){const ve=u.views;p!==null&&(e.setRenderTargetFramebuffer(v,p.framebuffer),e.setRenderTarget(v));let de=!1;ve.length!==M.cameras.length&&(M.cameras.length=0,de=!0);for(let He=0;He<ve.length;He++){const Be=ve[He];let it=null;if(p!==null)it=p.getViewport(Be);else{const le=h.getViewSubImage(d,Be);it=le.viewport,He===0&&(e.setRenderTargetTextures(v,le.colorTexture,d.ignoreDepthValues?void 0:le.depthStencilTexture),e.setRenderTarget(v))}let P=b[He];P===void 0&&(P=new Yt,P.layers.enable(He),P.viewport=new ct,b[He]=P),P.matrix.fromArray(Be.transform.matrix),P.matrix.decompose(P.position,P.quaternion,P.scale),P.projectionMatrix.fromArray(Be.projectionMatrix),P.projectionMatrixInverse.copy(P.projectionMatrix).invert(),P.viewport.set(it.x,it.y,it.width,it.height),He===0&&(M.matrix.copy(P.matrix),M.matrix.decompose(M.position,M.quaternion,M.scale)),de===!0&&M.cameras.push(P)}const De=r.enabledFeatures;if(De&&De.includes("depth-sensing")){const He=h.getDepthInformation(ve[0]);He&&He.isValid&&He.texture&&x.init(e,He,r.renderState)}}for(let ve=0;ve<y.length;ve++){const de=_[ve],De=y[ve];de!==null&&De!==void 0&&De.update(de,oe,c||o)}se&&se(X,oe),oe.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:oe}),m=null}const qe=new fM;qe.setAnimationLoop(Ae),this.setAnimationLoop=function(X){se=X},this.dispose=function(){}}}const Xr=new On,xI=new ke;function vI(n,e){function t(g,f){g.matrixAutoUpdate===!0&&g.updateMatrix(),f.value.copy(g.matrix)}function i(g,f){f.color.getRGB(g.fogColor.value,cM(n)),f.isFog?(g.fogNear.value=f.near,g.fogFar.value=f.far):f.isFogExp2&&(g.fogDensity.value=f.density)}function r(g,f,v,y,_){f.isMeshBasicMaterial||f.isMeshLambertMaterial?s(g,f):f.isMeshToonMaterial?(s(g,f),h(g,f)):f.isMeshPhongMaterial?(s(g,f),u(g,f)):f.isMeshStandardMaterial?(s(g,f),d(g,f),f.isMeshPhysicalMaterial&&p(g,f,_)):f.isMeshMatcapMaterial?(s(g,f),m(g,f)):f.isMeshDepthMaterial?s(g,f):f.isMeshDistanceMaterial?(s(g,f),x(g,f)):f.isMeshNormalMaterial?s(g,f):f.isLineBasicMaterial?(o(g,f),f.isLineDashedMaterial&&a(g,f)):f.isPointsMaterial?l(g,f,v,y):f.isSpriteMaterial?c(g,f):f.isShadowMaterial?(g.color.value.copy(f.color),g.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function s(g,f){g.opacity.value=f.opacity,f.color&&g.diffuse.value.copy(f.color),f.emissive&&g.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(g.map.value=f.map,t(f.map,g.mapTransform)),f.alphaMap&&(g.alphaMap.value=f.alphaMap,t(f.alphaMap,g.alphaMapTransform)),f.bumpMap&&(g.bumpMap.value=f.bumpMap,t(f.bumpMap,g.bumpMapTransform),g.bumpScale.value=f.bumpScale,f.side===fn&&(g.bumpScale.value*=-1)),f.normalMap&&(g.normalMap.value=f.normalMap,t(f.normalMap,g.normalMapTransform),g.normalScale.value.copy(f.normalScale),f.side===fn&&g.normalScale.value.negate()),f.displacementMap&&(g.displacementMap.value=f.displacementMap,t(f.displacementMap,g.displacementMapTransform),g.displacementScale.value=f.displacementScale,g.displacementBias.value=f.displacementBias),f.emissiveMap&&(g.emissiveMap.value=f.emissiveMap,t(f.emissiveMap,g.emissiveMapTransform)),f.specularMap&&(g.specularMap.value=f.specularMap,t(f.specularMap,g.specularMapTransform)),f.alphaTest>0&&(g.alphaTest.value=f.alphaTest);const v=e.get(f),y=v.envMap,_=v.envMapRotation;y&&(g.envMap.value=y,Xr.copy(_),Xr.x*=-1,Xr.y*=-1,Xr.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(Xr.y*=-1,Xr.z*=-1),g.envMapRotation.value.setFromMatrix4(xI.makeRotationFromEuler(Xr)),g.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=f.reflectivity,g.ior.value=f.ior,g.refractionRatio.value=f.refractionRatio),f.lightMap&&(g.lightMap.value=f.lightMap,g.lightMapIntensity.value=f.lightMapIntensity,t(f.lightMap,g.lightMapTransform)),f.aoMap&&(g.aoMap.value=f.aoMap,g.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,g.aoMapTransform))}function o(g,f){g.diffuse.value.copy(f.color),g.opacity.value=f.opacity,f.map&&(g.map.value=f.map,t(f.map,g.mapTransform))}function a(g,f){g.dashSize.value=f.dashSize,g.totalSize.value=f.dashSize+f.gapSize,g.scale.value=f.scale}function l(g,f,v,y){g.diffuse.value.copy(f.color),g.opacity.value=f.opacity,g.size.value=f.size*v,g.scale.value=y*.5,f.map&&(g.map.value=f.map,t(f.map,g.uvTransform)),f.alphaMap&&(g.alphaMap.value=f.alphaMap,t(f.alphaMap,g.alphaMapTransform)),f.alphaTest>0&&(g.alphaTest.value=f.alphaTest)}function c(g,f){g.diffuse.value.copy(f.color),g.opacity.value=f.opacity,g.rotation.value=f.rotation,f.map&&(g.map.value=f.map,t(f.map,g.mapTransform)),f.alphaMap&&(g.alphaMap.value=f.alphaMap,t(f.alphaMap,g.alphaMapTransform)),f.alphaTest>0&&(g.alphaTest.value=f.alphaTest)}function u(g,f){g.specular.value.copy(f.specular),g.shininess.value=Math.max(f.shininess,1e-4)}function h(g,f){f.gradientMap&&(g.gradientMap.value=f.gradientMap)}function d(g,f){g.metalness.value=f.metalness,f.metalnessMap&&(g.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,g.metalnessMapTransform)),g.roughness.value=f.roughness,f.roughnessMap&&(g.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,g.roughnessMapTransform)),f.envMap&&(g.envMapIntensity.value=f.envMapIntensity)}function p(g,f,v){g.ior.value=f.ior,f.sheen>0&&(g.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),g.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(g.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,g.sheenColorMapTransform)),f.sheenRoughnessMap&&(g.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,g.sheenRoughnessMapTransform))),f.clearcoat>0&&(g.clearcoat.value=f.clearcoat,g.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(g.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,g.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(g.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===fn&&g.clearcoatNormalScale.value.negate())),f.dispersion>0&&(g.dispersion.value=f.dispersion),f.iridescence>0&&(g.iridescence.value=f.iridescence,g.iridescenceIOR.value=f.iridescenceIOR,g.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(g.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,g.iridescenceMapTransform)),f.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),f.transmission>0&&(g.transmission.value=f.transmission,g.transmissionSamplerMap.value=v.texture,g.transmissionSamplerSize.value.set(v.width,v.height),f.transmissionMap&&(g.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,g.transmissionMapTransform)),g.thickness.value=f.thickness,f.thicknessMap&&(g.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=f.attenuationDistance,g.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(g.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(g.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=f.specularIntensity,g.specularColor.value.copy(f.specularColor),f.specularColorMap&&(g.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,g.specularColorMapTransform)),f.specularIntensityMap&&(g.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,g.specularIntensityMapTransform))}function m(g,f){f.matcap&&(g.matcap.value=f.matcap)}function x(g,f){const v=e.get(f).light;g.referencePosition.value.setFromMatrixPosition(v.matrixWorld),g.nearDistance.value=v.shadow.camera.near,g.farDistance.value=v.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function yI(n,e,t,i){let r={},s={},o=[];const a=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(v,y){const _=y.program;i.uniformBlockBinding(v,_)}function c(v,y){let _=r[v.id];_===void 0&&(m(v),_=u(v),r[v.id]=_,v.addEventListener("dispose",g));const R=y.program;i.updateUBOMapping(v,R);const w=e.render.frame;s[v.id]!==w&&(d(v),s[v.id]=w)}function u(v){const y=h();v.__bindingPointIndex=y;const _=n.createBuffer(),R=v.__size,w=v.usage;return n.bindBuffer(n.UNIFORM_BUFFER,_),n.bufferData(n.UNIFORM_BUFFER,R,w),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,y,_),_}function h(){for(let v=0;v<a;v++)if(o.indexOf(v)===-1)return o.push(v),v;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(v){const y=r[v.id],_=v.uniforms,R=v.__cache;n.bindBuffer(n.UNIFORM_BUFFER,y);for(let w=0,E=_.length;w<E;w++){const A=Array.isArray(_[w])?_[w]:[_[w]];for(let b=0,M=A.length;b<M;b++){const L=A[b];if(p(L,w,b,R)===!0){const G=L.__offset,B=Array.isArray(L.value)?L.value:[L.value];let j=0;for(let U=0;U<B.length;U++){const z=B[U],Z=x(z);typeof z=="number"||typeof z=="boolean"?(L.__data[0]=z,n.bufferSubData(n.UNIFORM_BUFFER,G+j,L.__data)):z.isMatrix3?(L.__data[0]=z.elements[0],L.__data[1]=z.elements[1],L.__data[2]=z.elements[2],L.__data[3]=0,L.__data[4]=z.elements[3],L.__data[5]=z.elements[4],L.__data[6]=z.elements[5],L.__data[7]=0,L.__data[8]=z.elements[6],L.__data[9]=z.elements[7],L.__data[10]=z.elements[8],L.__data[11]=0):(z.toArray(L.__data,j),j+=Z.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,G,L.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function p(v,y,_,R){const w=v.value,E=y+"_"+_;if(R[E]===void 0)return typeof w=="number"||typeof w=="boolean"?R[E]=w:R[E]=w.clone(),!0;{const A=R[E];if(typeof w=="number"||typeof w=="boolean"){if(A!==w)return R[E]=w,!0}else if(A.equals(w)===!1)return A.copy(w),!0}return!1}function m(v){const y=v.uniforms;let _=0;const R=16;for(let E=0,A=y.length;E<A;E++){const b=Array.isArray(y[E])?y[E]:[y[E]];for(let M=0,L=b.length;M<L;M++){const G=b[M],B=Array.isArray(G.value)?G.value:[G.value];for(let j=0,U=B.length;j<U;j++){const z=B[j],Z=x(z),D=_%R,$=D%Z.boundary,K=D+$;_+=$,K!==0&&R-K<Z.storage&&(_+=R-K),G.__data=new Float32Array(Z.storage/Float32Array.BYTES_PER_ELEMENT),G.__offset=_,_+=Z.storage}}}const w=_%R;return w>0&&(_+=R-w),v.__size=_,v.__cache={},this}function x(v){const y={boundary:0,storage:0};return typeof v=="number"||typeof v=="boolean"?(y.boundary=4,y.storage=4):v.isVector2?(y.boundary=8,y.storage=8):v.isVector3||v.isColor?(y.boundary=16,y.storage=12):v.isVector4?(y.boundary=16,y.storage=16):v.isMatrix3?(y.boundary=48,y.storage=48):v.isMatrix4?(y.boundary=64,y.storage=64):v.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",v),y}function g(v){const y=v.target;y.removeEventListener("dispose",g);const _=o.indexOf(y.__bindingPointIndex);o.splice(_,1),n.deleteBuffer(r[y.id]),delete r[y.id],delete s[y.id]}function f(){for(const v in r)n.deleteBuffer(r[v]);o=[],r={},s={}}return{bind:l,update:c,dispose:f}}class _I{constructor(e={}){const{canvas:t=sM(),context:i=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let d;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=i.getContextAttributes().alpha}else d=o;const p=new Uint32Array(4),m=new Int32Array(4);let x=null,g=null;const f=[],v=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Hn,this.toneMapping=ji,this.toneMappingExposure=1;const y=this;let _=!1,R=0,w=0,E=null,A=-1,b=null;const M=new ct,L=new ct;let G=null;const B=new _e(0);let j=0,U=t.width,z=t.height,Z=1,D=null,$=null;const K=new ct(0,0,U,z),se=new ct(0,0,U,z);let Ae=!1;const qe=new Ll;let X=!1,oe=!1;const ve=new ke,de=new I,De=new ct,He={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Be=!1;function it(){return E===null?Z:1}let P=i;function le(C,O){return t.getContext(C,O)}try{const C={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Rd}`),t.addEventListener("webglcontextlost",q,!1),t.addEventListener("webglcontextrestored",te,!1),t.addEventListener("webglcontextcreationerror",he,!1),P===null){const O="webgl2";if(P=le(O,C),P===null)throw le(O)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(C){throw console.error("THREE.WebGLRenderer: "+C.message),C}let ie,xe,Y,Ue,me,be,N,T,H,ee,J,ne,Le,pe,Me,We,ae,Se,Je,Ve,Te,Ge,Ze,vt;function k(){ie=new T2(P),ie.init(),Ge=new vM(P,ie),xe=new _2(P,ie,e,Ge),Y=new sI(P),Ue=new R2(P),me=new $P,be=new dI(P,ie,Y,me,xe,Ge,Ue),N=new M2(y),T=new E2(y),H=new kA(P),Ze=new v2(P,H),ee=new A2(P,H,Ue,Ze),J=new I2(P,ee,H,Ue),Je=new P2(P,xe,be),We=new S2(me),ne=new XP(y,N,T,ie,xe,Ze,We),Le=new vI(y,me),pe=new qP,Me=new tI(ie),Se=new x2(y,N,T,Y,J,d,l),ae=new rI(y,J,xe),vt=new yI(P,Ue,xe,Y),Ve=new y2(P,ie,Ue),Te=new C2(P,ie,Ue),Ue.programs=ne.programs,y.capabilities=xe,y.extensions=ie,y.properties=me,y.renderLists=pe,y.shadowMap=ae,y.state=Y,y.info=Ue}k();const ce=new gI(y,P);this.xr=ce,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){const C=ie.get("WEBGL_lose_context");C&&C.loseContext()},this.forceContextRestore=function(){const C=ie.get("WEBGL_lose_context");C&&C.restoreContext()},this.getPixelRatio=function(){return Z},this.setPixelRatio=function(C){C!==void 0&&(Z=C,this.setSize(U,z,!1))},this.getSize=function(C){return C.set(U,z)},this.setSize=function(C,O,V=!0){if(ce.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}U=C,z=O,t.width=Math.floor(C*Z),t.height=Math.floor(O*Z),V===!0&&(t.style.width=C+"px",t.style.height=O+"px"),this.setViewport(0,0,C,O)},this.getDrawingBufferSize=function(C){return C.set(U*Z,z*Z).floor()},this.setDrawingBufferSize=function(C,O,V){U=C,z=O,Z=V,t.width=Math.floor(C*V),t.height=Math.floor(O*V),this.setViewport(0,0,C,O)},this.getCurrentViewport=function(C){return C.copy(M)},this.getViewport=function(C){return C.copy(K)},this.setViewport=function(C,O,V,W){C.isVector4?K.set(C.x,C.y,C.z,C.w):K.set(C,O,V,W),Y.viewport(M.copy(K).multiplyScalar(Z).round())},this.getScissor=function(C){return C.copy(se)},this.setScissor=function(C,O,V,W){C.isVector4?se.set(C.x,C.y,C.z,C.w):se.set(C,O,V,W),Y.scissor(L.copy(se).multiplyScalar(Z).round())},this.getScissorTest=function(){return Ae},this.setScissorTest=function(C){Y.setScissorTest(Ae=C)},this.setOpaqueSort=function(C){D=C},this.setTransparentSort=function(C){$=C},this.getClearColor=function(C){return C.copy(Se.getClearColor())},this.setClearColor=function(){Se.setClearColor.apply(Se,arguments)},this.getClearAlpha=function(){return Se.getClearAlpha()},this.setClearAlpha=function(){Se.setClearAlpha.apply(Se,arguments)},this.clear=function(C=!0,O=!0,V=!0){let W=0;if(C){let F=!1;if(E!==null){const ue=E.texture.format;F=ue===kd||ue===Ud||ue===Pl}if(F){const ue=E.texture.type,ye=ue===Ei||ue===Ji||ue===Do||ue===Ms||ue===Nd||ue===Ld,Ce=Se.getClearColor(),Re=Se.getClearAlpha(),Fe=Ce.r,ze=Ce.g,Ie=Ce.b;ye?(p[0]=Fe,p[1]=ze,p[2]=Ie,p[3]=Re,P.clearBufferuiv(P.COLOR,0,p)):(m[0]=Fe,m[1]=ze,m[2]=Ie,m[3]=Re,P.clearBufferiv(P.COLOR,0,m))}else W|=P.COLOR_BUFFER_BIT}O&&(W|=P.DEPTH_BUFFER_BIT),V&&(W|=P.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),P.clear(W)},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(){t.removeEventListener("webglcontextlost",q,!1),t.removeEventListener("webglcontextrestored",te,!1),t.removeEventListener("webglcontextcreationerror",he,!1),pe.dispose(),Me.dispose(),me.dispose(),N.dispose(),T.dispose(),J.dispose(),Ze.dispose(),vt.dispose(),ne.dispose(),ce.dispose(),ce.removeEventListener("sessionstart",hi),ce.removeEventListener("sessionend",Cg),zr.stop()};function q(C){C.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),_=!0}function te(){console.log("THREE.WebGLRenderer: Context Restored."),_=!1;const C=Ue.autoReset,O=ae.enabled,V=ae.autoUpdate,W=ae.needsUpdate,F=ae.type;k(),Ue.autoReset=C,ae.enabled=O,ae.autoUpdate=V,ae.needsUpdate=W,ae.type=F}function he(C){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",C.statusMessage)}function Oe(C){const O=C.target;O.removeEventListener("dispose",Oe),Qe(O)}function Qe(C){It(C),me.remove(C)}function It(C){const O=me.get(C).programs;O!==void 0&&(O.forEach(function(V){ne.releaseProgram(V)}),C.isShaderMaterial&&ne.releaseShaderCache(C))}this.renderBufferDirect=function(C,O,V,W,F,ue){O===null&&(O=He);const ye=F.isMesh&&F.matrixWorld.determinant()<0,Ce=vw(C,O,V,W,F);Y.setMaterial(W,ye);let Re=V.index,Fe=1;if(W.wireframe===!0){if(Re=ee.getWireframeAttribute(V),Re===void 0)return;Fe=2}const ze=V.drawRange,Ie=V.attributes.position;let ot=ze.start*Fe,wt=(ze.start+ze.count)*Fe;ue!==null&&(ot=Math.max(ot,ue.start*Fe),wt=Math.min(wt,(ue.start+ue.count)*Fe)),Re!==null?(ot=Math.max(ot,0),wt=Math.min(wt,Re.count)):Ie!=null&&(ot=Math.max(ot,0),wt=Math.min(wt,Ie.count));const bt=wt-ot;if(bt<0||bt===1/0)return;Ze.setup(F,W,Ce,V,Re);let An,at=Ve;if(Re!==null&&(An=H.get(Re),at=Te,at.setIndex(An)),F.isMesh)W.wireframe===!0?(Y.setLineWidth(W.wireframeLinewidth*it()),at.setMode(P.LINES)):at.setMode(P.TRIANGLES);else if(F.isLine){let Ne=W.linewidth;Ne===void 0&&(Ne=1),Y.setLineWidth(Ne*it()),F.isLineSegments?at.setMode(P.LINES):F.isLineLoop?at.setMode(P.LINE_LOOP):at.setMode(P.LINE_STRIP)}else F.isPoints?at.setMode(P.POINTS):F.isSprite&&at.setMode(P.TRIANGLES);if(F.isBatchedMesh)if(F._multiDrawInstances!==null)at.renderMultiDrawInstances(F._multiDrawStarts,F._multiDrawCounts,F._multiDrawCount,F._multiDrawInstances);else if(ie.get("WEBGL_multi_draw"))at.renderMultiDraw(F._multiDrawStarts,F._multiDrawCounts,F._multiDrawCount);else{const Ne=F._multiDrawStarts,Xt=F._multiDrawCounts,lt=F._multiDrawCount,Zn=Re?H.get(Re).bytesPerElement:1,Is=me.get(W).currentProgram.getUniforms();for(let Cn=0;Cn<lt;Cn++)Is.setValue(P,"_gl_DrawID",Cn),at.render(Ne[Cn]/Zn,Xt[Cn])}else if(F.isInstancedMesh)at.renderInstances(ot,bt,F.count);else if(V.isInstancedBufferGeometry){const Ne=V._maxInstanceCount!==void 0?V._maxInstanceCount:1/0,Xt=Math.min(V.instanceCount,Ne);at.renderInstances(ot,bt,Xt)}else at.render(ot,bt)};function jt(C,O,V){C.transparent===!0&&C.side===vi&&C.forceSinglePass===!1?(C.side=fn,C.needsUpdate=!0,zl(C,O,V),C.side=Zi,C.needsUpdate=!0,zl(C,O,V),C.side=vi):zl(C,O,V)}this.compile=function(C,O,V=null){V===null&&(V=C),g=Me.get(V),g.init(O),v.push(g),V.traverseVisible(function(F){F.isLight&&F.layers.test(O.layers)&&(g.pushLight(F),F.castShadow&&g.pushShadow(F))}),C!==V&&C.traverseVisible(function(F){F.isLight&&F.layers.test(O.layers)&&(g.pushLight(F),F.castShadow&&g.pushShadow(F))}),g.setupLights();const W=new Set;return C.traverse(function(F){const ue=F.material;if(ue)if(Array.isArray(ue))for(let ye=0;ye<ue.length;ye++){const Ce=ue[ye];jt(Ce,V,F),W.add(Ce)}else jt(ue,V,F),W.add(ue)}),v.pop(),g=null,W},this.compileAsync=function(C,O,V=null){const W=this.compile(C,O,V);return new Promise(F=>{function ue(){if(W.forEach(function(ye){me.get(ye).currentProgram.isReady()&&W.delete(ye)}),W.size===0){F(C);return}setTimeout(ue,10)}ie.get("KHR_parallel_shader_compile")!==null?ue():setTimeout(ue,10)})};let st=null;function Ci(C){st&&st(C)}function hi(){zr.stop()}function Cg(){zr.start()}const zr=new fM;zr.setAnimationLoop(Ci),typeof self<"u"&&zr.setContext(self),this.setAnimationLoop=function(C){st=C,ce.setAnimationLoop(C),C===null?zr.stop():zr.start()},ce.addEventListener("sessionstart",hi),ce.addEventListener("sessionend",Cg),this.render=function(C,O){if(O!==void 0&&O.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(_===!0)return;if(C.matrixWorldAutoUpdate===!0&&C.updateMatrixWorld(),O.parent===null&&O.matrixWorldAutoUpdate===!0&&O.updateMatrixWorld(),ce.enabled===!0&&ce.isPresenting===!0&&(ce.cameraAutoUpdate===!0&&ce.updateCamera(O),O=ce.getCamera()),C.isScene===!0&&C.onBeforeRender(y,C,O,E),g=Me.get(C,v.length),g.init(O),v.push(g),ve.multiplyMatrices(O.projectionMatrix,O.matrixWorldInverse),qe.setFromProjectionMatrix(ve),oe=this.localClippingEnabled,X=We.init(this.clippingPlanes,oe),x=pe.get(C,f.length),x.init(),f.push(x),ce.enabled===!0&&ce.isPresenting===!0){const ue=y.xr.getDepthSensingMesh();ue!==null&&dh(ue,O,-1/0,y.sortObjects)}dh(C,O,0,y.sortObjects),x.finish(),y.sortObjects===!0&&x.sort(D,$),Be=ce.enabled===!1||ce.isPresenting===!1||ce.hasDepthSensing()===!1,Be&&Se.addToRenderList(x,C),this.info.render.frame++,X===!0&&We.beginShadows();const V=g.state.shadowsArray;ae.render(V,C,O),X===!0&&We.endShadows(),this.info.autoReset===!0&&this.info.reset();const W=x.opaque,F=x.transmissive;if(g.setupLights(),O.isArrayCamera){const ue=O.cameras;if(F.length>0)for(let ye=0,Ce=ue.length;ye<Ce;ye++){const Re=ue[ye];Pg(W,F,C,Re)}Be&&Se.render(C);for(let ye=0,Ce=ue.length;ye<Ce;ye++){const Re=ue[ye];Rg(x,C,Re,Re.viewport)}}else F.length>0&&Pg(W,F,C,O),Be&&Se.render(C),Rg(x,C,O);E!==null&&(be.updateMultisampleRenderTarget(E),be.updateRenderTargetMipmap(E)),C.isScene===!0&&C.onAfterRender(y,C,O),Ze.resetDefaultState(),A=-1,b=null,v.pop(),v.length>0?(g=v[v.length-1],X===!0&&We.setGlobalState(y.clippingPlanes,g.state.camera)):g=null,f.pop(),f.length>0?x=f[f.length-1]:x=null};function dh(C,O,V,W){if(C.visible===!1)return;if(C.layers.test(O.layers)){if(C.isGroup)V=C.renderOrder;else if(C.isLOD)C.autoUpdate===!0&&C.update(O);else if(C.isLight)g.pushLight(C),C.castShadow&&g.pushShadow(C);else if(C.isSprite){if(!C.frustumCulled||qe.intersectsSprite(C)){W&&De.setFromMatrixPosition(C.matrixWorld).applyMatrix4(ve);const ye=J.update(C),Ce=C.material;Ce.visible&&x.push(C,ye,Ce,V,De.z,null)}}else if((C.isMesh||C.isLine||C.isPoints)&&(!C.frustumCulled||qe.intersectsObject(C))){const ye=J.update(C),Ce=C.material;if(W&&(C.boundingSphere!==void 0?(C.boundingSphere===null&&C.computeBoundingSphere(),De.copy(C.boundingSphere.center)):(ye.boundingSphere===null&&ye.computeBoundingSphere(),De.copy(ye.boundingSphere.center)),De.applyMatrix4(C.matrixWorld).applyMatrix4(ve)),Array.isArray(Ce)){const Re=ye.groups;for(let Fe=0,ze=Re.length;Fe<ze;Fe++){const Ie=Re[Fe],ot=Ce[Ie.materialIndex];ot&&ot.visible&&x.push(C,ye,ot,V,De.z,Ie)}}else Ce.visible&&x.push(C,ye,Ce,V,De.z,null)}}const ue=C.children;for(let ye=0,Ce=ue.length;ye<Ce;ye++)dh(ue[ye],O,V,W)}function Rg(C,O,V,W){const F=C.opaque,ue=C.transmissive,ye=C.transparent;g.setupLightsView(V),X===!0&&We.setGlobalState(y.clippingPlanes,V),W&&Y.viewport(M.copy(W)),F.length>0&&Bl(F,O,V),ue.length>0&&Bl(ue,O,V),ye.length>0&&Bl(ye,O,V),Y.buffers.depth.setTest(!0),Y.buffers.depth.setMask(!0),Y.buffers.color.setMask(!0),Y.setPolygonOffset(!1)}function Pg(C,O,V,W){if((V.isScene===!0?V.overrideMaterial:null)!==null)return;g.state.transmissionRenderTarget[W.id]===void 0&&(g.state.transmissionRenderTarget[W.id]=new li(1,1,{generateMipmaps:!0,type:ie.has("EXT_color_buffer_half_float")||ie.has("EXT_color_buffer_float")?Ho:Ei,minFilter:yi,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:rt.workingColorSpace}));const ue=g.state.transmissionRenderTarget[W.id],ye=W.viewport||M;ue.setSize(ye.z,ye.w);const Ce=y.getRenderTarget();y.setRenderTarget(ue),y.getClearColor(B),j=y.getClearAlpha(),j<1&&y.setClearColor(16777215,.5),y.clear(),Be&&Se.render(V);const Re=y.toneMapping;y.toneMapping=ji;const Fe=W.viewport;if(W.viewport!==void 0&&(W.viewport=void 0),g.setupLightsView(W),X===!0&&We.setGlobalState(y.clippingPlanes,W),Bl(C,V,W),be.updateMultisampleRenderTarget(ue),be.updateRenderTargetMipmap(ue),ie.has("WEBGL_multisampled_render_to_texture")===!1){let ze=!1;for(let Ie=0,ot=O.length;Ie<ot;Ie++){const wt=O[Ie],bt=wt.object,An=wt.geometry,at=wt.material,Ne=wt.group;if(at.side===vi&&bt.layers.test(W.layers)){const Xt=at.side;at.side=fn,at.needsUpdate=!0,Ig(bt,V,W,An,at,Ne),at.side=Xt,at.needsUpdate=!0,ze=!0}}ze===!0&&(be.updateMultisampleRenderTarget(ue),be.updateRenderTargetMipmap(ue))}y.setRenderTarget(Ce),y.setClearColor(B,j),Fe!==void 0&&(W.viewport=Fe),y.toneMapping=Re}function Bl(C,O,V){const W=O.isScene===!0?O.overrideMaterial:null;for(let F=0,ue=C.length;F<ue;F++){const ye=C[F],Ce=ye.object,Re=ye.geometry,Fe=W===null?ye.material:W,ze=ye.group;Ce.layers.test(V.layers)&&Ig(Ce,O,V,Re,Fe,ze)}}function Ig(C,O,V,W,F,ue){C.onBeforeRender(y,O,V,W,F,ue),C.modelViewMatrix.multiplyMatrices(V.matrixWorldInverse,C.matrixWorld),C.normalMatrix.getNormalMatrix(C.modelViewMatrix),F.onBeforeRender(y,O,V,W,C,ue),F.transparent===!0&&F.side===vi&&F.forceSinglePass===!1?(F.side=fn,F.needsUpdate=!0,y.renderBufferDirect(V,O,W,F,C,ue),F.side=Zi,F.needsUpdate=!0,y.renderBufferDirect(V,O,W,F,C,ue),F.side=vi):y.renderBufferDirect(V,O,W,F,C,ue),C.onAfterRender(y,O,V,W,F,ue)}function zl(C,O,V){O.isScene!==!0&&(O=He);const W=me.get(C),F=g.state.lights,ue=g.state.shadowsArray,ye=F.state.version,Ce=ne.getParameters(C,F.state,ue,O,V),Re=ne.getProgramCacheKey(Ce);let Fe=W.programs;W.environment=C.isMeshStandardMaterial?O.environment:null,W.fog=O.fog,W.envMap=(C.isMeshStandardMaterial?T:N).get(C.envMap||W.environment),W.envMapRotation=W.environment!==null&&C.envMap===null?O.environmentRotation:C.envMapRotation,Fe===void 0&&(C.addEventListener("dispose",Oe),Fe=new Map,W.programs=Fe);let ze=Fe.get(Re);if(ze!==void 0){if(W.currentProgram===ze&&W.lightsStateVersion===ye)return Lg(C,Ce),ze}else Ce.uniforms=ne.getUniforms(C),C.onBeforeCompile(Ce,y),ze=ne.acquireProgram(Ce,Re),Fe.set(Re,ze),W.uniforms=Ce.uniforms;const Ie=W.uniforms;return(!C.isShaderMaterial&&!C.isRawShaderMaterial||C.clipping===!0)&&(Ie.clippingPlanes=We.uniform),Lg(C,Ce),W.needsLights=_w(C),W.lightsStateVersion=ye,W.needsLights&&(Ie.ambientLightColor.value=F.state.ambient,Ie.lightProbe.value=F.state.probe,Ie.directionalLights.value=F.state.directional,Ie.directionalLightShadows.value=F.state.directionalShadow,Ie.spotLights.value=F.state.spot,Ie.spotLightShadows.value=F.state.spotShadow,Ie.rectAreaLights.value=F.state.rectArea,Ie.ltc_1.value=F.state.rectAreaLTC1,Ie.ltc_2.value=F.state.rectAreaLTC2,Ie.pointLights.value=F.state.point,Ie.pointLightShadows.value=F.state.pointShadow,Ie.hemisphereLights.value=F.state.hemi,Ie.directionalShadowMap.value=F.state.directionalShadowMap,Ie.directionalShadowMatrix.value=F.state.directionalShadowMatrix,Ie.spotShadowMap.value=F.state.spotShadowMap,Ie.spotLightMatrix.value=F.state.spotLightMatrix,Ie.spotLightMap.value=F.state.spotLightMap,Ie.pointShadowMap.value=F.state.pointShadowMap,Ie.pointShadowMatrix.value=F.state.pointShadowMatrix),W.currentProgram=ze,W.uniformsList=null,ze}function Ng(C){if(C.uniformsList===null){const O=C.currentProgram.getUniforms();C.uniformsList=cu.seqWithValue(O.seq,C.uniforms)}return C.uniformsList}function Lg(C,O){const V=me.get(C);V.outputColorSpace=O.outputColorSpace,V.batching=O.batching,V.batchingColor=O.batchingColor,V.instancing=O.instancing,V.instancingColor=O.instancingColor,V.instancingMorph=O.instancingMorph,V.skinning=O.skinning,V.morphTargets=O.morphTargets,V.morphNormals=O.morphNormals,V.morphColors=O.morphColors,V.morphTargetsCount=O.morphTargetsCount,V.numClippingPlanes=O.numClippingPlanes,V.numIntersection=O.numClipIntersection,V.vertexAlphas=O.vertexAlphas,V.vertexTangents=O.vertexTangents,V.toneMapping=O.toneMapping}function vw(C,O,V,W,F){O.isScene!==!0&&(O=He),be.resetTextureUnits();const ue=O.fog,ye=W.isMeshStandardMaterial?O.environment:null,Ce=E===null?y.outputColorSpace:E.isXRRenderTarget===!0?E.texture.colorSpace:tr,Re=(W.isMeshStandardMaterial?T:N).get(W.envMap||ye),Fe=W.vertexColors===!0&&!!V.attributes.color&&V.attributes.color.itemSize===4,ze=!!V.attributes.tangent&&(!!W.normalMap||W.anisotropy>0),Ie=!!V.morphAttributes.position,ot=!!V.morphAttributes.normal,wt=!!V.morphAttributes.color;let bt=ji;W.toneMapped&&(E===null||E.isXRRenderTarget===!0)&&(bt=y.toneMapping);const An=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,at=An!==void 0?An.length:0,Ne=me.get(W),Xt=g.state.lights;if(X===!0&&(oe===!0||C!==b)){const zn=C===b&&W.id===A;We.setState(W,C,zn)}let lt=!1;W.version===Ne.__version?(Ne.needsLights&&Ne.lightsStateVersion!==Xt.state.version||Ne.outputColorSpace!==Ce||F.isBatchedMesh&&Ne.batching===!1||!F.isBatchedMesh&&Ne.batching===!0||F.isBatchedMesh&&Ne.batchingColor===!0&&F.colorTexture===null||F.isBatchedMesh&&Ne.batchingColor===!1&&F.colorTexture!==null||F.isInstancedMesh&&Ne.instancing===!1||!F.isInstancedMesh&&Ne.instancing===!0||F.isSkinnedMesh&&Ne.skinning===!1||!F.isSkinnedMesh&&Ne.skinning===!0||F.isInstancedMesh&&Ne.instancingColor===!0&&F.instanceColor===null||F.isInstancedMesh&&Ne.instancingColor===!1&&F.instanceColor!==null||F.isInstancedMesh&&Ne.instancingMorph===!0&&F.morphTexture===null||F.isInstancedMesh&&Ne.instancingMorph===!1&&F.morphTexture!==null||Ne.envMap!==Re||W.fog===!0&&Ne.fog!==ue||Ne.numClippingPlanes!==void 0&&(Ne.numClippingPlanes!==We.numPlanes||Ne.numIntersection!==We.numIntersection)||Ne.vertexAlphas!==Fe||Ne.vertexTangents!==ze||Ne.morphTargets!==Ie||Ne.morphNormals!==ot||Ne.morphColors!==wt||Ne.toneMapping!==bt||Ne.morphTargetsCount!==at)&&(lt=!0):(lt=!0,Ne.__version=W.version);let Zn=Ne.currentProgram;lt===!0&&(Zn=zl(W,O,F));let Is=!1,Cn=!1,hh=!1;const Nt=Zn.getUniforms(),nr=Ne.uniforms;if(Y.useProgram(Zn.program)&&(Is=!0,Cn=!0,hh=!0),W.id!==A&&(A=W.id,Cn=!0),Is||b!==C){Nt.setValue(P,"projectionMatrix",C.projectionMatrix),Nt.setValue(P,"viewMatrix",C.matrixWorldInverse);const zn=Nt.map.cameraPosition;zn!==void 0&&zn.setValue(P,de.setFromMatrixPosition(C.matrixWorld)),xe.logarithmicDepthBuffer&&Nt.setValue(P,"logDepthBufFC",2/(Math.log(C.far+1)/Math.LN2)),(W.isMeshPhongMaterial||W.isMeshToonMaterial||W.isMeshLambertMaterial||W.isMeshBasicMaterial||W.isMeshStandardMaterial||W.isShaderMaterial)&&Nt.setValue(P,"isOrthographic",C.isOrthographicCamera===!0),b!==C&&(b=C,Cn=!0,hh=!0)}if(F.isSkinnedMesh){Nt.setOptional(P,F,"bindMatrix"),Nt.setOptional(P,F,"bindMatrixInverse");const zn=F.skeleton;zn&&(zn.boneTexture===null&&zn.computeBoneTexture(),Nt.setValue(P,"boneTexture",zn.boneTexture,be))}F.isBatchedMesh&&(Nt.setOptional(P,F,"batchingTexture"),Nt.setValue(P,"batchingTexture",F._matricesTexture,be),Nt.setOptional(P,F,"batchingIdTexture"),Nt.setValue(P,"batchingIdTexture",F._indirectTexture,be),Nt.setOptional(P,F,"batchingColorTexture"),F._colorsTexture!==null&&Nt.setValue(P,"batchingColorTexture",F._colorsTexture,be));const fh=V.morphAttributes;if((fh.position!==void 0||fh.normal!==void 0||fh.color!==void 0)&&Je.update(F,V,Zn),(Cn||Ne.receiveShadow!==F.receiveShadow)&&(Ne.receiveShadow=F.receiveShadow,Nt.setValue(P,"receiveShadow",F.receiveShadow)),W.isMeshGouraudMaterial&&W.envMap!==null&&(nr.envMap.value=Re,nr.flipEnvMap.value=Re.isCubeTexture&&Re.isRenderTargetTexture===!1?-1:1),W.isMeshStandardMaterial&&W.envMap===null&&O.environment!==null&&(nr.envMapIntensity.value=O.environmentIntensity),Cn&&(Nt.setValue(P,"toneMappingExposure",y.toneMappingExposure),Ne.needsLights&&yw(nr,hh),ue&&W.fog===!0&&Le.refreshFogUniforms(nr,ue),Le.refreshMaterialUniforms(nr,W,Z,z,g.state.transmissionRenderTarget[C.id]),cu.upload(P,Ng(Ne),nr,be)),W.isShaderMaterial&&W.uniformsNeedUpdate===!0&&(cu.upload(P,Ng(Ne),nr,be),W.uniformsNeedUpdate=!1),W.isSpriteMaterial&&Nt.setValue(P,"center",F.center),Nt.setValue(P,"modelViewMatrix",F.modelViewMatrix),Nt.setValue(P,"normalMatrix",F.normalMatrix),Nt.setValue(P,"modelMatrix",F.matrixWorld),W.isShaderMaterial||W.isRawShaderMaterial){const zn=W.uniformsGroups;for(let ph=0,Sw=zn.length;ph<Sw;ph++){const Dg=zn[ph];vt.update(Dg,Zn),vt.bind(Dg,Zn)}}return Zn}function yw(C,O){C.ambientLightColor.needsUpdate=O,C.lightProbe.needsUpdate=O,C.directionalLights.needsUpdate=O,C.directionalLightShadows.needsUpdate=O,C.pointLights.needsUpdate=O,C.pointLightShadows.needsUpdate=O,C.spotLights.needsUpdate=O,C.spotLightShadows.needsUpdate=O,C.rectAreaLights.needsUpdate=O,C.hemisphereLights.needsUpdate=O}function _w(C){return C.isMeshLambertMaterial||C.isMeshToonMaterial||C.isMeshPhongMaterial||C.isMeshStandardMaterial||C.isShadowMaterial||C.isShaderMaterial&&C.lights===!0}this.getActiveCubeFace=function(){return R},this.getActiveMipmapLevel=function(){return w},this.getRenderTarget=function(){return E},this.setRenderTargetTextures=function(C,O,V){me.get(C.texture).__webglTexture=O,me.get(C.depthTexture).__webglTexture=V;const W=me.get(C);W.__hasExternalTextures=!0,W.__autoAllocateDepthBuffer=V===void 0,W.__autoAllocateDepthBuffer||ie.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),W.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(C,O){const V=me.get(C);V.__webglFramebuffer=O,V.__useDefaultFramebuffer=O===void 0},this.setRenderTarget=function(C,O=0,V=0){E=C,R=O,w=V;let W=!0,F=null,ue=!1,ye=!1;if(C){const Re=me.get(C);if(Re.__useDefaultFramebuffer!==void 0)Y.bindFramebuffer(P.FRAMEBUFFER,null),W=!1;else if(Re.__webglFramebuffer===void 0)be.setupRenderTarget(C);else if(Re.__hasExternalTextures)be.rebindTextures(C,me.get(C.texture).__webglTexture,me.get(C.depthTexture).__webglTexture);else if(C.depthBuffer){const Ie=C.depthTexture;if(Re.__boundDepthTexture!==Ie){if(Ie!==null&&me.has(Ie)&&(C.width!==Ie.image.width||C.height!==Ie.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");be.setupDepthRenderbuffer(C)}}const Fe=C.texture;(Fe.isData3DTexture||Fe.isDataArrayTexture||Fe.isCompressedArrayTexture)&&(ye=!0);const ze=me.get(C).__webglFramebuffer;C.isWebGLCubeRenderTarget?(Array.isArray(ze[O])?F=ze[O][V]:F=ze[O],ue=!0):C.samples>0&&be.useMultisampledRTT(C)===!1?F=me.get(C).__webglMultisampledFramebuffer:Array.isArray(ze)?F=ze[V]:F=ze,M.copy(C.viewport),L.copy(C.scissor),G=C.scissorTest}else M.copy(K).multiplyScalar(Z).floor(),L.copy(se).multiplyScalar(Z).floor(),G=Ae;if(Y.bindFramebuffer(P.FRAMEBUFFER,F)&&W&&Y.drawBuffers(C,F),Y.viewport(M),Y.scissor(L),Y.setScissorTest(G),ue){const Re=me.get(C.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+O,Re.__webglTexture,V)}else if(ye){const Re=me.get(C.texture),Fe=O||0;P.framebufferTextureLayer(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,Re.__webglTexture,V||0,Fe)}A=-1},this.readRenderTargetPixels=function(C,O,V,W,F,ue,ye){if(!(C&&C.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ce=me.get(C).__webglFramebuffer;if(C.isWebGLCubeRenderTarget&&ye!==void 0&&(Ce=Ce[ye]),Ce){Y.bindFramebuffer(P.FRAMEBUFFER,Ce);try{const Re=C.texture,Fe=Re.format,ze=Re.type;if(!xe.textureFormatReadable(Fe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!xe.textureTypeReadable(ze)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}O>=0&&O<=C.width-W&&V>=0&&V<=C.height-F&&P.readPixels(O,V,W,F,Ge.convert(Fe),Ge.convert(ze),ue)}finally{const Re=E!==null?me.get(E).__webglFramebuffer:null;Y.bindFramebuffer(P.FRAMEBUFFER,Re)}}},this.readRenderTargetPixelsAsync=async function(C,O,V,W,F,ue,ye){if(!(C&&C.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Ce=me.get(C).__webglFramebuffer;if(C.isWebGLCubeRenderTarget&&ye!==void 0&&(Ce=Ce[ye]),Ce){Y.bindFramebuffer(P.FRAMEBUFFER,Ce);try{const Re=C.texture,Fe=Re.format,ze=Re.type;if(!xe.textureFormatReadable(Fe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!xe.textureTypeReadable(ze))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(O>=0&&O<=C.width-W&&V>=0&&V<=C.height-F){const Ie=P.createBuffer();P.bindBuffer(P.PIXEL_PACK_BUFFER,Ie),P.bufferData(P.PIXEL_PACK_BUFFER,ue.byteLength,P.STREAM_READ),P.readPixels(O,V,W,F,Ge.convert(Fe),Ge.convert(ze),0),P.flush();const ot=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);await aA(P,ot,4);try{P.bindBuffer(P.PIXEL_PACK_BUFFER,Ie),P.getBufferSubData(P.PIXEL_PACK_BUFFER,0,ue)}finally{P.deleteBuffer(Ie),P.deleteSync(ot)}return ue}}finally{const Re=E!==null?me.get(E).__webglFramebuffer:null;Y.bindFramebuffer(P.FRAMEBUFFER,Re)}}},this.copyFramebufferToTexture=function(C,O=null,V=0){C.isTexture!==!0&&(bo("WebGLRenderer: copyFramebufferToTexture function signature has changed."),O=arguments[0]||null,C=arguments[1]);const W=Math.pow(2,-V),F=Math.floor(C.image.width*W),ue=Math.floor(C.image.height*W),ye=O!==null?O.x:0,Ce=O!==null?O.y:0;be.setTexture2D(C,0),P.copyTexSubImage2D(P.TEXTURE_2D,V,0,0,ye,Ce,F,ue),Y.unbindTexture()},this.copyTextureToTexture=function(C,O,V=null,W=null,F=0){C.isTexture!==!0&&(bo("WebGLRenderer: copyTextureToTexture function signature has changed."),W=arguments[0]||null,C=arguments[1],O=arguments[2],F=arguments[3]||0,V=null);let ue,ye,Ce,Re,Fe,ze;V!==null?(ue=V.max.x-V.min.x,ye=V.max.y-V.min.y,Ce=V.min.x,Re=V.min.y):(ue=C.image.width,ye=C.image.height,Ce=0,Re=0),W!==null?(Fe=W.x,ze=W.y):(Fe=0,ze=0);const Ie=Ge.convert(O.format),ot=Ge.convert(O.type);be.setTexture2D(O,0),P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,O.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,O.unpackAlignment);const wt=P.getParameter(P.UNPACK_ROW_LENGTH),bt=P.getParameter(P.UNPACK_IMAGE_HEIGHT),An=P.getParameter(P.UNPACK_SKIP_PIXELS),at=P.getParameter(P.UNPACK_SKIP_ROWS),Ne=P.getParameter(P.UNPACK_SKIP_IMAGES),Xt=C.isCompressedTexture?C.mipmaps[F]:C.image;P.pixelStorei(P.UNPACK_ROW_LENGTH,Xt.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,Xt.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Ce),P.pixelStorei(P.UNPACK_SKIP_ROWS,Re),C.isDataTexture?P.texSubImage2D(P.TEXTURE_2D,F,Fe,ze,ue,ye,Ie,ot,Xt.data):C.isCompressedTexture?P.compressedTexSubImage2D(P.TEXTURE_2D,F,Fe,ze,Xt.width,Xt.height,Ie,Xt.data):P.texSubImage2D(P.TEXTURE_2D,F,Fe,ze,ue,ye,Ie,ot,Xt),P.pixelStorei(P.UNPACK_ROW_LENGTH,wt),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,bt),P.pixelStorei(P.UNPACK_SKIP_PIXELS,An),P.pixelStorei(P.UNPACK_SKIP_ROWS,at),P.pixelStorei(P.UNPACK_SKIP_IMAGES,Ne),F===0&&O.generateMipmaps&&P.generateMipmap(P.TEXTURE_2D),Y.unbindTexture()},this.copyTextureToTexture3D=function(C,O,V=null,W=null,F=0){C.isTexture!==!0&&(bo("WebGLRenderer: copyTextureToTexture3D function signature has changed."),V=arguments[0]||null,W=arguments[1]||null,C=arguments[2],O=arguments[3],F=arguments[4]||0);let ue,ye,Ce,Re,Fe,ze,Ie,ot,wt;const bt=C.isCompressedTexture?C.mipmaps[F]:C.image;V!==null?(ue=V.max.x-V.min.x,ye=V.max.y-V.min.y,Ce=V.max.z-V.min.z,Re=V.min.x,Fe=V.min.y,ze=V.min.z):(ue=bt.width,ye=bt.height,Ce=bt.depth,Re=0,Fe=0,ze=0),W!==null?(Ie=W.x,ot=W.y,wt=W.z):(Ie=0,ot=0,wt=0);const An=Ge.convert(O.format),at=Ge.convert(O.type);let Ne;if(O.isData3DTexture)be.setTexture3D(O,0),Ne=P.TEXTURE_3D;else if(O.isDataArrayTexture||O.isCompressedArrayTexture)be.setTexture2DArray(O,0),Ne=P.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,O.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,O.unpackAlignment);const Xt=P.getParameter(P.UNPACK_ROW_LENGTH),lt=P.getParameter(P.UNPACK_IMAGE_HEIGHT),Zn=P.getParameter(P.UNPACK_SKIP_PIXELS),Is=P.getParameter(P.UNPACK_SKIP_ROWS),Cn=P.getParameter(P.UNPACK_SKIP_IMAGES);P.pixelStorei(P.UNPACK_ROW_LENGTH,bt.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,bt.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Re),P.pixelStorei(P.UNPACK_SKIP_ROWS,Fe),P.pixelStorei(P.UNPACK_SKIP_IMAGES,ze),C.isDataTexture||C.isData3DTexture?P.texSubImage3D(Ne,F,Ie,ot,wt,ue,ye,Ce,An,at,bt.data):O.isCompressedArrayTexture?P.compressedTexSubImage3D(Ne,F,Ie,ot,wt,ue,ye,Ce,An,bt.data):P.texSubImage3D(Ne,F,Ie,ot,wt,ue,ye,Ce,An,at,bt),P.pixelStorei(P.UNPACK_ROW_LENGTH,Xt),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,lt),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Zn),P.pixelStorei(P.UNPACK_SKIP_ROWS,Is),P.pixelStorei(P.UNPACK_SKIP_IMAGES,Cn),F===0&&O.generateMipmaps&&P.generateMipmap(Ne),Y.unbindTexture()},this.initRenderTarget=function(C){me.get(C).__webglFramebuffer===void 0&&be.setupRenderTarget(C)},this.initTexture=function(C){C.isCubeTexture?be.setTextureCube(C,0):C.isData3DTexture?be.setTexture3D(C,0):C.isDataArrayTexture||C.isCompressedArrayTexture?be.setTexture2DArray(C,0):be.setTexture2D(C,0),Y.unbindTexture()},this.resetState=function(){R=0,w=0,E=null,Y.reset(),Ze.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return _i}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Fd?"display-p3":"srgb",t.unpackColorSpace=rt.workingColorSpace===Il?"display-p3":"srgb"}}class Wd{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new _e(e),this.density=t}clone(){return new Wd(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class jd{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new _e(e),this.near=t,this.far=i}clone(){return new jd(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}let _M=class extends nt{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 On,this.environmentIntensity=1,this.environmentRotation=new On,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,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 t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}};class Xd{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=hl,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Un()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return bo("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}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,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[i+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Un()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}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=Un()),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 an=new I;class bs{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)an.fromBufferAttribute(this,t),an.applyMatrix4(e),this.setXYZ(t,an.x,an.y,an.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)an.fromBufferAttribute(this,t),an.applyNormalMatrix(e),this.setXYZ(t,an.x,an.y,an.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)an.fromBufferAttribute(this,t),an.transformDirection(e),this.setXYZ(t,an.x,an.y,an.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=un(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Xe(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=Xe(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Xe(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Xe(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Xe(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=un(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=un(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=un(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=un(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array),r=Xe(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array),r=Xe(r,this.array),s=Xe(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,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 t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new ht(new this.array.constructor(t),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 bs(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 t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,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 lg extends on{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new _e(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 qs;const aa=new I,Zs=new I,Ks=new I,Js=new Q,la=new Q,SM=new ke,Ec=new I,ca=new I,Tc=new I,$0=new Q,_f=new Q,Y0=new Q;class MM extends nt{constructor(e=new lg){if(super(),this.isSprite=!0,this.type="Sprite",qs===void 0){qs=new Ye;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new Xd(t,5);qs.setIndex([0,1,2,0,2,3]),qs.setAttribute("position",new bs(i,3,0,!1)),qs.setAttribute("uv",new bs(i,2,3,!1))}this.geometry=qs,this.material=e,this.center=new Q(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Zs.setFromMatrixScale(this.matrixWorld),SM.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Ks.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Zs.multiplyScalar(-Ks.z);const i=this.material.rotation;let r,s;i!==0&&(s=Math.cos(i),r=Math.sin(i));const o=this.center;Ac(Ec.set(-.5,-.5,0),Ks,o,Zs,r,s),Ac(ca.set(.5,-.5,0),Ks,o,Zs,r,s),Ac(Tc.set(.5,.5,0),Ks,o,Zs,r,s),$0.set(0,0),_f.set(1,0),Y0.set(1,1);let a=e.ray.intersectTriangle(Ec,ca,Tc,!1,aa);if(a===null&&(Ac(ca.set(-.5,.5,0),Ks,o,Zs,r,s),_f.set(0,1),a=e.ray.intersectTriangle(Ec,Tc,ca,!1,aa),a===null))return;const l=e.ray.origin.distanceTo(aa);l<e.near||l>e.far||t.push({distance:l,point:aa.clone(),uv:Nn.getInterpolation(aa,Ec,ca,Tc,$0,_f,Y0,new Q),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Ac(n,e,t,i,r,s){Js.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(la.x=s*Js.x-r*Js.y,la.y=r*Js.x+s*Js.y):la.copy(Js),n.copy(e),n.x+=la.x,n.y+=la.y,n.applyMatrix4(SM)}const Cc=new I,q0=new I;class wM extends nt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let i=0,r=t.length;i<r;i++){const s=t[i];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,i=0){t=Math.abs(t);const r=this.levels;let s;for(s=0;s<r.length&&!(t<r[s].distance);s++);return r.splice(s,0,{distance:t,hysteresis:i,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let i,r;for(i=1,r=t.length;i<r;i++){let s=t[i].distance;if(t[i].object.visible&&(s-=s*t[i].hysteresis),e<s)break}return t[i-1].object}return null}raycast(e,t){if(this.levels.length>0){Cc.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(Cc);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Cc.setFromMatrixPosition(e.matrixWorld),q0.setFromMatrixPosition(this.matrixWorld);const i=Cc.distanceTo(q0)/e.zoom;t[0].object.visible=!0;let r,s;for(r=1,s=t.length;r<s;r++){let o=t[r].distance;if(t[r].object.visible&&(o-=o*t[r].hysteresis),i>=o)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;r<s;r++)t[r].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const i=this.levels;for(let r=0,s=i.length;r<s;r++){const o=i[r];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const Z0=new I,K0=new ct,J0=new ct,SI=new I,Q0=new ke,Rc=new I,Sf=new rn,ev=new ke,Mf=new Go;class bM extends kt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Np,this.bindMatrix=new ke,this.bindMatrixInverse=new ke,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new pn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,Rc),this.boundingBox.expandByPoint(Rc)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new rn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,Rc),this.boundingSphere.expandByPoint(Rc)}copy(e,t){return super.copy(e,t),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,t){const i=this.material,r=this.matrixWorld;i!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Sf.copy(this.boundingSphere),Sf.applyMatrix4(r),e.ray.intersectsSphere(Sf)!==!1&&(ev.copy(r).invert(),Mf.copy(e.ray).applyMatrix4(ev),!(this.boundingBox!==null&&Mf.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,Mf)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new ct,t=this.geometry.attributes.skinWeight;for(let i=0,r=t.count;i<r;i++){e.fromBufferAttribute(t,i);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Np?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===WS?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const i=this.skeleton,r=this.geometry;K0.fromBufferAttribute(r.attributes.skinIndex,e),J0.fromBufferAttribute(r.attributes.skinWeight,e),Z0.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const o=J0.getComponent(s);if(o!==0){const a=K0.getComponent(s);Q0.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),t.addScaledVector(SI.copy(Z0).applyMatrix4(Q0),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}class cg extends nt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class wi extends Ct{constructor(e=null,t=1,i=1,r,s,o,a,l,c=Gt,u=Gt,h,d){super(null,o,a,l,c,u,r,s,h,d),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const tv=new ke,MI=new ke;class $d{constructor(e=[],t=[]){this.uuid=Un(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,r=this.bones.length;i<r;i++)this.boneInverses.push(new ke)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const i=new ke;this.bones[e]&&i.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&i.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){const e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:MI;tv.multiplyMatrices(a,t[s]),tv.toArray(i,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new $d(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 t=new Float32Array(e*e*4);t.set(this.boneMatrices);const i=new wi(t,e,e,dn,Sn);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){const r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,r=e.bones.length;i<r;i++){const s=e.bones[i];let o=t[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),o=new cg),this.bones.push(o),this.boneInverses.push(new ke().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,i=this.boneInverses;for(let r=0,s=t.length;r<s;r++){const o=t[r];e.bones.push(o.uuid);const a=i[r];e.boneInverses.push(a.toArray())}return e}}class Oo extends ht{constructor(e,t,i,r=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}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 Qs=new ke,nv=new ke,Pc=[],iv=new pn,wI=new ke,ua=new kt,da=new rn;class EM extends kt{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Oo(new Float32Array(i*16),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<i;r++)this.setMatrixAt(r,wI)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new pn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Qs),iv.copy(e.boundingBox).applyMatrix4(Qs),this.boundingBox.union(iv)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new rn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Qs),da.copy(e.boundingSphere).applyMatrix4(Qs),this.boundingSphere.union(da)}copy(e,t){return super.copy(e,t),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,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const i=t.morphTargetInfluences,r=this.morphTexture.source.data.data,s=i.length+1,o=e*s+1;for(let a=0;a<i.length;a++)i[a]=r[o+a]}raycast(e,t){const i=this.matrixWorld,r=this.count;if(ua.geometry=this.geometry,ua.material=this.material,ua.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),da.copy(this.boundingSphere),da.applyMatrix4(i),e.ray.intersectsSphere(da)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,Qs),nv.multiplyMatrices(i,Qs),ua.matrixWorld=nv,ua.raycast(e,Pc);for(let o=0,a=Pc.length;o<a;o++){const l=Pc[o];l.instanceId=s,l.object=this,t.push(l)}Pc.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Oo(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const i=t.morphTargetInfluences,r=i.length+1;this.morphTexture===null&&(this.morphTexture=new wi(new Float32Array(r*this.count),r,this.count,Dd,Sn));const s=this.morphTexture.source.data.data;let o=0;for(let c=0;c<i.length;c++)o+=i[c];const a=this.geometry.morphTargetsRelative?1:1-o,l=r*e;s[l]=a,s.set(i,l+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}function bI(n,e){return n.z-e.z}function EI(n,e){return e.z-n.z}class TI{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,i){const r=this.pool,s=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});const o=r[this.index];s.push(o),this.index++,o.start=e.start,o.count=e.count,o.z=t,o.index=i}reset(){this.list.length=0,this.index=0}}const dr=new ke,wf=new ke,AI=new ke,CI=new _e(1,1,1),rv=new ke,bf=new Ll,Ic=new pn,$r=new rn,ha=new I,sv=new I,RI=new I,Ef=new TI,tn=new kt,Nc=[];function PI(n,e,t=0){const i=e.itemSize;if(n.isInterleavedBufferAttribute||n.array.constructor!==e.array.constructor){const r=n.count;for(let s=0;s<r;s++)for(let o=0;o<i;o++)e.setComponent(s+t,o,n.getComponent(s,o))}else e.array.set(n.array,t*i);e.needsUpdate=!0}class TM extends kt{get maxInstanceCount(){return this._maxInstanceCount}constructor(e,t,i=t*2,r){super(new Ye,r),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawInfo=[],this._drawRanges=[],this._reservedRanges=[],this._bounds=[],this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=i,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 t=new Float32Array(e*e*4),i=new wi(t,e,e,dn,Sn);this._matricesTexture=i}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),i=new wi(t,e,e,Pl,Ji);this._indirectTexture=i}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),i=new wi(t,e,e,dn,Sn);i.colorSpace=rt.workingColorSpace,this._colorsTexture=i}_initializeGeometry(e){const t=this.geometry,i=this._maxVertexCount,r=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in e.attributes){const o=e.getAttribute(s),{array:a,itemSize:l,normalized:c}=o,u=new a.constructor(i*l),h=new ht(u,l,c);t.setAttribute(s,h)}if(e.getIndex()!==null){const s=i>65535?new Uint32Array(r):new Uint16Array(r);t.setIndex(new ht(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const i in t.attributes){if(!e.hasAttribute(i))throw new Error(`BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);const r=e.getAttribute(i),s=t.getAttribute(i);if(r.itemSize!==s.itemSize||r.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 pn);const e=this.boundingBox,t=this._drawInfo;e.makeEmpty();for(let i=0,r=t.length;i<r;i++){if(t[i].active===!1)continue;const s=t[i].geometryIndex;this.getMatrixAt(i,dr),this.getBoundingBoxAt(s,Ic).applyMatrix4(dr),e.union(Ic)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new rn);const e=this.boundingSphere,t=this._drawInfo;e.makeEmpty();for(let i=0,r=t.length;i<r;i++){if(t[i].active===!1)continue;const s=t[i].geometryIndex;this.getMatrixAt(i,dr),this.getBoundingSphereAt(s,$r).applyMatrix4(dr),e.union($r)}}addInstance(e){if(this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");this._drawInfo.push({visible:!0,active:!0,geometryIndex:e});const t=this._drawInfo.length-1,i=this._matricesTexture,r=i.image.data;AI.toArray(r,t*16),i.needsUpdate=!0;const s=this._colorsTexture;return s&&(CI.toArray(s.image.data,t*4),s.needsUpdate=!0),t}addGeometry(e,t=-1,i=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");const r={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]),t===-1?r.vertexCount=e.getAttribute("position").count:r.vertexCount=t,s===null?r.vertexStart=0:r.vertexStart=s.vertexStart+s.vertexCount;const c=e.getIndex(),u=c!==null;if(u&&(i===-1?r.indexCount=c.count:r.indexCount=i,s===null?r.indexStart=0:r.indexStart=s.indexStart+s.indexCount),r.indexStart!==-1&&r.indexStart+r.indexCount>this._maxIndexCount||r.vertexStart+r.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const h=this._geometryCount;return this._geometryCount++,o.push(r),a.push({start:u?r.indexStart:r.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new pn,sphereInitialized:!1,sphere:new rn}),this.setGeometryAt(h,e),h}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const i=this.geometry,r=i.getIndex()!==null,s=i.getIndex(),o=t.getIndex(),a=this._reservedRanges[e];if(r&&o.count>a.indexCount||t.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 p in i.attributes){const m=t.getAttribute(p),x=i.getAttribute(p);PI(m,x,l);const g=m.itemSize;for(let f=m.count,v=c;f<v;f++){const y=l+f;for(let _=0;_<g;_++)x.setComponent(y,_,0)}x.needsUpdate=!0,x.addUpdateRange(l*g,c*g)}if(r){const p=a.indexStart;for(let m=0;m<o.count;m++)s.setX(p+m,l+o.getX(m));for(let m=o.count,x=a.indexCount;m<x;m++)s.setX(p+m,l);s.needsUpdate=!0,s.addUpdateRange(p,a.indexCount)}const u=this._bounds[e];t.boundingBox!==null?(u.box.copy(t.boundingBox),u.boxInitialized=!0):u.boxInitialized=!1,t.boundingSphere!==null?(u.sphere.copy(t.boundingSphere),u.sphereInitialized=!0):u.sphereInitialized=!1;const h=this._drawRanges[e],d=t.getAttribute("position");return h.count=r?o.count:d.count,this._visibilityChanged=!0,e}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const i=this._bounds[e],r=i.box,s=this.geometry;if(i.boxInitialized===!1){r.makeEmpty();const o=s.index,a=s.attributes.position,l=this._drawRanges[e];for(let c=l.start,u=l.start+l.count;c<u;c++){let h=c;o&&(h=o.getX(h)),r.expandByPoint(ha.fromBufferAttribute(a,h))}i.boxInitialized=!0}return t.copy(r),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const i=this._bounds[e],r=i.sphere,s=this.geometry;if(i.sphereInitialized===!1){r.makeEmpty(),this.getBoundingBoxAt(e,Ic),Ic.getCenter(r.center);const o=s.index,a=s.attributes.position,l=this._drawRanges[e];let c=0;for(let u=l.start,h=l.start+l.count;u<h;u++){let d=u;o&&(d=o.getX(d)),ha.fromBufferAttribute(a,d),c=Math.max(c,r.center.distanceToSquared(ha))}r.radius=Math.sqrt(c),i.sphereInitialized=!0}return t.copy(r),t}setMatrixAt(e,t){const i=this._drawInfo,r=this._matricesTexture,s=this._matricesTexture.image.data;return e>=i.length||i[e].active===!1?this:(t.toArray(s,e*16),r.needsUpdate=!0,this)}getMatrixAt(e,t){const i=this._drawInfo,r=this._matricesTexture.image.data;return e>=i.length||i[e].active===!1?null:t.fromArray(r,e*16)}setColorAt(e,t){this._colorsTexture===null&&this._initColorsTexture();const i=this._colorsTexture,r=this._colorsTexture.image.data,s=this._drawInfo;return e>=s.length||s[e].active===!1?this:(t.toArray(r,e*4),i.needsUpdate=!0,this)}getColorAt(e,t){const i=this._colorsTexture.image.data,r=this._drawInfo;return e>=r.length||r[e].active===!1?null:t.fromArray(i,e*4)}setVisibleAt(e,t){const i=this._drawInfo;return e>=i.length||i[e].active===!1||i[e].visible===t?this:(i[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?!1:t[e].visible}raycast(e,t){const i=this._drawInfo,r=this._drawRanges,s=this.matrixWorld,o=this.geometry;tn.material=this.material,tn.geometry.index=o.index,tn.geometry.attributes=o.attributes,tn.geometry.boundingBox===null&&(tn.geometry.boundingBox=new pn),tn.geometry.boundingSphere===null&&(tn.geometry.boundingSphere=new rn);for(let a=0,l=i.length;a<l;a++){if(!i[a].visible||!i[a].active)continue;const c=i[a].geometryIndex,u=r[c];tn.geometry.setDrawRange(u.start,u.count),this.getMatrixAt(a,tn.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,tn.geometry.boundingBox),this.getBoundingSphereAt(c,tn.geometry.boundingSphere),tn.raycast(e,Nc);for(let h=0,d=Nc.length;h<d;h++){const p=Nc[h];p.object=this,p.batchId=a,t.push(p)}Nc.length=0}tn.material=null,tn.geometry.index=null,tn.geometry.attributes={},tn.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(t=>({...t})),this._reservedRanges=e._reservedRanges.map(t=>({...t})),this._drawInfo=e._drawInfo.map(t=>({...t})),this._bounds=e._bounds.map(t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.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,t,i,r,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=r.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=this._drawInfo,c=this._multiDrawStarts,u=this._multiDrawCounts,h=this._drawRanges,d=this.perObjectFrustumCulled,p=this._indirectTexture,m=p.image.data;d&&(rv.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),bf.setFromProjectionMatrix(rv,e.coordinateSystem));let x=0;if(this.sortObjects){wf.copy(this.matrixWorld).invert(),ha.setFromMatrixPosition(i.matrixWorld).applyMatrix4(wf),sv.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(wf);for(let v=0,y=l.length;v<y;v++)if(l[v].visible&&l[v].active){const _=l[v].geometryIndex;this.getMatrixAt(v,dr),this.getBoundingSphereAt(_,$r).applyMatrix4(dr);let R=!1;if(d&&(R=!bf.intersectsSphere($r)),!R){const w=RI.subVectors($r.center,ha).dot(sv);Ef.push(h[_],w,v)}}const g=Ef.list,f=this.customSort;f===null?g.sort(s.transparent?EI:bI):f.call(this,g,i);for(let v=0,y=g.length;v<y;v++){const _=g[v];c[x]=_.start*a,u[x]=_.count,m[x]=_.index,x++}Ef.reset()}else for(let g=0,f=l.length;g<f;g++)if(l[g].visible&&l[g].active){const v=l[g].geometryIndex;let y=!1;if(d&&(this.getMatrixAt(g,dr),this.getBoundingSphereAt(v,$r).applyMatrix4(dr),y=!bf.intersectsSphere($r)),!y){const _=h[v];c[x]=_.start*a,u[x]=_.count,m[x]=g,x++}}p.needsUpdate=!0,this._multiDrawCount=x,this._visibilityChanged=!1}onBeforeShadow(e,t,i,r,s,o){this.onBeforeRender(e,null,r,s,o)}}class xn extends on{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new _e(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 cd=new I,ud=new I,ov=new ke,fa=new Go,Lc=new rn,Tf=new I,av=new I;class Nr extends nt{constructor(e=new Ye,t=new xn){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),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 t=e.attributes.position,i=[0];for(let r=1,s=t.count;r<s;r++)cd.fromBufferAttribute(t,r-1),ud.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=cd.distanceTo(ud);e.setAttribute("lineDistance",new Pe(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Lc.copy(i.boundingSphere),Lc.applyMatrix4(r),Lc.radius+=s,e.ray.intersectsSphere(Lc)===!1)return;ov.copy(r).invert(),fa.copy(e.ray).applyMatrix4(ov);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,u=i.index,d=i.attributes.position;if(u!==null){const p=Math.max(0,o.start),m=Math.min(u.count,o.start+o.count);for(let x=p,g=m-1;x<g;x+=c){const f=u.getX(x),v=u.getX(x+1),y=Dc(this,e,fa,l,f,v);y&&t.push(y)}if(this.isLineLoop){const x=u.getX(m-1),g=u.getX(p),f=Dc(this,e,fa,l,x,g);f&&t.push(f)}}else{const p=Math.max(0,o.start),m=Math.min(d.count,o.start+o.count);for(let x=p,g=m-1;x<g;x+=c){const f=Dc(this,e,fa,l,x,x+1);f&&t.push(f)}if(this.isLineLoop){const x=Dc(this,e,fa,l,m-1,p);x&&t.push(x)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function Dc(n,e,t,i,r,s){const o=n.geometry.attributes.position;if(cd.fromBufferAttribute(o,r),ud.fromBufferAttribute(o,s),t.distanceSqToSegment(cd,ud,Tf,av)>i)return;Tf.applyMatrix4(n.matrixWorld);const l=e.ray.origin.distanceTo(Tf);if(!(l<e.near||l>e.far))return{distance:l,point:av.clone().applyMatrix4(n.matrixWorld),index:r,face:null,faceIndex:null,object:n}}const lv=new I,cv=new I;class Ai extends Nr{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[];for(let r=0,s=t.count;r<s;r+=2)lv.fromBufferAttribute(t,r),cv.fromBufferAttribute(t,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+lv.distanceTo(cv);e.setAttribute("lineDistance",new Pe(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class AM extends Nr{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class ug extends on{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new _e(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 uv=new ke,Fp=new Go,Uc=new rn,kc=new I;class CM extends nt{constructor(e=new Ye,t=new ug){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Uc.copy(i.boundingSphere),Uc.applyMatrix4(r),Uc.radius+=s,e.ray.intersectsSphere(Uc)===!1)return;uv.copy(r).invert(),Fp.copy(e.ray).applyMatrix4(uv);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=i.index,h=i.attributes.position;if(c!==null){const d=Math.max(0,o.start),p=Math.min(c.count,o.start+o.count);for(let m=d,x=p;m<x;m++){const g=c.getX(m);kc.fromBufferAttribute(h,g),dv(kc,g,l,r,e,t,this)}}else{const d=Math.max(0,o.start),p=Math.min(h.count,o.start+o.count);for(let m=d,x=p;m<x;m++)kc.fromBufferAttribute(h,m),dv(kc,m,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function dv(n,e,t,i,r,s,o){const a=Fp.distanceSqToPoint(n);if(a<t){const l=new I;Fp.closestPointToPoint(n,l),l.applyMatrix4(i);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class II extends Ct{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Ut,this.magFilter=s!==void 0?s:Ut,this.generateMipmaps=!1;const u=this;function h(){u.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class NI extends Ct{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Gt,this.minFilter=Gt,this.generateMipmaps=!1,this.needsUpdate=!0}}class Yd extends Ct{constructor(e,t,i,r,s,o,a,l,c,u,h,d){super(null,o,a,l,c,u,r,s,h,d),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class LI extends Yd{constructor(e,t,i,r,s,o){super(e,t,i,s,o),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=Xn,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class DI extends Yd{constructor(e,t,i){super(void 0,e[0].width,e[0].height,t,i,Ki),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class UI extends Ct{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class ui{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let i,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let r=0;const s=i.length;let o;t?o=t:o=e*i[s-1];let a=0,l=s-1,c;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),c=i[r]-o,c<0)a=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,i[r]===o)return r/(s-1);const u=i[r],d=i[r+1]-u,p=(o-u)/d;return(r+p)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new Q:new I);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new I,r=[],s=[],o=[],a=new I,l=new ke;for(let p=0;p<=e;p++){const m=p/e;r[p]=this.getTangentAt(m,new I)}s[0]=new I,o[0]=new I;let c=Number.MAX_VALUE;const u=Math.abs(r[0].x),h=Math.abs(r[0].y),d=Math.abs(r[0].z);u<=c&&(c=u,i.set(1,0,0)),h<=c&&(c=h,i.set(0,1,0)),d<=c&&i.set(0,0,1),a.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let p=1;p<=e;p++){if(s[p]=s[p-1].clone(),o[p]=o[p-1].clone(),a.crossVectors(r[p-1],r[p]),a.length()>Number.EPSILON){a.normalize();const m=Math.acos(At(r[p-1].dot(r[p]),-1,1));s[p].applyMatrix4(l.makeRotationAxis(a,m))}o[p].crossVectors(r[p],s[p])}if(t===!0){let p=Math.acos(At(s[0].dot(s[e]),-1,1));p/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(p=-p);for(let m=1;m<=e;m++)s[m].applyMatrix4(l.makeRotationAxis(r[m],p*m)),o[m].crossVectors(r[m],s[m])}return{tangents:r,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 qd extends ui{constructor(e=0,t=0,i=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new Q){const i=t,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);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 u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),d=l-this.aX,p=c-this.aY;l=d*u-p*h+this.aX,c=d*h+p*u+this.aY}return i.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 RM extends qd{constructor(e,t,i,r,s,o){super(e,t,i,i,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function dg(){let n=0,e=0,t=0,i=0;function r(s,o,a,l){n=s,e=a,t=-3*s+3*o-2*a-l,i=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){r(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,h){let d=(o-s)/c-(a-s)/(c+u)+(a-o)/u,p=(a-o)/u-(l-o)/(u+h)+(l-a)/h;d*=u,p*=u,r(o,a,d,p)},calc:function(s){const o=s*s,a=o*s;return n+e*s+t*o+i*a}}}const Oc=new I,Af=new dg,Cf=new dg,Rf=new dg;class PM extends ui{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new I){const i=t,r=this.points,s=r.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,u;this.closed||a>0?c=r[(a-1)%s]:(Oc.subVectors(r[0],r[1]).add(r[0]),c=Oc);const h=r[a%s],d=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(Oc.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=Oc),this.curveType==="centripetal"||this.curveType==="chordal"){const p=this.curveType==="chordal"?.5:.25;let m=Math.pow(c.distanceToSquared(h),p),x=Math.pow(h.distanceToSquared(d),p),g=Math.pow(d.distanceToSquared(u),p);x<1e-4&&(x=1),m<1e-4&&(m=x),g<1e-4&&(g=x),Af.initNonuniformCatmullRom(c.x,h.x,d.x,u.x,m,x,g),Cf.initNonuniformCatmullRom(c.y,h.y,d.y,u.y,m,x,g),Rf.initNonuniformCatmullRom(c.z,h.z,d.z,u.z,m,x,g)}else this.curveType==="catmullrom"&&(Af.initCatmullRom(c.x,h.x,d.x,u.x,this.tension),Cf.initCatmullRom(c.y,h.y,d.y,u.y,this.tension),Rf.initCatmullRom(c.z,h.z,d.z,u.z,this.tension));return i.set(Af.calc(l),Cf.calc(l),Rf.calc(l)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new I().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function hv(n,e,t,i,r){const s=(i-e)*.5,o=(r-t)*.5,a=n*n,l=n*a;return(2*t-2*i+s+o)*l+(-3*t+3*i-2*s-o)*a+s*n+t}function kI(n,e){const t=1-n;return t*t*e}function OI(n,e){return 2*(1-n)*n*e}function FI(n,e){return n*n*e}function Oa(n,e,t,i){return kI(n,e)+OI(n,t)+FI(n,i)}function BI(n,e){const t=1-n;return t*t*t*e}function zI(n,e){const t=1-n;return 3*t*t*n*e}function VI(n,e){return 3*(1-n)*n*n*e}function HI(n,e){return n*n*n*e}function Fa(n,e,t,i,r){return BI(n,e)+zI(n,t)+VI(n,i)+HI(n,r)}class hg extends ui{constructor(e=new Q,t=new Q,i=new Q,r=new Q){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new Q){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(Fa(e,r.x,s.x,o.x,a.x),Fa(e,r.y,s.y,o.y,a.y)),i}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 IM extends ui{constructor(e=new I,t=new I,i=new I,r=new I){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new I){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(Fa(e,r.x,s.x,o.x,a.x),Fa(e,r.y,s.y,o.y,a.y),Fa(e,r.z,s.z,o.z,a.z)),i}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 fg extends ui{constructor(e=new Q,t=new Q){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Q){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Q){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}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 NM extends ui{constructor(e=new I,t=new I){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new I){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new I){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}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 pg extends ui{constructor(e=new Q,t=new Q,i=new Q){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new Q){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(Oa(e,r.x,s.x,o.x),Oa(e,r.y,s.y,o.y)),i}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 mg extends ui{constructor(e=new I,t=new I,i=new I){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new I){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(Oa(e,r.x,s.x,o.x),Oa(e,r.y,s.y,o.y),Oa(e,r.z,s.z,o.z)),i}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 gg extends ui{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Q){const i=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,l=r[o===0?o:o-1],c=r[o],u=r[o>r.length-2?r.length-1:o+1],h=r[o>r.length-3?r.length-1:o+2];return i.set(hv(a,l.x,c.x,u.x,h.x),hv(a,l.y,c.y,u.y,h.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new Q().fromArray(r))}return this}}var dd=Object.freeze({__proto__:null,ArcCurve:RM,CatmullRomCurve3:PM,CubicBezierCurve:hg,CubicBezierCurve3:IM,EllipseCurve:qd,LineCurve:fg,LineCurve3:NM,QuadraticBezierCurve:pg,QuadraticBezierCurve3:mg,SplineCurve:gg});class LM extends ui{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const i=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new dd[i](t,e))}return this}getPoint(e,t){const i=e*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=i){const o=r[s]-i,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let i=0,r=this.curves.length;i<r;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let i;for(let r=0,s=this.curves;r<s.length;r++){const o=s[r],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 u=l[c];i&&i.equals(u)||(t.push(u),i=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){const r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(new dd[r.type]().fromJSON(r))}return this}}class ml extends LM{constructor(e){super(),this.type="Path",this.currentPoint=new Q,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const i=new fg(this.currentPoint.clone(),new Q(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){const s=new pg(this.currentPoint.clone(),new Q(e,t),new Q(i,r));return this.curves.push(s),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,s,o){const a=new hg(this.currentPoint.clone(),new Q(e,t),new Q(i,r),new Q(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),i=new gg(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,i,r,s,o),this}absarc(e,t,i,r,s,o){return this.absellipse(e,t,i,i,r,s,o),this}ellipse(e,t,i,r,s,o,a,l){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,i,r,s,o,a,l),this}absellipse(e,t,i,r,s,o,a,l){const c=new qd(e,t,i,r,s,o,a,l);if(this.curves.length>0){const h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Dl extends Ye{constructor(e=[new Q(0,-.5),new Q(.5,0),new Q(0,.5)],t=12,i=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=At(r,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],u=1/t,h=new I,d=new Q,p=new I,m=new I,x=new I;let g=0,f=0;for(let v=0;v<=e.length-1;v++)switch(v){case 0:g=e[v+1].x-e[v].x,f=e[v+1].y-e[v].y,p.x=f*1,p.y=-g,p.z=f*0,x.copy(p),p.normalize(),l.push(p.x,p.y,p.z);break;case e.length-1:l.push(x.x,x.y,x.z);break;default:g=e[v+1].x-e[v].x,f=e[v+1].y-e[v].y,p.x=f*1,p.y=-g,p.z=f*0,m.copy(p),p.x+=x.x,p.y+=x.y,p.z+=x.z,p.normalize(),l.push(p.x,p.y,p.z),x.copy(m)}for(let v=0;v<=t;v++){const y=i+v*u*r,_=Math.sin(y),R=Math.cos(y);for(let w=0;w<=e.length-1;w++){h.x=e[w].x*_,h.y=e[w].y,h.z=e[w].x*R,o.push(h.x,h.y,h.z),d.x=v/t,d.y=w/(e.length-1),a.push(d.x,d.y);const E=l[3*w+0]*_,A=l[3*w+1],b=l[3*w+0]*R;c.push(E,A,b)}}for(let v=0;v<t;v++)for(let y=0;y<e.length-1;y++){const _=y+v*e.length,R=_,w=_+e.length,E=_+e.length+1,A=_+1;s.push(R,w,A),s.push(E,A,w)}this.setIndex(s),this.setAttribute("position",new Pe(o,3)),this.setAttribute("uv",new Pe(a,2)),this.setAttribute("normal",new Pe(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Dl(e.points,e.segments,e.phiStart,e.phiLength)}}class Zd extends Dl{constructor(e=1,t=1,i=4,r=8){const s=new ml;s.absarc(0,-t/2,e,Math.PI*1.5,0),s.absarc(0,t/2,e,0,Math.PI*.5),super(s.getPoints(i),r),this.type="CapsuleGeometry",this.parameters={radius:e,length:t,capSegments:i,radialSegments:r}}static fromJSON(e){return new Zd(e.radius,e.length,e.capSegments,e.radialSegments)}}class Kd extends Ye{constructor(e=1,t=32,i=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},t=Math.max(3,t);const s=[],o=[],a=[],l=[],c=new I,u=new Q;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let h=0,d=3;h<=t;h++,d+=3){const p=i+h/t*r;c.x=e*Math.cos(p),c.y=e*Math.sin(p),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[d]/e+1)/2,u.y=(o[d+1]/e+1)/2,l.push(u.x,u.y)}for(let h=1;h<=t;h++)s.push(h,h+1,0);this.setIndex(s),this.setAttribute("position",new Pe(o,3)),this.setAttribute("normal",new Pe(a,3)),this.setAttribute("uv",new Pe(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Kd(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Xo extends Ye{constructor(e=1,t=1,i=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const u=[],h=[],d=[],p=[];let m=0;const x=[],g=i/2;let f=0;v(),o===!1&&(e>0&&y(!0),t>0&&y(!1)),this.setIndex(u),this.setAttribute("position",new Pe(h,3)),this.setAttribute("normal",new Pe(d,3)),this.setAttribute("uv",new Pe(p,2));function v(){const _=new I,R=new I;let w=0;const E=(t-e)/i;for(let A=0;A<=s;A++){const b=[],M=A/s,L=M*(t-e)+e;for(let G=0;G<=r;G++){const B=G/r,j=B*l+a,U=Math.sin(j),z=Math.cos(j);R.x=L*U,R.y=-M*i+g,R.z=L*z,h.push(R.x,R.y,R.z),_.set(U,E,z).normalize(),d.push(_.x,_.y,_.z),p.push(B,1-M),b.push(m++)}x.push(b)}for(let A=0;A<r;A++)for(let b=0;b<s;b++){const M=x[b][A],L=x[b+1][A],G=x[b+1][A+1],B=x[b][A+1];u.push(M,L,B),u.push(L,G,B),w+=6}c.addGroup(f,w,0),f+=w}function y(_){const R=m,w=new Q,E=new I;let A=0;const b=_===!0?e:t,M=_===!0?1:-1;for(let G=1;G<=r;G++)h.push(0,g*M,0),d.push(0,M,0),p.push(.5,.5),m++;const L=m;for(let G=0;G<=r;G++){const j=G/r*l+a,U=Math.cos(j),z=Math.sin(j);E.x=b*z,E.y=g*M,E.z=b*U,h.push(E.x,E.y,E.z),d.push(0,M,0),w.x=U*.5+.5,w.y=z*.5*M+.5,p.push(w.x,w.y),m++}for(let G=0;G<r;G++){const B=R+G,j=L+G;_===!0?u.push(j,j+1,B):u.push(j+1,j,B),A+=3}c.addGroup(f,A,_===!0?1:2),f+=A}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Xo(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Jd extends Xo{constructor(e=1,t=1,i=32,r=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,i,r,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new Jd(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Fr extends Ye{constructor(e=[],t=[],i=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:r};const s=[],o=[];a(r),c(i),u(),this.setAttribute("position",new Pe(s,3)),this.setAttribute("normal",new Pe(s.slice(),3)),this.setAttribute("uv",new Pe(o,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function a(v){const y=new I,_=new I,R=new I;for(let w=0;w<t.length;w+=3)p(t[w+0],y),p(t[w+1],_),p(t[w+2],R),l(y,_,R,v)}function l(v,y,_,R){const w=R+1,E=[];for(let A=0;A<=w;A++){E[A]=[];const b=v.clone().lerp(_,A/w),M=y.clone().lerp(_,A/w),L=w-A;for(let G=0;G<=L;G++)G===0&&A===w?E[A][G]=b:E[A][G]=b.clone().lerp(M,G/L)}for(let A=0;A<w;A++)for(let b=0;b<2*(w-A)-1;b++){const M=Math.floor(b/2);b%2===0?(d(E[A][M+1]),d(E[A+1][M]),d(E[A][M])):(d(E[A][M+1]),d(E[A+1][M+1]),d(E[A+1][M]))}}function c(v){const y=new I;for(let _=0;_<s.length;_+=3)y.x=s[_+0],y.y=s[_+1],y.z=s[_+2],y.normalize().multiplyScalar(v),s[_+0]=y.x,s[_+1]=y.y,s[_+2]=y.z}function u(){const v=new I;for(let y=0;y<s.length;y+=3){v.x=s[y+0],v.y=s[y+1],v.z=s[y+2];const _=g(v)/2/Math.PI+.5,R=f(v)/Math.PI+.5;o.push(_,1-R)}m(),h()}function h(){for(let v=0;v<o.length;v+=6){const y=o[v+0],_=o[v+2],R=o[v+4],w=Math.max(y,_,R),E=Math.min(y,_,R);w>.9&&E<.1&&(y<.2&&(o[v+0]+=1),_<.2&&(o[v+2]+=1),R<.2&&(o[v+4]+=1))}}function d(v){s.push(v.x,v.y,v.z)}function p(v,y){const _=v*3;y.x=e[_+0],y.y=e[_+1],y.z=e[_+2]}function m(){const v=new I,y=new I,_=new I,R=new I,w=new Q,E=new Q,A=new Q;for(let b=0,M=0;b<s.length;b+=9,M+=6){v.set(s[b+0],s[b+1],s[b+2]),y.set(s[b+3],s[b+4],s[b+5]),_.set(s[b+6],s[b+7],s[b+8]),w.set(o[M+0],o[M+1]),E.set(o[M+2],o[M+3]),A.set(o[M+4],o[M+5]),R.copy(v).add(y).add(_).divideScalar(3);const L=g(R);x(w,M+0,v,L),x(E,M+2,y,L),x(A,M+4,_,L)}}function x(v,y,_,R){R<0&&v.x===1&&(o[y]=v.x-1),_.x===0&&_.z===0&&(o[y]=R/2/Math.PI+.5)}function g(v){return Math.atan2(v.z,-v.x)}function f(v){return Math.atan2(-v.y,Math.sqrt(v.x*v.x+v.z*v.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Fr(e.vertices,e.indices,e.radius,e.details)}}class Qd extends Fr{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=1/i,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,-r,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,0,r],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,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Qd(e.radius,e.detail)}}const Fc=new I,Bc=new I,Pf=new I,zc=new Nn;class DM extends Ye{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(ms*t),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,c=[0,0,0],u=["a","b","c"],h=new Array(3),d={},p=[];for(let m=0;m<l;m+=3){o?(c[0]=o.getX(m),c[1]=o.getX(m+1),c[2]=o.getX(m+2)):(c[0]=m,c[1]=m+1,c[2]=m+2);const{a:x,b:g,c:f}=zc;if(x.fromBufferAttribute(a,c[0]),g.fromBufferAttribute(a,c[1]),f.fromBufferAttribute(a,c[2]),zc.getNormal(Pf),h[0]=`${Math.round(x.x*r)},${Math.round(x.y*r)},${Math.round(x.z*r)}`,h[1]=`${Math.round(g.x*r)},${Math.round(g.y*r)},${Math.round(g.z*r)}`,h[2]=`${Math.round(f.x*r)},${Math.round(f.y*r)},${Math.round(f.z*r)}`,!(h[0]===h[1]||h[1]===h[2]||h[2]===h[0]))for(let v=0;v<3;v++){const y=(v+1)%3,_=h[v],R=h[y],w=zc[u[v]],E=zc[u[y]],A=`${_}_${R}`,b=`${R}_${_}`;b in d&&d[b]?(Pf.dot(d[b].normal)<=s&&(p.push(w.x,w.y,w.z),p.push(E.x,E.y,E.z)),d[b]=null):A in d||(d[A]={index0:c[v],index1:c[y],normal:Pf.clone()})}}for(const m in d)if(d[m]){const{index0:x,index1:g}=d[m];Fc.fromBufferAttribute(a,x),Bc.fromBufferAttribute(a,g),p.push(Fc.x,Fc.y,Fc.z),p.push(Bc.x,Bc.y,Bc.z)}this.setAttribute("position",new Pe(p,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class gs extends ml{constructor(e){super(e),this.uuid=Un(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){const r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(new ml().fromJSON(r))}return this}}const GI={triangulate:function(n,e,t=2){const i=e&&e.length,r=i?e[0]*t:n.length;let s=UM(n,0,r,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c,u,h,d,p;if(i&&(s=YI(n,e,s,t)),n.length>80*t){a=c=n[0],l=u=n[1];for(let m=t;m<r;m+=t)h=n[m],d=n[m+1],h<a&&(a=h),d<l&&(l=d),h>c&&(c=h),d>u&&(u=d);p=Math.max(c-a,u-l),p=p!==0?32767/p:0}return gl(s,o,t,a,l,p,0),o}};function UM(n,e,t,i,r){let s,o;if(r===sN(n,e,t,i)>0)for(s=e;s<t;s+=i)o=fv(s,n[s],n[s+1],o);else for(s=t-i;s>=e;s-=i)o=fv(s,n[s],n[s+1],o);return o&&eh(o,o.next)&&(vl(o),o=o.next),o}function Es(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(eh(t,t.next)||_t(t.prev,t,t.next)===0)){if(vl(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function gl(n,e,t,i,r,s,o){if(!n)return;!o&&s&&QI(n,i,r,s);let a=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,s?jI(n,i,r,s):WI(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(c.i/t|0),vl(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=XI(Es(n),e,t),gl(n,e,t,i,r,s,2)):o===2&&$I(n,e,t,i,r,s):gl(Es(n),e,t,i,r,s,1);break}}}function WI(n){const e=n.prev,t=n,i=n.next;if(_t(e,t,i)>=0)return!1;const r=e.x,s=t.x,o=i.x,a=e.y,l=t.y,c=i.y,u=r<s?r<o?r:o:s<o?s:o,h=a<l?a<c?a:c:l<c?l:c,d=r>s?r>o?r:o:s>o?s:o,p=a>l?a>c?a:c:l>c?l:c;let m=i.next;for(;m!==e;){if(m.x>=u&&m.x<=d&&m.y>=h&&m.y<=p&&xo(r,a,s,l,o,c,m.x,m.y)&&_t(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function jI(n,e,t,i){const r=n.prev,s=n,o=n.next;if(_t(r,s,o)>=0)return!1;const a=r.x,l=s.x,c=o.x,u=r.y,h=s.y,d=o.y,p=a<l?a<c?a:c:l<c?l:c,m=u<h?u<d?u:d:h<d?h:d,x=a>l?a>c?a:c:l>c?l:c,g=u>h?u>d?u:d:h>d?h:d,f=Bp(p,m,e,t,i),v=Bp(x,g,e,t,i);let y=n.prevZ,_=n.nextZ;for(;y&&y.z>=f&&_&&_.z<=v;){if(y.x>=p&&y.x<=x&&y.y>=m&&y.y<=g&&y!==r&&y!==o&&xo(a,u,l,h,c,d,y.x,y.y)&&_t(y.prev,y,y.next)>=0||(y=y.prevZ,_.x>=p&&_.x<=x&&_.y>=m&&_.y<=g&&_!==r&&_!==o&&xo(a,u,l,h,c,d,_.x,_.y)&&_t(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;y&&y.z>=f;){if(y.x>=p&&y.x<=x&&y.y>=m&&y.y<=g&&y!==r&&y!==o&&xo(a,u,l,h,c,d,y.x,y.y)&&_t(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;_&&_.z<=v;){if(_.x>=p&&_.x<=x&&_.y>=m&&_.y<=g&&_!==r&&_!==o&&xo(a,u,l,h,c,d,_.x,_.y)&&_t(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function XI(n,e,t){let i=n;do{const r=i.prev,s=i.next.next;!eh(r,s)&&kM(r,i,i.next,s)&&xl(r,s)&&xl(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),vl(i),vl(i.next),i=n=s),i=i.next}while(i!==n);return Es(i)}function $I(n,e,t,i,r,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&nN(o,a)){let l=OM(o,a);o=Es(o,o.next),l=Es(l,l.next),gl(o,e,t,i,r,s,0),gl(l,e,t,i,r,s,0);return}a=a.next}o=o.next}while(o!==n)}function YI(n,e,t,i){const r=[];let s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*i,l=s<o-1?e[s+1]*i:n.length,c=UM(n,a,l,i,!1),c===c.next&&(c.steiner=!0),r.push(tN(c));for(r.sort(qI),s=0;s<r.length;s++)t=ZI(r[s],t);return t}function qI(n,e){return n.x-e.x}function ZI(n,e){const t=KI(n,e);if(!t)return e;const i=OM(t,n);return Es(i,i.next),Es(t,t.next)}function KI(n,e){let t=e,i=-1/0,r;const s=n.x,o=n.y;do{if(o<=t.y&&o>=t.next.y&&t.next.y!==t.y){const d=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=s&&d>i&&(i=d,r=t.x<t.next.x?t:t.next,d===s))return r}t=t.next}while(t!==e);if(!r)return null;const a=r,l=r.x,c=r.y;let u=1/0,h;t=r;do s>=t.x&&t.x>=l&&s!==t.x&&xo(o<c?s:i,o,l,c,o<c?i:s,o,t.x,t.y)&&(h=Math.abs(o-t.y)/(s-t.x),xl(t,n)&&(h<u||h===u&&(t.x>r.x||t.x===r.x&&JI(r,t)))&&(r=t,u=h)),t=t.next;while(t!==a);return r}function JI(n,e){return _t(n.prev,n,e.prev)<0&&_t(e.next,n,n.next)<0}function QI(n,e,t,i){let r=n;do r.z===0&&(r.z=Bp(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,eN(r)}function eN(n){let e,t,i,r,s,o,a,l,c=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,i=t,a=0,e=0;e<c&&(a++,i=i.nextZ,!!i);e++);for(l=c;a>0||l>0&&i;)a!==0&&(l===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,c*=2}while(o>1);return n}function Bp(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function tN(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function xo(n,e,t,i,r,s,o,a){return(r-o)*(e-a)>=(n-o)*(s-a)&&(n-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(i-a)}function nN(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!iN(n,e)&&(xl(n,e)&&xl(e,n)&&rN(n,e)&&(_t(n.prev,n,e.prev)||_t(n,e.prev,e))||eh(n,e)&&_t(n.prev,n,n.next)>0&&_t(e.prev,e,e.next)>0)}function _t(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function eh(n,e){return n.x===e.x&&n.y===e.y}function kM(n,e,t,i){const r=Hc(_t(n,e,t)),s=Hc(_t(n,e,i)),o=Hc(_t(t,i,n)),a=Hc(_t(t,i,e));return!!(r!==s&&o!==a||r===0&&Vc(n,t,e)||s===0&&Vc(n,i,e)||o===0&&Vc(t,n,i)||a===0&&Vc(t,e,i))}function Vc(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function Hc(n){return n>0?1:n<0?-1:0}function iN(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&kM(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function xl(n,e){return _t(n.prev,n,n.next)<0?_t(n,e,n.next)>=0&&_t(n,n.prev,e)>=0:_t(n,e,n.prev)<0||_t(n,n.next,e)<0}function rN(n,e){let t=n,i=!1;const r=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function OM(n,e){const t=new zp(n.i,n.x,n.y),i=new zp(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function fv(n,e,t,i){const r=new zp(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function vl(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function zp(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function sN(n,e,t,i){let r=0;for(let s=e,o=t-i;s<t;s+=i)r+=(n[o]-n[s])*(n[s+1]+n[o+1]),o=s;return r}class bi{static area(e){const t=e.length;let i=0;for(let r=t-1,s=0;s<t;r=s++)i+=e[r].x*e[s].y-e[s].x*e[r].y;return i*.5}static isClockWise(e){return bi.area(e)<0}static triangulateShape(e,t){const i=[],r=[],s=[];pv(e),mv(i,e);let o=e.length;t.forEach(pv);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,mv(i,t[l]);const a=GI.triangulate(i,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function pv(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function mv(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}class th extends Ye{constructor(e=new gs([new Q(.5,.5),new Q(-.5,.5),new Q(-.5,-.5),new Q(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const i=this,r=[],s=[];for(let a=0,l=e.length;a<l;a++){const c=e[a];o(c)}this.setAttribute("position",new Pe(r,3)),this.setAttribute("uv",new Pe(s,2)),this.computeVertexNormals();function o(a){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,h=t.depth!==void 0?t.depth:1;let d=t.bevelEnabled!==void 0?t.bevelEnabled:!0,p=t.bevelThickness!==void 0?t.bevelThickness:.2,m=t.bevelSize!==void 0?t.bevelSize:p-.1,x=t.bevelOffset!==void 0?t.bevelOffset:0,g=t.bevelSegments!==void 0?t.bevelSegments:3;const f=t.extrudePath,v=t.UVGenerator!==void 0?t.UVGenerator:oN;let y,_=!1,R,w,E,A;f&&(y=f.getSpacedPoints(u),_=!0,d=!1,R=f.computeFrenetFrames(u,!1),w=new I,E=new I,A=new I),d||(g=0,p=0,m=0,x=0);const b=a.extractPoints(c);let M=b.shape;const L=b.holes;if(!bi.isClockWise(M)){M=M.reverse();for(let P=0,le=L.length;P<le;P++){const ie=L[P];bi.isClockWise(ie)&&(L[P]=ie.reverse())}}const B=bi.triangulateShape(M,L),j=M;for(let P=0,le=L.length;P<le;P++){const ie=L[P];M=M.concat(ie)}function U(P,le,ie){return le||console.error("THREE.ExtrudeGeometry: vec does not exist"),P.clone().addScaledVector(le,ie)}const z=M.length,Z=B.length;function D(P,le,ie){let xe,Y,Ue;const me=P.x-le.x,be=P.y-le.y,N=ie.x-P.x,T=ie.y-P.y,H=me*me+be*be,ee=me*T-be*N;if(Math.abs(ee)>Number.EPSILON){const J=Math.sqrt(H),ne=Math.sqrt(N*N+T*T),Le=le.x-be/J,pe=le.y+me/J,Me=ie.x-T/ne,We=ie.y+N/ne,ae=((Me-Le)*T-(We-pe)*N)/(me*T-be*N);xe=Le+me*ae-P.x,Y=pe+be*ae-P.y;const Se=xe*xe+Y*Y;if(Se<=2)return new Q(xe,Y);Ue=Math.sqrt(Se/2)}else{let J=!1;me>Number.EPSILON?N>Number.EPSILON&&(J=!0):me<-Number.EPSILON?N<-Number.EPSILON&&(J=!0):Math.sign(be)===Math.sign(T)&&(J=!0),J?(xe=-be,Y=me,Ue=Math.sqrt(H)):(xe=me,Y=be,Ue=Math.sqrt(H/2))}return new Q(xe/Ue,Y/Ue)}const $=[];for(let P=0,le=j.length,ie=le-1,xe=P+1;P<le;P++,ie++,xe++)ie===le&&(ie=0),xe===le&&(xe=0),$[P]=D(j[P],j[ie],j[xe]);const K=[];let se,Ae=$.concat();for(let P=0,le=L.length;P<le;P++){const ie=L[P];se=[];for(let xe=0,Y=ie.length,Ue=Y-1,me=xe+1;xe<Y;xe++,Ue++,me++)Ue===Y&&(Ue=0),me===Y&&(me=0),se[xe]=D(ie[xe],ie[Ue],ie[me]);K.push(se),Ae=Ae.concat(se)}for(let P=0;P<g;P++){const le=P/g,ie=p*Math.cos(le*Math.PI/2),xe=m*Math.sin(le*Math.PI/2)+x;for(let Y=0,Ue=j.length;Y<Ue;Y++){const me=U(j[Y],$[Y],xe);de(me.x,me.y,-ie)}for(let Y=0,Ue=L.length;Y<Ue;Y++){const me=L[Y];se=K[Y];for(let be=0,N=me.length;be<N;be++){const T=U(me[be],se[be],xe);de(T.x,T.y,-ie)}}}const qe=m+x;for(let P=0;P<z;P++){const le=d?U(M[P],Ae[P],qe):M[P];_?(E.copy(R.normals[0]).multiplyScalar(le.x),w.copy(R.binormals[0]).multiplyScalar(le.y),A.copy(y[0]).add(E).add(w),de(A.x,A.y,A.z)):de(le.x,le.y,0)}for(let P=1;P<=u;P++)for(let le=0;le<z;le++){const ie=d?U(M[le],Ae[le],qe):M[le];_?(E.copy(R.normals[P]).multiplyScalar(ie.x),w.copy(R.binormals[P]).multiplyScalar(ie.y),A.copy(y[P]).add(E).add(w),de(A.x,A.y,A.z)):de(ie.x,ie.y,h/u*P)}for(let P=g-1;P>=0;P--){const le=P/g,ie=p*Math.cos(le*Math.PI/2),xe=m*Math.sin(le*Math.PI/2)+x;for(let Y=0,Ue=j.length;Y<Ue;Y++){const me=U(j[Y],$[Y],xe);de(me.x,me.y,h+ie)}for(let Y=0,Ue=L.length;Y<Ue;Y++){const me=L[Y];se=K[Y];for(let be=0,N=me.length;be<N;be++){const T=U(me[be],se[be],xe);_?de(T.x,T.y+y[u-1].y,y[u-1].x+ie):de(T.x,T.y,h+ie)}}}X(),oe();function X(){const P=r.length/3;if(d){let le=0,ie=z*le;for(let xe=0;xe<Z;xe++){const Y=B[xe];De(Y[2]+ie,Y[1]+ie,Y[0]+ie)}le=u+g*2,ie=z*le;for(let xe=0;xe<Z;xe++){const Y=B[xe];De(Y[0]+ie,Y[1]+ie,Y[2]+ie)}}else{for(let le=0;le<Z;le++){const ie=B[le];De(ie[2],ie[1],ie[0])}for(let le=0;le<Z;le++){const ie=B[le];De(ie[0]+z*u,ie[1]+z*u,ie[2]+z*u)}}i.addGroup(P,r.length/3-P,0)}function oe(){const P=r.length/3;let le=0;ve(j,le),le+=j.length;for(let ie=0,xe=L.length;ie<xe;ie++){const Y=L[ie];ve(Y,le),le+=Y.length}i.addGroup(P,r.length/3-P,1)}function ve(P,le){let ie=P.length;for(;--ie>=0;){const xe=ie;let Y=ie-1;Y<0&&(Y=P.length-1);for(let Ue=0,me=u+g*2;Ue<me;Ue++){const be=z*Ue,N=z*(Ue+1),T=le+xe+be,H=le+Y+be,ee=le+Y+N,J=le+xe+N;He(T,H,ee,J)}}}function de(P,le,ie){l.push(P),l.push(le),l.push(ie)}function De(P,le,ie){Be(P),Be(le),Be(ie);const xe=r.length/3,Y=v.generateTopUV(i,r,xe-3,xe-2,xe-1);it(Y[0]),it(Y[1]),it(Y[2])}function He(P,le,ie,xe){Be(P),Be(le),Be(xe),Be(le),Be(ie),Be(xe);const Y=r.length/3,Ue=v.generateSideWallUV(i,r,Y-6,Y-3,Y-2,Y-1);it(Ue[0]),it(Ue[1]),it(Ue[3]),it(Ue[1]),it(Ue[2]),it(Ue[3])}function Be(P){r.push(l[P*3+0]),r.push(l[P*3+1]),r.push(l[P*3+2])}function it(P){s.push(P.x),s.push(P.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,i=this.parameters.options;return aN(t,i,e)}static fromJSON(e,t){const i=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=t[e.shapes[s]];i.push(a)}const r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new dd[r.type]().fromJSON(r)),new th(i,e.options)}}const oN={generateTopUV:function(n,e,t,i,r){const s=e[t*3],o=e[t*3+1],a=e[i*3],l=e[i*3+1],c=e[r*3],u=e[r*3+1];return[new Q(s,o),new Q(a,l),new Q(c,u)]},generateSideWallUV:function(n,e,t,i,r,s){const o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[i*3],u=e[i*3+1],h=e[i*3+2],d=e[r*3],p=e[r*3+1],m=e[r*3+2],x=e[s*3],g=e[s*3+1],f=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new Q(o,1-l),new Q(c,1-h),new Q(d,1-m),new Q(x,1-f)]:[new Q(a,1-l),new Q(u,1-h),new Q(p,1-m),new Q(g,1-f)]}};function aN(n,e,t){if(t.shapes=[],Array.isArray(n))for(let i=0,r=n.length;i<r;i++){const s=n[i];t.shapes.push(s.uuid)}else t.shapes.push(n.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class nh extends Fr{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,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(r,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new nh(e.radius,e.detail)}}class Ul extends Fr{constructor(e=1,t=0){const i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[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(i,r,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Ul(e.radius,e.detail)}}class ih extends Ye{constructor(e=.5,t=1,i=32,r=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:r,thetaStart:s,thetaLength:o},i=Math.max(3,i),r=Math.max(1,r);const a=[],l=[],c=[],u=[];let h=e;const d=(t-e)/r,p=new I,m=new Q;for(let x=0;x<=r;x++){for(let g=0;g<=i;g++){const f=s+g/i*o;p.x=h*Math.cos(f),p.y=h*Math.sin(f),l.push(p.x,p.y,p.z),c.push(0,0,1),m.x=(p.x/t+1)/2,m.y=(p.y/t+1)/2,u.push(m.x,m.y)}h+=d}for(let x=0;x<r;x++){const g=x*(i+1);for(let f=0;f<i;f++){const v=f+g,y=v,_=v+i+1,R=v+i+2,w=v+1;a.push(y,_,w),a.push(_,R,w)}}this.setIndex(a),this.setAttribute("position",new Pe(l,3)),this.setAttribute("normal",new Pe(c,3)),this.setAttribute("uv",new Pe(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ih(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class rh extends Ye{constructor(e=new gs([new Q(0,.5),new Q(-.5,-.5),new Q(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const i=[],r=[],s=[],o=[];let a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let u=0;u<e.length;u++)c(e[u]),this.addGroup(a,l,u),a+=l,l=0;this.setIndex(i),this.setAttribute("position",new Pe(r,3)),this.setAttribute("normal",new Pe(s,3)),this.setAttribute("uv",new Pe(o,2));function c(u){const h=r.length/3,d=u.extractPoints(t);let p=d.shape;const m=d.holes;bi.isClockWise(p)===!1&&(p=p.reverse());for(let g=0,f=m.length;g<f;g++){const v=m[g];bi.isClockWise(v)===!0&&(m[g]=v.reverse())}const x=bi.triangulateShape(p,m);for(let g=0,f=m.length;g<f;g++){const v=m[g];p=p.concat(v)}for(let g=0,f=p.length;g<f;g++){const v=p[g];r.push(v.x,v.y,0),s.push(0,0,1),o.push(v.x,v.y)}for(let g=0,f=x.length;g<f;g++){const v=x[g],y=v[0]+h,_=v[1]+h,R=v[2]+h;i.push(y,_,R),l+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return lN(t,e)}static fromJSON(e,t){const i=[];for(let r=0,s=e.shapes.length;r<s;r++){const o=t[e.shapes[r]];i.push(o)}return new rh(i,e.curveSegments)}}function lN(n,e){if(e.shapes=[],Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const r=n[t];e.shapes.push(r.uuid)}else e.shapes.push(n.uuid);return e}class kl extends Ye{constructor(e=1,t=32,i=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const l=Math.min(o+a,Math.PI);let c=0;const u=[],h=new I,d=new I,p=[],m=[],x=[],g=[];for(let f=0;f<=i;f++){const v=[],y=f/i;let _=0;f===0&&o===0?_=.5/t:f===i&&l===Math.PI&&(_=-.5/t);for(let R=0;R<=t;R++){const w=R/t;h.x=-e*Math.cos(r+w*s)*Math.sin(o+y*a),h.y=e*Math.cos(o+y*a),h.z=e*Math.sin(r+w*s)*Math.sin(o+y*a),m.push(h.x,h.y,h.z),d.copy(h).normalize(),x.push(d.x,d.y,d.z),g.push(w+_,1-y),v.push(c++)}u.push(v)}for(let f=0;f<i;f++)for(let v=0;v<t;v++){const y=u[f][v+1],_=u[f][v],R=u[f+1][v],w=u[f+1][v+1];(f!==0||o>0)&&p.push(y,_,w),(f!==i-1||l<Math.PI)&&p.push(_,R,w)}this.setIndex(p),this.setAttribute("position",new Pe(m,3)),this.setAttribute("normal",new Pe(x,3)),this.setAttribute("uv",new Pe(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new kl(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class sh extends Fr{constructor(e=1,t=0){const i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];super(i,r,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new sh(e.radius,e.detail)}}class oh extends Ye{constructor(e=1,t=.4,i=12,r=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:s},i=Math.floor(i),r=Math.floor(r);const o=[],a=[],l=[],c=[],u=new I,h=new I,d=new I;for(let p=0;p<=i;p++)for(let m=0;m<=r;m++){const x=m/r*s,g=p/i*Math.PI*2;h.x=(e+t*Math.cos(g))*Math.cos(x),h.y=(e+t*Math.cos(g))*Math.sin(x),h.z=t*Math.sin(g),a.push(h.x,h.y,h.z),u.x=e*Math.cos(x),u.y=e*Math.sin(x),d.subVectors(h,u).normalize(),l.push(d.x,d.y,d.z),c.push(m/r),c.push(p/i)}for(let p=1;p<=i;p++)for(let m=1;m<=r;m++){const x=(r+1)*p+m-1,g=(r+1)*(p-1)+m-1,f=(r+1)*(p-1)+m,v=(r+1)*p+m;o.push(x,g,v),o.push(g,f,v)}this.setIndex(o),this.setAttribute("position",new Pe(a,3)),this.setAttribute("normal",new Pe(l,3)),this.setAttribute("uv",new Pe(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new oh(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class ah extends Ye{constructor(e=1,t=.4,i=64,r=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:s,q:o},i=Math.floor(i),r=Math.floor(r);const a=[],l=[],c=[],u=[],h=new I,d=new I,p=new I,m=new I,x=new I,g=new I,f=new I;for(let y=0;y<=i;++y){const _=y/i*s*Math.PI*2;v(_,s,o,e,p),v(_+.01,s,o,e,m),g.subVectors(m,p),f.addVectors(m,p),x.crossVectors(g,f),f.crossVectors(x,g),x.normalize(),f.normalize();for(let R=0;R<=r;++R){const w=R/r*Math.PI*2,E=-t*Math.cos(w),A=t*Math.sin(w);h.x=p.x+(E*f.x+A*x.x),h.y=p.y+(E*f.y+A*x.y),h.z=p.z+(E*f.z+A*x.z),l.push(h.x,h.y,h.z),d.subVectors(h,p).normalize(),c.push(d.x,d.y,d.z),u.push(y/i),u.push(R/r)}}for(let y=1;y<=i;y++)for(let _=1;_<=r;_++){const R=(r+1)*(y-1)+(_-1),w=(r+1)*y+(_-1),E=(r+1)*y+_,A=(r+1)*(y-1)+_;a.push(R,w,A),a.push(w,E,A)}this.setIndex(a),this.setAttribute("position",new Pe(l,3)),this.setAttribute("normal",new Pe(c,3)),this.setAttribute("uv",new Pe(u,2));function v(y,_,R,w,E){const A=Math.cos(y),b=Math.sin(y),M=R/_*y,L=Math.cos(M);E.x=w*(2+L)*.5*A,E.y=w*(2+L)*b*.5,E.z=w*Math.sin(M)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ah(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class lh extends Ye{constructor(e=new mg(new I(-1,-1,0),new I(-1,1,0),new I(1,1,0)),t=64,i=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:r,closed:s};const o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new I,l=new I,c=new Q;let u=new I;const h=[],d=[],p=[],m=[];x(),this.setIndex(m),this.setAttribute("position",new Pe(h,3)),this.setAttribute("normal",new Pe(d,3)),this.setAttribute("uv",new Pe(p,2));function x(){for(let y=0;y<t;y++)g(y);g(s===!1?t:0),v(),f()}function g(y){u=e.getPointAt(y/t,u);const _=o.normals[y],R=o.binormals[y];for(let w=0;w<=r;w++){const E=w/r*Math.PI*2,A=Math.sin(E),b=-Math.cos(E);l.x=b*_.x+A*R.x,l.y=b*_.y+A*R.y,l.z=b*_.z+A*R.z,l.normalize(),d.push(l.x,l.y,l.z),a.x=u.x+i*l.x,a.y=u.y+i*l.y,a.z=u.z+i*l.z,h.push(a.x,a.y,a.z)}}function f(){for(let y=1;y<=t;y++)for(let _=1;_<=r;_++){const R=(r+1)*(y-1)+(_-1),w=(r+1)*y+(_-1),E=(r+1)*y+_,A=(r+1)*(y-1)+_;m.push(R,w,A),m.push(w,E,A)}}function v(){for(let y=0;y<=t;y++)for(let _=0;_<=r;_++)c.x=y/t,c.y=_/r,p.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 lh(new dd[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class FM extends Ye{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],i=new Set,r=new I,s=new I;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,u=l.length;c<u;++c){const h=l[c],d=h.start,p=h.count;for(let m=d,x=d+p;m<x;m+=3)for(let g=0;g<3;g++){const f=a.getX(m+g),v=a.getX(m+(g+1)%3);r.fromBufferAttribute(o,f),s.fromBufferAttribute(o,v),gv(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.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 u=3*a+c,h=3*a+(c+1)%3;r.fromBufferAttribute(o,u),s.fromBufferAttribute(o,h),gv(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Pe(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function gv(n,e,t){const i=`${n.x},${n.y},${n.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${n.x},${n.y},${n.z}`;return t.has(i)===!0||t.has(r)===!0?!1:(t.add(i),t.add(r),!0)}var xv=Object.freeze({__proto__:null,BoxGeometry:Cs,CapsuleGeometry:Zd,CircleGeometry:Kd,ConeGeometry:Jd,CylinderGeometry:Xo,DodecahedronGeometry:Qd,EdgesGeometry:DM,ExtrudeGeometry:th,IcosahedronGeometry:nh,LatheGeometry:Dl,OctahedronGeometry:Ul,PlaneGeometry:Wo,PolyhedronGeometry:Fr,RingGeometry:ih,ShapeGeometry:rh,SphereGeometry:kl,TetrahedronGeometry:sh,TorusGeometry:oh,TorusKnotGeometry:ah,TubeGeometry:lh,WireframeGeometry:FM});class BM extends on{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new _e(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 zM extends ci{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class xg extends on{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new _e(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 _e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new Q(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 On,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 VM extends xg{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 Q(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return At(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new _e(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 _e(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new _e(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 HM extends on{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new _e(16777215),this.specular=new _e(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new Q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new On,this.combine=Rl,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 GM extends on{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new _e(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new Q(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 WM extends on{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new Q(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 jM extends on{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new _e(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new Q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new On,this.combine=Rl,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 XM extends on{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new _e(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new Q(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 $M extends xn{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 us(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function YM(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function qM(n){function e(r,s){return n[r]-n[s]}const t=n.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i}function Vp(n,e,t){const i=n.length,r=new n.constructor(i);for(let s=0,o=0;o!==i;++s){const a=t[s]*e;for(let l=0;l!==e;++l)r[o++]=n[a+l]}return r}function vg(n,e,t,i){let r=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[r++];if(s===void 0)return;let o=s[i];if(o!==void 0)if(Array.isArray(o))do o=s[i],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[r++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[i],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[r++];while(s!==void 0);else do o=s[i],o!==void 0&&(e.push(s.time),t.push(o)),s=n[r++];while(s!==void 0)}function cN(n,e,t,i,r=30){const s=n.clone();s.name=e;const o=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],u=c.getValueSize(),h=[],d=[];for(let p=0;p<c.times.length;++p){const m=c.times[p]*r;if(!(m<t||m>=i)){h.push(c.times[p]);for(let x=0;x<u;++x)d.push(c.values[p*u+x])}}h.length!==0&&(c.times=us(h,c.times.constructor),c.values=us(d,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 uN(n,e=0,t=n,i=30){i<=0&&(i=30);const r=t.tracks.length,s=e/i;for(let o=0;o<r;++o){const a=t.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;const c=n.tracks.find(function(f){return f.name===a.name&&f.ValueTypeName===l});if(c===void 0)continue;let u=0;const h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=h/3);let d=0;const p=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=p/3);const m=a.times.length-1;let x;if(s<=a.times[0]){const f=u,v=h-u;x=a.values.slice(f,v)}else if(s>=a.times[m]){const f=m*h+u,v=f+h-u;x=a.values.slice(f,v)}else{const f=a.createInterpolant(),v=u,y=h-u;f.evaluate(s),x=f.resultBuffer.slice(v,y)}l==="quaternion"&&new En().fromArray(x).normalize().conjugate().toArray(x);const g=c.times.length;for(let f=0;f<g;++f){const v=f*p+d;if(l==="quaternion")En.multiplyQuaternionsFlat(c.values,v,x,0,c.values,v);else{const y=p-d*2;for(let _=0;_<y;++_)c.values[v+_]-=x[_]}}}return n.blendMode=Jm,n}const dN={convertArray:us,isTypedArray:YM,getKeyframeOrder:qM,sortedArray:Vp,flattenJSON:vg,subclip:cN,makeClipAdditive:uN};class Ol{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,r=t[i],s=t[i-1];e:{t:{let o;n:{i:if(!(e<r)){for(let a=i+2;;){if(r===void 0){if(e<s)break i;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(s=r,r=t[++i],e<r)break t}o=t.length;break n}if(!(e>=s)){const a=t[1];e<a&&(i=2,s=a);for(let l=i-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===l)break;if(r=s,s=t[--i-1],e>=s)break t}o=i,i=0;break n}break e}for(;i<o;){const a=i+o>>>1;e<t[a]?o=a:i=a+1}if(r=t[i],s=t[i-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,r)}return this.interpolate_(i,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=i[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class ZM extends Ol{constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:as,endingEnd:as}}intervalChanged_(e,t,i){const r=this.parameterPositions;let s=e-2,o=e+1,a=r[s],l=r[o];if(a===void 0)switch(this.getSettings_().endingStart){case ls:s=e,a=2*t-i;break;case ll:s=r.length-2,a=t+r[s]-r[s+1];break;default:s=e,a=i}if(l===void 0)switch(this.getSettings_().endingEnd){case ls:o=e,l=2*i-t;break;case ll:o=1,l=i+r[1]-r[0];break;default:o=e-1,l=t}const c=(i-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-i),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,h=this._offsetNext,d=this._weightPrev,p=this._weightNext,m=(i-t)/(r-t),x=m*m,g=x*m,f=-d*g+2*d*x-d*m,v=(1+d)*g+(-1.5-2*d)*x+(-.5+d)*m+1,y=(-1-p)*g+(1.5+p)*x+.5*m,_=p*g-p*x;for(let R=0;R!==a;++R)s[R]=f*o[u+R]+v*o[c+R]+y*o[l+R]+_*o[h+R];return s}}class yg extends Ol{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(i-t)/(r-t),h=1-u;for(let d=0;d!==a;++d)s[d]=o[c+d]*h+o[l+d]*u;return s}}class KM extends Ol{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class di{constructor(e,t,i,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=us(t,this.TimeBufferType),this.values=us(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:us(e.times,Array),values:us(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new KM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new yg(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new ZM(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case al:t=this.InterpolantFactoryMethodDiscrete;break;case ld:t=this.InterpolantFactoryMethodLinear;break;case lu:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const i="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(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return al;case this.InterpolantFactoryMethodLinear:return ld;case this.InterpolantFactoryMethodSmooth:return lu}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){const i=this.times,r=i.length;let s=0,o=r-1;for(;s!==r&&i[s]<e;)++s;for(;o!==-1&&i[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=i.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,r=this.values,s=i.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=i[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(r!==void 0&&YM(r))for(let a=0,l=r.length;a!==l;++a){const c=r[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(),t=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===lu,s=e.length-1;let o=1;for(let a=1;a<s;++a){let l=!1;const c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(r)l=!0;else{const h=a*i,d=h-i,p=h+i;for(let m=0;m!==i;++m){const x=t[h+m];if(x!==t[d+m]||x!==t[p+m]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];const h=a*i,d=o*i;for(let p=0;p!==i;++p)t[d+p]=t[h+p]}++o}}if(s>0){e[o]=e[s];for(let a=s*i,l=o*i,c=0;c!==i;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}di.prototype.TimeBufferType=Float32Array;di.prototype.ValueBufferType=Float32Array;di.prototype.DefaultInterpolation=ld;class Rs extends di{constructor(e,t,i){super(e,t,i)}}Rs.prototype.ValueTypeName="bool";Rs.prototype.ValueBufferType=Array;Rs.prototype.DefaultInterpolation=al;Rs.prototype.InterpolantFactoryMethodLinear=void 0;Rs.prototype.InterpolantFactoryMethodSmooth=void 0;class _g extends di{}_g.prototype.ValueTypeName="color";class yl extends di{}yl.prototype.ValueTypeName="number";class JM extends Ol{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-t)/(r-t);let c=e*a;for(let u=c+a;c!==u;c+=4)En.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Fl extends di{InterpolantFactoryMethodLinear(e){return new JM(this.times,this.values,this.getValueSize(),e)}}Fl.prototype.ValueTypeName="quaternion";Fl.prototype.InterpolantFactoryMethodSmooth=void 0;class Ps extends di{constructor(e,t,i){super(e,t,i)}}Ps.prototype.ValueTypeName="string";Ps.prototype.ValueBufferType=Array;Ps.prototype.DefaultInterpolation=al;Ps.prototype.InterpolantFactoryMethodLinear=void 0;Ps.prototype.InterpolantFactoryMethodSmooth=void 0;class _l extends di{}_l.prototype.ValueTypeName="vector";class Sl{constructor(e="",t=-1,i=[],r=Od){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=Un(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(fN(i[o]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=i.length;s!==o;++s)t.push(di.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.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 u=qM(l);l=Vp(l,1,u),c=Vp(c,1,u),!r&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new yl(".morphTargetInfluences["+t[a].name+"]",l,c).scale(1/i))}return new this(e,-1,o)}static findByName(e,t){let i=e;if(!Array.isArray(e)){const r=e;i=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<i.length;r++)if(i[r].name===t)return i[r];return null}static CreateClipsFromMorphTargetSequences(e,t,i){const r={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){const c=e[a],u=c.name.match(s);if(u&&u.length>1){const h=u[1];let d=r[h];d||(r[h]=d=[]),d.push(c)}}const o=[];for(const a in r)o.push(this.CreateFromMorphTargetSequence(a,r[a],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(h,d,p,m,x){if(p.length!==0){const g=[],f=[];vg(p,g,f,m),g.length!==0&&x.push(new h(d,g,f))}},r=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h<c.length;h++){const d=c[h].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const p={};let m;for(m=0;m<d.length;m++)if(d[m].morphTargets)for(let x=0;x<d[m].morphTargets.length;x++)p[d[m].morphTargets[x]]=-1;for(const x in p){const g=[],f=[];for(let v=0;v!==d[m].morphTargets.length;++v){const y=d[m];g.push(y.time),f.push(y.morphTarget===x?1:0)}r.push(new yl(".morphTargetInfluence["+x+"]",g,f))}l=p.length*o}else{const p=".bones["+t[h].name+"]";i(_l,p+".position",d,"pos",r),i(Fl,p+".quaternion",d,"rot",r),i(_l,p+".scale",d,"scl",r)}}return r.length===0?null:new this(s,l,r,a)}resetDuration(){const e=this.tracks;let t=0;for(let i=0,r=e.length;i!==r;++i){const s=this.tracks[i];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,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 t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function hN(n){switch(n.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return yl;case"vector":case"vector2":case"vector3":case"vector4":return _l;case"color":return _g;case"quaternion":return Fl;case"bool":case"boolean":return Rs;case"string":return Ps}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+n)}function fN(n){if(n.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=hN(n.type);if(n.times===void 0){const t=[],i=[];vg(n.keys,t,i,"value"),n.times=t,n.values=i}return e.parse!==void 0?e.parse(n):new e(n.name,n.times,n.values,n.interpolation)}const Hi={enabled:!1,files:{},add:function(n,e){this.enabled!==!1&&(this.files[n]=e)},get:function(n){if(this.enabled!==!1)return this.files[n]},remove:function(n){delete this.files[n]},clear:function(){this.files={}}};class Sg{constructor(e,t,i){const r=this;let s=!1,o=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(u){a++,s===!1&&r.onStart!==void 0&&r.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,r.onProgress!==void 0&&r.onProgress(u,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,h){return c.push(u,h),this},this.removeHandler=function(u){const h=c.indexOf(u);return h!==-1&&c.splice(h,2),this},this.getHandler=function(u){for(let h=0,d=c.length;h<d;h+=2){const p=c[h],m=c[h+1];if(p.global&&(p.lastIndex=0),p.test(u))return m}return null}}}const QM=new Sg;class Tn{constructor(e){this.manager=e!==void 0?e:QM,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const i=this;return new Promise(function(r,s){i.load(e,r,t,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}}Tn.DEFAULT_MATERIAL_NAME="__DEFAULT";const Ui={};class pN extends Error{constructor(e,t){super(e),this.response=t}}class Qi extends Tn{constructor(e){super(e)}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Hi.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Ui[e]!==void 0){Ui[e].push({onLoad:t,onProgress:i,onError:r});return}Ui[e]=[],Ui[e].push({onLoad:t,onProgress:i,onError:r});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 u=Ui[e],h=c.body.getReader(),d=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),p=d?parseInt(d):0,m=p!==0;let x=0;const g=new ReadableStream({start(f){v();function v(){h.read().then(({done:y,value:_})=>{if(y)f.close();else{x+=_.byteLength;const R=new ProgressEvent("progress",{lengthComputable:m,loaded:x,total:p});for(let w=0,E=u.length;w<E;w++){const A=u[w];A.onProgress&&A.onProgress(R)}f.enqueue(_),v()}},y=>{f.error(y)})}}});return new Response(g)}else throw new pN(`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(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a===void 0)return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),d=h&&h[1]?h[1].toLowerCase():void 0,p=new TextDecoder(d);return c.arrayBuffer().then(m=>p.decode(m))}}}).then(c=>{Hi.add(e,c);const u=Ui[e];delete Ui[e];for(let h=0,d=u.length;h<d;h++){const p=u[h];p.onLoad&&p.onLoad(c)}}).catch(c=>{const u=Ui[e];if(u===void 0)throw this.manager.itemError(e),c;delete Ui[e];for(let h=0,d=u.length;h<d;h++){const p=u[h];p.onError&&p.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 mN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Qi(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=[];for(let i=0;i<e.length;i++){const r=Sl.parse(e[i]);t.push(r)}return t}}class gN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=[],a=new Yd,l=new Qi(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function u(h){l.load(e[h],function(d){const p=s.parse(d,!0);o[h]={width:p.width,height:p.height,format:p.format,mipmaps:p.mipmaps},c+=1,c===6&&(p.mipmapCount===1&&(a.minFilter=Ut),a.image=o,a.format=p.format,a.needsUpdate=!0,t&&t(a))},i,r)}if(Array.isArray(e))for(let h=0,d=e.length;h<d;++h)u(h);else l.load(e,function(h){const d=s.parse(h,!0);if(d.isCubemap){const p=d.mipmaps.length/d.mipmapCount;for(let m=0;m<p;m++){o[m]={mipmaps:[]};for(let x=0;x<d.mipmapCount;x++)o[m].mipmaps.push(d.mipmaps[m*d.mipmapCount+x]),o[m].format=d.format,o[m].width=d.width,o[m].height=d.height}a.image=o}else a.image.width=d.width,a.image.height=d.height,a.mipmaps=d.mipmaps;d.mipmapCount===1&&(a.minFilter=Ut),a.format=d.format,a.needsUpdate=!0,t&&t(a)},i,r);return a}}class Ml extends Tn{constructor(e){super(e)}load(e,t,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Hi.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=pl("img");function l(){u(),Hi.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(h){u(),r&&r(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){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 xN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=new Nl;s.colorSpace=Hn;const o=new Ml(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(u){s.images[c]=u,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,r)}for(let c=0;c<e.length;++c)l(c);return s}}class vN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new wi,a=new Qi(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(u){if(r!==void 0)r(u);else{console.error(u);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:Xn,o.wrapT=c.wrapT!==void 0?c.wrapT:Xn,o.magFilter=c.magFilter!==void 0?c.magFilter:Ut,o.minFilter=c.minFilter!==void 0?c.minFilter:Ut,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=yi),c.mipmapCount===1&&(o.minFilter=Ut),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,t&&t(o,c)},i,r),o}}class yN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=new Ct,o=new Ml(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},i,r),s}}class Br extends nt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new _e(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}class ew extends Br{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(nt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new _e(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const If=new ke,vv=new I,yv=new I;class Mg{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Q(512,512),this.map=null,this.mapPass=null,this.matrix=new ke,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ll,this._frameExtents=new Q(1,1),this._viewportCount=1,this._viewports=[new ct(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;vv.setFromMatrixPosition(e.matrixWorld),t.position.copy(vv),yv.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(yv),t.updateMatrixWorld(),If.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(If),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(If)}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 _N extends Mg{constructor(){super(new Yt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=Uo*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(i!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=i,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class tw extends Br{constructor(e,t,i=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(nt.DEFAULT_UP),this.updateMatrix(),this.target=new nt,this.distance=i,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new _N}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),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 _v=new ke,pa=new I,Nf=new I;class SN extends Mg{constructor(){super(new Yt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Q(4,2),this._viewportCount=6,this._viewports=[new ct(2,1,1,1),new ct(0,1,1,1),new ct(3,1,1,1),new ct(1,1,1,1),new ct(3,0,1,1),new ct(1,0,1,1)],this._cubeDirections=[new I(1,0,0),new I(-1,0,0),new I(0,0,1),new I(0,0,-1),new I(0,1,0),new I(0,-1,0)],this._cubeUps=[new I(0,1,0),new I(0,1,0),new I(0,1,0),new I(0,1,0),new I(0,0,1),new I(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,r=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),pa.setFromMatrixPosition(e.matrixWorld),i.position.copy(pa),Nf.copy(i.position),Nf.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(Nf),i.updateMatrixWorld(),r.makeTranslation(-pa.x,-pa.y,-pa.z),_v.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_v)}}class nw extends Br{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new SN}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class MN extends Mg{constructor(){super(new Hd(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class iw extends Br{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(nt.DEFAULT_UP),this.updateMatrix(),this.target=new nt,this.shadow=new MN}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class rw extends Br{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class sw extends Br{constructor(e,t,i=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=i,this.height=r}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 t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class ow{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new I)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const i=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*i),t.addScaledVector(o[4],1.092548*(i*r)),t.addScaledVector(o[5],1.092548*(r*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(i*s)),t.addScaledVector(o[8],.546274*(i*i-r*r)),t}getIrradianceAt(e,t){const i=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*r),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*i),t.addScaledVector(o[4],2*.429043*i*r),t.addScaledVector(o[5],2*.429043*r*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*i*s),t.addScaledVector(o[8],.429043*(i*i-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(e.coefficients[i],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let i=0;i<9;i++)this.coefficients[i].lerp(e.coefficients[i],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){const i=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*i,t[4]=1.092548*i*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*i*s,t[8]=.546274*(i*i-r*r)}}class aw extends Br{constructor(e=new ow,t=1){super(void 0,t),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 t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class ch extends Tn{constructor(e){super(e),this.textures={}}load(e,t,i,r){const s=this,o=new Qi(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=this.textures;function i(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const r=ch.createMaterialFromType(e.type);if(e.uuid!==void 0&&(r.uuid=e.uuid),e.name!==void 0&&(r.name=e.name),e.color!==void 0&&r.color!==void 0&&r.color.setHex(e.color),e.roughness!==void 0&&(r.roughness=e.roughness),e.metalness!==void 0&&(r.metalness=e.metalness),e.sheen!==void 0&&(r.sheen=e.sheen),e.sheenColor!==void 0&&(r.sheenColor=new _e().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(r.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&r.emissive!==void 0&&r.emissive.setHex(e.emissive),e.specular!==void 0&&r.specular!==void 0&&r.specular.setHex(e.specular),e.specularIntensity!==void 0&&(r.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&r.specularColor!==void 0&&r.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(r.shininess=e.shininess),e.clearcoat!==void 0&&(r.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(r.dispersion=e.dispersion),e.iridescence!==void 0&&(r.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(r.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(r.transmission=e.transmission),e.thickness!==void 0&&(r.thickness=e.thickness),e.attenuationDistance!==void 0&&(r.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&r.attenuationColor!==void 0&&r.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(r.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(r.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(r.fog=e.fog),e.flatShading!==void 0&&(r.flatShading=e.flatShading),e.blending!==void 0&&(r.blending=e.blending),e.combine!==void 0&&(r.combine=e.combine),e.side!==void 0&&(r.side=e.side),e.shadowSide!==void 0&&(r.shadowSide=e.shadowSide),e.opacity!==void 0&&(r.opacity=e.opacity),e.transparent!==void 0&&(r.transparent=e.transparent),e.alphaTest!==void 0&&(r.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(r.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(r.depthFunc=e.depthFunc),e.depthTest!==void 0&&(r.depthTest=e.depthTest),e.depthWrite!==void 0&&(r.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(r.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(r.blendSrc=e.blendSrc),e.blendDst!==void 0&&(r.blendDst=e.blendDst),e.blendEquation!==void 0&&(r.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(r.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(r.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(r.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&r.blendColor!==void 0&&r.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(r.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(r.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(r.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(r.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(r.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(r.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(r.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(r.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(r.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(r.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(r.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(r.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(r.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(r.rotation=e.rotation),e.linewidth!==void 0&&(r.linewidth=e.linewidth),e.dashSize!==void 0&&(r.dashSize=e.dashSize),e.gapSize!==void 0&&(r.gapSize=e.gapSize),e.scale!==void 0&&(r.scale=e.scale),e.polygonOffset!==void 0&&(r.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(r.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(r.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(r.dithering=e.dithering),e.alphaToCoverage!==void 0&&(r.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(r.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(r.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(r.visible=e.visible),e.toneMapped!==void 0&&(r.toneMapped=e.toneMapped),e.userData!==void 0&&(r.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(r.uniforms[s]={},o.type){case"t":r.uniforms[s].value=i(o.value);break;case"c":r.uniforms[s].value=new _e().setHex(o.value);break;case"v2":r.uniforms[s].value=new Q().fromArray(o.value);break;case"v3":r.uniforms[s].value=new I().fromArray(o.value);break;case"v4":r.uniforms[s].value=new ct().fromArray(o.value);break;case"m3":r.uniforms[s].value=new je().fromArray(o.value);break;case"m4":r.uniforms[s].value=new ke().fromArray(o.value);break;default:r.uniforms[s].value=o.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)r.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(r.lights=e.lights),e.clipping!==void 0&&(r.clipping=e.clipping),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=i(e.map)),e.matcap!==void 0&&(r.matcap=i(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new Q().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=i(e.envMap)),e.envMapRotation!==void 0&&r.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new Q().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=i(e.thicknessMap)),e.anisotropyMap!==void 0&&(r.anisotropyMap=i(e.anisotropyMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=i(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:BM,SpriteMaterial:lg,RawShaderMaterial:zM,ShaderMaterial:ci,PointsMaterial:ug,MeshPhysicalMaterial:VM,MeshStandardMaterial:xg,MeshPhongMaterial:HM,MeshToonMaterial:GM,MeshNormalMaterial:WM,MeshLambertMaterial:jM,MeshDepthMaterial:og,MeshDistanceMaterial:ag,MeshBasicMaterial:Or,MeshMatcapMaterial:XM,LineDashedMaterial:$M,LineBasicMaterial:xn,Material:on};return new t[e]}}class Hp{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 t="";for(let i=0,r=e.length;i<r;i++)t+=String.fromCharCode(e[i]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class lw extends Ye{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 cw extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Qi(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t={},i={};function r(p,m){if(t[m]!==void 0)return t[m];const g=p.interleavedBuffers[m],f=s(p,g.buffer),v=po(g.type,f),y=new Xd(v,g.stride);return y.uuid=g.uuid,t[m]=y,y}function s(p,m){if(i[m]!==void 0)return i[m];const g=p.arrayBuffers[m],f=new Uint32Array(g).buffer;return i[m]=f,f}const o=e.isInstancedBufferGeometry?new lw:new Ye,a=e.data.index;if(a!==void 0){const p=po(a.type,a.array);o.setIndex(new ht(p,1))}const l=e.data.attributes;for(const p in l){const m=l[p];let x;if(m.isInterleavedBufferAttribute){const g=r(e.data,m.data);x=new bs(g,m.itemSize,m.offset,m.normalized)}else{const g=po(m.type,m.array),f=m.isInstancedBufferAttribute?Oo:ht;x=new f(g,m.itemSize,m.normalized)}m.name!==void 0&&(x.name=m.name),m.usage!==void 0&&x.setUsage(m.usage),o.setAttribute(p,x)}const c=e.data.morphAttributes;if(c)for(const p in c){const m=c[p],x=[];for(let g=0,f=m.length;g<f;g++){const v=m[g];let y;if(v.isInterleavedBufferAttribute){const _=r(e.data,v.data);y=new bs(_,v.itemSize,v.offset,v.normalized)}else{const _=po(v.type,v.array);y=new ht(_,v.itemSize,v.normalized)}v.name!==void 0&&(y.name=v.name),x.push(y)}o.morphAttributes[p]=x}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let p=0,m=h.length;p!==m;++p){const x=h[p];o.addGroup(x.start,x.count,x.materialIndex)}const d=e.data.boundingSphere;if(d!==void 0){const p=new I;d.center!==void 0&&p.fromArray(d.center),o.boundingSphere=new rn(p,d.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class wN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=this.path===""?Hp.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new Qi(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(h){r!==void 0&&r(h),console.error("THREE:ObjectLoader: Can't parse "+e+".",h.message);return}const u=c.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry"){r!==void 0&&r(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(c,t)},i,r)}async loadAsync(e,t){const i=this,r=this.path===""?Hp.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||r;const s=new Qi(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const o=await s.loadAsync(e,t),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 i.parseAsync(a)}parse(e,t){const i=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,r),o=this.parseImages(e.images,function(){t!==void 0&&t(c)}),a=this.parseTextures(e.textures,o),l=this.parseMaterials(e.materials,a),c=this.parseObject(e.object,s,l,a,i),u=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,u),this.bindLightTargets(c),t!==void 0){let h=!1;for(const d in o)if(o[d].data instanceof HTMLImageElement){h=!0;break}h===!1&&t(c)}return c}async parseAsync(e){const t=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),s=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,r,a,o,t),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),this.bindLightTargets(l),l}parseShapes(e){const t={};if(e!==void 0)for(let i=0,r=e.length;i<r;i++){const s=new gs().fromJSON(e[i]);t[s.uuid]=s}return t}parseSkeletons(e,t){const i={},r={};if(t.traverse(function(s){s.isBone&&(r[s.uuid]=s)}),e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=new $d().fromJSON(e[s],r);i[a.uuid]=a}return i}parseGeometries(e,t){const i={};if(e!==void 0){const r=new cw;for(let s=0,o=e.length;s<o;s++){let a;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":a=r.parse(l);break;default:l.type in xv?a=xv[l.type].fromJSON(l,t):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),i[l.uuid]=a}}return i}parseMaterials(e,t){const i={},r={};if(e!==void 0){const s=new ch;s.setTextures(t);for(let o=0,a=e.length;o<a;o++){const l=e[o];i[l.uuid]===void 0&&(i[l.uuid]=s.parse(l)),r[l.uuid]=i[l.uuid]}}return r}parseAnimations(e){const t={};if(e!==void 0)for(let i=0;i<e.length;i++){const r=e[i],s=Sl.parse(r);t[s.uuid]=s}return t}parseImages(e,t){const i=this,r={};let s;function o(l){return i.manager.itemStart(l),s.load(l,function(){i.manager.itemEnd(l)},void 0,function(){i.manager.itemError(l),i.manager.itemEnd(l)})}function a(l){if(typeof l=="string"){const c=l,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:i.resourcePath+c;return o(u)}else return l.data?{data:po(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new Sg(t);s=new Ml(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c<u;c++){const h=e[c],d=h.url;if(Array.isArray(d)){const p=[];for(let m=0,x=d.length;m<x;m++){const g=d[m],f=a(g);f!==null&&(f instanceof HTMLImageElement?p.push(f):p.push(new wi(f.data,f.width,f.height)))}r[h.uuid]=new cs(p)}else{const p=a(h.url);r[h.uuid]=new cs(p)}}}return r}async parseImagesAsync(e){const t=this,i={};let r;async function s(o){if(typeof o=="string"){const a=o,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return await r.loadAsync(l)}else return o.data?{data:po(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){r=new Ml(this.manager),r.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 u=[];for(let h=0,d=c.length;h<d;h++){const p=c[h],m=await s(p);m!==null&&(m instanceof HTMLImageElement?u.push(m):u.push(new wi(m.data,m.width,m.height)))}i[l.uuid]=new cs(u)}else{const u=await s(l.url);i[l.uuid]=new cs(u)}}}return i}parseTextures(e,t){function i(s,o){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const r={};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),t[a.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",a.image);const l=t[a.image],c=l.data;let u;Array.isArray(c)?(u=new Nl,c.length===6&&(u.needsUpdate=!0)):(c&&c.data?u=new wi:u=new Ct,c&&(u.needsUpdate=!0)),u.source=l,u.uuid=a.uuid,a.name!==void 0&&(u.name=a.name),a.mapping!==void 0&&(u.mapping=i(a.mapping,bN)),a.channel!==void 0&&(u.channel=a.channel),a.offset!==void 0&&u.offset.fromArray(a.offset),a.repeat!==void 0&&u.repeat.fromArray(a.repeat),a.center!==void 0&&u.center.fromArray(a.center),a.rotation!==void 0&&(u.rotation=a.rotation),a.wrap!==void 0&&(u.wrapS=i(a.wrap[0],Sv),u.wrapT=i(a.wrap[1],Sv)),a.format!==void 0&&(u.format=a.format),a.internalFormat!==void 0&&(u.internalFormat=a.internalFormat),a.type!==void 0&&(u.type=a.type),a.colorSpace!==void 0&&(u.colorSpace=a.colorSpace),a.minFilter!==void 0&&(u.minFilter=i(a.minFilter,Mv)),a.magFilter!==void 0&&(u.magFilter=i(a.magFilter,Mv)),a.anisotropy!==void 0&&(u.anisotropy=a.anisotropy),a.flipY!==void 0&&(u.flipY=a.flipY),a.generateMipmaps!==void 0&&(u.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(u.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(u.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(u.compareFunction=a.compareFunction),a.userData!==void 0&&(u.userData=a.userData),r[a.uuid]=u}return r}parseObject(e,t,i,r,s){let o;function a(d){return t[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",d),t[d]}function l(d){if(d!==void 0){if(Array.isArray(d)){const p=[];for(let m=0,x=d.length;m<x;m++){const g=d[m];i[g]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",g),p.push(i[g])}return p}return i[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",d),i[d]}}function c(d){return r[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",d),r[d]}let u,h;switch(e.type){case"Scene":o=new _M,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new _e(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 jd(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new Wd(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 Yt(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 Hd(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 rw(e.color,e.intensity);break;case"DirectionalLight":o=new iw(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new nw(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new sw(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new tw(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new ew(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new aw().fromJSON(e);break;case"SkinnedMesh":u=a(e.geometry),h=l(e.material),o=new bM(u,h),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":u=a(e.geometry),h=l(e.material),o=new kt(u,h);break;case"InstancedMesh":u=a(e.geometry),h=l(e.material);const d=e.count,p=e.instanceMatrix,m=e.instanceColor;o=new EM(u,h,d),o.instanceMatrix=new Oo(new Float32Array(p.array),16),m!==void 0&&(o.instanceColor=new Oo(new Float32Array(m.array),m.itemSize));break;case"BatchedMesh":u=a(e.geometry),h=l(e.material),o=new TM(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,h),o.geometry=u,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(x=>{const g=new pn;g.min.fromArray(x.boxMin),g.max.fromArray(x.boxMax);const f=new rn;return f.radius=x.sphereRadius,f.center.fromArray(x.sphereCenter),{boxInitialized:x.boxInitialized,box:g,sphereInitialized:x.sphereInitialized,sphere:f}}),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 wM;break;case"Line":o=new Nr(a(e.geometry),l(e.material));break;case"LineLoop":o=new AM(a(e.geometry),l(e.material));break;case"LineSegments":o=new Ai(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new CM(a(e.geometry),l(e.material));break;case"Sprite":o=new MM(l(e.material));break;case"Group":o=new go;break;case"Bone":o=new cg;break;default:o=new nt}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 d=e.children;for(let p=0;p<d.length;p++)o.add(this.parseObject(d[p],t,i,r,s))}if(e.animations!==void 0){const d=e.animations;for(let p=0;p<d.length;p++){const m=d[p];o.animations.push(s[m])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const d=e.levels;for(let p=0;p<d.length;p++){const m=d[p],x=o.getObjectByProperty("uuid",m.object);x!==void 0&&o.addLevel(x,m.distance,m.hysteresis)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(i){if(i.isSkinnedMesh===!0&&i.skeleton!==void 0){const r=t[i.skeleton];r===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",i.skeleton):i.bind(r,i.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const i=t.target,r=e.getObjectByProperty("uuid",i);r!==void 0?t.target=r:t.target=new nt}})}}const bN={UVMapping:Pd,CubeReflectionMapping:Ki,CubeRefractionMapping:Ir,EquirectangularReflectionMapping:il,EquirectangularRefractionMapping:rl,CubeUVReflectionMapping:Vo},Sv={RepeatWrapping:sl,ClampToEdgeWrapping:Xn,MirroredRepeatWrapping:ol},Mv={NearestFilter:Gt,NearestMipmapNearestFilter:Hm,NearestMipmapLinearFilter:fo,LinearFilter:Ut,LinearMipmapNearestFilter:Pa,LinearMipmapLinearFilter:yi};class EN extends Tn{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,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Hi.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{t&&t(c),s.manager.itemEnd(e)}).catch(c=>{r&&r(c)});return}return setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;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 Hi.add(e,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){r&&r(c),Hi.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Hi.add(e,l),s.manager.itemStart(e)}}let Gc;class wg{static getContext(){return Gc===void 0&&(Gc=new(window.AudioContext||window.webkitAudioContext)),Gc}static setContext(e){Gc=e}}class TN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Qi(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);wg.getContext().decodeAudioData(c,function(h){t(h)}).catch(a)}catch(c){a(c)}},i,r);function a(l){r?r(l):console.error(l),s.manager.itemError(e)}}}const wv=new ke,bv=new ke,Yr=new ke;class AN{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Yt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Yt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Yr.copy(e.projectionMatrix);const r=t.eyeSep/2,s=r*t.near/t.focus,o=t.near*Math.tan(ms*t.fov*.5)/t.zoom;let a,l;bv.elements[12]=-r,wv.elements[12]=r,a=-o*t.aspect+s,l=o*t.aspect+s,Yr.elements[0]=2*t.near/(l-a),Yr.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Yr),a=-o*t.aspect-s,l=o*t.aspect-s,Yr.elements[0]=2*t.near/(l-a),Yr.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Yr)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(bv),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(wv)}}class uw{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Ev(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=Ev();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Ev(){return(typeof performance>"u"?Date:performance).now()}const qr=new I,Tv=new En,CN=new I,Zr=new I;class RN extends nt{constructor(){super(),this.type="AudioListener",this.context=wg.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new uw}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(qr,Tv,CN),Zr.set(0,0,-1).applyQuaternion(Tv),t.positionX){const r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(qr.x,r),t.positionY.linearRampToValueAtTime(qr.y,r),t.positionZ.linearRampToValueAtTime(qr.z,r),t.forwardX.linearRampToValueAtTime(Zr.x,r),t.forwardY.linearRampToValueAtTime(Zr.y,r),t.forwardZ.linearRampToValueAtTime(Zr.z,r),t.upX.linearRampToValueAtTime(i.x,r),t.upY.linearRampToValueAtTime(i.y,r),t.upZ.linearRampToValueAtTime(i.z,r)}else t.setPosition(qr.x,qr.y,qr.z),t.setOrientation(Zr.x,Zr.y,Zr.z,i.x,i.y,i.z)}}class dw extends nt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;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,t=this.filters.length;e<t;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 Kr=new I,Av=new En,PN=new I,Jr=new I;class IN extends dw{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,t,i){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=i,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Kr,Av,PN),Jr.set(0,0,1).applyQuaternion(Av);const t=this.panner;if(t.positionX){const i=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Kr.x,i),t.positionY.linearRampToValueAtTime(Kr.y,i),t.positionZ.linearRampToValueAtTime(Kr.z,i),t.orientationX.linearRampToValueAtTime(Jr.x,i),t.orientationY.linearRampToValueAtTime(Jr.y,i),t.orientationZ.linearRampToValueAtTime(Jr.z,i)}else t.setPosition(Kr.x,Kr.y,Kr.z),t.setOrientation(Jr.x,Jr.y,Jr.z)}}class NN{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,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 t=this.getFrequencyData();for(let i=0;i<t.length;i++)e+=t[i];return e/t.length}}class hw{constructor(e,t,i){this.binding=e,this.valueSize=i;let r,s,o;switch(t){case"quaternion":r=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(i*6),this._workIndex=5;break;case"string":case"bool":r=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(i*5);break;default:r=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(i*5)}this._mixBufferRegion=r,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,t){const i=this.buffer,r=this.valueSize,s=e*r+r;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==r;++a)i[s+a]=i[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(i,s,0,a,r)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,i=this.valueSize,r=i*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,i=this.buffer,r=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(i,r,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(i,r,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(i[l]!==i[l+t]){a.setValue(i,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(t,r);for(let s=i,o=r;s!==o;++s)t[s]=t[r+s%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i<t;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[t+i]=this.buffer[e+i]}_select(e,t,i,r,s){if(r>=.5)for(let o=0;o!==s;++o)e[t+o]=e[i+o]}_slerp(e,t,i,r){En.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,s){const o=this._workIndex*s;En.multiplyQuaternionsFlat(e,o,e,t,e,i),En.slerpFlat(e,t,e,t,e,o,r)}_lerp(e,t,i,r,s){const o=1-r;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[i+a]*r}}_lerpAdditive(e,t,i,r,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[i+o]*r}}}const bg="\\[\\]\\.:\\/",LN=new RegExp("["+bg+"]","g"),Eg="[^"+bg+"]",DN="[^"+bg.replace("\\.","")+"]",UN=/((?:WC+[\/:])*)/.source.replace("WC",Eg),kN=/(WCOD+)?/.source.replace("WCOD",DN),ON=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Eg),FN=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Eg),BN=new RegExp("^"+UN+kN+ON+FN+"$"),zN=["material","materials","bones","map"];class VN{constructor(e,t,i){const r=i||et.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class et{constructor(e,t,i){this.path=t,this.parsedPath=i||et.parseTrackName(t),this.node=et.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new et.Composite(e,t,i):new et(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(LN,"")}static parseTrackName(e){const t=BN.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=i.nodeName.substring(r+1);zN.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(s){for(let o=0;o<s.length;o++){const a=s[o];if(a.name===t||a.uuid===t)return a;const l=i(a.children);if(l)return l}return null},r=i(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)e[t++]=i[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,i=t.objectName,r=t.propertyName;let s=t.propertyIndex;if(e||(e=et.findNode(this.rootNode,t.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(i){let c=t.objectIndex;switch(i){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 u=0;u<e.length;u++)if(e[u].name===c){c=u;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[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}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[r];if(o===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+r+" 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(r==="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=r;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}}et.Composite=VN;et.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};et.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};et.prototype.GetterByBindingType=[et.prototype._getValue_direct,et.prototype._getValue_array,et.prototype._getValue_arrayElement,et.prototype._getValue_toArray];et.prototype.SetterByBindingTypeAndVersioning=[[et.prototype._setValue_direct,et.prototype._setValue_direct_setNeedsUpdate,et.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[et.prototype._setValue_array,et.prototype._setValue_array_setNeedsUpdate,et.prototype._setValue_array_setMatrixWorldNeedsUpdate],[et.prototype._setValue_arrayElement,et.prototype._setValue_arrayElement_setNeedsUpdate,et.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[et.prototype._setValue_fromArray,et.prototype._setValue_fromArray_setNeedsUpdate,et.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class HN{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Un(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let i=0,r=arguments.length;i!==r;++i)e[arguments[i].uuid]=i;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,i=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length;let a,l=e.length,c=this.nCachedObjects_;for(let u=0,h=arguments.length;u!==h;++u){const d=arguments[u],p=d.uuid;let m=t[p];if(m===void 0){m=l++,t[p]=m,e.push(d);for(let x=0,g=o;x!==g;++x)s[x].push(new et(d,i[x],r[x]))}else if(m<c){a=e[m];const x=--c,g=e[x];t[g.uuid]=m,e[m]=g,t[p]=x,e[x]=d;for(let f=0,v=o;f!==v;++f){const y=s[f],_=y[x];let R=y[m];y[m]=_,R===void 0&&(R=new et(d,i[f],r[f])),y[x]=R}}else e[m]!==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,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const l=arguments[o],c=l.uuid,u=t[c];if(u!==void 0&&u>=s){const h=s++,d=e[h];t[d.uuid]=u,e[u]=d,t[c]=h,e[h]=l;for(let p=0,m=r;p!==m;++p){const x=i[p],g=x[h],f=x[u];x[u]=g,x[h]=f}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],u=c.uuid,h=t[u];if(h!==void 0)if(delete t[u],h<s){const d=--s,p=e[d],m=--o,x=e[m];t[p.uuid]=h,e[h]=p,t[x.uuid]=d,e[d]=x,e.pop();for(let g=0,f=r;g!==f;++g){const v=i[g],y=v[d],_=v[m];v[h]=y,v[d]=_,v.pop()}}else{const d=--o,p=e[d];d>0&&(t[p.uuid]=h),e[h]=p,e.pop();for(let m=0,x=r;m!==x;++m){const g=i[m];g[h]=g[d],g.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const i=this._bindingsIndicesByPath;let r=i[e];const s=this._bindings;if(r!==void 0)return s[r];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,h=new Array(c);r=s.length,i[e]=r,o.push(e),a.push(t),s.push(h);for(let d=u,p=l.length;d!==p;++d){const m=l[d];h[d]=new et(m,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const r=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=i,o[i]=l,o.pop(),s[i]=s[a],s.pop(),r[i]=r[a],r.pop()}}}class fw{constructor(e,t,i=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=r;const s=t.tracks,o=s.length,a=new Array(o),l={endingStart:as,endingEnd:as};for(let c=0;c!==o;++c){const u=s[c].createInterpolant(null);a[c]=u,u.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=XS,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){const r=this._clip.duration,s=e._clip.duration,o=s/r,a=r/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){const r=this._mixer,s=r.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+i,c[0]=e/o,c[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,i,r){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*i;l<0||i===0?t=0:(this._startTime=null,t=i*l)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Jm:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case Od:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(r,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let r=this.time+e,s=this._loopCount;const o=i===$S;if(e===0)return s===-1?r:o&&(s&1)===1?t-r:r;if(i===jS){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,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)),r>=t||r<0){const a=Math.floor(r/t);r-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,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=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=r;if(o&&(s&1)===1)return t-r}return r}_setEndings(e,t,i){const r=this._interpolantSettings;i?(r.endingStart=ls,r.endingEnd=ls):(e?r.endingStart=this.zeroSlopeAtStart?ls:as:r.endingStart=ll,t?r.endingEnd=this.zeroSlopeAtEnd?ls:as:r.endingEnd=ll)}_scheduleFading(e,t,i){const r=this._mixer,s=r.time;let o=this._weightInterpolant;o===null&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=i,this}}const GN=new Float32Array(1);class WN extends Ti{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,r=e._clip.tracks,s=r.length,o=e._propertyBindings,a=e._interpolants,l=i.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==s;++h){const d=r[h],p=d.name;let m=u[p];if(m!==void 0)++m.referenceCount,o[h]=m;else{if(m=o[h],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,l,p));continue}const x=t&&t._propertyBindings[h].binding.parsedPath;m=new hw(et.create(i,p,x),d.ValueTypeName,d.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,l,p),o[h]=m}a[h].resultBuffer=m.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,i)}const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,i){const r=this._actions,s=this._actionsByClip;let o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=r.length,r.push(e),o.actionByRoot[i]=e}_removeInactiveAction(e){const t=this._actions,i=t[t.length-1],r=e._cacheIndex;i._cacheIndex=r,t[r]=i,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,o=this._actionsByClip,a=o[s],l=a.knownActions,c=l[l.length-1],u=e._byClipCacheIndex;c._byClipCacheIndex=u,l[u]=c,l.pop(),e._byClipCacheIndex=null;const h=a.actionByRoot,d=(e._localRoot||this._root).uuid;delete h[d],l.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,i=e._cacheIndex,r=this._nActiveActions++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackAction(e){const t=this._actions,i=e._cacheIndex,r=--this._nActiveActions,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_addInactiveBinding(e,t,i){const r=this._bindingsByRootAndName,s=this._bindings;let o=r[t];o===void 0&&(o={},r[t]=o),o[i]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,i=e.binding,r=i.rootNode.uuid,s=i.path,o=this._bindingsByRootAndName,a=o[r],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete a[s],Object.keys(a).length===0&&delete o[r]}_lendBinding(e){const t=this._bindings,i=e._cacheIndex,r=this._nActiveBindings++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackBinding(e){const t=this._bindings,i=e._cacheIndex,r=--this._nActiveBindings,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let i=e[t];return i===void 0&&(i=new yg(new Float32Array(2),new Float32Array(2),1,GN),i.__cacheIndex=t,e[t]=i),i}_takeBackControlInterpolant(e){const t=this._controlInterpolants,i=e.__cacheIndex,r=--this._nActiveControlInterpolants,s=t[r];e.__cacheIndex=r,t[r]=e,s.__cacheIndex=i,t[i]=s}clipAction(e,t,i){const r=t||this._root,s=r.uuid;let o=typeof e=="string"?Sl.findByName(r,e):e;const a=o!==null?o.uuid:e,l=this._actionsByClip[a];let c=null;if(i===void 0&&(o!==null?i=o.blendMode:i=Od),l!==void 0){const h=l.actionByRoot[s];if(h!==void 0&&h.blendMode===i)return h;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;const u=new fw(this,o,t,i);return this._bindAction(u,c),this._addInactiveAction(u,a,s),u}existingAction(e,t){const i=t||this._root,r=i.uuid,s=typeof e=="string"?Sl.findByName(i,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[r]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let i=t-1;i>=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,r=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==i;++c)t[c]._update(r,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 t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,i=e.uuid,r=this._actionsByClip,s=r[i];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 u=c._cacheIndex,h=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=u,t[u]=h,t.pop(),this._removeInactiveBindingsForAction(c)}delete r[i]}}uncacheRoot(e){const t=e.uuid,i=this._actionsByClip;for(const o in i){const a=i[o].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const r=this._bindingsByRootAndName,s=r[t];if(s!==void 0)for(const o in s){const a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const i=this.existingAction(e,t);i!==null&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class Tg{constructor(e){this.value=e}clone(){return new Tg(this.value.clone===void 0?this.value:this.value.clone())}}let jN=0;class XN extends Ti{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:jN++}),this.name="",this.usage=hl,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,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 t=e.uniforms;this.uniforms.length=0;for(let i=0,r=t.length;i<r;i++){const s=Array.isArray(t[i])?t[i]:[t[i]];for(let o=0;o<s.length;o++)this.uniforms.push(s[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class $N extends Xd{constructor(e,t,i=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class YN{constructor(e,t,i,r,s){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=i,this.elementSize=r,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const Cv=new ke;class qN{constructor(e,t,i=0,r=1/0){this.ray=new Go(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new zd,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Cv.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Cv),this}intersectObject(e,t=!0,i=[]){return Gp(e,this,i,t),i.sort(Rv),i}intersectObjects(e,t=!0,i=[]){for(let r=0,s=e.length;r<s;r++)Gp(e[r],this,i,t);return i.sort(Rv),i}}function Rv(n,e){return n.distance-e.distance}function Gp(n,e,t,i){let r=!0;if(n.layers.test(e.layers)&&n.raycast(e,t)===!1&&(r=!1),r===!0&&i===!0){const s=n.children;for(let o=0,a=s.length;o<a;o++)Gp(s[o],e,t,!0)}}class ZN{constructor(e=1,t=0,i=0){return this.radius=e,this.phi=t,this.theta=i,this}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,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,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(At(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class KN{constructor(e=1,t=0,i=0){return this.radius=e,this.theta=t,this.y=i,this}set(e,t,i){return this.radius=e,this.theta=t,this.y=i,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,t,i){return this.radius=Math.sqrt(e*e+i*i),this.theta=Math.atan2(e,i),this.y=t,this}clone(){return new this.constructor().copy(this)}}class Ag{constructor(e,t,i,r){Ag.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,i,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let i=0;i<4;i++)this.elements[i]=e[i+t];return this}set(e,t,i,r){const s=this.elements;return s[0]=e,s[2]=t,s[1]=i,s[3]=r,this}}const Pv=new Q;class JN{constructor(e=new Q(1/0,1/0),t=new Q(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=Pv.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),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,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Pv).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 Iv=new I,Wc=new I;class QN{constructor(e=new I,t=new I){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Iv.subVectors(e,this.start),Wc.subVectors(this.end,this.start);const i=Wc.dot(Wc);let s=Wc.dot(Iv)/i;return t&&(s=At(s,0,1)),s}closestPointToPoint(e,t,i){const r=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(r).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 Nv=new I;class e3 extends nt{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new Ye,r=[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,u=a/l*Math.PI*2;r.push(Math.cos(c),Math.sin(c),1,Math.cos(u),Math.sin(u),1)}i.setAttribute("position",new Pe(r,3));const s=new xn({fog:!1,toneMapped:!1});this.cone=new Ai(i,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,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Nv.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Nv),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const hr=new I,jc=new ke,Lf=new ke;class t3 extends Ai{constructor(e){const t=pw(e),i=new Ye,r=[],s=[],o=new _e(0,0,1),a=new _e(0,1,0);for(let c=0;c<t.length;c++){const u=t[c];u.parent&&u.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),s.push(o.r,o.g,o.b),s.push(a.r,a.g,a.b))}i.setAttribute("position",new Pe(r,3)),i.setAttribute("color",new Pe(s,3));const l=new xn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(i,l),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,i=this.geometry,r=i.getAttribute("position");Lf.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){const a=t[s];a.parent&&a.parent.isBone&&(jc.multiplyMatrices(Lf,a.matrixWorld),hr.setFromMatrixPosition(jc),r.setXYZ(o,hr.x,hr.y,hr.z),jc.multiplyMatrices(Lf,a.parent.matrixWorld),hr.setFromMatrixPosition(jc),r.setXYZ(o+1,hr.x,hr.y,hr.z),o+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function pw(n){const e=[];n.isBone===!0&&e.push(n);for(let t=0;t<n.children.length;t++)e.push.apply(e,pw(n.children[t]));return e}class n3 extends kt{constructor(e,t,i){const r=new kl(t,4,2),s=new Or({wireframe:!0,fog:!1,toneMapped:!1});super(r,s),this.light=e,this.color=i,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 i3=new I,Lv=new _e,Dv=new _e;class r3 extends nt{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";const r=new Ul(t);r.rotateY(Math.PI*.5),this.material=new Or({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=r.getAttribute("position"),o=new Float32Array(s.count*3);r.setAttribute("color",new ht(o,3)),this.add(new kt(r,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 t=e.geometry.getAttribute("color");Lv.copy(this.light.color),Dv.copy(this.light.groundColor);for(let i=0,r=t.count;i<r;i++){const s=i<r/2?Lv:Dv;t.setXYZ(i,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(i3.setFromMatrixPosition(this.light.matrixWorld).negate())}}class s3 extends Ai{constructor(e=10,t=10,i=4473924,r=8947848){i=new _e(i),r=new _e(r);const s=t/2,o=e/t,a=e/2,l=[],c=[];for(let d=0,p=0,m=-a;d<=t;d++,m+=o){l.push(-a,0,m,a,0,m),l.push(m,0,-a,m,0,a);const x=d===s?i:r;x.toArray(c,p),p+=3,x.toArray(c,p),p+=3,x.toArray(c,p),p+=3,x.toArray(c,p),p+=3}const u=new Ye;u.setAttribute("position",new Pe(l,3)),u.setAttribute("color",new Pe(c,3));const h=new xn({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class o3 extends Ai{constructor(e=10,t=16,i=8,r=64,s=4473924,o=8947848){s=new _e(s),o=new _e(o);const a=[],l=[];if(t>1)for(let h=0;h<t;h++){const d=h/t*(Math.PI*2),p=Math.sin(d)*e,m=Math.cos(d)*e;a.push(0,0,0),a.push(p,0,m);const x=h&1?s:o;l.push(x.r,x.g,x.b),l.push(x.r,x.g,x.b)}for(let h=0;h<i;h++){const d=h&1?s:o,p=e-e/i*h;for(let m=0;m<r;m++){let x=m/r*(Math.PI*2),g=Math.sin(x)*p,f=Math.cos(x)*p;a.push(g,0,f),l.push(d.r,d.g,d.b),x=(m+1)/r*(Math.PI*2),g=Math.sin(x)*p,f=Math.cos(x)*p,a.push(g,0,f),l.push(d.r,d.g,d.b)}}const c=new Ye;c.setAttribute("position",new Pe(a,3)),c.setAttribute("color",new Pe(l,3));const u=new xn({vertexColors:!0,toneMapped:!1});super(c,u),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Uv=new I,Xc=new I,kv=new I;class a3 extends nt{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",t===void 0&&(t=1);let r=new Ye;r.setAttribute("position",new Pe([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new xn({fog:!1,toneMapped:!1});this.lightPlane=new Nr(r,s),this.add(this.lightPlane),r=new Ye,r.setAttribute("position",new Pe([0,0,0,0,0,1],3)),this.targetLine=new Nr(r,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),Uv.setFromMatrixPosition(this.light.matrixWorld),Xc.setFromMatrixPosition(this.light.target.matrixWorld),kv.subVectors(Xc,Uv),this.lightPlane.lookAt(Xc),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(Xc),this.targetLine.scale.z=kv.length()}}const $c=new I,Et=new Vd;class l3 extends Ai{constructor(e){const t=new Ye,i=new xn({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],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(m,x){l(m),l(x)}function l(m){r.push(0,0,0),s.push(0,0,0),o[m]===void 0&&(o[m]=[]),o[m].push(r.length/3-1)}t.setAttribute("position",new Pe(r,3)),t.setAttribute("color",new Pe(s,3)),super(t,i),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 _e(16755200),u=new _e(16711680),h=new _e(43775),d=new _e(16777215),p=new _e(3355443);this.setColors(c,u,h,d,p)}setColors(e,t,i,r,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,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,i.r,i.g,i.b),a.setXYZ(33,i.r,i.g,i.b),a.setXYZ(34,i.r,i.g,i.b),a.setXYZ(35,i.r,i.g,i.b),a.setXYZ(36,i.r,i.g,i.b),a.setXYZ(37,i.r,i.g,i.b),a.setXYZ(38,r.r,r.g,r.b),a.setXYZ(39,r.r,r.g,r.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,t=this.pointMap,i=1,r=1;Et.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Rt("c",t,e,Et,0,0,-1),Rt("t",t,e,Et,0,0,1),Rt("n1",t,e,Et,-i,-r,-1),Rt("n2",t,e,Et,i,-r,-1),Rt("n3",t,e,Et,-i,r,-1),Rt("n4",t,e,Et,i,r,-1),Rt("f1",t,e,Et,-i,-r,1),Rt("f2",t,e,Et,i,-r,1),Rt("f3",t,e,Et,-i,r,1),Rt("f4",t,e,Et,i,r,1),Rt("u1",t,e,Et,i*.7,r*1.1,-1),Rt("u2",t,e,Et,-i*.7,r*1.1,-1),Rt("u3",t,e,Et,0,r*2,-1),Rt("cf1",t,e,Et,-i,0,1),Rt("cf2",t,e,Et,i,0,1),Rt("cf3",t,e,Et,0,-r,1),Rt("cf4",t,e,Et,0,r,1),Rt("cn1",t,e,Et,-i,0,-1),Rt("cn2",t,e,Et,i,0,-1),Rt("cn3",t,e,Et,0,-r,-1),Rt("cn4",t,e,Et,0,r,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Rt(n,e,t,i,r,s,o){$c.set(r,s,o).unproject(i);const a=e[n];if(a!==void 0){const l=t.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],$c.x,$c.y,$c.z)}}const Yc=new pn;class c3 extends Ai{constructor(e,t=16776960){const i=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]),r=new Float32Array(8*3),s=new Ye;s.setIndex(new ht(i,1)),s.setAttribute("position",new ht(r,3)),super(s,new xn({color:t,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&&Yc.setFromObject(this.object),Yc.isEmpty())return;const t=Yc.min,i=Yc.max,r=this.geometry.attributes.position,s=r.array;s[0]=i.x,s[1]=i.y,s[2]=i.z,s[3]=t.x,s[4]=i.y,s[5]=i.z,s[6]=t.x,s[7]=t.y,s[8]=i.z,s[9]=i.x,s[10]=t.y,s[11]=i.z,s[12]=i.x,s[13]=i.y,s[14]=t.z,s[15]=t.x,s[16]=i.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=i.x,s[22]=t.y,s[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class u3 extends Ai{constructor(e,t=16776960){const i=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]),r=[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 Ye;s.setIndex(new ht(i,1)),s.setAttribute("position",new Pe(r,3)),super(s,new xn({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class d3 extends Nr{constructor(e,t=1,i=16776960){const r=i,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 Ye;o.setAttribute("position",new Pe(s,3)),o.computeBoundingSphere(),super(o,new xn({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const a=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new Ye;l.setAttribute("position",new Pe(a,3)),l.computeBoundingSphere(),this.add(new kt(l,new Or({color:r,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 Ov=new I;let qc,Df;class h3 extends nt{constructor(e=new I(0,0,1),t=new I(0,0,0),i=1,r=16776960,s=i*.2,o=s*.2){super(),this.type="ArrowHelper",qc===void 0&&(qc=new Ye,qc.setAttribute("position",new Pe([0,0,0,0,1,0],3)),Df=new Xo(0,.5,1,5,1),Df.translate(0,-.5,0)),this.position.copy(t),this.line=new Nr(qc,new xn({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new kt(Df,new Or({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(i,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{Ov.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Ov,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),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 f3 extends Ai{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new Ye;r.setAttribute("position",new Pe(t,3)),r.setAttribute("color",new Pe(i,3));const s=new xn({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,i){const r=new _e,s=this.geometry.attributes.color.array;return r.set(e),r.toArray(s,0),r.toArray(s,3),r.set(t),r.toArray(s,6),r.toArray(s,9),r.set(i),r.toArray(s,12),r.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class p3{constructor(){this.type="ShapePath",this.color=new _e,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new ml,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,s,o){return this.currentPath.bezierCurveTo(e,t,i,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(f){const v=[];for(let y=0,_=f.length;y<_;y++){const R=f[y],w=new gs;w.curves=R.curves,v.push(w)}return v}function i(f,v){const y=v.length;let _=!1;for(let R=y-1,w=0;w<y;R=w++){let E=v[R],A=v[w],b=A.x-E.x,M=A.y-E.y;if(Math.abs(M)>Number.EPSILON){if(M<0&&(E=v[w],b=-b,A=v[R],M=-M),f.y<E.y||f.y>A.y)continue;if(f.y===E.y){if(f.x===E.x)return!0}else{const L=M*(f.x-E.x)-b*(f.y-E.y);if(L===0)return!0;if(L<0)continue;_=!_}}else{if(f.y!==E.y)continue;if(A.x<=f.x&&f.x<=E.x||E.x<=f.x&&f.x<=A.x)return!0}}return _}const r=bi.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 gs,l.curves=a.curves,c.push(l),c;let u=!r(s[0].getPoints());u=e?!u:u;const h=[],d=[];let p=[],m=0,x;d[m]=void 0,p[m]=[];for(let f=0,v=s.length;f<v;f++)a=s[f],x=a.getPoints(),o=r(x),o=e?!o:o,o?(!u&&d[m]&&m++,d[m]={s:new gs,p:x},d[m].s.curves=a.curves,u&&m++,p[m]=[]):p[m].push({h:a,p:x[0]});if(!d[0])return t(s);if(d.length>1){let f=!1,v=0;for(let y=0,_=d.length;y<_;y++)h[y]=[];for(let y=0,_=d.length;y<_;y++){const R=p[y];for(let w=0;w<R.length;w++){const E=R[w];let A=!0;for(let b=0;b<d.length;b++)i(E.p,d[b].p)&&(y!==b&&v++,A?(A=!1,h[b].push(E)):f=!0);A&&h[y].push(E)}}v>0&&f===!1&&(p=h)}let g;for(let f=0,v=d.length;f<v;f++){l=d[f].s,c.push(l),g=p[f];for(let y=0,_=g.length;y<_;y++)l.holes.push(g[y].h)}return c}}class m3 extends Ti{constructor(e,t){super(),this.object=e,this.domElement=t,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 g3 extends li{constructor(e=1,t=1,i=1,r={}){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,t,{...r,count:i}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Rd}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Rd);const eL=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:zS,AddEquation:vr,AddOperation:kS,AdditiveAnimationBlendMode:Jm,AdditiveBlending:Rp,AgXToneMapping:HS,AlphaFormat:Xm,AlwaysCompare:iM,AlwaysDepth:RS,AlwaysStencilFunc:Lp,AmbientLight:rw,AnimationAction:fw,AnimationClip:Sl,AnimationLoader:mN,AnimationMixer:WN,AnimationObjectGroup:HN,AnimationUtils:dN,ArcCurve:RM,ArrayCamera:yM,ArrowHelper:h3,AttachedBindMode:Np,Audio:dw,AudioAnalyser:NN,AudioContext:wg,AudioListener:RN,AudioLoader:TN,AxesHelper:f3,BackSide:fn,BasicDepthPacking:YS,BasicShadowMap:cT,BatchedMesh:TM,Bone:cg,BooleanKeyframeTrack:Rs,Box2:JN,Box3:pn,Box3Helper:u3,BoxGeometry:Cs,BoxHelper:c3,BufferAttribute:ht,BufferGeometry:Ye,BufferGeometryLoader:cw,ByteType:Gm,Cache:Hi,Camera:Vd,CameraHelper:l3,CanvasTexture:UI,CapsuleGeometry:Zd,CatmullRomCurve3:PM,CineonToneMapping:BS,CircleGeometry:Kd,ClampToEdgeWrapping:Xn,Clock:uw,Color:_e,ColorKeyframeTrack:_g,ColorManagement:rt,CompressedArrayTexture:LI,CompressedCubeTexture:DI,CompressedTexture:Yd,CompressedTextureLoader:gN,ConeGeometry:Jd,ConstantAlphaFactor:TS,ConstantColorFactor:bS,Controls:m3,CubeCamera:dM,CubeReflectionMapping:Ki,CubeRefractionMapping:Ir,CubeTexture:Nl,CubeTextureLoader:xN,CubeUVReflectionMapping:Vo,CubicBezierCurve:hg,CubicBezierCurve3:IM,CubicInterpolant:ZM,CullFaceBack:Cp,CullFaceFront:lS,CullFaceFrontBack:lT,CullFaceNone:aS,Curve:ui,CurvePath:LM,CustomBlending:uS,CustomToneMapping:VS,CylinderGeometry:Xo,Cylindrical:KN,Data3DTexture:tg,DataArrayTexture:Bd,DataTexture:wi,DataTextureLoader:vN,DataUtils:MA,DecrementStencilOp:wT,DecrementWrapStencilOp:ET,DefaultLoadingManager:QM,DepthFormat:ps,DepthStencilFormat:ws,DepthTexture:sg,DetachedBindMode:WS,DirectionalLight:iw,DirectionalLightHelper:a3,DiscreteInterpolant:KM,DisplayP3ColorSpace:Fd,DodecahedronGeometry:Qd,DoubleSide:vi,DstAlphaFactor:yS,DstColorFactor:SS,DynamicCopyUsage:zT,DynamicDrawUsage:DT,DynamicReadUsage:OT,EdgesGeometry:DM,EllipseCurve:qd,EqualCompare:QS,EqualDepth:IS,EqualStencilFunc:RT,EquirectangularReflectionMapping:il,EquirectangularRefractionMapping:rl,Euler:On,EventDispatcher:Ti,ExtrudeGeometry:th,FileLoader:Qi,Float16BufferAttribute:CA,Float32BufferAttribute:Pe,FloatType:Sn,Fog:jd,FogExp2:Wd,FramebufferTexture:NI,FrontSide:Zi,Frustum:Ll,GLBufferAttribute:YN,GLSL1:HT,GLSL3:Dp,GreaterCompare:eM,GreaterDepth:LS,GreaterEqualCompare:nM,GreaterEqualDepth:NS,GreaterEqualStencilFunc:LT,GreaterStencilFunc:IT,GridHelper:s3,Group:go,HalfFloatType:Ho,HemisphereLight:ew,HemisphereLightHelper:r3,IcosahedronGeometry:nh,ImageBitmapLoader:EN,ImageLoader:Ml,ImageUtils:oM,IncrementStencilOp:MT,IncrementWrapStencilOp:bT,InstancedBufferAttribute:Oo,InstancedBufferGeometry:lw,InstancedInterleavedBuffer:$N,InstancedMesh:EM,Int16BufferAttribute:TA,Int32BufferAttribute:AA,Int8BufferAttribute:wA,IntType:Id,InterleavedBuffer:Xd,InterleavedBufferAttribute:bs,Interpolant:Ol,InterpolateDiscrete:al,InterpolateLinear:ld,InterpolateSmooth:lu,InvertStencilOp:TT,KeepStencilOp:ts,KeyframeTrack:di,LOD:wM,LatheGeometry:Dl,Layers:zd,LessCompare:JS,LessDepth:PS,LessEqualCompare:Qm,LessEqualDepth:nl,LessEqualStencilFunc:PT,LessStencilFunc:CT,Light:Br,LightProbe:aw,Line:Nr,Line3:QN,LineBasicMaterial:xn,LineCurve:fg,LineCurve3:NM,LineDashedMaterial:$M,LineLoop:AM,LineSegments:Ai,LinearDisplayP3ColorSpace:Il,LinearFilter:Ut,LinearInterpolant:yg,LinearMipMapLinearFilter:fT,LinearMipMapNearestFilter:hT,LinearMipmapLinearFilter:yi,LinearMipmapNearestFilter:Pa,LinearSRGBColorSpace:tr,LinearToneMapping:OS,LinearTransfer:cl,Loader:Tn,LoaderUtils:Hp,LoadingManager:Sg,LoopOnce:jS,LoopPingPong:$S,LoopRepeat:XS,LuminanceAlphaFormat:qm,LuminanceFormat:Ym,MOUSE:oT,Material:on,MaterialLoader:ch,MathUtils:sA,Matrix2:Ag,Matrix3:je,Matrix4:ke,MaxEquation:pS,Mesh:kt,MeshBasicMaterial:Or,MeshDepthMaterial:og,MeshDistanceMaterial:ag,MeshLambertMaterial:jM,MeshMatcapMaterial:XM,MeshNormalMaterial:WM,MeshPhongMaterial:HM,MeshPhysicalMaterial:VM,MeshStandardMaterial:xg,MeshToonMaterial:GM,MinEquation:fS,MirroredRepeatWrapping:ol,MixOperation:US,MultiplyBlending:Ip,MultiplyOperation:Rl,NearestFilter:Gt,NearestMipMapLinearFilter:dT,NearestMipMapNearestFilter:uT,NearestMipmapLinearFilter:fo,NearestMipmapNearestFilter:Hm,NeutralToneMapping:GS,NeverCompare:KS,NeverDepth:CS,NeverStencilFunc:AT,NoBlending:Wi,NoColorSpace:Fi,NoToneMapping:ji,NormalAnimationBlendMode:Od,NormalBlending:fs,NotEqualCompare:tM,NotEqualDepth:DS,NotEqualStencilFunc:NT,NumberKeyframeTrack:yl,Object3D:nt,ObjectLoader:wN,ObjectSpaceNormalMap:ZS,OctahedronGeometry:Ul,OneFactor:gS,OneMinusConstantAlphaFactor:AS,OneMinusConstantColorFactor:ES,OneMinusDstAlphaFactor:_S,OneMinusDstColorFactor:MS,OneMinusSrcAlphaFactor:Uu,OneMinusSrcColorFactor:vS,OrthographicCamera:Hd,P3Primaries:dl,PCFShadowMap:Vm,PCFSoftShadowMap:cS,PMREMGenerator:Up,Path:ml,PerspectiveCamera:Yt,Plane:mr,PlaneGeometry:Wo,PlaneHelper:d3,PointLight:nw,PointLightHelper:n3,Points:CM,PointsMaterial:ug,PolarGridHelper:o3,PolyhedronGeometry:Fr,PositionalAudio:IN,PropertyBinding:et,PropertyMixer:hw,QuadraticBezierCurve:pg,QuadraticBezierCurve3:mg,Quaternion:En,QuaternionKeyframeTrack:Fl,QuaternionLinearInterpolant:JM,RED_GREEN_RGTC2_Format:od,RED_RGTC1_Format:Km,REVISION:Rd,RGBADepthPacking:qS,RGBAFormat:dn,RGBAIntegerFormat:kd,RGBA_ASTC_10x10_Format:ed,RGBA_ASTC_10x5_Format:Ku,RGBA_ASTC_10x6_Format:Ju,RGBA_ASTC_10x8_Format:Qu,RGBA_ASTC_12x10_Format:td,RGBA_ASTC_12x12_Format:nd,RGBA_ASTC_4x4_Format:Gu,RGBA_ASTC_5x4_Format:Wu,RGBA_ASTC_5x5_Format:ju,RGBA_ASTC_6x5_Format:Xu,RGBA_ASTC_6x6_Format:$u,RGBA_ASTC_8x5_Format:Yu,RGBA_ASTC_8x6_Format:qu,RGBA_ASTC_8x8_Format:Zu,RGBA_BPTC_Format:Ua,RGBA_ETC2_EAC_Format:Hu,RGBA_PVRTC_2BPPV1_Format:Bu,RGBA_PVRTC_4BPPV1_Format:Fu,RGBA_S3TC_DXT1_Format:Na,RGBA_S3TC_DXT3_Format:La,RGBA_S3TC_DXT5_Format:Da,RGBDepthPacking:vT,RGBFormat:$m,RGBIntegerFormat:pT,RGB_BPTC_SIGNED_Format:id,RGB_BPTC_UNSIGNED_Format:rd,RGB_ETC1_Format:zu,RGB_ETC2_Format:Vu,RGB_PVRTC_2BPPV1_Format:Ou,RGB_PVRTC_4BPPV1_Format:ku,RGB_S3TC_DXT1_Format:Ia,RGDepthPacking:yT,RGFormat:Zm,RGIntegerFormat:Ud,RawShaderMaterial:zM,Ray:Go,Raycaster:qN,Rec709Primaries:ul,RectAreaLight:sw,RedFormat:Dd,RedIntegerFormat:Pl,ReinhardToneMapping:FS,RenderTarget:aM,RepeatWrapping:sl,ReplaceStencilOp:ST,ReverseSubtractEquation:hS,RingGeometry:ih,SIGNED_RED_GREEN_RGTC2_Format:ad,SIGNED_RED_RGTC1_Format:sd,SRGBColorSpace:Hn,SRGBTransfer:ft,Scene:_M,ShaderChunk:$e,ShaderLib:ri,ShaderMaterial:ci,ShadowMaterial:BM,Shape:gs,ShapeGeometry:rh,ShapePath:p3,ShapeUtils:bi,ShortType:Wm,Skeleton:$d,SkeletonHelper:t3,SkinnedMesh:bM,Source:cs,Sphere:rn,SphereGeometry:kl,Spherical:ZN,SphericalHarmonics3:ow,SplineCurve:gg,SpotLight:tw,SpotLightHelper:e3,Sprite:MM,SpriteMaterial:lg,SrcAlphaFactor:Du,SrcAlphaSaturateFactor:wS,SrcColorFactor:xS,StaticCopyUsage:BT,StaticDrawUsage:hl,StaticReadUsage:kT,StereoCamera:AN,StreamCopyUsage:VT,StreamDrawUsage:UT,StreamReadUsage:FT,StringKeyframeTrack:Ps,SubtractEquation:dS,SubtractiveBlending:Pp,TOUCH:aT,TangentSpaceNormalMap:kr,TetrahedronGeometry:sh,Texture:Ct,TextureLoader:yN,TextureUtils:uI,TorusGeometry:oh,TorusKnotGeometry:ah,Triangle:Nn,TriangleFanDrawMode:xT,TriangleStripDrawMode:gT,TrianglesDrawMode:mT,TubeGeometry:lh,UVMapping:Pd,Uint16BufferAttribute:ng,Uint32BufferAttribute:ig,Uint8BufferAttribute:bA,Uint8ClampedBufferAttribute:EA,Uniform:Tg,UniformsGroup:XN,UniformsLib:fe,UniformsUtils:uM,UnsignedByteType:Ei,UnsignedInt248Type:Ms,UnsignedInt5999Type:jm,UnsignedIntType:Ji,UnsignedShort4444Type:Nd,UnsignedShort5551Type:Ld,UnsignedShortType:Do,VSMShadowMap:gi,Vector2:Q,Vector3:I,Vector4:ct,VectorKeyframeTrack:_l,VideoTexture:II,WebGL3DRenderTarget:hA,WebGLArrayRenderTarget:dA,WebGLCoordinateSystem:_i,WebGLCubeRenderTarget:hM,WebGLMultipleRenderTargets:g3,WebGLRenderTarget:li,WebGLRenderer:_I,WebGLUtils:vM,WebGPUCoordinateSystem:fl,WireframeGeometry:FM,WrapAroundEnding:ll,ZeroCurvatureEnding:as,ZeroFactor:mS,ZeroSlopeEnding:ls,ZeroStencilOp:_T,createCanvasElement:sM},Symbol.toStringTag,{value:"Module"})),ut={controls:null,camera:null,initialPosition:null,initialTarget:null};function tL(n,e){ut.controls=n,ut.camera=e,e&&!ut.initialPosition&&(ut.initialPosition=e.position.clone()),n&&!ut.initialTarget&&(ut.initialTarget=n.target.clone())}function nL(){ut.controls=null,ut.camera=null}const mw=1.18,Fv=2.5;function gw(n=mw){if(!ut.controls||!ut.camera)return;const e=new I().subVectors(ut.controls.target,ut.camera.position).multiplyScalar(1-1/n);ut.camera.position.add(e),ut.controls.update()}function x3(n=mw){gw(1/n)}function uh(n,e){if(!ut.controls||!ut.camera)return;const t=ut.camera,i=new I().subVectors(ut.controls.target,t.position).normalize(),r=new I().crossVectors(i,t.up).normalize(),s=new I().crossVectors(r,i).normalize(),o=new I().addScaledVector(r,n*Fv).addScaledVector(s,e*Fv);t.position.add(o),ut.controls.target.add(o),ut.controls.update()}const v3=()=>uh(-1,0),y3=()=>uh(1,0),_3=()=>uh(0,1),S3=()=>uh(0,-1);function M3(){!ut.controls||!ut.camera||(ut.initialPosition&&ut.camera.position.copy(ut.initialPosition),ut.initialTarget&&ut.controls.target.copy(ut.initialTarget),ut.controls.update())}function w3(){const n=ge(E=>E.selectedSessionId),e=ge(E=>E.sessions),t=ge(E=>E.goals),i=ge(E=>E.missions),r=ge(E=>E.chatBySessionId),s=ge(E=>E.selectSession),o=ge(E=>E.sendPromptTo),[a,l]=Ee.useState("chat"),[c,u]=Ee.useState(""),h=Ee.useRef(null),d=n?e[n]:null,p=Ee.useMemo(()=>n?r[n]??[]:[],[r,n]),m=Ee.useMemo(()=>d?Object.values(i).filter(E=>E.sessionId===d.id).sort((E,A)=>A.startedAt-E.startedAt):[],[i,d]),x=Ee.useMemo(()=>{if(d!=null&&d.currentMissionId)return i[d.currentMissionId]},[i,d]),g=d?ZE(d,x):null;if(Ee.useEffect(()=>{if(a!=="chat")return;const E=h.current;E&&(E.scrollTop=E.scrollHeight)},[a,p.length,n]),!d)return null;const f=d.origin==="internal",v=!!d.wrapperSocketPath,y=f||v,_=d.currentGoalId?t[d.currentGoalId]:void 0,R=d.budgetUsd&&d.budgetUsd>0?Math.min(100,d.costUsd/d.budgetUsd*100):null,w=()=>{c.trim()&&(o(d.id,c),u(""))};return S.jsxs("div",{className:"absolute top-16 right-0 bottom-0 w-full sm:w-[460px] bg-solix-panel border-l border-solix-border backdrop-blur-md flex flex-col z-20",children:[S.jsxs("div",{className:"px-4 py-3 border-b border-solix-border flex items-start justify-between",children:[S.jsxs("div",{className:"min-w-0",children:[S.jsx("div",{className:"text-xs uppercase tracking-wide text-slate-400",children:"Planet"}),S.jsx("div",{className:"text-lg font-semibold truncate",children:d.name??d.id.slice(0,8)}),S.jsxs("div",{className:"text-xs text-slate-400 mt-0.5 truncate",title:zm[d.status]??void 0,children:[String(d.model)," · ",oS(d.status),d.origin==="external"?" · external":d.origin==="agentview"?" · agent view":" · internal",v&&S.jsx("span",{className:"ml-1.5 px-1.5 py-0.5 rounded text-[9px] uppercase tracking-wide border border-solix-accent/50 text-solix-accent",title:"Wrapped by `solix run` — UI prompts go to your terminal.",children:"wrapped"}),d.agentViewId&&S.jsx("span",{className:"ml-1.5 font-mono text-[9px] text-cyan-300/80",title:`Agent View id: ${d.agentViewId}`,children:d.agentViewId.slice(0,8)})]}),d.prUrl&&S.jsxs("a",{href:d.prUrl,target:"_blank",rel:"noopener noreferrer",className:"mt-1 inline-flex items-center gap-1.5 text-[11px] text-slate-300 hover:text-white border border-solix-border rounded px-2 py-0.5",title:`Open ${d.prUrl}`,children:[S.jsx("span",{children:"PR"}),S.jsx("span",{className:"text-slate-500 truncate max-w-[200px]",children:d.prUrl.replace(/^https?:\/\//,"")}),d.prCheckStatus&&S.jsx("span",{className:d.prCheckStatus==="success"?"text-solix-ok":d.prCheckStatus==="failure"?"text-solix-danger":"text-amber-300",children:d.prCheckStatus==="success"?"✓":d.prCheckStatus==="failure"?"✗":"⏳"})]}),d.agentViewSummary&&S.jsx("div",{className:"mt-1 text-[11px] text-slate-400 italic line-clamp-2",title:d.agentViewSummary,children:d.agentViewSummary}),_&&S.jsxs("div",{className:"mt-1 inline-flex items-center gap-1.5 text-[11px]",children:[S.jsx("span",{className:"inline-block w-2 h-2 rounded-full",style:{background:_.color}}),S.jsx("span",{className:"text-slate-300",children:_.name})]}),(d.budgetUsd!=null||d.costUsd>0)&&S.jsxs("div",{className:"mt-1.5",children:[S.jsxs("div",{className:"flex items-center justify-between text-[11px] text-slate-400",children:[S.jsx("span",{children:"cost"}),S.jsxs("span",{className:"font-mono",children:["$",d.costUsd.toFixed(2),d.budgetUsd!=null&&S.jsxs("span",{className:"text-slate-500",children:[" ","/ $",d.budgetUsd.toFixed(2)]})]})]}),R!=null&&S.jsx("div",{className:"mt-1 h-1.5 rounded-full bg-slate-800 overflow-hidden",children:S.jsx("div",{className:"h-full",style:{width:`${R}%`,background:R>=100?"#dc2626":R>=75?"#f59e0b":"#38bdf8"}})})]})]}),S.jsx("button",{onClick:()=>s(null),className:"text-slate-400 hover:text-slate-100","aria-label":"Close",children:"✕"})]}),g&&S.jsxs("div",{className:`px-4 py-2 border-b border-solix-border text-[11px] leading-snug ${g.severity==="danger"?"text-solix-danger bg-solix-danger/10":g.severity==="warn"?"text-solix-warn bg-solix-warn/10":"text-slate-300 bg-black/20"}`,children:[S.jsx("span",{className:"font-semibold mr-1",children:"Suggested:"}),g.text]}),S.jsxs("div",{className:"px-4 py-2 border-b border-solix-border",children:[S.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400",children:[S.jsx("span",{children:"context"}),S.jsxs("span",{children:[d.contextUsagePct.toFixed(0),"%"]})]}),S.jsx("div",{className:"mt-1 h-1.5 rounded-full bg-slate-800 overflow-hidden",children:S.jsx("div",{className:`h-full ${d.contextUsagePct>=90?"bg-solix-danger":d.contextUsagePct>=80?"bg-solix-warn":"bg-solix-accent"}`,style:{width:`${Math.min(100,d.contextUsagePct)}%`}})})]}),S.jsxs("div",{className:"flex border-b border-solix-border text-xs",children:[S.jsxs(Uf,{active:a==="chat",onClick:()=>l("chat"),children:["Chat ",p.length>0&&S.jsxs("span",{className:"opacity-60",children:["(",p.length,")"]})]}),S.jsxs(Uf,{active:a==="missions",onClick:()=>l("missions"),children:["Missions ",m.length>0&&S.jsxs("span",{className:"opacity-60",children:["(",m.length,")"]})]}),S.jsx(Uf,{active:a==="files",onClick:()=>l("files"),children:"Files"})]}),S.jsxs("div",{className:"flex-1 overflow-hidden",children:[a==="chat"&&S.jsx(b3,{chat:p,scrollRef:h,session:d}),a==="missions"&&S.jsx(E3,{missions:m}),a==="files"&&S.jsx(T3,{missions:m})]}),a==="chat"&&S.jsx("div",{className:"px-3 py-3 border-t border-solix-border",children:y?S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"flex gap-2",children:[S.jsx("textarea",{value:c,onChange:E=>u(E.target.value),onKeyDown:E=>{E.key==="Enter"&&(E.metaKey||E.ctrlKey)&&(E.preventDefault(),w())},placeholder:v?"Type a prompt — it goes straight into your terminal claude (Cmd/Ctrl+Enter)":"Send a prompt to this session… (Cmd/Ctrl+Enter)",rows:2,className:"flex-1 text-sm bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent resize-none"}),S.jsx("button",{onClick:w,disabled:!c.trim(),className:"px-3 py-2 rounded bg-solix-accent/20 border border-solix-accent text-solix-accent text-sm hover:bg-solix-accent/30 disabled:opacity-40",children:"Send"})]}),v&&S.jsxs("div",{className:"text-[10px] text-slate-500 italic mt-1.5",children:["Wrapped by ",S.jsx("code",{children:"solix run"}),". Don't type in the terminal while sending from here, or characters will interleave."]})]}):S.jsxs("div",{className:"text-xs text-slate-500",children:["External session — keep typing in your terminal. To send prompts from here instead, restart the session with"," ",S.jsx("code",{className:"bg-black/40 px-1 rounded",children:"solix run"}),"."]})})]})}function Uf({active:n,onClick:e,children:t}){return S.jsx("button",{onClick:e,className:`flex-1 px-3 py-2 ${n?"text-solix-accent border-b-2 border-solix-accent":"text-slate-400 hover:text-slate-200 border-b-2 border-transparent"}`,children:t})}function b3({chat:n,scrollRef:e,session:t}){return S.jsxs("div",{ref:e,className:"h-full overflow-y-auto p-4 space-y-3",children:[n.length===0&&S.jsxs("div",{className:"text-sm text-slate-500 italic",children:["No chat yet. Type a prompt to this session in your terminal — it will stream here as it happens.",S.jsxs("div",{className:"mt-2 text-[11px] text-slate-600",children:["Watching transcript at ",S.jsxs("code",{children:["~/.claude/projects/","<encoded>","/",t.id,".jsonl"]})]})]}),n.map(i=>S.jsx("div",{className:`flex ${i.role==="user"?"justify-end":"justify-start"}`,children:S.jsxs("div",{className:`max-w-[85%] rounded-lg px-3 py-2 text-sm ${i.role==="user"?"bg-solix-accent/15 border border-solix-accent/40 text-slate-100":"bg-black/40 border border-solix-border text-slate-200"}`,children:[S.jsxs("div",{className:"text-[10px] uppercase tracking-wide opacity-60 mb-1",children:[i.role,S.jsx("span",{className:"ml-2 text-slate-500",children:new Date(i.ts).toLocaleTimeString()})]}),S.jsx("div",{className:"whitespace-pre-wrap break-words leading-relaxed",children:i.content})]})},i.messageId))]})}function E3({missions:n}){return S.jsx("div",{className:"h-full overflow-y-auto p-4 space-y-3",children:n.length===0?S.jsx("div",{className:"text-sm text-slate-500 italic",children:"No missions yet."}):n.map(e=>S.jsxs("div",{className:"rounded border border-solix-border p-3 bg-black/30",children:[S.jsxs("div",{className:"flex items-center justify-between text-xs",children:[S.jsx("span",{className:`font-semibold ${e.status==="active"?"text-solix-warn":e.status==="completed"?"text-solix-ok":"text-slate-300"}`,children:e.shortName}),S.jsx("span",{className:"text-slate-500",children:new Date(e.startedAt).toLocaleTimeString()})]}),S.jsx("div",{className:"mt-1 text-sm text-slate-200 line-clamp-3",children:e.prompt}),S.jsxs("div",{className:"mt-2 flex gap-3 text-[10px] text-slate-500",children:[S.jsxs("span",{children:[e.metrics.toolCallCount," tools"]}),S.jsxs("span",{children:[e.metrics.subagentCount," subagents"]}),S.jsxs("span",{children:[e.filesTouched.length," files"]}),e.metrics.durationMs!==void 0&&S.jsxs("span",{children:[(e.metrics.durationMs/1e3).toFixed(1),"s"]})]})]},e.id))})}function T3({missions:n}){const e=Array.from(new Set(n.flatMap(t=>t.filesTouched))).sort();return S.jsx("div",{className:"h-full overflow-y-auto p-4",children:e.length===0?S.jsx("div",{className:"text-sm text-slate-500 italic",children:"No files touched yet."}):S.jsx("ul",{className:"space-y-1 text-xs font-mono text-slate-300",children:e.map(t=>S.jsx("li",{className:"truncate",children:t},t))})})}function A3(){const n=ge(g=>g.selectedAdvisorId),e=ge(g=>n?g.advisors[n]:null),t=ge(g=>g.selectedSessionId?g.sessions[g.selectedSessionId]:null),i=ge(g=>g.selectAdvisor),r=ge(g=>g.invokeAdvisor),s=ge(g=>g.pinAdvisor),o=ge(g=>g.unpinAdvisor),a=ge(g=>g.enableAdvisor),l=ge(g=>g.disableAdvisor),[c,u]=Ee.useState(""),[h,d]=Ee.useState(null),[p,m]=Ee.useState(!1);if(Ee.useEffect(()=>{if(!e){d(null);return}let g=!1;const f=new URLSearchParams;t&&f.set("targetSessionId",t.id),c.trim()&&f.set("prompt",c.trim());const v=f.toString();return fetch(`/api/advisors/${encodeURIComponent(e.id)}/preview${v?`?${v}`:""}`).then(y=>y.ok?y.json():null).then(y=>{g||d(y)}).catch(()=>{g||d(null)}),()=>{g=!0}},[e==null?void 0:e.id,t==null?void 0:t.id,c]),!e)return null;const x=()=>{r(e.id,c.trim()||void 0),u("")};return S.jsxs("div",{className:"absolute top-16 right-0 bottom-0 w-[420px] bg-solix-panel border-l border-solix-border backdrop-blur-md flex flex-col z-20",children:[S.jsxs("div",{className:"px-4 py-3 border-b border-solix-border flex items-start justify-between",children:[S.jsxs("div",{children:[S.jsx("div",{className:"text-xs uppercase tracking-wide text-amber-200/70",children:"Advisor"}),S.jsxs("div",{className:"text-lg font-semibold flex items-center gap-2",children:[S.jsx("span",{style:{color:e.color},children:e.glyph}),S.jsx("span",{children:e.codename}),e.pinned&&S.jsx("span",{className:"text-[10px] uppercase tracking-wider text-amber-300 border border-amber-300/40 rounded px-1.5 py-0.5",children:"pinned"}),!e.enabled&&S.jsx("span",{className:"text-[10px] uppercase tracking-wider text-cyan-300 border border-cyan-300/40 rounded px-1.5 py-0.5",children:"opt-in"})]}),S.jsxs("div",{className:"text-xs text-slate-400 mt-0.5",children:[e.name," · ",String(e.defaultModel)]})]}),S.jsx("button",{onClick:()=>i(null),className:"text-slate-400 hover:text-slate-100","aria-label":"Close",children:"✕"})]}),S.jsx("div",{className:"px-4 py-3 border-b border-solix-border text-sm text-slate-300 leading-relaxed",children:e.description}),e.requiredSkills.length>0&&S.jsxs("div",{className:"px-4 py-2 border-b border-solix-border",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500 mb-1",children:"requires skills"}),S.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.requiredSkills.map(g=>S.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-solix-accent/15 border border-solix-accent/40 text-solix-accent",children:g},g))})]}),S.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3 text-sm text-slate-300",children:[S.jsx("div",{className:"text-xs uppercase tracking-wide text-slate-400",children:"Invoke"}),S.jsx("div",{className:"text-xs text-slate-500",children:t?S.jsxs(S.Fragment,{children:["Will dispatch to"," ",S.jsx("span",{className:"text-slate-200",children:t.name??t.id.slice(0,8)})," ",S.jsxs("span",{className:"text-slate-500",children:["(",t.cwd,")"]})]}):S.jsx(S.Fragment,{children:"No planet focused. Click a user planet first to set a target."})}),S.jsx("textarea",{value:c,onChange:g=>u(g.target.value),placeholder:`Optional: hand ${e.codename} a specific brief…`,rows:4,className:"w-full text-sm bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent resize-none"}),h&&S.jsxs("div",{className:"rounded border border-solix-border bg-black/30",children:[S.jsxs("button",{onClick:()=>m(g=>!g),className:"w-full text-left px-2 py-1.5 text-xs flex items-center justify-between text-slate-400 hover:text-slate-100",children:[S.jsxs("span",{children:["Context envelope · ",h.recentMissionsCount," mission(s)",h.contextUsagePct!==null&&` · target at ${h.contextUsagePct.toFixed(0)}%`]}),S.jsx("span",{children:p?"▾":"▸"})]}),p&&S.jsx("pre",{className:"text-[10.5px] text-slate-300 whitespace-pre-wrap px-3 pb-3 max-h-72 overflow-auto leading-relaxed",children:h.prompt})]})]}),e.enabled?S.jsxs("div",{className:"px-4 py-3 border-t border-solix-border flex gap-2",children:[S.jsx("button",{onClick:x,className:"flex-1 py-2 rounded bg-solix-accent/20 border border-solix-accent text-solix-accent text-sm hover:bg-solix-accent/30",children:"Invoke"}),e.pinned?S.jsx("button",{onClick:()=>o(e.id),className:"px-3 py-2 rounded bg-amber-500/15 border border-amber-400/50 text-amber-200 text-sm hover:bg-amber-500/25",children:"Unpin"}):S.jsx("button",{onClick:()=>s(e.id),className:"px-3 py-2 rounded bg-amber-500/10 border border-amber-400/30 text-amber-200/80 text-sm hover:bg-amber-500/20",title:"Spawn an always-on session for this advisor",children:"Pin"}),S.jsx("button",{onClick:()=>l(e.id),className:"px-3 py-2 rounded border border-solix-border text-slate-400 text-sm hover:text-white hover:bg-solix-border/30",title:"Remove from crew (keeps it available as opt-in)",children:"Disable"})]}):S.jsxs("div",{className:"px-4 py-3 border-t border-solix-border flex flex-col gap-2",children:[S.jsx("button",{onClick:()=>a(e.id),className:"w-full py-2 rounded bg-cyan-500/20 border border-cyan-400/60 text-cyan-100 text-sm hover:bg-cyan-500/30",title:"Add this advisor to your crew (renders in the inner ring, selectable in + Task)",children:"+ Add to crew"}),S.jsx("button",{onClick:x,className:"w-full py-1.5 rounded border border-solix-border text-slate-300 text-xs hover:text-white hover:bg-solix-border/30",children:"Invoke once without adding"})]})]})}function C3(){const n=ge(c=>c.selectedSkillId),e=ge(c=>n?c.skills[n]:null),t=ge(c=>c.selectSkill),i=ge(c=>c.advisors),[r,s]=Ee.useState(null),[o,a]=Ee.useState(!1);if(Ee.useEffect(()=>{if(!n){s(null);return}let c=!1;return a(!0),fetch(`/api/skills/${encodeURIComponent(n)}`).then(u=>u.ok?u.json():null).then(u=>{c||s(u)}).catch(()=>{c||s(null)}).finally(()=>{c||a(!1)}),()=>{c=!0}},[n]),!e)return null;const l=Object.values(i).filter(c=>c.requiredSkills.some(u=>e.id.endsWith(`:${u}`)||e.id===u));return S.jsxs("div",{className:"absolute top-16 right-0 bottom-0 w-[480px] bg-solix-panel border-l border-solix-border backdrop-blur-md flex flex-col z-20",children:[S.jsxs("div",{className:"px-4 py-3 border-b border-solix-border flex items-start justify-between",children:[S.jsxs("div",{children:[S.jsxs("div",{className:"text-xs uppercase tracking-wide text-cyan-300/70",children:["Skill · ",e.source]}),S.jsx("div",{className:"text-lg font-semibold",children:e.name}),S.jsx("div",{className:"text-xs text-slate-400 mt-0.5 break-all",children:e.id})]}),S.jsx("button",{onClick:()=>t(null),className:"text-slate-400 hover:text-slate-100","aria-label":"Close",children:"✕"})]}),l.length>0&&S.jsxs("div",{className:"px-4 py-2 border-b border-solix-border",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500 mb-1",children:"required by"}),S.jsx("div",{className:"flex flex-wrap gap-1.5",children:l.map(c=>S.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded border border-amber-300/40 text-amber-200",children:[S.jsx("span",{className:"mr-1",children:c.glyph}),c.codename]},c.id))})]}),S.jsx("div",{className:"px-4 py-3 border-b border-solix-border text-sm text-slate-300 leading-relaxed",children:e.description}),S.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500 mb-2",children:"manifest"}),o&&S.jsx("div",{className:"text-sm text-slate-500 italic",children:"Loading…"}),r&&S.jsx("pre",{className:"text-[11px] text-slate-300 whitespace-pre-wrap break-words bg-black/40 p-3 rounded border border-solix-border",children:r.manifest})]}),S.jsx("div",{className:"px-4 py-3 border-t border-solix-border text-xs text-slate-500",children:e.installedInProjects.length===0?"Not installed in any project yet.":`Installed in ${e.installedInProjects.length} project(s).`})]})}const R3=["default","opus","sonnet","haiku"];function P3({open:n,onClose:e}){const t=ge(U=>U.projects),i=ge(U=>U.advisors),r=ge(U=>U.goals),s=ge(U=>U.launchTask),o=Object.values(t).sort((U,z)=>z.lastActiveAt-U.lastActiveAt),a=Ee.useMemo(()=>Object.values(i).filter(U=>U.enabled).sort((U,z)=>U.codename.localeCompare(z.codename)),[i]),[l,c]=Ee.useState(""),[u,h]=Ee.useState("default"),[d,p]=Ee.useState(null),[m,x]=Ee.useState(""),[g,f]=Ee.useState(""),[v,y]=Ee.useState(""),[_,R]=Ee.useState(""),[w,E]=Ee.useState(null),A=Object.values(r),[b,M]=Ee.useState(null),[L,G]=Ee.useState(!0);if(Ee.useEffect(()=>{if(!n)return;let U=!1;return fetch("/api/system/preflight").then(z=>z.ok?z.json():null).then(z=>{U||M(z)}).catch(()=>{}),()=>{U=!0}},[n]),Ee.useEffect(()=>{if(!n||l)return;const U=o[0];U&&c(U.cwd)},[n,o,l]),!n)return null;const B=()=>{const U=l.trim(),z=m.trim();if(!U||!z)return;const Z=d?a.find(X=>X.id===d):void 0,D=Z?`[Acting as ${Z.codename} — ${Z.name}. ${Z.description}]
3899
3899
 
3900
- ${z}`:z,$=Z&&u==="default"?Z.defaultModel:u,K=g.trim(),se=L&&(b==null?void 0:b.agentViewAvailable)===!0,Te=parseFloat(_),qe=Number.isFinite(Te)&&Te>0?Te:void 0;s(U,$,D,{worktreeBranch:se?void 0:K||void 0,worktreeBaseRef:se?void 0:K&&v.trim()||void 0,useAgentView:se,agentName:Z==null?void 0:Z.codename.toLowerCase(),budgetUsd:qe,goalId:w??void 0}),x(""),p(null),f(""),y(""),C(""),E(null),e()},j=async()=>{const U=window.prompt("New goal name:");if(U!=null&&U.trim())try{const z=await fetch("/api/goals",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:U.trim()})});if(z.ok){const Z=await z.json();E(Z.id)}}catch{}};return S.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/70 backdrop-blur-md",children:S.jsxs("div",{className:"w-[520px] max-w-[92vw] rounded-xl border border-solix-accent/40 bg-solix-panel shadow-2xl",children:[S.jsxs("div",{className:"px-5 py-4 border-b border-solix-border flex items-start justify-between",children:[S.jsxs("div",{children:[S.jsx("div",{className:"text-xs uppercase tracking-widest text-solix-accent",children:"new task"}),S.jsx("div",{className:"text-lg font-semibold mt-0.5",children:"Launch a Claude Code session"}),S.jsx("div",{className:"text-xs text-slate-400 mt-1",children:b!=null&&b.agentViewAvailable&&L?S.jsxs(S.Fragment,{children:["Dispatches via"," ",S.jsx("code",{className:"bg-black/40 px-1 rounded",children:"claude --bg"})," ","— the session shows up in both Solix and"," ",S.jsx("code",{className:"bg-black/40 px-1 rounded",children:"claude agents"}),"."]}):S.jsxs(S.Fragment,{children:["Solix will spawn ",S.jsx("code",{className:"bg-black/40 px-1 rounded",children:"claude --print"})," ","in this folder. A new planet appears the moment it starts."]})}),b&&!b.claudeAvailable&&S.jsxs("div",{className:"mt-2 text-[11px] text-solix-danger border border-solix-danger/40 bg-solix-danger/10 rounded px-2 py-1",children:[S.jsx("span",{className:"font-semibold",children:"claude"})," not found on the server's PATH. Install Claude Code, then restart the Solix server."]}),(b==null?void 0:b.claudeAvailable)&&b.version&&S.jsxs("div",{className:"mt-1 text-[10px] text-slate-500 font-mono",children:["claude detected · ",b.version,b.agentViewAvailable&&S.jsxs(S.Fragment,{children:[" ","·"," ",S.jsx("button",{onClick:()=>G(U=>!U),className:`underline decoration-dotted ${L?"text-solix-accent":"text-slate-500 hover:text-slate-300"}`,title:"Toggle dispatch through Anthropic's Agent View",children:L?"agent view: on":"agent view: off"})]})]})]}),S.jsx("button",{onClick:e,className:"text-slate-400 hover:text-slate-100",children:"✕"})]}),S.jsxs("div",{className:"px-5 py-4 space-y-4",children:[S.jsxs("label",{className:"block",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-400 mb-1",children:"Working directory"}),o.length>0&&S.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:o.slice(0,6).map(U=>S.jsx("button",{onClick:()=>c(U.cwd),className:`text-[10px] px-2 py-1 rounded border ${l===U.cwd?"bg-solix-accent/20 border-solix-accent text-solix-accent":"border-solix-border text-slate-300 hover:bg-solix-border/30"}`,children:U.name},U.id))}),S.jsx("input",{value:l,onChange:U=>c(U.target.value),placeholder:"/Users/you/path/to/project",className:"w-full text-sm font-mono bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent"})]}),S.jsxs("label",{className:"block",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-400 mb-1",children:"Model"}),S.jsx("div",{className:"flex gap-1.5",children:R3.map(U=>S.jsx("button",{onClick:()=>h(U),className:`text-xs px-3 py-1.5 rounded border ${u===U?"bg-solix-accent/20 border-solix-accent text-solix-accent":"border-solix-border text-slate-300 hover:bg-solix-border/30"}`,children:U},U))})]}),a.length>0&&S.jsxs("label",{className:"block",children:[S.jsxs("div",{className:"text-[10px] uppercase tracking-wide text-slate-400 mb-1",children:["Advisor ",S.jsx("span",{className:"text-slate-600 normal-case",children:"(optional)"})]}),S.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[S.jsx("button",{onClick:()=>p(null),className:`text-xs px-3 py-1.5 rounded border ${d===null?"bg-solix-accent/20 border-solix-accent text-solix-accent":"border-solix-border text-slate-300 hover:bg-solix-border/30"}`,children:"none"}),a.map(U=>S.jsxs("button",{onClick:()=>p(U.id),title:U.description,className:`text-xs px-3 py-1.5 rounded border flex items-center gap-1.5 ${d===U.id?"border-amber-300 text-amber-100 bg-amber-500/15":"border-solix-border text-slate-300 hover:bg-solix-border/30"}`,children:[S.jsx("span",{style:{color:U.color},children:U.glyph}),U.codename]},U.id))]}),d&&S.jsx("div",{className:"mt-1.5 text-[10px] text-slate-500 italic",children:"The advisor's role will be prepended to your prompt."})]}),S.jsxs("label",{className:"block",children:[S.jsxs("div",{className:"text-[10px] uppercase tracking-wide text-slate-400 mb-1",children:["Worktree branch"," ",S.jsx("span",{className:"text-slate-600 normal-case",children:"(optional)"})]}),S.jsx("input",{value:g,onChange:U=>f(U.target.value),placeholder:"leave empty to run in the chosen directory",className:"w-full text-sm font-mono bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent"}),g.trim()&&S.jsxs("div",{className:"mt-2 space-y-1",children:[S.jsxs("div",{className:"text-[10px] text-slate-500 italic",children:["Solix will create (or reuse) a fresh git worktree at ~/.solix/worktrees/<repo>-",g.trim()||"<branch>","and spawn Claude there. Existing branches are reused."]}),S.jsx("input",{value:v,onChange:U=>y(U.target.value),placeholder:"based on (default: HEAD)",className:"w-full text-xs font-mono bg-black/40 border border-solix-border rounded p-1.5 text-slate-200 placeholder-slate-600 focus:outline-none focus:border-solix-accent"})]})]}),S.jsxs("div",{className:"flex gap-3",children:[S.jsxs("label",{className:"block flex-1",children:[S.jsxs("div",{className:"text-[10px] uppercase tracking-wide text-slate-400 mb-1",children:["Budget"," ",S.jsx("span",{className:"text-slate-600 normal-case",children:"(USD, optional)"})]}),S.jsx("input",{value:_,onChange:U=>C(U.target.value),inputMode:"decimal",placeholder:"e.g. 2.00",className:"w-full text-sm font-mono bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent"})]}),S.jsxs("label",{className:"block flex-1",children:[S.jsxs("div",{className:"text-[10px] uppercase tracking-wide text-slate-400 mb-1",children:["Goal"," ",S.jsx("span",{className:"text-slate-600 normal-case",children:"(optional)"})]}),S.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[S.jsx("button",{onClick:()=>E(null),className:`text-xs px-2.5 py-1.5 rounded border ${w===null?"bg-solix-accent/20 border-solix-accent text-solix-accent":"border-solix-border text-slate-300 hover:bg-solix-border/30"}`,children:"none"}),A.map(U=>S.jsxs("button",{onClick:()=>E(U.id),className:`text-xs px-2.5 py-1.5 rounded border flex items-center gap-1.5 ${w===U.id?"border-solix-accent text-slate-100 bg-solix-accent/15":"border-solix-border text-slate-300 hover:bg-solix-border/30"}`,children:[S.jsx("span",{className:"inline-block w-2 h-2 rounded-full",style:{background:U.color}}),U.name]},U.id)),S.jsx("button",{onClick:j,className:"text-xs px-2.5 py-1.5 rounded border border-dashed border-solix-border text-slate-400 hover:text-slate-100",children:"+ new"})]})]})]}),S.jsxs("label",{className:"block",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-400 mb-1",children:"Prompt"}),S.jsx("textarea",{value:m,onChange:U=>x(U.target.value),onKeyDown:U=>{U.key==="Enter"&&(U.metaKey||U.ctrlKey)&&(U.preventDefault(),B())},placeholder:"What should this Claude Code session do?",rows:4,className:"w-full text-sm bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent resize-none"})]})]}),S.jsxs("div",{className:"px-5 py-3 border-t border-solix-border flex items-center gap-2",children:[S.jsx("button",{onClick:e,className:"px-3 py-1.5 rounded border border-solix-border text-xs text-slate-300 hover:text-white",children:"Cancel"}),S.jsx("div",{className:"flex-1"}),S.jsx("span",{className:"text-[10px] text-slate-500 mr-2",children:"Cmd/Ctrl+Enter"}),S.jsx("button",{onClick:B,disabled:!l.trim()||!m.trim()||(b==null?void 0:b.claudeAvailable)===!1,className:"px-4 py-1.5 rounded bg-solix-accent/20 border border-solix-accent text-solix-accent text-sm hover:bg-solix-accent/30 disabled:opacity-40",children:"Launch"})]})]})})}const I3=1500;function N3(){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}/ws`}function L3(){let n=null,e=!1;const t=r=>{n&&n.readyState===WebSocket.OPEN&&n.send(JSON.stringify(r))};xe.getState().attachSocket(t);const i=()=>{if(e)return;n=new WebSocket(N3()),n.onopen=()=>{xe.getState().setConnected(!0)},n.onmessage=s=>{try{const o=JSON.parse(s.data);xe.getState().applyMessage(o)}catch(o){console.warn("[ws] bad message",o)}};const r=()=>{xe.getState().setConnected(!1),e||setTimeout(i,I3)};n.onclose=r,n.onerror=()=>n==null?void 0:n.close()};i(),window.addEventListener("beforeunload",()=>{e=!0,n==null||n.close()})}const D3=Ae.lazy(()=>Ad(()=>import("./Scene-BBqSunvy.js"),[]).then(n=>({default:n.Scene}))),U3=Ae.lazy(()=>Ad(()=>import("./TimelineDrawer-ir15gAsB.js"),[]).then(n=>({default:n.TimelineDrawer}))),k3=Ae.lazy(()=>Ad(()=>import("./GalaxyPanel-De7wiIUu.js"),[]).then(n=>({default:n.GalaxyPanel}))),O3=Ae.lazy(()=>Ad(()=>import("./CrewPanel-B3iYTtoI.js"),[]).then(n=>({default:n.CrewPanel})));function F3(){const[n,e]=Ae.useState(!1),[t,i]=Ae.useState(!1),[r,s]=Ae.useState(!1),[o,a]=Ae.useState(!1),[l,c]=Ae.useState(!1),u=xe(m=>m.selectedSessionId),h=xe(m=>m.selectedAdvisorId),d=xe(m=>m.selectedSkillId),p=u?460:h?420:d||n?480:0;return Ae.useEffect(()=>{L3()},[]),Ae.useEffect(()=>{const m=x=>{const g=xe.getState(),f=x.target,v=(f==null?void 0:f.tagName)==="INPUT"||(f==null?void 0:f.tagName)==="TEXTAREA"||(f==null?void 0:f.isContentEditable)===!0,_=Object.values(g.pendingPermissions)[0];x.key==="Escape"?(g.selectSession(null),g.selectAdvisor(null),g.selectSkill(null),e(!1),i(!1),a(!1),c(!1),g.playback.active&&(g.exitPlayback(),s(!1))):!v&&x.key==="?"?a(C=>!C):!v&&(x.key==="g"||x.key==="G")?e(C=>!C):!v&&(x.key==="c"||x.key==="C")?c(C=>!C):!v&&(x.key==="l"||x.key==="L")?i(!0):!v&&(x.key==="+"||x.key==="=")?gw():!v&&x.key==="-"?x3():!v&&x.key==="0"?M3():!v&&x.key==="ArrowLeft"?v3():!v&&x.key==="ArrowRight"?y3():!v&&x.key==="ArrowUp"?_3():!v&&x.key==="ArrowDown"?S3():!v&&x.key===" "?(x.preventDefault(),g.toggleMotion()):!v&&(x.key==="v"||x.key==="V")?g.toggleViewMode():!v&&(x.key==="m"||x.key==="M")?g.setViewMode("missions"):!v&&(x.key==="t"||x.key==="T")?s(C=>!C):!v&&_&&(x.key==="y"||x.key==="Y")?g.resolvePermission(_.requestId,!0):!v&&_&&(x.key==="n"||x.key==="N")&&g.resolvePermission(_.requestId,!1)};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[]),S.jsxs("div",{className:"relative h-full w-full",children:[S.jsx(B3,{}),S.jsx(jE,{onOpenGalaxy:()=>e(!0),onNewTask:()=>i(!0),onOpenTimeline:()=>s(!0),onOpenHelp:()=>a(!0),onOpenCrew:()=>c(!0)}),S.jsx(KE,{panelOffsetPx:p}),S.jsx(w3,{}),S.jsx(A3,{}),S.jsx(C3,{}),n&&S.jsx(Ae.Suspense,{fallback:null,children:S.jsx(k3,{open:n,onClose:()=>e(!1)})}),l&&S.jsx(Ae.Suspense,{fallback:null,children:S.jsx(O3,{open:l,onClose:()=>c(!1)})}),S.jsx(P3,{open:t,onClose:()=>i(!1)}),r&&S.jsx(Ae.Suspense,{fallback:null,children:S.jsx(U3,{open:r,onClose:()=>s(!1)})}),S.jsx(sT,{}),S.jsx(YE,{onOpenGalaxy:()=>e(!0),forceOpen:o,onClose:()=>a(!1)}),S.jsx($E,{}),S.jsx(V3,{})]})}function B3(){const n=xe(e=>e.viewMode);return n==="list"?S.jsx(DE,{}):n==="missions"?S.jsx(VE,{}):S.jsx(Ae.Suspense,{fallback:S.jsx(z3,{}),children:S.jsx(D3,{})})}function z3(){return S.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-solix-bg z-0",children:S.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-widest solix-pulse",children:"loading galaxy…"})})}function V3(){const n=xe(t=>Object.keys(t.sessions).length),e=xe(t=>t.connected);return n>0?null:S.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center z-10",children:S.jsxs("div",{className:"rounded-lg border border-solix-border bg-solix-panel p-6 max-w-md text-center backdrop-blur",children:[S.jsx("div",{className:"text-sm uppercase tracking-widest text-solix-accent",children:"empty system"}),S.jsx("div",{className:"mt-2 text-slate-200",children:e?"Run `claude` in any terminal — the planet will appear here.":"Waiting for the Solix server…"}),S.jsx("div",{className:"mt-3 text-xs text-slate-500",children:"The sun is mission control. Each agent orbits it as a planet."})]})})}const xw=document.getElementById("root");if(!xw)throw new Error("#root not found");K_(xw).render(S.jsx(Ae.StrictMode,{children:S.jsx(F3,{})}));export{Ms as $,zS as A,cT as B,Vd as C,vi as D,ke as E,Pe as F,sA as G,_e as H,lw as I,Ct as J,yN as K,zd as L,oT as M,ji as N,Hd as O,Yt as P,En as Q,qN as R,_M as S,J3 as T,Ei as U,gi as V,_I as W,Rp as X,Hn as Y,rg as Z,ws as _,cS as a,Sn as a0,li as a1,Ut as a2,WM as a3,Gt as a4,YS as a5,Ti as a6,tr as a7,Fi as a8,fn as a9,$3 as aA,Y3 as aB,Q3 as aC,eL as aD,j3 as aE,Zi as aa,Wi as ab,Eg as ac,on as ad,RS as ae,Ye as af,ht as ag,Ow as ah,Ho as ai,sl as aj,UI as ak,xe as al,IE as am,q3 as an,H3 as ao,NE as ap,Z3 as aq,Bm as ar,oS as as,LE as at,G3 as au,W3 as av,X3 as aw,nt as ax,sS as ay,PE as az,zm as b,I as c,Q as d,uw as e,dn as f,Fv as g,K_ as h,Rd as i,S as j,aT as k,ZN as l,Go as m,mr as n,$N as o,bs as p,FM as q,Ae as r,pn as s,rn as t,ci as u,uM as v,fe as w,kt as x,ct as y,QN as z};
3900
+ ${z}`:z,$=Z&&u==="default"?Z.defaultModel:u,K=g.trim(),se=L&&(b==null?void 0:b.agentViewAvailable)===!0,Ae=parseFloat(_),qe=Number.isFinite(Ae)&&Ae>0?Ae:void 0;s(U,$,D,{worktreeBranch:se?void 0:K||void 0,worktreeBaseRef:se?void 0:K&&v.trim()||void 0,useAgentView:se,agentName:Z==null?void 0:Z.codename.toLowerCase(),budgetUsd:qe,goalId:w??void 0}),x(""),p(null),f(""),y(""),R(""),E(null),e()},j=async()=>{const U=window.prompt("New goal name:");if(U!=null&&U.trim())try{const z=await fetch("/api/goals",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:U.trim()})});if(z.ok){const Z=await z.json();E(Z.id)}}catch{}};return S.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/70 backdrop-blur-md",children:S.jsxs("div",{className:"w-[520px] max-w-[92vw] rounded-xl border border-solix-accent/40 bg-solix-panel shadow-2xl",children:[S.jsxs("div",{className:"px-5 py-4 border-b border-solix-border flex items-start justify-between",children:[S.jsxs("div",{children:[S.jsx("div",{className:"text-xs uppercase tracking-widest text-solix-accent",children:"new task"}),S.jsx("div",{className:"text-lg font-semibold mt-0.5",children:"Launch a Claude Code session"}),S.jsx("div",{className:"text-xs text-slate-400 mt-1",children:b!=null&&b.agentViewAvailable&&L?S.jsxs(S.Fragment,{children:["Dispatches via"," ",S.jsx("code",{className:"bg-black/40 px-1 rounded",children:"claude --bg"})," ","— the session shows up in both Solix and"," ",S.jsx("code",{className:"bg-black/40 px-1 rounded",children:"claude agents"}),"."]}):S.jsxs(S.Fragment,{children:["Solix will spawn ",S.jsx("code",{className:"bg-black/40 px-1 rounded",children:"claude --print"})," ","in this folder. A new planet appears the moment it starts."]})}),b&&!b.claudeAvailable&&S.jsxs("div",{className:"mt-2 text-[11px] text-solix-danger border border-solix-danger/40 bg-solix-danger/10 rounded px-2 py-1",children:[S.jsx("span",{className:"font-semibold",children:"claude"})," not found on the server's PATH. Install Claude Code, then restart the Solix server."]}),(b==null?void 0:b.claudeAvailable)&&b.version&&S.jsxs("div",{className:"mt-1 text-[10px] text-slate-500 font-mono",children:["claude detected · ",b.version,b.agentViewAvailable&&S.jsxs(S.Fragment,{children:[" ","·"," ",S.jsx("button",{onClick:()=>G(U=>!U),className:`underline decoration-dotted ${L?"text-solix-accent":"text-slate-500 hover:text-slate-300"}`,title:"Toggle dispatch through Anthropic's Agent View",children:L?"agent view: on":"agent view: off"})]})]})]}),S.jsx("button",{onClick:e,className:"text-slate-400 hover:text-slate-100",children:"✕"})]}),S.jsxs("div",{className:"px-5 py-4 space-y-4",children:[S.jsxs("label",{className:"block",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-400 mb-1",children:"Working directory"}),o.length>0&&S.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:o.slice(0,6).map(U=>S.jsx("button",{onClick:()=>c(U.cwd),className:`text-[10px] px-2 py-1 rounded border ${l===U.cwd?"bg-solix-accent/20 border-solix-accent text-solix-accent":"border-solix-border text-slate-300 hover:bg-solix-border/30"}`,children:U.name},U.id))}),S.jsx("input",{value:l,onChange:U=>c(U.target.value),placeholder:"/Users/you/path/to/project",className:"w-full text-sm font-mono bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent"})]}),S.jsxs("label",{className:"block",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-400 mb-1",children:"Model"}),S.jsx("div",{className:"flex gap-1.5",children:R3.map(U=>S.jsx("button",{onClick:()=>h(U),className:`text-xs px-3 py-1.5 rounded border ${u===U?"bg-solix-accent/20 border-solix-accent text-solix-accent":"border-solix-border text-slate-300 hover:bg-solix-border/30"}`,children:U},U))})]}),a.length>0&&S.jsxs("label",{className:"block",children:[S.jsxs("div",{className:"text-[10px] uppercase tracking-wide text-slate-400 mb-1",children:["Advisor ",S.jsx("span",{className:"text-slate-600 normal-case",children:"(optional)"})]}),S.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[S.jsx("button",{onClick:()=>p(null),className:`text-xs px-3 py-1.5 rounded border ${d===null?"bg-solix-accent/20 border-solix-accent text-solix-accent":"border-solix-border text-slate-300 hover:bg-solix-border/30"}`,children:"none"}),a.map(U=>S.jsxs("button",{onClick:()=>p(U.id),title:U.description,className:`text-xs px-3 py-1.5 rounded border flex items-center gap-1.5 ${d===U.id?"border-amber-300 text-amber-100 bg-amber-500/15":"border-solix-border text-slate-300 hover:bg-solix-border/30"}`,children:[S.jsx("span",{style:{color:U.color},children:U.glyph}),U.codename]},U.id))]}),d&&S.jsx("div",{className:"mt-1.5 text-[10px] text-slate-500 italic",children:"The advisor's role will be prepended to your prompt."})]}),S.jsxs("label",{className:"block",children:[S.jsxs("div",{className:"text-[10px] uppercase tracking-wide text-slate-400 mb-1",children:["Worktree branch"," ",S.jsx("span",{className:"text-slate-600 normal-case",children:"(optional)"})]}),S.jsx("input",{value:g,onChange:U=>f(U.target.value),placeholder:"leave empty to run in the chosen directory",className:"w-full text-sm font-mono bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent"}),g.trim()&&S.jsxs("div",{className:"mt-2 space-y-1",children:[S.jsxs("div",{className:"text-[10px] text-slate-500 italic",children:["Solix will create (or reuse) a fresh git worktree at ~/.solix/worktrees/<repo>-",g.trim()||"<branch>","and spawn Claude there. Existing branches are reused."]}),S.jsx("input",{value:v,onChange:U=>y(U.target.value),placeholder:"based on (default: HEAD)",className:"w-full text-xs font-mono bg-black/40 border border-solix-border rounded p-1.5 text-slate-200 placeholder-slate-600 focus:outline-none focus:border-solix-accent"})]})]}),S.jsxs("div",{className:"flex gap-3",children:[S.jsxs("label",{className:"block flex-1",children:[S.jsxs("div",{className:"text-[10px] uppercase tracking-wide text-slate-400 mb-1",children:["Budget"," ",S.jsx("span",{className:"text-slate-600 normal-case",children:"(USD, optional)"})]}),S.jsx("input",{value:_,onChange:U=>R(U.target.value),inputMode:"decimal",placeholder:"e.g. 2.00",className:"w-full text-sm font-mono bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent"})]}),S.jsxs("label",{className:"block flex-1",children:[S.jsxs("div",{className:"text-[10px] uppercase tracking-wide text-slate-400 mb-1",children:["Goal"," ",S.jsx("span",{className:"text-slate-600 normal-case",children:"(optional)"})]}),S.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[S.jsx("button",{onClick:()=>E(null),className:`text-xs px-2.5 py-1.5 rounded border ${w===null?"bg-solix-accent/20 border-solix-accent text-solix-accent":"border-solix-border text-slate-300 hover:bg-solix-border/30"}`,children:"none"}),A.map(U=>S.jsxs("button",{onClick:()=>E(U.id),className:`text-xs px-2.5 py-1.5 rounded border flex items-center gap-1.5 ${w===U.id?"border-solix-accent text-slate-100 bg-solix-accent/15":"border-solix-border text-slate-300 hover:bg-solix-border/30"}`,children:[S.jsx("span",{className:"inline-block w-2 h-2 rounded-full",style:{background:U.color}}),U.name]},U.id)),S.jsx("button",{onClick:j,className:"text-xs px-2.5 py-1.5 rounded border border-dashed border-solix-border text-slate-400 hover:text-slate-100",children:"+ new"})]})]})]}),S.jsxs("label",{className:"block",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-400 mb-1",children:"Prompt"}),S.jsx("textarea",{value:m,onChange:U=>x(U.target.value),onKeyDown:U=>{U.key==="Enter"&&(U.metaKey||U.ctrlKey)&&(U.preventDefault(),B())},placeholder:"What should this Claude Code session do?",rows:4,className:"w-full text-sm bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent resize-none"})]})]}),S.jsxs("div",{className:"px-5 py-3 border-t border-solix-border flex items-center gap-2",children:[S.jsx("button",{onClick:e,className:"px-3 py-1.5 rounded border border-solix-border text-xs text-slate-300 hover:text-white",children:"Cancel"}),S.jsx("div",{className:"flex-1"}),S.jsx("span",{className:"text-[10px] text-slate-500 mr-2",children:"Cmd/Ctrl+Enter"}),S.jsx("button",{onClick:B,disabled:!l.trim()||!m.trim()||(b==null?void 0:b.claudeAvailable)===!1,className:"px-4 py-1.5 rounded bg-solix-accent/20 border border-solix-accent text-solix-accent text-sm hover:bg-solix-accent/30 disabled:opacity-40",children:"Launch"})]})]})})}const I3=1500;function N3(){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}/ws`}function L3(){let n=null,e=!1;const t=r=>{n&&n.readyState===WebSocket.OPEN&&n.send(JSON.stringify(r))};ge.getState().attachSocket(t);const i=()=>{if(e)return;n=new WebSocket(N3()),n.onopen=()=>{ge.getState().setConnected(!0)},n.onmessage=s=>{try{const o=JSON.parse(s.data);ge.getState().applyMessage(o)}catch(o){console.warn("[ws] bad message",o)}};const r=()=>{ge.getState().setConnected(!1),e||setTimeout(i,I3)};n.onclose=r,n.onerror=()=>n==null?void 0:n.close()};i(),window.addEventListener("beforeunload",()=>{e=!0,n==null||n.close()})}const D3=Ee.lazy(()=>Cl(()=>import("./Scene-D50tNcep.js"),[]).then(n=>({default:n.Scene}))),U3=Ee.lazy(()=>Cl(()=>import("./TimelineDrawer-BfnNVtiR.js"),[]).then(n=>({default:n.TimelineDrawer}))),k3=Ee.lazy(()=>Cl(()=>import("./GalaxyPanel-CdPijHA4.js"),[]).then(n=>({default:n.GalaxyPanel}))),O3=Ee.lazy(()=>Cl(()=>import("./CrewPanel-DtihGk3R.js"),[]).then(n=>({default:n.CrewPanel}))),F3=Ee.lazy(()=>Cl(()=>import("./WorkspacePanel-DSD8Z7ji.js"),[]).then(n=>({default:n.WorkspacePanel})));function B3(){const[n,e]=Ee.useState(!1),[t,i]=Ee.useState(!1),[r,s]=Ee.useState(!1),[o,a]=Ee.useState(!1),[l,c]=Ee.useState(!1),u=ge(g=>g.selectedSessionId),h=ge(g=>g.selectedAdvisorId),d=ge(g=>g.selectedSkillId),p=ge(g=>g.workspaceOpen),m=ge(g=>g.closeWorkspace),x=u?460:h?420:d||n||p?480:0;return Ee.useEffect(()=>{L3()},[]),Ee.useEffect(()=>{const g=f=>{const v=ge.getState(),y=f.target,_=(y==null?void 0:y.tagName)==="INPUT"||(y==null?void 0:y.tagName)==="TEXTAREA"||(y==null?void 0:y.isContentEditable)===!0,w=Object.values(v.pendingPermissions)[0];f.key==="Escape"?(v.selectSession(null),v.selectAdvisor(null),v.selectSkill(null),v.closeWorkspace(),e(!1),i(!1),a(!1),c(!1),v.playback.active&&(v.exitPlayback(),s(!1))):!_&&f.key==="?"?a(E=>!E):!_&&(f.key==="g"||f.key==="G")?e(E=>!E):!_&&(f.key==="c"||f.key==="C")?c(E=>!E):!_&&(f.key==="l"||f.key==="L")?i(!0):!_&&(f.key==="+"||f.key==="=")?gw():!_&&f.key==="-"?x3():!_&&f.key==="0"?M3():!_&&f.key==="ArrowLeft"?v3():!_&&f.key==="ArrowRight"?y3():!_&&f.key==="ArrowUp"?_3():!_&&f.key==="ArrowDown"?S3():!_&&f.key===" "?(f.preventDefault(),v.toggleMotion()):!_&&(f.key==="v"||f.key==="V")?v.toggleViewMode():!_&&(f.key==="m"||f.key==="M")?v.setViewMode("missions"):!_&&(f.key==="t"||f.key==="T")?s(E=>!E):!_&&(f.key==="w"||f.key==="W")?v.workspaceOpen?v.closeWorkspace():v.openWorkspace():!_&&w&&(f.key==="y"||f.key==="Y")?v.resolvePermission(w.requestId,!0):!_&&w&&(f.key==="n"||f.key==="N")&&v.resolvePermission(w.requestId,!1)};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[]),S.jsxs("div",{className:"relative h-full w-full",children:[S.jsx(z3,{}),S.jsx(jE,{onOpenGalaxy:()=>e(!0),onNewTask:()=>i(!0),onOpenTimeline:()=>s(!0),onOpenHelp:()=>a(!0),onOpenCrew:()=>c(!0)}),S.jsx(KE,{panelOffsetPx:x}),S.jsx(w3,{}),S.jsx(A3,{}),S.jsx(C3,{}),n&&S.jsx(Ee.Suspense,{fallback:null,children:S.jsx(k3,{open:n,onClose:()=>e(!1)})}),l&&S.jsx(Ee.Suspense,{fallback:null,children:S.jsx(O3,{open:l,onClose:()=>c(!1)})}),p&&S.jsx(Ee.Suspense,{fallback:null,children:S.jsx(F3,{open:p,onClose:m})}),S.jsx(P3,{open:t,onClose:()=>i(!1)}),r&&S.jsx(Ee.Suspense,{fallback:null,children:S.jsx(U3,{open:r,onClose:()=>s(!1)})}),S.jsx(sT,{}),S.jsx(YE,{onOpenGalaxy:()=>e(!0),forceOpen:o,onClose:()=>a(!1)}),S.jsx($E,{}),S.jsx(H3,{})]})}function z3(){const n=ge(e=>e.viewMode);return n==="list"?S.jsx(DE,{}):n==="missions"?S.jsx(VE,{}):S.jsx(Ee.Suspense,{fallback:S.jsx(V3,{}),children:S.jsx(D3,{})})}function V3(){return S.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-solix-bg z-0",children:S.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-widest solix-pulse",children:"loading galaxy…"})})}function H3(){const n=ge(t=>Object.keys(t.sessions).length),e=ge(t=>t.connected);return n>0?null:S.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center z-10",children:S.jsxs("div",{className:"rounded-lg border border-solix-border bg-solix-panel p-6 max-w-md text-center backdrop-blur",children:[S.jsx("div",{className:"text-sm uppercase tracking-widest text-solix-accent",children:"empty system"}),S.jsx("div",{className:"mt-2 text-slate-200",children:e?"Run `claude` in any terminal — the planet will appear here.":"Waiting for the Solix server…"}),S.jsx("div",{className:"mt-3 text-xs text-slate-500",children:"The sun is mission control. Each agent orbits it as a planet."})]})})}const xw=document.getElementById("root");if(!xw)throw new Error("#root not found");J_(xw).render(S.jsx(Ee.StrictMode,{children:S.jsx(B3,{})}));export{Ms as $,zS as A,cT as B,Vd as C,vi as D,ke as E,Pe as F,sA as G,_e as H,lw as I,Ct as J,yN as K,zd as L,oT as M,ji as N,Hd as O,Yt as P,En as Q,qN as R,_M as S,eL as T,Ei as U,gi as V,_I as W,Rp as X,Hn as Y,sg as Z,ws as _,cS as a,Sn as a0,li as a1,Ut as a2,WM as a3,Gt as a4,YS as a5,Ti as a6,tr as a7,Fi as a8,fn as a9,q3 as aA,Z3 as aB,tL as aC,nL as aD,$3 as aE,W3 as aF,Zi as aa,Wi as ab,Tg as ac,on as ad,RS as ae,Ye as af,ht as ag,Ow as ah,Ho as ai,ge as aj,sl as ak,UI as al,Bm as am,IE as an,K3 as ao,G3 as ap,NE as aq,J3 as ar,zm as as,oS as at,LE as au,j3 as av,X3 as aw,Y3 as ax,nt as ay,PE as az,Vm as b,I as c,Q as d,uw as e,dn as f,Bv as g,J_ as h,Rd as i,S as j,aT as k,ZN as l,Go as m,mr as n,$N as o,bs as p,FM as q,Ee as r,pn as s,rn as t,ci as u,uM as v,fe as w,kt as x,ct as y,QN as z};