-
Notifications
You must be signed in to change notification settings - Fork 1
/
react-three-fiber.js
2 lines (2 loc) · 811 KB
/
react-three-fiber.js
1
2
/*! For license information please see react-three-fiber.js.LICENSE.txt */
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(self,(()=>(()=>{var e={617:e=>{function t(e,t,n){var r,i,a,o,s;function l(){var u=Date.now()-o;u<t&&u>=0?r=setTimeout(l,t-u):(r=null,n||(s=e.apply(a,i),a=i=null))}null==t&&(t=100);var u=function(){a=this,i=arguments,o=Date.now();var u=n&&!r;return r||(r=setTimeout(l,t)),u&&(s=e.apply(a,i),a=i=null),s};return u.clear=function(){r&&(clearTimeout(r),r=null)},u.flush=function(){r&&(s=e.apply(a,i),a=i=null,clearTimeout(r),r=null)},u}t.debounce=t,e.exports=t},489:(e,t)=>{"use strict";t.ConcurrentRoot=1,t.ContinuousEventPriority=4,t.DefaultEventPriority=16,t.DiscreteEventPriority=1},404:(e,t,n)=>{function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}e.exports=function(e){var t={},i=n(440),a=n(258),o=Object.assign;function s(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var l=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,u=Symbol.for("react.element"),c=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),p=Symbol.for("react.provider"),v=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),x=Symbol.for("react.lazy");Symbol.for("react.scope"),Symbol.for("react.debug_trace_mode");var b=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden"),Symbol.for("react.cache"),Symbol.for("react.tracing_marker");var w=Symbol.iterator;function M(e){return null===e||"object"!==r(e)?null:"function"==typeof(e=w&&e[w]||e["@@iterator"])?e:null}function S(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case h:return"Fragment";case c:return"Portal";case f:return"Profiler";case d:return"StrictMode";case g:return"Suspense";case y:return"SuspenseList"}if("object"===r(e))switch(e.$$typeof){case v:return(e.displayName||"Context")+".Consumer";case p:return(e._context.displayName||"Context")+".Provider";case m:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case _:return null!==(t=e.displayName||null)?t:S(e.type)||"Memo";case x:t=e._payload,e=e._init;try{return S(e(t))}catch(e){}}return null}function T(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return S(t);case 8:return t===d?"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("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t}return null}function k(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!=(4098&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function E(e){if(k(e)!==e)throw Error(s(188))}function A(e){var t=e.alternate;if(!t){if(null===(t=k(e)))throw Error(s(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(null===i)break;var a=i.alternate;if(null===a){if(null!==(r=i.return)){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return E(i),e;if(a===r)return E(i),t;a=a.sibling}throw Error(s(188))}if(n.return!==r.return)n=i,r=a;else{for(var o=!1,l=i.child;l;){if(l===n){o=!0,n=i,r=a;break}if(l===r){o=!0,r=i,n=a;break}l=l.sibling}if(!o){for(l=a.child;l;){if(l===n){o=!0,n=a,r=i;break}if(l===r){o=!0,r=a,n=i;break}l=l.sibling}if(!o)throw Error(s(189))}}if(n.alternate!==r)throw Error(s(190))}if(3!==n.tag)throw Error(s(188));return n.stateNode.current===n?e:t}function C(e){return null!==(e=A(e))?P(e):null}function P(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=P(e);if(null!==t)return t;e=e.sibling}return null}function L(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){if(4!==e.tag){var t=L(e);if(null!==t)return t}e=e.sibling}return null}var R,I=Array.isArray,D=e.getPublicInstance,O=e.getRootHostContext,z=e.getChildHostContext,N=e.prepareForCommit,U=e.resetAfterCommit,F=e.createInstance,B=e.appendInitialChild,G=e.finalizeInitialChildren,H=e.prepareUpdate,V=e.shouldSetTextContent,W=e.createTextInstance,j=e.scheduleTimeout,q=e.cancelTimeout,X=e.noTimeout,Y=e.isPrimaryRenderer,Z=e.supportsMutation,J=e.supportsPersistence,Q=e.supportsHydration,K=e.getInstanceFromNode,$=e.preparePortalMount,ee=e.getCurrentEventPriority,te=e.detachDeletedInstance,ne=e.supportsMicrotasks,re=e.scheduleMicrotask,ie=e.supportsTestSelectors,ae=e.findFiberRoot,oe=e.getBoundingRect,se=e.getTextContent,le=e.isHiddenSubtree,ue=e.matchAccessibilityRole,ce=e.setFocusIfFocusable,he=e.setupIntersectionObserver,de=e.appendChild,fe=e.appendChildToContainer,pe=e.commitTextUpdate,ve=e.commitMount,me=e.commitUpdate,ge=e.insertBefore,ye=e.insertInContainerBefore,_e=e.removeChild,xe=e.removeChildFromContainer,be=e.resetTextContent,we=e.hideInstance,Me=e.hideTextInstance,Se=e.unhideInstance,Te=e.unhideTextInstance,ke=e.clearContainer,Ee=e.cloneInstance,Ae=e.createContainerChildSet,Ce=e.appendChildToContainerChildSet,Pe=e.finalizeContainerChildren,Le=e.replaceContainerChildren,Re=e.cloneHiddenInstance,Ie=e.cloneHiddenTextInstance,De=e.canHydrateInstance,Oe=e.canHydrateTextInstance,ze=e.canHydrateSuspenseInstance,Ne=e.isSuspenseInstancePending,Ue=e.isSuspenseInstanceFallback,Fe=e.registerSuspenseInstanceRetry,Be=e.getNextHydratableSibling,Ge=e.getFirstHydratableChild,He=e.getFirstHydratableChildWithinContainer,Ve=e.getFirstHydratableChildWithinSuspenseInstance,We=e.hydrateInstance,je=e.hydrateTextInstance,qe=e.hydrateSuspenseInstance,Xe=e.getNextHydratableInstanceAfterSuspenseInstance,Ye=e.commitHydratedContainer,Ze=e.commitHydratedSuspenseInstance,Je=e.clearSuspenseBoundary,Qe=e.clearSuspenseBoundaryFromContainer,Ke=e.shouldDeleteUnhydratedTailInstances,$e=e.didNotMatchHydratedContainerTextInstance,et=e.didNotMatchHydratedTextInstance;function tt(e){if(void 0===R)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);R=t&&t[1]||""}return"\n"+R+e}var nt=!1;function rt(e,t){if(!e||nt)return"";nt=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"===("undefined"==typeof Reflect?"undefined":r(Reflect))&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var i=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){i=e}e.call(t.prototype)}else{try{throw Error()}catch(e){i=e}e()}}catch(t){if(t&&i&&"string"==typeof t.stack){for(var a=t.stack.split("\n"),o=i.stack.split("\n"),s=a.length-1,l=o.length-1;1<=s&&0<=l&&a[s]!==o[l];)l--;for(;1<=s&&0<=l;s--,l--)if(a[s]!==o[l]){if(1!==s||1!==l)do{if(s--,0>--l||a[s]!==o[l]){var u="\n"+a[s].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}}while(1<=s&&0<=l);break}}}finally{nt=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?tt(e):""}var it=Object.prototype.hasOwnProperty,at=[],ot=-1;function st(e){return{current:e}}function lt(e){0>ot||(e.current=at[ot],at[ot]=null,ot--)}function ut(e,t){ot++,at[ot]=e.current,e.current=t}var ct={},ht=st(ct),dt=st(!1),ft=ct;function pt(e,t){var n=e.type.contextTypes;if(!n)return ct;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i,a={};for(i in n)a[i]=t[i];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function vt(e){return null!=e.childContextTypes}function mt(){lt(dt),lt(ht)}function gt(e,t,n){if(ht.current!==ct)throw Error(s(168));ut(ht,t),ut(dt,n)}function yt(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var i in r=r.getChildContext())if(!(i in t))throw Error(s(108,T(e)||"Unknown",i));return o({},n,r)}function _t(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ct,ft=ht.current,ut(ht,e),ut(dt,dt.current),!0}function xt(e,t,n){var r=e.stateNode;if(!r)throw Error(s(169));n?(e=yt(e,t,ft),r.__reactInternalMemoizedMergedChildContext=e,lt(dt),lt(ht),ut(ht,e)):lt(dt),ut(dt,n)}var bt=Math.clz32?Math.clz32:function(e){return 0==(e>>>=0)?32:31-(wt(e)/Mt|0)|0},wt=Math.log,Mt=Math.LN2,St=64,Tt=4194304;function kt(e){switch(e&-e){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 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Et(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=268435455&n;if(0!==o){var s=o&~i;0!==s?r=kt(s):0!=(a&=o)&&(r=kt(a))}else 0!=(o=n&~i)?r=kt(o):0!==a&&(r=kt(a));if(0===r)return 0;if(0!==t&&t!==r&&0==(t&i)&&((i=r&-r)>=(a=t&-t)||16===i&&0!=(4194240&a)))return t;if(0!=(4&r)&&(r|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0<t;)i=1<<(n=31-bt(t)),r|=e[n],t&=~i;return r}function At(e,t){switch(e){case 1:case 2:case 4:return t+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 t+5e3;default:return-1}}function Ct(e){return 0!=(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function Pt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Lt(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-bt(t)]=n}function Rt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-bt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var It=0;function Dt(e){return 1<(e&=-e)?4<e?0!=(268435455&e)?16:536870912:4:1}var Ot=a.unstable_scheduleCallback,zt=a.unstable_cancelCallback,Nt=a.unstable_shouldYield,Ut=a.unstable_requestPaint,Ft=a.unstable_now,Bt=a.unstable_ImmediatePriority,Gt=a.unstable_UserBlockingPriority,Ht=a.unstable_NormalPriority,Vt=a.unstable_IdlePriority,Wt=null,jt=null,qt="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},Xt=null,Yt=!1,Zt=!1;function Jt(e){null===Xt?Xt=[e]:Xt.push(e)}function Qt(){if(!Zt&&null!==Xt){Zt=!0;var e=0,t=It;try{var n=Xt;for(It=1;e<n.length;e++){var r=n[e];do{r=r(!0)}while(null!==r)}Xt=null,Yt=!1}catch(t){throw null!==Xt&&(Xt=Xt.slice(e+1)),Ot(Bt,Qt),t}finally{It=t,Zt=!1}}return null}var Kt=l.ReactCurrentBatchConfig;function $t(e,t){if(qt(e,t))return!0;if("object"!==r(e)||null===e||"object"!==r(t)||null===t)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(i=0;i<n.length;i++){var a=n[i];if(!it.call(t,a)||!qt(e[a],t[a]))return!1}return!0}function en(e){switch(e.tag){case 5:return tt(e.type);case 16:return tt("Lazy");case 13:return tt("Suspense");case 19:return tt("SuspenseList");case 0:case 2:case 15:return rt(e.type,!1);case 11:return rt(e.type.render,!1);case 1:return rt(e.type,!0);default:return""}}function tn(e,t){if(e&&e.defaultProps){for(var n in t=o({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}var nn=st(null),rn=null,an=null,on=null;function sn(){on=an=rn=null}function ln(e,t,n){Y?(ut(nn,t._currentValue),t._currentValue=n):(ut(nn,t._currentValue2),t._currentValue2=n)}function un(e){var t=nn.current;lt(nn),Y?e._currentValue=t:e._currentValue2=t}function cn(e,t,n){for(;null!==e;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==r&&(r.childLanes|=t)):null!==r&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function hn(e,t){rn=e,on=an=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!=(e.lanes&t)&&(Ni=!0),e.firstContext=null)}function dn(e){var t=Y?e._currentValue:e._currentValue2;if(on!==e)if(e={context:e,memoizedValue:t,next:null},null===an){if(null===rn)throw Error(s(308));an=e,rn.dependencies={lanes:0,firstContext:e}}else an=an.next=e;return t}var fn=null,pn=!1;function vn(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function mn(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function gn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function yn(e,t){var n=e.updateQueue;null!==n&&(n=n.shared,null!==Za&&0!=(1&e.mode)&&0==(2&Ya)?(null===(e=n.interleaved)?(t.next=t,null===fn?fn=[n]:fn.push(n)):(t.next=e.next,e.next=t),n.interleaved=t):(null===(e=n.pending)?t.next=t:(t.next=e.next,e.next=t),n.pending=t))}function _n(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,0!=(4194240&n))){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,Rt(e,n)}}function xn(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var i=null,a=null;if(null!==(n=n.firstBaseUpdate)){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===a?i=a=o:a=a.next=o,n=n.next}while(null!==n);null===a?i=a=t:a=a.next=t}else i=a=t;return n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function bn(e,t,n,r){var i=e.updateQueue;pn=!1;var a=i.firstBaseUpdate,s=i.lastBaseUpdate,l=i.shared.pending;if(null!==l){i.shared.pending=null;var u=l,c=u.next;u.next=null,null===s?a=c:s.next=c,s=u;var h=e.alternate;null!==h&&(l=(h=h.updateQueue).lastBaseUpdate)!==s&&(null===l?h.firstBaseUpdate=c:l.next=c,h.lastBaseUpdate=u)}if(null!==a){var d=i.baseState;for(s=0,h=c=u=null,l=a;;){var f=l.lane,p=l.eventTime;if((r&f)===f){null!==h&&(h=h.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var v=e,m=l;switch(f=t,p=n,m.tag){case 1:if("function"==typeof(v=m.payload)){d=v.call(p,d,f);break e}d=v;break e;case 3:v.flags=-65537&v.flags|128;case 0:if(null==(f="function"==typeof(v=m.payload)?v.call(p,d,f):v))break e;d=o({},d,f);break e;case 2:pn=!0}}null!==l.callback&&0!==l.lane&&(e.flags|=64,null===(f=i.effects)?i.effects=[l]:f.push(l))}else p={eventTime:p,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},null===h?(c=h=p,u=d):h=h.next=p,s|=f;if(null===(l=l.next)){if(null===(l=i.shared.pending))break;l=(f=l).next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}if(null===h&&(u=d),i.baseState=u,i.firstBaseUpdate=c,i.lastBaseUpdate=h,null!==(t=i.shared.interleaved)){i=t;do{s|=i.lane,i=i.next}while(i!==t)}else null===a&&(i.shared.lanes=0);no|=s,e.lanes=s,e.memoizedState=d}}function wn(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(null!==i){if(r.callback=null,r=n,"function"!=typeof i)throw Error(s(191,i));i.call(r)}}}var Mn=(new i.Component).refs;function Sn(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:o({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var Tn={isMounted:function(e){return!!(e=e._reactInternals)&&k(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=wo(),i=Mo(e),a=gn(r,i);a.payload=t,null!=n&&(a.callback=n),yn(e,a),null!==(t=So(e,i,r))&&_n(t,e,i)},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=wo(),i=Mo(e),a=gn(r,i);a.tag=1,a.payload=t,null!=n&&(a.callback=n),yn(e,a),null!==(t=So(e,i,r))&&_n(t,e,i)},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=wo(),r=Mo(e),i=gn(n,r);i.tag=2,null!=t&&(i.callback=t),yn(e,i),null!==(t=So(e,r,n))&&_n(t,e,r)}};function kn(e,t,n,r,i,a,o){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,a,o):!(t.prototype&&t.prototype.isPureReactComponent&&$t(n,r)&&$t(i,a))}function En(e,t,n){var i=!1,a=ct,o=t.contextType;return"object"===r(o)&&null!==o?o=dn(o):(a=vt(t)?ft:ht.current,o=(i=null!=(i=t.contextTypes))?pt(e,a):ct),t=new t(n,o),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=Tn,e.stateNode=t,t._reactInternals=e,i&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=a,e.__reactInternalMemoizedMaskedChildContext=o),t}function An(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Tn.enqueueReplaceState(t,t.state,null)}function Cn(e,t,n,i){var a=e.stateNode;a.props=n,a.state=e.memoizedState,a.refs=Mn,vn(e);var o=t.contextType;"object"===r(o)&&null!==o?a.context=dn(o):(o=vt(t)?ft:ht.current,a.context=pt(e,o)),a.state=e.memoizedState,"function"==typeof(o=t.getDerivedStateFromProps)&&(Sn(e,t,o,n),a.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof a.getSnapshotBeforeUpdate||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||(t=a.state,"function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount(),t!==a.state&&Tn.enqueueReplaceState(a,a.state,null),bn(e,n,a,i),a.state=e.memoizedState),"function"==typeof a.componentDidMount&&(e.flags|=4194308)}var Pn=[],Ln=0,Rn=null,In=0,Dn=[],On=0,zn=null,Nn=1,Un="";function Fn(e,t){Pn[Ln++]=In,Pn[Ln++]=Rn,Rn=e,In=t}function Bn(e,t,n){Dn[On++]=Nn,Dn[On++]=Un,Dn[On++]=zn,zn=e;var r=Nn;e=Un;var i=32-bt(r)-1;r&=~(1<<i),n+=1;var a=32-bt(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Nn=1<<32-bt(t)+i|n<<i|r,Un=a+e}else Nn=1<<a|n<<i|r,Un=e}function Gn(e){null!==e.return&&(Fn(e,1),Bn(e,1,0))}function Hn(e){for(;e===Rn;)Rn=Pn[--Ln],Pn[Ln]=null,In=Pn[--Ln],Pn[Ln]=null;for(;e===zn;)zn=Dn[--On],Dn[On]=null,Un=Dn[--On],Dn[On]=null,Nn=Dn[--On],Dn[On]=null}var Vn=null,Wn=null,jn=!1,qn=!1,Xn=null;function Yn(e,t){var n=$o(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,null===(t=e.deletions)?(e.deletions=[n],e.flags|=16):t.push(n)}function Zn(e,t){switch(e.tag){case 5:return null!==(t=De(t,e.type,e.pendingProps))&&(e.stateNode=t,Vn=e,Wn=Ge(t),!0);case 6:return null!==(t=Oe(t,e.pendingProps))&&(e.stateNode=t,Vn=e,Wn=null,!0);case 13:if(null!==(t=ze(t))){var n=null!==zn?{id:Nn,overflow:Un}:null;return e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},(n=$o(18,null,null,0)).stateNode=t,n.return=e,e.child=n,Vn=e,Wn=null,!0}return!1;default:return!1}}function Jn(e){return 0!=(1&e.mode)&&0==(128&e.flags)}function Qn(e){if(jn){var t=Wn;if(t){var n=t;if(!Zn(e,t)){if(Jn(e))throw Error(s(418));t=Be(n);var r=Vn;t&&Zn(e,t)?Yn(r,n):(e.flags=-4097&e.flags|2,jn=!1,Vn=e)}}else{if(Jn(e))throw Error(s(418));e.flags=-4097&e.flags|2,jn=!1,Vn=e}}}function Kn(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;Vn=e}function $n(e){if(!Q||e!==Vn)return!1;if(!jn)return Kn(e),jn=!0,!1;if(3!==e.tag&&(5!==e.tag||Ke(e.type)&&!V(e.type,e.memoizedProps))){var t=Wn;if(t){if(Jn(e)){for(e=Wn;e;)e=Be(e);throw Error(s(418))}for(;t;)Yn(e,t),t=Be(t)}}if(Kn(e),13===e.tag){if(!Q)throw Error(s(316));if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(s(317));Wn=Xe(e)}else Wn=Vn?Be(e.stateNode):null;return!0}function er(){Q&&(Wn=Vn=null,qn=jn=!1)}function tr(e){null===Xn?Xn=[e]:Xn.push(e)}function nr(e,t,n){if(null!==(e=n.ref)&&"function"!=typeof e&&"object"!==r(e)){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(s(309));var i=n.stateNode}if(!i)throw Error(s(147,e));var a=i,o=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===o?t.ref:(t=function(e){var t=a.refs;t===Mn&&(t=a.refs={}),null===e?delete t[o]:t[o]=e},t._stringRef=o,t)}if("string"!=typeof e)throw Error(s(284));if(!n._owner)throw Error(s(290,e))}return e}function rr(e,t){throw e=Object.prototype.toString.call(t),Error(s(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function ir(e){return(0,e._init)(e._payload)}function ar(e){function t(t,n){if(e){var r=t.deletions;null===r?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function i(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function a(e,t){return(e=ts(e,t)).index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags|=2,n):r:(t.flags|=2,n):(t.flags|=1048576,n)}function l(t){return e&&null===t.alternate&&(t.flags|=2),t}function d(e,t,n,r){return null===t||6!==t.tag?((t=as(n,e.mode,r)).return=e,t):((t=a(t,n)).return=e,t)}function f(e,t,n,i){var o=n.type;return o===h?v(e,t,n.props.children,i,n.key):null!==t&&(t.elementType===o||"object"===r(o)&&null!==o&&o.$$typeof===x&&ir(o)===t.type)?((i=a(t,n.props)).ref=nr(e,t,n),i.return=e,i):((i=ns(n.type,n.key,n.props,null,e.mode,i)).ref=nr(e,t,n),i.return=e,i)}function p(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=os(n,e.mode,r)).return=e,t):((t=a(t,n.children||[])).return=e,t)}function v(e,t,n,r,i){return null===t||7!==t.tag?((t=rs(n,e.mode,r,i)).return=e,t):((t=a(t,n)).return=e,t)}function m(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t)return(t=as(""+t,e.mode,n)).return=e,t;if("object"===r(t)&&null!==t){switch(t.$$typeof){case u:return(n=ns(t.type,t.key,t.props,null,e.mode,n)).ref=nr(e,null,t),n.return=e,n;case c:return(t=os(t,e.mode,n)).return=e,t;case x:return m(e,(0,t._init)(t._payload),n)}if(I(t)||M(t))return(t=rs(t,e.mode,n,null)).return=e,t;rr(e,t)}return null}function g(e,t,n,i){var a=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n)return null!==a?null:d(e,t,""+n,i);if("object"===r(n)&&null!==n){switch(n.$$typeof){case u:return n.key===a?f(e,t,n,i):null;case c:return n.key===a?p(e,t,n,i):null;case x:return g(e,t,(a=n._init)(n._payload),i)}if(I(n)||M(n))return null!==a?null:v(e,t,n,i,null);rr(e,n)}return null}function y(e,t,n,i,a){if("string"==typeof i&&""!==i||"number"==typeof i)return d(t,e=e.get(n)||null,""+i,a);if("object"===r(i)&&null!==i){switch(i.$$typeof){case u:return f(t,e=e.get(null===i.key?n:i.key)||null,i,a);case c:return p(t,e=e.get(null===i.key?n:i.key)||null,i,a);case x:return y(e,t,n,(0,i._init)(i._payload),a)}if(I(i)||M(i))return v(t,e=e.get(n)||null,i,a,null);rr(t,i)}return null}function _(r,a,s,l){for(var u=null,c=null,h=a,d=a=0,f=null;null!==h&&d<s.length;d++){h.index>d?(f=h,h=null):f=h.sibling;var p=g(r,h,s[d],l);if(null===p){null===h&&(h=f);break}e&&h&&null===p.alternate&&t(r,h),a=o(p,a,d),null===c?u=p:c.sibling=p,c=p,h=f}if(d===s.length)return n(r,h),jn&&Fn(r,d),u;if(null===h){for(;d<s.length;d++)null!==(h=m(r,s[d],l))&&(a=o(h,a,d),null===c?u=h:c.sibling=h,c=h);return jn&&Fn(r,d),u}for(h=i(r,h);d<s.length;d++)null!==(f=y(h,r,d,s[d],l))&&(e&&null!==f.alternate&&h.delete(null===f.key?d:f.key),a=o(f,a,d),null===c?u=f:c.sibling=f,c=f);return e&&h.forEach((function(e){return t(r,e)})),jn&&Fn(r,d),u}function b(r,a,l,u){var c=M(l);if("function"!=typeof c)throw Error(s(150));if(null==(l=c.call(l)))throw Error(s(151));for(var h=c=null,d=a,f=a=0,p=null,v=l.next();null!==d&&!v.done;f++,v=l.next()){d.index>f?(p=d,d=null):p=d.sibling;var _=g(r,d,v.value,u);if(null===_){null===d&&(d=p);break}e&&d&&null===_.alternate&&t(r,d),a=o(_,a,f),null===h?c=_:h.sibling=_,h=_,d=p}if(v.done)return n(r,d),jn&&Fn(r,f),c;if(null===d){for(;!v.done;f++,v=l.next())null!==(v=m(r,v.value,u))&&(a=o(v,a,f),null===h?c=v:h.sibling=v,h=v);return jn&&Fn(r,f),c}for(d=i(r,d);!v.done;f++,v=l.next())null!==(v=y(d,r,f,v.value,u))&&(e&&null!==v.alternate&&d.delete(null===v.key?f:v.key),a=o(v,a,f),null===h?c=v:h.sibling=v,h=v);return e&&d.forEach((function(e){return t(r,e)})),jn&&Fn(r,f),c}return function e(i,o,s,d){if("object"===r(s)&&null!==s&&s.type===h&&null===s.key&&(s=s.props.children),"object"===r(s)&&null!==s){switch(s.$$typeof){case u:e:{for(var f=s.key,p=o;null!==p;){if(p.key===f){if((f=s.type)===h){if(7===p.tag){n(i,p.sibling),(o=a(p,s.props.children)).return=i,i=o;break e}}else if(p.elementType===f||"object"===r(f)&&null!==f&&f.$$typeof===x&&ir(f)===p.type){n(i,p.sibling),(o=a(p,s.props)).ref=nr(i,p,s),o.return=i,i=o;break e}n(i,p);break}t(i,p),p=p.sibling}s.type===h?((o=rs(s.props.children,i.mode,d,s.key)).return=i,i=o):((d=ns(s.type,s.key,s.props,null,i.mode,d)).ref=nr(i,o,s),d.return=i,i=d)}return l(i);case c:e:{for(p=s.key;null!==o;){if(o.key===p){if(4===o.tag&&o.stateNode.containerInfo===s.containerInfo&&o.stateNode.implementation===s.implementation){n(i,o.sibling),(o=a(o,s.children||[])).return=i,i=o;break e}n(i,o);break}t(i,o),o=o.sibling}(o=os(s,i.mode,d)).return=i,i=o}return l(i);case x:return e(i,o,(p=s._init)(s._payload),d)}if(I(s))return _(i,o,s,d);if(M(s))return b(i,o,s,d);rr(i,s)}return"string"==typeof s&&""!==s||"number"==typeof s?(s=""+s,null!==o&&6===o.tag?(n(i,o.sibling),(o=a(o,s)).return=i,i=o):(n(i,o),(o=as(s,i.mode,d)).return=i,i=o),l(i)):n(i,o)}}var or=ar(!0),sr=ar(!1),lr={},ur=st(lr),cr=st(lr),hr=st(lr);function dr(e){if(e===lr)throw Error(s(174));return e}function fr(e,t){ut(hr,t),ut(cr,e),ut(ur,lr),e=O(t),lt(ur),ut(ur,e)}function pr(){lt(ur),lt(cr),lt(hr)}function vr(e){var t=dr(hr.current),n=dr(ur.current);n!==(t=z(n,e.type,t))&&(ut(cr,e),ut(ur,t))}function mr(e){cr.current===e&&(lt(ur),lt(cr))}var gr=st(0);function yr(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||Ne(n)||Ue(n)))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var _r=[];function xr(){for(var e=0;e<_r.length;e++){var t=_r[e];Y?t._workInProgressVersionPrimary=null:t._workInProgressVersionSecondary=null}_r.length=0}var br=l.ReactCurrentDispatcher,wr=l.ReactCurrentBatchConfig,Mr=0,Sr=null,Tr=null,kr=null,Er=!1,Ar=!1,Cr=0,Pr=0;function Lr(){throw Error(s(321))}function Rr(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!qt(e[n],t[n]))return!1;return!0}function Ir(e,t,n,r,i,a){if(Mr=a,Sr=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,br.current=null===e||null===e.memoizedState?vi:mi,e=n(r,i),Ar){a=0;do{if(Ar=!1,Cr=0,25<=a)throw Error(s(301));a+=1,kr=Tr=null,t.updateQueue=null,br.current=gi,e=n(r,i)}while(Ar)}if(br.current=pi,t=null!==Tr&&null!==Tr.next,Mr=0,kr=Tr=Sr=null,Er=!1,t)throw Error(s(300));return e}function Dr(){var e=0!==Cr;return Cr=0,e}function Or(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===kr?Sr.memoizedState=kr=e:kr=kr.next=e,kr}function zr(){if(null===Tr){var e=Sr.alternate;e=null!==e?e.memoizedState:null}else e=Tr.next;var t=null===kr?Sr.memoizedState:kr.next;if(null!==t)kr=t,Tr=e;else{if(null===e)throw Error(s(310));e={memoizedState:(Tr=e).memoizedState,baseState:Tr.baseState,baseQueue:Tr.baseQueue,queue:Tr.queue,next:null},null===kr?Sr.memoizedState=kr=e:kr=kr.next=e}return kr}function Nr(e,t){return"function"==typeof t?t(e):t}function Ur(e){var t=zr(),n=t.queue;if(null===n)throw Error(s(311));n.lastRenderedReducer=e;var r=Tr,i=r.baseQueue,a=n.pending;if(null!==a){if(null!==i){var o=i.next;i.next=a.next,a.next=o}r.baseQueue=i=a,n.pending=null}if(null!==i){a=i.next,r=r.baseState;var l=o=null,u=null,c=a;do{var h=c.lane;if((Mr&h)===h)null!==u&&(u=u.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var d={lane:h,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};null===u?(l=u=d,o=r):u=u.next=d,Sr.lanes|=h,no|=h}c=c.next}while(null!==c&&c!==a);null===u?o=r:u.next=l,qt(r,t.memoizedState)||(Ni=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=u,n.lastRenderedState=r}if(null!==(e=n.interleaved)){i=e;do{a=i.lane,Sr.lanes|=a,no|=a,i=i.next}while(i!==e)}else null===i&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Fr(e){var t=zr(),n=t.queue;if(null===n)throw Error(s(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,a=t.memoizedState;if(null!==i){n.pending=null;var o=i=i.next;do{a=e(a,o.action),o=o.next}while(o!==i);qt(a,t.memoizedState)||(Ni=!0),t.memoizedState=a,null===t.baseQueue&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function Br(){}function Gr(e,t){var n=Sr,r=zr(),i=t(),a=!qt(r.memoizedState,i);if(a&&(r.memoizedState=i,Ni=!0),r=r.queue,Kr(Wr.bind(null,n,r,e),[e]),r.getSnapshot!==t||a||null!==kr&&1&kr.memoizedState.tag){if(n.flags|=2048,Xr(9,Vr.bind(null,n,r,i,t),void 0,null),null===Za)throw Error(s(349));0!=(30&Mr)||Hr(n,t,i)}return i}function Hr(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=Sr.updateQueue)?(t={lastEffect:null,stores:null},Sr.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function Vr(e,t,n,r){t.value=n,t.getSnapshot=r,jr(t)&&So(e,1,-1)}function Wr(e,t,n){return n((function(){jr(t)&&So(e,1,-1)}))}function jr(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!qt(e,n)}catch(e){return!0}}function qr(e){var t=Or();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Nr,lastRenderedState:e},t.queue=e,e=e.dispatch=ui.bind(null,Sr,e),[t.memoizedState,e]}function Xr(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=Sr.updateQueue)?(t={lastEffect:null,stores:null},Sr.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Yr(){return zr().memoizedState}function Zr(e,t,n,r){var i=Or();Sr.flags|=e,i.memoizedState=Xr(1|t,n,void 0,void 0===r?null:r)}function Jr(e,t,n,r){var i=zr();r=void 0===r?null:r;var a=void 0;if(null!==Tr){var o=Tr.memoizedState;if(a=o.destroy,null!==r&&Rr(r,o.deps))return void(i.memoizedState=Xr(t,n,a,r))}Sr.flags|=e,i.memoizedState=Xr(1|t,n,a,r)}function Qr(e,t){return Zr(8390656,8,e,t)}function Kr(e,t){return Jr(2048,8,e,t)}function $r(e,t){return Jr(4,2,e,t)}function ei(e,t){return Jr(4,4,e,t)}function ti(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function ni(e,t,n){return n=null!=n?n.concat([e]):null,Jr(4,4,ti.bind(null,t,e),n)}function ri(){}function ii(e,t){var n=zr();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&Rr(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ai(e,t){var n=zr();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&Rr(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function oi(e,t){var n=It;It=0!==n&&4>n?n:4,e(!0);var r=wr.transition;wr.transition={};try{e(!1),t()}finally{It=n,wr.transition=r}}function si(){return zr().memoizedState}function li(e,t,n){var r=Mo(e);n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ci(e)?hi(t,n):(di(e,t,n),null!==(e=So(e,r,n=wo()))&&fi(e,t,r))}function ui(e,t,n){var r=Mo(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ci(e))hi(t,i);else{di(e,t,i);var a=e.alternate;if(0===e.lanes&&(null===a||0===a.lanes)&&null!==(a=t.lastRenderedReducer))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,qt(s,o))return}catch(e){}null!==(e=So(e,r,n=wo()))&&fi(e,t,r)}}function ci(e){var t=e.alternate;return e===Sr||null!==t&&t===Sr}function hi(e,t){Ar=Er=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function di(e,t,n){null!==Za&&0!=(1&e.mode)&&0==(2&Ya)?(null===(e=t.interleaved)?(n.next=n,null===fn?fn=[t]:fn.push(t)):(n.next=e.next,e.next=n),t.interleaved=n):(null===(e=t.pending)?n.next=n:(n.next=e.next,e.next=n),t.pending=n)}function fi(e,t,n){if(0!=(4194240&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,Rt(e,n)}}var pi={readContext:dn,useCallback:Lr,useContext:Lr,useEffect:Lr,useImperativeHandle:Lr,useInsertionEffect:Lr,useLayoutEffect:Lr,useMemo:Lr,useReducer:Lr,useRef:Lr,useState:Lr,useDebugValue:Lr,useDeferredValue:Lr,useTransition:Lr,useMutableSource:Lr,useSyncExternalStore:Lr,useId:Lr,unstable_isNewReconciler:!1},vi={readContext:dn,useCallback:function(e,t){return Or().memoizedState=[e,void 0===t?null:t],e},useContext:dn,useEffect:Qr,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,Zr(4194308,4,ti.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Zr(4194308,4,e,t)},useInsertionEffect:function(e,t){return Zr(4,2,e,t)},useMemo:function(e,t){var n=Or();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Or();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=li.bind(null,Sr,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},Or().memoizedState=e},useState:qr,useDebugValue:ri,useDeferredValue:function(e){var t=qr(e),n=t[0],r=t[1];return Qr((function(){var t=wr.transition;wr.transition={};try{r(e)}finally{wr.transition=t}}),[e]),n},useTransition:function(){var e=qr(!1),t=e[0];return e=oi.bind(null,e[1]),Or().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Sr,i=Or();if(jn){if(void 0===n)throw Error(s(407));n=n()}else{if(n=t(),null===Za)throw Error(s(349));0!=(30&Mr)||Hr(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,Qr(Wr.bind(null,r,a,e),[e]),r.flags|=2048,Xr(9,Vr.bind(null,r,a,n,t),void 0,null),n},useId:function(){var e=Or(),t=Za.identifierPrefix;if(jn){var n=Un;t=":"+t+"R"+(n=(Nn&~(1<<32-bt(Nn)-1)).toString(32)+n),0<(n=Cr++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=Pr++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},mi={readContext:dn,useCallback:ii,useContext:dn,useEffect:Kr,useImperativeHandle:ni,useInsertionEffect:$r,useLayoutEffect:ei,useMemo:ai,useReducer:Ur,useRef:Yr,useState:function(){return Ur(Nr)},useDebugValue:ri,useDeferredValue:function(e){var t=Ur(Nr),n=t[0],r=t[1];return Kr((function(){var t=wr.transition;wr.transition={};try{r(e)}finally{wr.transition=t}}),[e]),n},useTransition:function(){return[Ur(Nr)[0],zr().memoizedState]},useMutableSource:Br,useSyncExternalStore:Gr,useId:si,unstable_isNewReconciler:!1},gi={readContext:dn,useCallback:ii,useContext:dn,useEffect:Kr,useImperativeHandle:ni,useInsertionEffect:$r,useLayoutEffect:ei,useMemo:ai,useReducer:Fr,useRef:Yr,useState:function(){return Fr(Nr)},useDebugValue:ri,useDeferredValue:function(e){var t=Fr(Nr),n=t[0],r=t[1];return Kr((function(){var t=wr.transition;wr.transition={};try{r(e)}finally{wr.transition=t}}),[e]),n},useTransition:function(){return[Fr(Nr)[0],zr().memoizedState]},useMutableSource:Br,useSyncExternalStore:Gr,useId:si,unstable_isNewReconciler:!1};function yi(e,t){try{var n="",r=t;do{n+=en(r),r=r.return}while(r);var i=n}catch(e){i="\nError generating stack: "+e.message+"\n"+e.stack}return{value:e,source:t,stack:i}}function _i(e,t){try{console.error(t.value)}catch(e){setTimeout((function(){throw e}))}}var xi,bi,wi,Mi,Si="function"==typeof WeakMap?WeakMap:Map;function Ti(e,t,n){(n=gn(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){ho||(ho=!0,fo=r),_i(0,t)},n}function ki(e,t,n){(n=gn(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){_i(0,t)}}var a=e.stateNode;return null!==a&&"function"==typeof a.componentDidCatch&&(n.callback=function(){_i(0,t),"function"!=typeof r&&(null===po?po=new Set([this]):po.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}function Ei(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new Si;var i=new Set;r.set(t,i)}else void 0===(i=r.get(t))&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=Xo.bind(null,e,t,n),t.then(e,e))}function Ai(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function Ci(e,t,n,r,i){return 0==(1&e.mode)?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=gn(-1,1)).tag=2,yn(n,t))),n.lanes|=1),e):(e.flags|=65536,e.lanes=i,e)}function Pi(e){e.flags|=4}function Li(e,t){if(null!==e&&e.child===t.child)return!0;if(0!=(16&t.flags))return!1;for(e=t.child;null!==e;){if(0!=(12854&e.flags)||0!=(12854&e.subtreeFlags))return!1;e=e.sibling}return!0}if(Z)xi=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)B(e,n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},bi=function(){},wi=function(e,t,n,r,i){if((e=e.memoizedProps)!==r){var a=t.stateNode,o=dr(ur.current);n=H(a,n,e,r,i,o),(t.updateQueue=n)&&Pi(t)}},Mi=function(e,t,n,r){n!==r&&Pi(t)};else if(J){xi=function(e,t,n,r){for(var i=t.child;null!==i;){if(5===i.tag){var a=i.stateNode;n&&r&&(a=Re(a,i.type,i.memoizedProps,i)),B(e,a)}else if(6===i.tag)a=i.stateNode,n&&r&&(a=Ie(a,i.memoizedProps,i)),B(e,a);else if(4!==i.tag)if(22===i.tag&&null!==i.memoizedState)null!==(a=i.child)&&(a.return=i),xi(e,i,!0,!0);else if(null!==i.child){i.child.return=i,i=i.child;continue}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}};var Ri=function e(t,n,r,i){for(var a=n.child;null!==a;){if(5===a.tag){var o=a.stateNode;r&&i&&(o=Re(o,a.type,a.memoizedProps,a)),Ce(t,o)}else if(6===a.tag)o=a.stateNode,r&&i&&(o=Ie(o,a.memoizedProps,a)),Ce(t,o);else if(4!==a.tag)if(22===a.tag&&null!==a.memoizedState)null!==(o=a.child)&&(o.return=a),e(t,a,!0,!0);else if(null!==a.child){a.child.return=a,a=a.child;continue}if(a===n)break;for(;null===a.sibling;){if(null===a.return||a.return===n)return;a=a.return}a.sibling.return=a.return,a=a.sibling}};bi=function(e,t){var n=t.stateNode;if(!Li(e,t)){e=n.containerInfo;var r=Ae(e);Ri(r,t,!1,!1),n.pendingChildren=r,Pi(t),Pe(e,r)}},wi=function(e,t,n,r,i){var a=e.stateNode,o=e.memoizedProps;if((e=Li(e,t))&&o===r)t.stateNode=a;else{var s=t.stateNode,l=dr(ur.current),u=null;o!==r&&(u=H(s,n,o,r,i,l)),e&&null===u?t.stateNode=a:(a=Ee(a,u,n,o,r,t,e,s),G(a,n,r,i,l)&&Pi(t),t.stateNode=a,e?Pi(t):xi(a,t,!1,!1))}},Mi=function(e,t,n,r){n!==r?(e=dr(hr.current),n=dr(ur.current),t.stateNode=W(r,e,n,t),Pi(t)):t.stateNode=e.stateNode}}else bi=function(){},wi=function(){},Mi=function(){};function Ii(e,t){if(!jn)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Di(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=14680064&i.subtreeFlags,r|=14680064&i.flags,i.return=e,i=i.sibling;else for(i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Oi(e,t,n){var r=t.pendingProps;switch(Hn(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Di(t),null;case 1:case 17:return vt(t.type)&&mt(),Di(t),null;case 3:return r=t.stateNode,pr(),lt(dt),lt(ht),xr(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==e&&null!==e.child||($n(t)?Pi(t):null===e||e.memoizedState.isDehydrated&&0==(256&t.flags)||(t.flags|=1024,null!==Xn&&(Co(Xn),Xn=null))),bi(e,t),Di(t),null;case 5:mr(t),n=dr(hr.current);var i=t.type;if(null!==e&&null!=t.stateNode)wi(e,t,i,r,n),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(null===t.stateNode)throw Error(s(166));return Di(t),null}if(e=dr(ur.current),$n(t)){if(!Q)throw Error(s(175));e=We(t.stateNode,t.type,t.memoizedProps,n,e,t,!qn),t.updateQueue=e,null!==e&&Pi(t)}else{var a=F(i,r,n,e,t);xi(a,t,!1,!1),t.stateNode=a,G(a,i,r,n,e)&&Pi(t)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return Di(t),null;case 6:if(e&&null!=t.stateNode)Mi(e,t,e.memoizedProps,r);else{if("string"!=typeof r&&null===t.stateNode)throw Error(s(166));if(e=dr(hr.current),n=dr(ur.current),$n(t)){if(!Q)throw Error(s(176));if(e=t.stateNode,r=t.memoizedProps,(n=je(e,r,t,!qn))&&null!==(i=Vn))switch(a=0!=(1&i.mode),i.tag){case 3:$e(i.stateNode.containerInfo,e,r,a);break;case 5:et(i.type,i.memoizedProps,i.stateNode,e,r,a)}n&&Pi(t)}else t.stateNode=W(r,e,n,t)}return Di(t),null;case 13:if(lt(gr),r=t.memoizedState,jn&&null!==Wn&&0!=(1&t.mode)&&0==(128&t.flags)){for(e=Wn;e;)e=Be(e);return er(),t.flags|=98560,t}if(null!==r&&null!==r.dehydrated){if(r=$n(t),null===e){if(!r)throw Error(s(318));if(!Q)throw Error(s(344));if(!(e=null!==(e=t.memoizedState)?e.dehydrated:null))throw Error(s(317));qe(e,t)}else er(),0==(128&t.flags)&&(t.memoizedState=null),t.flags|=4;return Di(t),null}return null!==Xn&&(Co(Xn),Xn=null),0!=(128&t.flags)?(t.lanes=n,t):(r=null!==r,n=!1,null===e?$n(t):n=null!==e.memoizedState,r&&!n&&(t.child.flags|=8192,0!=(1&t.mode)&&(null===e||0!=(1&gr.current)?0===eo&&(eo=3):No())),null!==t.updateQueue&&(t.flags|=4),Di(t),null);case 4:return pr(),bi(e,t),null===e&&$(t.stateNode.containerInfo),Di(t),null;case 10:return un(t.type._context),Di(t),null;case 19:if(lt(gr),null===(i=t.memoizedState))return Di(t),null;if(r=0!=(128&t.flags),null===(a=i.rendering))if(r)Ii(i,!1);else{if(0!==eo||null!==e&&0!=(128&e.flags))for(e=t.child;null!==e;){if(null!==(a=yr(e))){for(t.flags|=128,Ii(i,!1),null!==(e=a.updateQueue)&&(t.updateQueue=e,t.flags|=4),t.subtreeFlags=0,e=n,r=t.child;null!==r;)i=e,(n=r).flags&=14680066,null===(a=n.alternate)?(n.childLanes=0,n.lanes=i,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=a.childLanes,n.lanes=a.lanes,n.child=a.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=a.memoizedProps,n.memoizedState=a.memoizedState,n.updateQueue=a.updateQueue,n.type=a.type,i=a.dependencies,n.dependencies=null===i?null:{lanes:i.lanes,firstContext:i.firstContext}),r=r.sibling;return ut(gr,1&gr.current|2),t.child}e=e.sibling}null!==i.tail&&Ft()>lo&&(t.flags|=128,r=!0,Ii(i,!1),t.lanes=4194304)}else{if(!r)if(null!==(e=yr(a))){if(t.flags|=128,r=!0,null!==(e=e.updateQueue)&&(t.updateQueue=e,t.flags|=4),Ii(i,!0),null===i.tail&&"hidden"===i.tailMode&&!a.alternate&&!jn)return Di(t),null}else 2*Ft()-i.renderingStartTime>lo&&1073741824!==n&&(t.flags|=128,r=!0,Ii(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(null!==(e=i.last)?e.sibling=a:t.child=a,i.last=a)}return null!==i.tail?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Ft(),t.sibling=null,e=gr.current,ut(gr,r?1&e|2:1&e),t):(Di(t),null);case 22:case 23:return Io(),r=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==r&&(t.flags|=8192),r&&0!=(1&t.mode)?0!=(1073741824&Ka)&&(Di(t),Z&&6&t.subtreeFlags&&(t.flags|=8192)):Di(t),null;case 24:case 25:return null}throw Error(s(156,t.tag))}var zi=l.ReactCurrentOwner,Ni=!1;function Ui(e,t,n,r){t.child=null===e?sr(t,null,n,r):or(t,e.child,n,r)}function Fi(e,t,n,r,i){n=n.render;var a=t.ref;return hn(t,i),r=Ir(e,t,n,r,a,i),n=Dr(),null===e||Ni?(jn&&n&&Gn(t),t.flags|=1,Ui(e,t,r,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,aa(e,t,i))}function Bi(e,t,n,r,i){if(null===e){var a=n.type;return"function"!=typeof a||es(a)||void 0!==a.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=ns(n.type,null,r,t,t.mode,i)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=a,Gi(e,t,a,r,i))}if(a=e.child,0==(e.lanes&i)){var o=a.memoizedProps;if((n=null!==(n=n.compare)?n:$t)(o,r)&&e.ref===t.ref)return aa(e,t,i)}return t.flags|=1,(e=ts(a,r)).ref=t.ref,e.return=t,t.child=e}function Gi(e,t,n,r,i){if(null!==e&&$t(e.memoizedProps,r)&&e.ref===t.ref){if(Ni=!1,0==(e.lanes&i))return t.lanes=e.lanes,aa(e,t,i);0!=(131072&e.flags)&&(Ni=!0)}return Wi(e,t,n,r,i)}function Hi(e,t,n){var r=t.pendingProps,i=r.children,a=null!==e?e.memoizedState:null;if("hidden"===r.mode)if(0==(1&t.mode))t.memoizedState={baseLanes:0,cachePool:null},ut($a,Ka),Ka|=n;else{if(0==(1073741824&n))return e=null!==a?a.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null},t.updateQueue=null,ut($a,Ka),Ka|=e,null;t.memoizedState={baseLanes:0,cachePool:null},r=null!==a?a.baseLanes:n,ut($a,Ka),Ka|=r}else null!==a?(r=a.baseLanes|n,t.memoizedState=null):r=n,ut($a,Ka),Ka|=r;return Ui(e,t,i,n),t.child}function Vi(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Wi(e,t,n,r,i){var a=vt(n)?ft:ht.current;return a=pt(t,a),hn(t,i),n=Ir(e,t,n,r,a,i),r=Dr(),null===e||Ni?(jn&&r&&Gn(t),t.flags|=1,Ui(e,t,n,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,aa(e,t,i))}function ji(e,t,n,i,a){if(vt(n)){var o=!0;_t(t)}else o=!1;if(hn(t,a),null===t.stateNode)null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),En(t,n,i),Cn(t,n,i,a),i=!0;else if(null===e){var s=t.stateNode,l=t.memoizedProps;s.props=l;var u=s.context,c=n.contextType;c="object"===r(c)&&null!==c?dn(c):pt(t,c=vt(n)?ft:ht.current);var h=n.getDerivedStateFromProps,d="function"==typeof h||"function"==typeof s.getSnapshotBeforeUpdate;d||"function"!=typeof s.UNSAFE_componentWillReceiveProps&&"function"!=typeof s.componentWillReceiveProps||(l!==i||u!==c)&&An(t,s,i,c),pn=!1;var f=t.memoizedState;s.state=f,bn(t,i,s,a),u=t.memoizedState,l!==i||f!==u||dt.current||pn?("function"==typeof h&&(Sn(t,n,h,i),u=t.memoizedState),(l=pn||kn(t,n,l,i,f,u,c))?(d||"function"!=typeof s.UNSAFE_componentWillMount&&"function"!=typeof s.componentWillMount||("function"==typeof s.componentWillMount&&s.componentWillMount(),"function"==typeof s.UNSAFE_componentWillMount&&s.UNSAFE_componentWillMount()),"function"==typeof s.componentDidMount&&(t.flags|=4194308)):("function"==typeof s.componentDidMount&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=u),s.props=i,s.state=u,s.context=c,i=l):("function"==typeof s.componentDidMount&&(t.flags|=4194308),i=!1)}else{s=t.stateNode,mn(e,t),l=t.memoizedProps,c=t.type===t.elementType?l:tn(t.type,l),s.props=c,d=t.pendingProps,f=s.context,u="object"===r(u=n.contextType)&&null!==u?dn(u):pt(t,u=vt(n)?ft:ht.current);var p=n.getDerivedStateFromProps;(h="function"==typeof p||"function"==typeof s.getSnapshotBeforeUpdate)||"function"!=typeof s.UNSAFE_componentWillReceiveProps&&"function"!=typeof s.componentWillReceiveProps||(l!==d||f!==u)&&An(t,s,i,u),pn=!1,f=t.memoizedState,s.state=f,bn(t,i,s,a);var v=t.memoizedState;l!==d||f!==v||dt.current||pn?("function"==typeof p&&(Sn(t,n,p,i),v=t.memoizedState),(c=pn||kn(t,n,c,i,f,v,u)||!1)?(h||"function"!=typeof s.UNSAFE_componentWillUpdate&&"function"!=typeof s.componentWillUpdate||("function"==typeof s.componentWillUpdate&&s.componentWillUpdate(i,v,u),"function"==typeof s.UNSAFE_componentWillUpdate&&s.UNSAFE_componentWillUpdate(i,v,u)),"function"==typeof s.componentDidUpdate&&(t.flags|=4),"function"==typeof s.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof s.componentDidUpdate||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof s.getSnapshotBeforeUpdate||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=v),s.props=i,s.state=v,s.context=u,i=c):("function"!=typeof s.componentDidUpdate||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof s.getSnapshotBeforeUpdate||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),i=!1)}return qi(e,t,n,i,o,a)}function qi(e,t,n,r,i,a){Vi(e,t);var o=0!=(128&t.flags);if(!r&&!o)return i&&xt(t,n,!1),aa(e,t,a);r=t.stateNode,zi.current=t;var s=o&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&o?(t.child=or(t,e.child,null,a),t.child=or(t,null,s,a)):Ui(e,t,s,a),t.memoizedState=r.state,i&&xt(t,n,!0),t.child}function Xi(e){var t=e.stateNode;t.pendingContext?gt(0,t.pendingContext,t.pendingContext!==t.context):t.context&>(0,t.context,!1),fr(e,t.containerInfo)}function Yi(e,t,n,r,i){return er(),tr(i),t.flags|=256,Ui(e,t,n,r),t.child}var Zi={dehydrated:null,treeContext:null,retryLane:0};function Ji(e){return{baseLanes:e,cachePool:null}}function Qi(e,t,n){var r,i=t.pendingProps,a=gr.current,o=!1,l=0!=(128&t.flags);if((r=l)||(r=(null===e||null!==e.memoizedState)&&0!=(2&a)),r?(o=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(a|=1),ut(gr,1&a),null===e)return Qn(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(0==(1&t.mode)?t.lanes=1:Ue(e)?t.lanes=8:t.lanes=1073741824,null):(a=i.children,e=i.fallback,o?(i=t.mode,o=t.child,a={mode:"hidden",children:a},0==(1&i)&&null!==o?(o.childLanes=0,o.pendingProps=a):o=is(a,i,0,null),e=rs(e,i,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=Ji(n),t.memoizedState=Zi,e):Ki(t,a));if(null!==(a=e.memoizedState)){if(null!==(r=a.dehydrated)){if(l)return 256&t.flags?(t.flags&=-257,ta(e,t,n,Error(s(422)))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(o=i.fallback,a=t.mode,i=is({mode:"visible",children:i.children},a,0,null),(o=rs(o,a,n,null)).flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,0!=(1&t.mode)&&or(t,e.child,null,n),t.child.memoizedState=Ji(n),t.memoizedState=Zi,o);if(0==(1&t.mode))t=ta(e,t,n,null);else if(Ue(r))t=ta(e,t,n,Error(s(419)));else if(i=0!=(n&e.childLanes),Ni||i){if(null!==(i=Za)){switch(n&-n){case 4:o=2;break;case 16:o=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:o=32;break;case 536870912:o=268435456;break;default:o=0}0!==(i=0!=(o&(i.suspendedLanes|n))?0:o)&&i!==a.retryLane&&(a.retryLane=i,So(e,i,-1))}No(),t=ta(e,t,n,Error(s(421)))}else Ne(r)?(t.flags|=128,t.child=e.child,t=Zo.bind(null,e),Fe(r,t),t=null):(n=a.treeContext,Q&&(Wn=Ve(r),Vn=t,jn=!0,Xn=null,qn=!1,null!==n&&(Dn[On++]=Nn,Dn[On++]=Un,Dn[On++]=zn,Nn=n.id,Un=n.overflow,zn=t)),(t=Ki(t,t.pendingProps.children)).flags|=4096);return t}return o?(i=ea(e,t,i.children,i.fallback,n),o=t.child,a=e.child.memoizedState,o.memoizedState=null===a?Ji(n):{baseLanes:a.baseLanes|n,cachePool:null},o.childLanes=e.childLanes&~n,t.memoizedState=Zi,i):(n=$i(e,t,i.children,n),t.memoizedState=null,n)}return o?(i=ea(e,t,i.children,i.fallback,n),o=t.child,a=e.child.memoizedState,o.memoizedState=null===a?Ji(n):{baseLanes:a.baseLanes|n,cachePool:null},o.childLanes=e.childLanes&~n,t.memoizedState=Zi,i):(n=$i(e,t,i.children,n),t.memoizedState=null,n)}function Ki(e,t){return(t=is({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function $i(e,t,n,r){var i=e.child;return e=i.sibling,n=ts(i,{mode:"visible",children:n}),0==(1&t.mode)&&(n.lanes=r),n.return=t,n.sibling=null,null!==e&&(null===(r=t.deletions)?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n}function ea(e,t,n,r,i){var a=t.mode,o=(e=e.child).sibling,s={mode:"hidden",children:n};return 0==(1&a)&&t.child!==e?((n=t.child).childLanes=0,n.pendingProps=s,t.deletions=null):(n=ts(e,s)).subtreeFlags=14680064&e.subtreeFlags,null!==o?r=ts(o,r):(r=rs(r,a,i,null)).flags|=2,r.return=t,n.return=t,n.sibling=r,t.child=n,r}function ta(e,t,n,r){return null!==r&&tr(r),or(t,e.child,null,n),(e=Ki(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function na(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),cn(e.return,t,n)}function ra(e,t,n,r,i){var a=e.memoizedState;null===a?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function ia(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Ui(e,t,r.children,n),0!=(2&(r=gr.current)))r=1&r|2,t.flags|=128;else{if(null!==e&&0!=(128&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&na(e,n,t);else if(19===e.tag)na(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(ut(gr,r),0==(1&t.mode))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;null!==n;)null!==(e=n.alternate)&&null===yr(e)&&(i=n),n=n.sibling;null===(n=i)?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),ra(t,!1,i,n,a);break;case"backwards":for(n=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===yr(e)){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}ra(t,!0,n,null,a);break;case"together":ra(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function aa(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),no|=t.lanes,0==(n&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(s(153));if(null!==t.child){for(n=ts(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=ts(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function oa(e,t){switch(Hn(t),t.tag){case 1:return vt(t.type)&&mt(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return pr(),lt(dt),lt(ht),xr(),0!=(65536&(e=t.flags))&&0==(128&e)?(t.flags=-65537&e|128,t):null;case 5:return mr(t),null;case 13:if(lt(gr),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(s(340));er()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return lt(gr),null;case 4:return pr(),null;case 10:return un(t.type._context),null;case 22:case 23:return Io(),null;default:return null}}var sa=!1,la=!1,ua="function"==typeof WeakSet?WeakSet:Set,ca=null;function ha(e,t){var n=e.ref;if(null!==n)if("function"==typeof n)try{n(null)}catch(n){qo(e,t,n)}else n.current=null}function da(e,t,n){try{n()}catch(n){qo(e,t,n)}}var fa=!1;function pa(e,t,n){var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,void 0!==a&&da(t,n,a)}i=i.next}while(i!==r)}}function va(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function ma(e){var t=e.ref;if(null!==t){var n=e.stateNode;e=5===e.tag?D(n):n,"function"==typeof t?t(e):t.current=e}}function ga(e,t,n){if(jt&&"function"==typeof jt.onCommitFiberUnmount)try{jt.onCommitFiberUnmount(Wt,t)}catch(e){}switch(t.tag){case 0:case 11:case 14:case 15:if(null!==(e=t.updateQueue)&&null!==(e=e.lastEffect)){var r=e=e.next;do{var i=r,a=i.destroy;i=i.tag,void 0!==a&&(0!=(2&i)||0!=(4&i))&&da(t,n,a),r=r.next}while(r!==e)}break;case 1:if(ha(t,n),"function"==typeof(e=t.stateNode).componentWillUnmount)try{e.props=t.memoizedProps,e.state=t.memoizedState,e.componentWillUnmount()}catch(e){qo(t,n,e)}break;case 5:ha(t,n);break;case 4:Z?Ta(e,t,n):J&&J&&(t=t.stateNode.containerInfo,n=Ae(t),Le(t,n))}}function ya(e,t,n){for(var r=t;;)if(ga(e,r,n),null===r.child||Z&&4===r.tag){if(r===t)break;for(;null===r.sibling;){if(null===r.return||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}else r.child.return=r,r=r.child}function _a(e){var t=e.alternate;null!==t&&(e.alternate=null,_a(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&null!==(t=e.stateNode)&&te(t),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function xa(e){return 5===e.tag||3===e.tag||4===e.tag}function ba(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||xa(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function wa(e){if(Z){e:{for(var t=e.return;null!==t;){if(xa(t))break e;t=t.return}throw Error(s(160))}var n=t;switch(n.tag){case 5:t=n.stateNode,32&n.flags&&(be(t),n.flags&=-33),Sa(e,n=ba(e),t);break;case 3:case 4:t=n.stateNode.containerInfo,Ma(e,n=ba(e),t);break;default:throw Error(s(161))}}}function Ma(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?ye(n,e,t):fe(n,e);else if(4!==r&&null!==(e=e.child))for(Ma(e,t,n),e=e.sibling;null!==e;)Ma(e,t,n),e=e.sibling}function Sa(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?ge(n,e,t):de(n,e);else if(4!==r&&null!==(e=e.child))for(Sa(e,t,n),e=e.sibling;null!==e;)Sa(e,t,n),e=e.sibling}function Ta(e,t,n){for(var r,i,a=t,o=!1;;){if(!o){o=a.return;e:for(;;){if(null===o)throw Error(s(160));switch(r=o.stateNode,o.tag){case 5:i=!1;break e;case 3:case 4:r=r.containerInfo,i=!0;break e}o=o.return}o=!0}if(5===a.tag||6===a.tag)ya(e,a,n),i?xe(r,a.stateNode):_e(r,a.stateNode);else if(18===a.tag)i?Qe(r,a.stateNode):Je(r,a.stateNode);else if(4===a.tag){if(null!==a.child){r=a.stateNode.containerInfo,i=!0,a.child.return=a,a=a.child;continue}}else if(ga(e,a,n),null!==a.child){a.child.return=a,a=a.child;continue}if(a===t)break;for(;null===a.sibling;){if(null===a.return||a.return===t)return;4===(a=a.return).tag&&(o=!1)}a.sibling.return=a.return,a=a.sibling}}function ka(e,t){if(Z){switch(t.tag){case 0:case 11:case 14:case 15:return pa(3,t,t.return),va(3,t),void pa(5,t,t.return);case 1:case 12:case 17:return;case 5:var n=t.stateNode;if(null!=n){var r=t.memoizedProps;e=null!==e?e.memoizedProps:r;var i=t.type,a=t.updateQueue;t.updateQueue=null,null!==a&&me(n,a,i,e,r,t)}return;case 6:if(null===t.stateNode)throw Error(s(162));return n=t.memoizedProps,void pe(t.stateNode,null!==e?e.memoizedProps:n,n);case 3:return void(Q&&null!==e&&e.memoizedState.isDehydrated&&Ye(t.stateNode.containerInfo));case 13:case 19:return void Ea(t)}throw Error(s(163))}switch(t.tag){case 0:case 11:case 14:case 15:return pa(3,t,t.return),va(3,t),void pa(5,t,t.return);case 12:case 22:case 23:return;case 13:case 19:return void Ea(t);case 3:Q&&null!==e&&e.memoizedState.isDehydrated&&Ye(t.stateNode.containerInfo)}e:if(J){switch(t.tag){case 1:case 5:case 6:break e;case 3:case 4:t=t.stateNode,Le(t.containerInfo,t.pendingChildren);break e}throw Error(s(163))}}function Ea(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new ua),t.forEach((function(t){var r=Jo.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))}))}}function Aa(e,t,n){ca=e,Ca(e,t,n)}function Ca(e,t,n){for(var r=0!=(1&e.mode);null!==ca;){var i=ca,a=i.child;if(22===i.tag&&r){var o=null!==i.memoizedState||sa;if(!o){var s=i.alternate,l=null!==s&&null!==s.memoizedState||la;s=sa;var u=la;if(sa=o,(la=l)&&!u)for(ca=i;null!==ca;)l=(o=ca).child,22===o.tag&&null!==o.memoizedState?Ra(i):null!==l?(l.return=o,ca=l):Ra(i);for(;null!==a;)ca=a,Ca(a,t,n),a=a.sibling;ca=i,sa=s,la=u}Pa(e)}else 0!=(8772&i.subtreeFlags)&&null!==a?(a.return=i,ca=a):Pa(e)}}function Pa(e){for(;null!==ca;){var t=ca;if(0!=(8772&t.flags)){var n=t.alternate;try{if(0!=(8772&t.flags))switch(t.tag){case 0:case 11:case 15:la||va(5,t);break;case 1:var r=t.stateNode;if(4&t.flags&&!la)if(null===n)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:tn(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var a=t.updateQueue;null!==a&&wn(t,a,r);break;case 3:var o=t.updateQueue;if(null!==o){if(n=null,null!==t.child)switch(t.child.tag){case 5:n=D(t.child.stateNode);break;case 1:n=t.child.stateNode}wn(t,o,n)}break;case 5:var l=t.stateNode;null===n&&4&t.flags&&ve(l,t.type,t.memoizedProps,t);break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:break;case 13:if(Q&&null===t.memoizedState){var u=t.alternate;if(null!==u){var c=u.memoizedState;if(null!==c){var h=c.dehydrated;null!==h&&Ze(h)}}}break;default:throw Error(s(163))}la||512&t.flags&&ma(t)}catch(e){qo(t,t.return,e)}}if(t===e){ca=null;break}if(null!==(n=t.sibling)){n.return=t.return,ca=n;break}ca=t.return}}function La(e){for(;null!==ca;){var t=ca;if(t===e){ca=null;break}var n=t.sibling;if(null!==n){n.return=t.return,ca=n;break}ca=t.return}}function Ra(e){for(;null!==ca;){var t=ca;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{va(4,t)}catch(e){qo(t,n,e)}break;case 1:var r=t.stateNode;if("function"==typeof r.componentDidMount){var i=t.return;try{r.componentDidMount()}catch(e){qo(t,i,e)}}var a=t.return;try{ma(t)}catch(e){qo(t,a,e)}break;case 5:var o=t.return;try{ma(t)}catch(e){qo(t,o,e)}}}catch(e){qo(t,t.return,e)}if(t===e){ca=null;break}var s=t.sibling;if(null!==s){s.return=t.return,ca=s;break}ca=t.return}}var Ia=0,Da=1,Oa=2,za=3,Na=4;if("function"==typeof Symbol&&Symbol.for){var Ua=Symbol.for;Ia=Ua("selector.component"),Da=Ua("selector.has_pseudo_class"),Oa=Ua("selector.role"),za=Ua("selector.test_id"),Na=Ua("selector.text")}function Fa(e){var t=K(e);if(null!=t){if("string"!=typeof t.memoizedProps["data-testname"])throw Error(s(364));return t}if(null===(e=ae(e)))throw Error(s(362));return e.stateNode.current}function Ba(e,t){switch(t.$$typeof){case Ia:if(e.type===t.value)return!0;break;case Da:e:{t=t.value,e=[e,0];for(var n=0;n<e.length;){var r=e[n++],i=e[n++],a=t[i];if(5!==r.tag||!le(r)){for(;null!=a&&Ba(r,a);)a=t[++i];if(i===t.length){t=!0;break e}for(r=r.child;null!==r;)e.push(r,i),r=r.sibling}}t=!1}return t;case Oa:if(5===e.tag&&ue(e.stateNode,t.value))return!0;break;case Na:if((5===e.tag||6===e.tag)&&null!==(e=se(e))&&0<=e.indexOf(t.value))return!0;break;case za:if(5===e.tag&&"string"==typeof(e=e.memoizedProps["data-testname"])&&e.toLowerCase()===t.value.toLowerCase())return!0;break;default:throw Error(s(365))}return!1}function Ga(e){switch(e.$$typeof){case Ia:return"<"+(S(e.value)||"Unknown")+">";case Da:return":has("+(Ga(e)||"")+")";case Oa:return'[role="'+e.value+'"]';case Na:return'"'+e.value+'"';case za:return'[data-testname="'+e.value+'"]';default:throw Error(s(365))}}function Ha(e,t){var n=[];e=[e,0];for(var r=0;r<e.length;){var i=e[r++],a=e[r++],o=t[a];if(5!==i.tag||!le(i)){for(;null!=o&&Ba(i,o);)o=t[++a];if(a===t.length)n.push(i);else for(i=i.child;null!==i;)e.push(i,a),i=i.sibling}}return n}function Va(e,t){if(!ie)throw Error(s(363));e=Ha(e=Fa(e),t),t=[],e=Array.from(e);for(var n=0;n<e.length;){var r=e[n++];if(5===r.tag)le(r)||t.push(r.stateNode);else for(r=r.child;null!==r;)e.push(r),r=r.sibling}return t}var Wa=Math.ceil,ja=l.ReactCurrentDispatcher,qa=l.ReactCurrentOwner,Xa=l.ReactCurrentBatchConfig,Ya=0,Za=null,Ja=null,Qa=0,Ka=0,$a=st(0),eo=0,to=null,no=0,ro=0,io=0,ao=null,oo=null,so=0,lo=1/0;function uo(){lo=Ft()+500}var co,ho=!1,fo=null,po=null,vo=!1,mo=null,go=0,yo=0,_o=null,xo=-1,bo=0;function wo(){return 0!=(6&Ya)?Ft():-1!==xo?xo:xo=Ft()}function Mo(e){return 0==(1&e.mode)?1:0!=(2&Ya)&&0!==Qa?Qa&-Qa:null!==Kt.transition?(0===bo&&(e=St,0==(4194240&(St<<=1))&&(St=64),bo=e),bo):0!==(e=It)?e:ee()}function So(e,t,n){if(50<yo)throw yo=0,_o=null,Error(s(185));var r=To(e,t);return null===r?null:(Lt(r,t,n),0!=(2&Ya)&&r===Za||(r===Za&&(0==(2&Ya)&&(ro|=t),4===eo&&Po(r,Qa)),ko(r,n),1===t&&0===Ya&&0==(1&e.mode)&&(uo(),Yt&&Qt())),r)}function To(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}function ko(e,t){var n=e.callbackNode;!function(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-bt(a),s=1<<o,l=i[o];-1===l?0!=(s&n)&&0==(s&r)||(i[o]=At(s,t)):l<=t&&(e.expiredLanes|=s),a&=~s}}(e,t);var r=Et(e,e===Za?Qa:0);if(0===r)null!==n&&zt(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(null!=n&&zt(n),1===t)0===e.tag?function(e){Yt=!0,Jt(e)}(Lo.bind(null,e)):Jt(Lo.bind(null,e)),ne?re((function(){0===Ya&&Qt()})):Ot(Bt,Qt),n=null;else{switch(Dt(r)){case 1:n=Bt;break;case 4:n=Gt;break;case 16:default:n=Ht;break;case 536870912:n=Vt}n=Qo(n,Eo.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Eo(e,t){if(xo=-1,bo=0,0!=(6&Ya))throw Error(s(327));var n=e.callbackNode;if(Wo()&&e.callbackNode!==n)return null;var r=Et(e,e===Za?Qa:0);if(0===r)return null;if(0!=(30&r)||0!=(r&e.expiredLanes)||t)t=Uo(e,r);else{t=r;var i=Ya;Ya|=2;var a=zo();for(Za===e&&Qa===t||(uo(),Do(e,t));;)try{Bo();break}catch(t){Oo(e,t)}sn(),ja.current=a,Ya=i,null!==Ja?t=0:(Za=null,Qa=0,t=eo)}if(0!==t){if(2===t&&0!==(i=Ct(e))&&(r=i,t=Ao(e,i)),1===t)throw n=to,Do(e,0),Po(e,r),ko(e,Ft()),n;if(6===t)Po(e,r);else{if(i=e.current.alternate,0==(30&r)&&!function(e){for(var t=e;;){if(16384&t.flags){var n=t.updateQueue;if(null!==n&&null!==(n=n.stores))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!qt(a(),i))return!1}catch(e){return!1}}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(i)&&(2===(t=Uo(e,r))&&0!==(a=Ct(e))&&(r=a,t=Ao(e,a)),1===t))throw n=to,Do(e,0),Po(e,r),ko(e,Ft()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(s(345));case 2:case 5:Vo(e,oo);break;case 3:if(Po(e,r),(130023424&r)===r&&10<(t=so+500-Ft())){if(0!==Et(e,0))break;if(((i=e.suspendedLanes)&r)!==r){wo(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=j(Vo.bind(null,e,oo),t);break}Vo(e,oo);break;case 4:if(Po(e,r),(4194240&r)===r)break;for(t=e.eventTimes,i=-1;0<r;){var o=31-bt(r);a=1<<o,(o=t[o])>i&&(i=o),r&=~a}if(r=i,10<(r=(120>(r=Ft()-r)?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Wa(r/1960))-r)){e.timeoutHandle=j(Vo.bind(null,e,oo),r);break}Vo(e,oo);break;default:throw Error(s(329))}}}return ko(e,Ft()),e.callbackNode===n?Eo.bind(null,e):null}function Ao(e,t){var n=ao;return e.current.memoizedState.isDehydrated&&(Do(e,t).flags|=256),2!==(e=Uo(e,t))&&(t=oo,oo=n,null!==t&&Co(t)),e}function Co(e){null===oo?oo=e:oo.push.apply(oo,e)}function Po(e,t){for(t&=~io,t&=~ro,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-bt(t),r=1<<n;e[n]=-1,t&=~r}}function Lo(e){if(0!=(6&Ya))throw Error(s(327));Wo();var t=Et(e,0);if(0==(1&t))return ko(e,Ft()),null;var n=Uo(e,t);if(0!==e.tag&&2===n){var r=Ct(e);0!==r&&(t=r,n=Ao(e,r))}if(1===n)throw n=to,Do(e,0),Po(e,t),ko(e,Ft()),n;if(6===n)throw Error(s(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Vo(e,oo),ko(e,Ft()),null}function Ro(e){null!==mo&&0===mo.tag&&0==(6&Ya)&&Wo();var t=Ya;Ya|=1;var n=Xa.transition,r=It;try{if(Xa.transition=null,It=1,e)return e()}finally{It=r,Xa.transition=n,0==(6&(Ya=t))&&Qt()}}function Io(){Ka=$a.current,lt($a)}function Do(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==X&&(e.timeoutHandle=X,q(n)),null!==Ja)for(n=Ja.return;null!==n;){var r=n;switch(Hn(r),r.tag){case 1:null!=(r=r.type.childContextTypes)&&mt();break;case 3:pr(),lt(dt),lt(ht),xr();break;case 5:mr(r);break;case 4:pr();break;case 13:case 19:lt(gr);break;case 10:un(r.type._context);break;case 22:case 23:Io()}n=n.return}if(Za=e,Ja=e=ts(e.current,null),Qa=Ka=t,eo=0,to=null,io=ro=no=0,oo=ao=null,null!==fn){for(t=0;t<fn.length;t++)if(null!==(r=(n=fn[t]).interleaved)){n.interleaved=null;var i=r.next,a=n.pending;if(null!==a){var o=a.next;a.next=i,r.next=o}n.pending=r}fn=null}return e}function Oo(e,t){for(;;){var n=Ja;try{if(sn(),br.current=pi,Er){for(var i=Sr.memoizedState;null!==i;){var a=i.queue;null!==a&&(a.pending=null),i=i.next}Er=!1}if(Mr=0,kr=Tr=Sr=null,Ar=!1,Cr=0,qa.current=null,null===n||null===n.return){eo=1,to=t,Ja=null;break}e:{var o=e,l=n.return,u=n,c=t;if(t=Qa,u.flags|=32768,null!==c&&"object"===r(c)&&"function"==typeof c.then){var h=c,d=u,f=d.tag;if(0==(1&d.mode)&&(0===f||11===f||15===f)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var v=Ai(l);if(null!==v){v.flags&=-257,Ci(v,l,u,0,t),1&v.mode&&Ei(o,h,t),c=h;var m=(t=v).updateQueue;if(null===m){var g=new Set;g.add(c),t.updateQueue=g}else m.add(c);break e}if(0==(1&t)){Ei(o,h,t),No();break e}c=Error(s(426))}else if(jn&&1&u.mode){var y=Ai(l);if(null!==y){0==(65536&y.flags)&&(y.flags|=256),Ci(y,l,u,0,t),tr(c);break e}}o=c,4!==eo&&(eo=2),null===ao?ao=[o]:ao.push(o),c=yi(c,u),u=l;do{switch(u.tag){case 3:u.flags|=65536,t&=-t,u.lanes|=t,xn(u,Ti(0,c,t));break e;case 1:o=c;var _=u.type,x=u.stateNode;if(0==(128&u.flags)&&("function"==typeof _.getDerivedStateFromError||null!==x&&"function"==typeof x.componentDidCatch&&(null===po||!po.has(x)))){u.flags|=65536,t&=-t,u.lanes|=t,xn(u,ki(u,o,t));break e}}u=u.return}while(null!==u)}Ho(n)}catch(e){t=e,Ja===n&&null!==n&&(Ja=n=n.return);continue}break}}function zo(){var e=ja.current;return ja.current=pi,null===e?pi:e}function No(){0!==eo&&3!==eo&&2!==eo||(eo=4),null===Za||0==(268435455&no)&&0==(268435455&ro)||Po(Za,Qa)}function Uo(e,t){var n=Ya;Ya|=2;var r=zo();for(Za===e&&Qa===t||Do(e,t);;)try{Fo();break}catch(t){Oo(e,t)}if(sn(),Ya=n,ja.current=r,null!==Ja)throw Error(s(261));return Za=null,Qa=0,eo}function Fo(){for(;null!==Ja;)Go(Ja)}function Bo(){for(;null!==Ja&&!Nt();)Go(Ja)}function Go(e){var t=co(e.alternate,e,Ka);e.memoizedProps=e.pendingProps,null===t?Ho(e):Ja=t,qa.current=null}function Ho(e){var t=e;do{var n=t.alternate;if(e=t.return,0==(32768&t.flags)){if(null!==(n=Oi(n,t,Ka)))return void(Ja=n)}else{if(null!==(n=oa(n,t)))return n.flags&=32767,void(Ja=n);if(null===e)return eo=6,void(Ja=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}if(null!==(t=t.sibling))return void(Ja=t);Ja=t=e}while(null!==t);0===eo&&(eo=5)}function Vo(e,t){var n=It,r=Xa.transition;try{Xa.transition=null,It=1,function(e,t,n){do{Wo()}while(null!==mo);if(0!=(6&Ya))throw Error(s(327));var r=e.finishedWork,i=e.finishedLanes;if(null===r)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(s(177));e.callbackNode=null,e.callbackPriority=0;var a=r.lanes|r.childLanes;if(function(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-bt(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}(e,a),e===Za&&(Ja=Za=null,Qa=0),0==(2064&r.subtreeFlags)&&0==(2064&r.flags)||vo||(vo=!0,Qo(Ht,(function(){return Wo(),null}))),a=0!=(15990&r.flags),0!=(15990&r.subtreeFlags)||a){a=Xa.transition,Xa.transition=null;var o=It;It=1;var l=Ya;Ya|=4,qa.current=null,function(e,t){for(N(e.containerInfo),ca=t;null!==ca;)if(t=(e=ca).child,0!=(1028&e.subtreeFlags)&&null!==t)t.return=e,ca=t;else for(;null!==ca;){e=ca;try{var n=e.alternate;if(0!=(1024&e.flags))switch(e.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==n){var r=n.memoizedProps,i=n.memoizedState,a=e.stateNode,o=a.getSnapshotBeforeUpdate(e.elementType===e.type?r:tn(e.type,r),i);a.__reactInternalSnapshotBeforeUpdate=o}break;case 3:Z&&ke(e.stateNode.containerInfo);break;default:throw Error(s(163))}}catch(t){qo(e,e.return,t)}if(null!==(t=e.sibling)){t.return=e.return,ca=t;break}ca=e.return}n=fa,fa=!1}(e,r),function(e,t){for(ca=t;null!==ca;){var n=(t=ca).deletions;if(null!==n)for(var r=0;r<n.length;r++){var i=n[r];try{var a=e;Z?Ta(a,i,t):ya(a,i,t);var o=i.alternate;null!==o&&(o.return=null),i.return=null}catch(e){qo(i,t,e)}}if(n=t.child,0!=(12854&t.subtreeFlags)&&null!==n)n.return=t,ca=n;else for(;null!==ca;){t=ca;try{var s=t.flags;if(32&s&&Z&&be(t.stateNode),512&s){var l=t.alternate;if(null!==l){var u=l.ref;null!==u&&("function"==typeof u?u(null):u.current=null)}}if(8192&s)switch(t.tag){case 13:if(null!==t.memoizedState){var c=t.alternate;null!==c&&null!==c.memoizedState||(so=Ft())}break;case 22:var h=null!==t.memoizedState,d=t.alternate,f=null!==d&&null!==d.memoizedState;if(n=t,Z)e:if(r=n,i=h,a=null,Z)for(var p=r;;){if(5===p.tag){if(null===a){a=p;var v=p.stateNode;i?we(v):Se(p.stateNode,p.memoizedProps)}}else if(6===p.tag){if(null===a){var m=p.stateNode;i?Me(m):Te(m,p.memoizedProps)}}else if((22!==p.tag&&23!==p.tag||null===p.memoizedState||p===r)&&null!==p.child){p.child.return=p,p=p.child;continue}if(p===r)break;for(;null===p.sibling;){if(null===p.return||p.return===r)break e;a===p&&(a=null),p=p.return}a===p&&(a=null),p.sibling.return=p.return,p=p.sibling}if(h&&!f&&0!=(1&n.mode)){ca=n;for(var g=n.child;null!==g;){for(n=ca=g;null!==ca;){var y=(r=ca).child;switch(r.tag){case 0:case 11:case 14:case 15:pa(4,r,r.return);break;case 1:ha(r,r.return);var _=r.stateNode;if("function"==typeof _.componentWillUnmount){var x=r.return;try{_.props=r.memoizedProps,_.state=r.memoizedState,_.componentWillUnmount()}catch(e){qo(r,x,e)}}break;case 5:ha(r,r.return);break;case 22:if(null!==r.memoizedState){La(n);continue}}null!==y?(y.return=r,ca=y):La(n)}g=g.sibling}}}switch(4102&s){case 2:wa(t),t.flags&=-3;break;case 6:wa(t),t.flags&=-3,ka(t.alternate,t);break;case 4096:t.flags&=-4097;break;case 4100:t.flags&=-4097,ka(t.alternate,t);break;case 4:ka(t.alternate,t)}}catch(e){qo(t,t.return,e)}if(null!==(n=t.sibling)){n.return=t.return,ca=n;break}ca=t.return}}}(e,r),U(e.containerInfo),e.current=r,Aa(r,e,i),Ut(),Ya=l,It=o,Xa.transition=a}else e.current=r;if(vo&&(vo=!1,mo=e,go=i),0===(a=e.pendingLanes)&&(po=null),function(e){if(jt&&"function"==typeof jt.onCommitFiberRoot)try{jt.onCommitFiberRoot(Wt,e,void 0,128==(128&e.current.flags))}catch(e){}}(r.stateNode),ko(e,Ft()),null!==t)for(n=e.onRecoverableError,r=0;r<t.length;r++)n(t[r]);if(ho)throw ho=!1,e=fo,fo=null,e;0!=(1&go)&&0!==e.tag&&Wo(),0!=(1&(a=e.pendingLanes))?e===_o?yo++:(yo=0,_o=e):yo=0,Qt()}(e,t,n)}finally{Xa.transition=r,It=n}return null}function Wo(){if(null!==mo){var e=Dt(go),t=Xa.transition,n=It;try{if(Xa.transition=null,It=16>e?16:e,null===mo)var r=!1;else{if(e=mo,mo=null,go=0,0!=(6&Ya))throw Error(s(331));var i=Ya;for(Ya|=4,ca=e.current;null!==ca;){var a=ca,o=a.child;if(0!=(16&ca.flags)){var l=a.deletions;if(null!==l){for(var u=0;u<l.length;u++){var c=l[u];for(ca=c;null!==ca;){var h=ca;switch(h.tag){case 0:case 11:case 15:pa(8,h,a)}var d=h.child;if(null!==d)d.return=h,ca=d;else for(;null!==ca;){var f=(h=ca).sibling,p=h.return;if(_a(h),h===c){ca=null;break}if(null!==f){f.return=p,ca=f;break}ca=p}}}var v=a.alternate;if(null!==v){var m=v.child;if(null!==m){v.child=null;do{var g=m.sibling;m.sibling=null,m=g}while(null!==m)}}ca=a}}if(0!=(2064&a.subtreeFlags)&&null!==o)o.return=a,ca=o;else e:for(;null!==ca;){if(0!=(2048&(a=ca).flags))switch(a.tag){case 0:case 11:case 15:pa(9,a,a.return)}var y=a.sibling;if(null!==y){y.return=a.return,ca=y;break e}ca=a.return}}var _=e.current;for(ca=_;null!==ca;){var x=(o=ca).child;if(0!=(2064&o.subtreeFlags)&&null!==x)x.return=o,ca=x;else e:for(o=_;null!==ca;){if(0!=(2048&(l=ca).flags))try{switch(l.tag){case 0:case 11:case 15:va(9,l)}}catch(e){qo(l,l.return,e)}if(l===o){ca=null;break e}var b=l.sibling;if(null!==b){b.return=l.return,ca=b;break e}ca=l.return}}if(Ya=i,Qt(),jt&&"function"==typeof jt.onPostCommitFiberRoot)try{jt.onPostCommitFiberRoot(Wt,e)}catch(e){}r=!0}return r}finally{It=n,Xa.transition=t}}return!1}function jo(e,t,n){yn(e,t=Ti(0,t=yi(n,t),1)),t=wo(),null!==(e=To(e,1))&&(Lt(e,1,t),ko(e,t))}function qo(e,t,n){if(3===e.tag)jo(e,e,n);else for(;null!==t;){if(3===t.tag){jo(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===po||!po.has(r))){yn(t,e=ki(t,e=yi(n,e),1)),e=wo(),null!==(t=To(t,1))&&(Lt(t,1,e),ko(t,e));break}}t=t.return}}function Xo(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),t=wo(),e.pingedLanes|=e.suspendedLanes&n,Za===e&&(Qa&n)===n&&(4===eo||3===eo&&(130023424&Qa)===Qa&&500>Ft()-so?Do(e,0):io|=n),ko(e,t)}function Yo(e,t){0===t&&(0==(1&e.mode)?t=1:(t=Tt,0==(130023424&(Tt<<=1))&&(Tt=4194304)));var n=wo();null!==(e=To(e,t))&&(Lt(e,t,n),ko(e,n))}function Zo(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),Yo(e,n)}function Jo(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;null!==i&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(s(314))}null!==r&&r.delete(t),Yo(e,n)}function Qo(e,t){return Ot(e,t)}function Ko(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $o(e,t,n,r){return new Ko(e,t,n,r)}function es(e){return!(!(e=e.prototype)||!e.isReactComponent)}function ts(e,t){var n=e.alternate;return null===n?((n=$o(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ns(e,t,n,i,a,o){var l=2;if(i=e,"function"==typeof e)es(e)&&(l=1);else if("string"==typeof e)l=5;else e:switch(e){case h:return rs(n.children,a,o,t);case d:l=8,a|=8;break;case f:return(e=$o(12,n,t,2|a)).elementType=f,e.lanes=o,e;case g:return(e=$o(13,n,t,a)).elementType=g,e.lanes=o,e;case y:return(e=$o(19,n,t,a)).elementType=y,e.lanes=o,e;case b:return is(n,a,o,t);default:if("object"===r(e)&&null!==e)switch(e.$$typeof){case p:l=10;break e;case v:l=9;break e;case m:l=11;break e;case _:l=14;break e;case x:l=16,i=null;break e}throw Error(s(130,null==e?e:r(e),""))}return(t=$o(l,n,t,a)).elementType=e,t.type=i,t.lanes=o,t}function rs(e,t,n,r){return(e=$o(7,e,r,t)).lanes=n,e}function is(e,t,n,r){return(e=$o(22,e,r,t)).elementType=b,e.lanes=n,e.stateNode={},e}function as(e,t,n){return(e=$o(6,e,null,t)).lanes=n,e}function os(e,t,n){return(t=$o(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ss(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=X,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Pt(0),this.expirationTimes=Pt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pt(0),this.identifierPrefix=r,this.onRecoverableError=i,Q&&(this.mutableSourceEagerHydrationData=null)}function ls(e,t,n,r,i,a,o,s,l){return e=new ss(e,t,n,s,l),1===t?(t=1,!0===a&&(t|=8)):t=0,a=$o(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null},vn(a),e}function us(e){if(!e)return ct;e:{if(k(e=e._reactInternals)!==e||1!==e.tag)throw Error(s(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(vt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(s(171))}if(1===e.tag){var n=e.type;if(vt(n))return yt(e,n,t)}return t}function cs(e){var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(s(188));throw e=Object.keys(e).join(","),Error(s(268,e))}return null===(e=C(t))?null:e.stateNode}function hs(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function ds(e,t){hs(e,t),(e=e.alternate)&&hs(e,t)}function fs(e){return null===(e=C(e))?null:e.stateNode}function ps(){return null}return co=function(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps||dt.current)Ni=!0;else{if(0==(e.lanes&n)&&0==(128&t.flags))return Ni=!1,function(e,t,n){switch(t.tag){case 3:Xi(t),er();break;case 5:vr(t);break;case 1:vt(t.type)&&_t(t);break;case 4:fr(t,t.stateNode.containerInfo);break;case 10:ln(0,t.type._context,t.memoizedProps.value);break;case 13:var r=t.memoizedState;if(null!==r)return null!==r.dehydrated?(ut(gr,1&gr.current),t.flags|=128,null):0!=(n&t.child.childLanes)?Qi(e,t,n):(ut(gr,1&gr.current),null!==(e=aa(e,t,n))?e.sibling:null);ut(gr,1&gr.current);break;case 19:if(r=0!=(n&t.childLanes),0!=(128&e.flags)){if(r)return ia(e,t,n);t.flags|=128}var i=t.memoizedState;if(null!==i&&(i.rendering=null,i.tail=null,i.lastEffect=null),ut(gr,gr.current),r)break;return null;case 22:case 23:return t.lanes=0,Hi(e,t,n)}return aa(e,t,n)}(e,t,n);Ni=0!=(131072&e.flags)}else Ni=!1,jn&&0!=(1048576&t.flags)&&Bn(t,In,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps;var a=pt(t,ht.current);hn(t,n),a=Ir(null,t,i,e,a,n);var o=Dr();return t.flags|=1,"object"===r(a)&&null!==a&&"function"==typeof a.render&&void 0===a.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,vt(i)?(o=!0,_t(t)):o=!1,t.memoizedState=null!==a.state&&void 0!==a.state?a.state:null,vn(t),a.updater=Tn,t.stateNode=a,a._reactInternals=t,Cn(t,i,e,n),t=qi(null,t,i,!0,o,n)):(t.tag=0,jn&&o&&Gn(t),Ui(null,t,a,n),t=t.child),t;case 16:i=t.elementType;e:{switch(null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps,i=(a=i._init)(i._payload),t.type=i,a=t.tag=function(e){if("function"==typeof e)return es(e)?1:0;if(null!=e){if((e=e.$$typeof)===m)return 11;if(e===_)return 14}return 2}(i),e=tn(i,e),a){case 0:t=Wi(null,t,i,e,n);break e;case 1:t=ji(null,t,i,e,n);break e;case 11:t=Fi(null,t,i,e,n);break e;case 14:t=Bi(null,t,i,tn(i.type,e),n);break e}throw Error(s(306,i,""))}return t;case 0:return i=t.type,a=t.pendingProps,Wi(e,t,i,a=t.elementType===i?a:tn(i,a),n);case 1:return i=t.type,a=t.pendingProps,ji(e,t,i,a=t.elementType===i?a:tn(i,a),n);case 3:e:{if(Xi(t),null===e)throw Error(s(387));i=t.pendingProps,a=(o=t.memoizedState).element,mn(e,t),bn(t,i,null,n);var l=t.memoizedState;if(i=l.element,Q&&o.isDehydrated){if(o={element:i,isDehydrated:!1,cache:l.cache,transitions:l.transitions},t.updateQueue.baseState=o,t.memoizedState=o,256&t.flags){t=Yi(e,t,i,n,a=Error(s(423)));break e}if(i!==a){t=Yi(e,t,i,n,a=Error(s(424)));break e}for(Q&&(Wn=He(t.stateNode.containerInfo),Vn=t,jn=!0,Xn=null,qn=!1),n=sr(t,null,i,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(er(),i===a){t=aa(e,t,n);break e}Ui(e,t,i,n)}t=t.child}return t;case 5:return vr(t),null===e&&Qn(t),i=t.type,a=t.pendingProps,o=null!==e?e.memoizedProps:null,l=a.children,V(i,a)?l=null:null!==o&&V(i,o)&&(t.flags|=32),Vi(e,t),Ui(e,t,l,n),t.child;case 6:return null===e&&Qn(t),null;case 13:return Qi(e,t,n);case 4:return fr(t,t.stateNode.containerInfo),i=t.pendingProps,null===e?t.child=or(t,null,i,n):Ui(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,Fi(e,t,i,a=t.elementType===i?a:tn(i,a),n);case 7:return Ui(e,t,t.pendingProps,n),t.child;case 8:case 12:return Ui(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,ln(0,i,l=a.value),null!==o)if(qt(o.value,l)){if(o.children===a.children&&!dt.current){t=aa(e,t,n);break e}}else for(null!==(o=t.child)&&(o.return=t);null!==o;){var u=o.dependencies;if(null!==u){l=o.child;for(var c=u.firstContext;null!==c;){if(c.context===i){if(1===o.tag){(c=gn(-1,n&-n)).tag=2;var h=o.updateQueue;if(null!==h){var d=(h=h.shared).pending;null===d?c.next=c:(c.next=d.next,d.next=c),h.pending=c}}o.lanes|=n,null!==(c=o.alternate)&&(c.lanes|=n),cn(o.return,n,t),u.lanes|=n;break}c=c.next}}else if(10===o.tag)l=o.type===t.type?null:o.child;else if(18===o.tag){if(null===(l=o.return))throw Error(s(341));l.lanes|=n,null!==(u=l.alternate)&&(u.lanes|=n),cn(l,n,t),l=o.sibling}else l=o.child;if(null!==l)l.return=o;else for(l=o;null!==l;){if(l===t){l=null;break}if(null!==(o=l.sibling)){o.return=l.return,l=o;break}l=l.return}o=l}Ui(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,hn(t,n),i=i(a=dn(a)),t.flags|=1,Ui(e,t,i,n),t.child;case 14:return a=tn(i=t.type,t.pendingProps),Bi(e,t,i,a=tn(i.type,a),n);case 15:return Gi(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:tn(i,a),null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),t.tag=1,vt(i)?(e=!0,_t(t)):e=!1,hn(t,n),En(t,i,a),Cn(t,i,a,n),qi(null,t,i,!0,e,n);case 19:return ia(e,t,n);case 22:return Hi(e,t,n)}throw Error(s(156,t.tag))},t.attemptContinuousHydration=function(e){13===e.tag&&(So(e,134217728,wo()),ds(e,134217728))},t.attemptHydrationAtCurrentPriority=function(e){if(13===e.tag){var t=wo(),n=Mo(e);So(e,n,t),ds(e,n)}},t.attemptSynchronousHydration=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=kt(t.pendingLanes);0!==n&&(Rt(t,1|n),ko(t,Ft()),0==(6&Ya)&&(uo(),Qt()))}break;case 13:var r=wo();Ro((function(){return So(e,1,r)})),ds(e,1)}},t.batchedUpdates=function(e,t){var n=Ya;Ya|=1;try{return e(t)}finally{0===(Ya=n)&&(uo(),Yt&&Qt())}},t.createComponentSelector=function(e){return{$$typeof:Ia,value:e}},t.createContainer=function(e,t,n,r,i,a,o){return ls(e,t,!1,null,0,r,0,a,o)},t.createHasPseudoClassSelector=function(e){return{$$typeof:Da,value:e}},t.createHydrationContainer=function(e,t,n,r,i,a,o,s,l){return(e=ls(n,r,!0,e,0,a,0,s,l)).context=us(null),n=e.current,(a=gn(r=wo(),i=Mo(n))).callback=null!=t?t:null,yn(n,a),e.current.lanes=i,Lt(e,i,r),ko(e,r),e},t.createPortal=function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:c,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}},t.createRoleSelector=function(e){return{$$typeof:Oa,value:e}},t.createTestNameSelector=function(e){return{$$typeof:za,value:e}},t.createTextSelector=function(e){return{$$typeof:Na,value:e}},t.deferredUpdates=function(e){var t=It,n=Xa.transition;try{return Xa.transition=null,It=16,e()}finally{It=t,Xa.transition=n}},t.discreteUpdates=function(e,t,n,r,i){var a=It,o=Xa.transition;try{return Xa.transition=null,It=1,e(t,n,r,i)}finally{It=a,Xa.transition=o,0===Ya&&uo()}},t.findAllNodes=Va,t.findBoundingRects=function(e,t){if(!ie)throw Error(s(363));t=Va(e,t),e=[];for(var n=0;n<t.length;n++)e.push(oe(t[n]));for(t=e.length-1;0<t;t--)for(var r=(n=e[t]).x,i=r+n.width,a=n.y,o=a+n.height,l=t-1;0<=l;l--)if(t!==l){var u=e[l],c=u.x,h=c+u.width,d=u.y,f=d+u.height;if(r>=c&&a>=d&&i<=h&&o<=f){e.splice(t,1);break}if(!(r!==c||n.width!==u.width||f<a||d>o)){d>a&&(u.height+=d-a,u.y=a),f<o&&(u.height=o-d),e.splice(t,1);break}if(!(a!==d||n.height!==u.height||h<r||c>i)){c>r&&(u.width+=c-r,u.x=r),h<i&&(u.width=i-c),e.splice(t,1);break}}return e},t.findHostInstance=cs,t.findHostInstanceWithNoPortals=function(e){return null===(e=null!==(e=A(e))?L(e):null)?null:e.stateNode},t.findHostInstanceWithWarning=function(e){return cs(e)},t.flushControlled=function(e){var t=Ya;Ya|=1;var n=Xa.transition,r=It;try{Xa.transition=null,It=1,e()}finally{It=r,Xa.transition=n,0===(Ya=t)&&(uo(),Qt())}},t.flushPassiveEffects=Wo,t.flushSync=Ro,t.focusWithin=function(e,t){if(!ie)throw Error(s(363));for(t=Ha(e=Fa(e),t),t=Array.from(t),e=0;e<t.length;){var n=t[e++];if(!le(n)){if(5===n.tag&&ce(n.stateNode))return!0;for(n=n.child;null!==n;)t.push(n),n=n.sibling}}return!1},t.getCurrentUpdatePriority=function(){return It},t.getFindAllNodesFailureDescription=function(e,t){if(!ie)throw Error(s(363));var n=0,r=[];e=[Fa(e),0];for(var i=0;i<e.length;){var a=e[i++],o=e[i++],l=t[o];if((5!==a.tag||!le(a))&&(Ba(a,l)&&(r.push(Ga(l)),++o>n&&(n=o)),o<t.length))for(a=a.child;null!==a;)e.push(a,o),a=a.sibling}if(n<t.length){for(e=[];n<t.length;n++)e.push(Ga(t[n]));return"findAllNodes was able to match part of the selector:\n "+r.join(" > ")+"\n\nNo matching component was found for:\n "+e.join(" > ")}return null},t.getPublicRootInstance=function(e){return(e=e.current).child?5===e.child.tag?D(e.child.stateNode):e.child.stateNode:null},t.injectIntoDevTools=function(e){if(e={bundleType:e.bundleType,version:e.version,rendererPackageName:e.rendererPackageName,rendererConfig:e.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:l.ReactCurrentDispatcher,findHostInstanceByFiber:fs,findFiberByHostInstance:e.findFiberByHostInstance||ps,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},"undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)e=!1;else{var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)e=!0;else{try{Wt=t.inject(e),jt=t}catch(e){}e=!!t.checkDCE}}return e},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(e,t,n,r){if(!ie)throw Error(s(363));e=Va(e,t);var i=he(e,n,r).disconnect;return{disconnect:function(){i()}}},t.registerMutableSourceForHydration=function(e,t){var n=t._getVersion;n=n(t._source),null==e.mutableSourceEagerHydrationData?e.mutableSourceEagerHydrationData=[t,n]:e.mutableSourceEagerHydrationData.push(t,n)},t.runWithPriority=function(e,t){var n=It;try{return It=e,t()}finally{It=n}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(e,t,n,r){var i=t.current,a=wo(),o=Mo(i);return n=us(n),null===t.context?t.context=n:t.pendingContext=n,(t=gn(a,o)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),yn(i,t),null!==(e=So(i,o,a))&&_n(e,i,o),o},t}},266:(e,t,n)=>{"use strict";e.exports=n(489)},915:(e,t,n)=>{"use strict";e.exports=n(404)},507:(e,t)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function r(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,i=e[r];if(!(0<o(i,t)))break e;e[r]=t,e[n]=i,n=r}}function i(e){return 0===e.length?null:e[0]}function a(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,i=e.length,a=i>>>1;r<a;){var s=2*(r+1)-1,l=e[s],u=s+1,c=e[u];if(0>o(l,n))u<i&&0>o(c,l)?(e[r]=c,e[u]=n,r=u):(e[r]=l,e[s]=n,r=s);else{if(!(u<i&&0>o(c,n)))break e;e[r]=c,e[u]=n,r=u}}}return t}function o(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"===("undefined"==typeof performance?"undefined":n(performance))&&"function"==typeof performance.now){var s=performance;t.unstable_now=function(){return s.now()}}else{var l=Date,u=l.now();t.unstable_now=function(){return l.now()-u}}var c=[],h=[],d=1,f=null,p=3,v=!1,m=!1,g=!1,y="function"==typeof setTimeout?setTimeout:null,_="function"==typeof clearTimeout?clearTimeout:null,x="undefined"!=typeof setImmediate?setImmediate:null;function b(e){for(var t=i(h);null!==t;){if(null===t.callback)a(h);else{if(!(t.startTime<=e))break;a(h),t.sortIndex=t.expirationTime,r(c,t)}t=i(h)}}function w(e){if(g=!1,b(e),!m)if(null!==i(c))m=!0,D(M);else{var t=i(h);null!==t&&O(w,t.startTime-e)}}function M(e,n){m=!1,g&&(g=!1,_(E),E=-1),v=!0;var r=p;try{for(b(n),f=i(c);null!==f&&(!(f.expirationTime>n)||e&&!P());){var o=f.callback;if("function"==typeof o){f.callback=null,p=f.priorityLevel;var s=o(f.expirationTime<=n);n=t.unstable_now(),"function"==typeof s?f.callback=s:f===i(c)&&a(c),b(n)}else a(c);f=i(c)}if(null!==f)var l=!0;else{var u=i(h);null!==u&&O(w,u.startTime-n),l=!1}return l}finally{f=null,p=r,v=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var S,T=!1,k=null,E=-1,A=5,C=-1;function P(){return!(t.unstable_now()-C<A)}function L(){if(null!==k){var e=t.unstable_now();C=e;var n=!0;try{n=k(!0,e)}finally{n?S():(T=!1,k=null)}}else T=!1}if("function"==typeof x)S=function(){x(L)};else if("undefined"!=typeof MessageChannel){var R=new MessageChannel,I=R.port2;R.port1.onmessage=L,S=function(){I.postMessage(null)}}else S=function(){y(L,0)};function D(e){k=e,T||(T=!0,S())}function O(e,n){E=y((function(){e(t.unstable_now())}),n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){m||v||(m=!0,D(M))},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<e?Math.floor(1e3/e):5},t.unstable_getCurrentPriorityLevel=function(){return p},t.unstable_getFirstCallbackNode=function(){return i(c)},t.unstable_next=function(e){switch(p){case 1:case 2:case 3:var t=3;break;default:t=p}var n=p;p=t;try{return e()}finally{p=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=p;p=e;try{return t()}finally{p=n}},t.unstable_scheduleCallback=function(e,a,o){var s=t.unstable_now();switch(o="object"===n(o)&&null!==o&&"number"==typeof(o=o.delay)&&0<o?s+o:s,e){case 1:var l=-1;break;case 2:l=250;break;case 5:l=1073741823;break;case 4:l=1e4;break;default:l=5e3}return e={id:d++,callback:a,priorityLevel:e,startTime:o,expirationTime:l=o+l,sortIndex:-1},o>s?(e.sortIndex=o,r(h,e),null===i(c)&&e===i(h)&&(g?(_(E),E=-1):g=!0,O(w,o-s))):(e.sortIndex=l,r(c,e),m||v||(m=!0,D(M))),e},t.unstable_shouldYield=P,t.unstable_wrapCallback=function(e){var t=p;return function(){var n=p;p=t;try{return e.apply(this,arguments)}finally{p=n}}}},258:(e,t,n)=>{"use strict";e.exports=n(507)},440:e=>{e.exports=function(){return this.React}()}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";n.r(r),n.d(r,{Canvas:()=>Tg,ReactThreeFiber:()=>yv,_roots:()=>vm,act:()=>Lm,addAfterEffect:()=>rm,addEffect:()=>nm,addTail:()=>im,advance:()=>ym,applyProps:()=>bm,context:()=>Zv,createEvents:()=>Vv,createPortal:()=>Cm,createRoot:()=>Tm,dispose:()=>Cv,events:()=>Mg,extend:()=>qv,getRootState:()=>kv,invalidate:()=>gm,reconciler:()=>xm,render:()=>km,unmountComponentAtNode:()=>Am,useFrame:()=>hm,useGraph:()=>dm,useInstanceHandle:()=>lm,useLoader:()=>pm,useStore:()=>um,useThree:()=>cm});var e,t={};function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function a(e){var t="function"==typeof Map?new Map:void 0;return a=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return o(e,arguments,x(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),v(r,e)},a(e)}function o(e,t,n){return o=_()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&v(i,n.prototype),i},o.apply(null,arguments)}function s(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function l(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){s(a,r,i,o,l,"next",e)}function l(e){s(a,r,i,o,l,"throw",e)}o(void 0)}))}}function u(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=c(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function c(e,t){if(e){if("string"==typeof e)return h(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function d(){return d="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=f(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},d.apply(this,arguments)}function f(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=x(e)););return e}function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}function m(e){var t=_();return function(){var n,r=x(e);if(t){var i=x(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return g(this,n)}}function g(e,t){if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return y(e)}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function x(e){return x=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},x(e)}function b(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(){w=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},a=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",s=r.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var i=t&&t.prototype instanceof d?t:d,a=Object.create(i.prototype),o=new T(r||[]);return a._invoke=function(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return{value:void 0,done:!0}}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=b(o,n);if(s){if(s===h)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=c(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}(e,n,o),a}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var h={};function d(){}function f(){}function p(){}var v={};l(v,a,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(k([])));g&&g!==t&&n.call(g,a)&&(v=g);var y=p.prototype=d.prototype=Object.create(v);function _(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function r(a,o,s,l){var u=c(e[a],e,o);if("throw"!==u.type){var h=u.arg,d=h.value;return d&&"object"==i(d)&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){r("next",e,s,l)}),(function(e){r("throw",e,s,l)})):t.resolve(d).then((function(e){h.value=e,s(h)}),(function(e){return r("throw",e,s,l)}))}l(u.arg)}var a;this._invoke=function(e,n){function i(){return new t((function(t,i){r(e,n,t,i)}))}return a=a?a.then(i,i):i()}}function b(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,b(e,t),"throw"===t.method))return h;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var r=c(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,h;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function M(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(M,this),this.reset(!0)}function k(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return f.prototype=p,l(y,"constructor",p),l(p,"constructor",f),f.displayName=l(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,l(e,s,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},_(x.prototype),l(x.prototype,o,(function(){return this})),e.AsyncIterator=x,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new x(u(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},_(y),l(y,s,"Generator"),l(y,a,(function(){return this})),l(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=k,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return o.type="throw",o.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,h):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;S(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:k(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},e}function M(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function T(e,t,n){return t&&S(e.prototype,t),n&&S(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(t),n.d(t,{ACESFilmicToneMapping:()=>Me,AddEquation:()=>q,AddOperation:()=>ye,AdditiveAnimationBlendMode:()=>Zt,AdditiveBlending:()=>H,AlphaFormat:()=>tt,AlwaysDepth:()=>ue,AlwaysStencilFunc:()=>Sn,AmbientLight:()=>pd,AmbientLightProbe:()=>Pd,AnimationClip:()=>Nh,AnimationLoader:()=>Xh,AnimationMixer:()=>sf,AnimationObjectGroup:()=>rf,AnimationUtils:()=>Sh,ArcCurve:()=>Gu,ArrayCamera:()=>yl,ArrowHelper:()=>Kf,Audio:()=>Hd,AudioAnalyser:()=>Yd,AudioContext:()=>Ed,AudioListener:()=>Gd,AudioLoader:()=>Ad,AxesHelper:()=>$f,BackSide:()=>U,BasicDepthPacking:()=>tn,BasicShadowMap:()=>I,Bone:()=>ou,BooleanKeyframeTrack:()=>Ph,Box2:()=>_f,Box3:()=>Rr,Box3Helper:()=>Zf,BoxBufferGeometry:()=>lp,BoxGeometry:()=>Ra,BoxHelper:()=>Yf,BufferAttribute:()=>Yi,BufferGeometry:()=>da,BufferGeometryLoader:()=>bd,ByteType:()=>je,Cache:()=>Bh,Camera:()=>Na,CameraHelper:()=>Vf,CanvasTexture:()=>Uu,CapsuleBufferGeometry:()=>up,CapsuleGeometry:()=>lc,CatmullRomCurve3:()=>Xu,CineonToneMapping:()=>we,CircleBufferGeometry:()=>cp,CircleGeometry:()=>uc,ClampToEdgeWrapping:()=>Re,Clock:()=>Od,Color:()=>vr,ColorKeyframeTrack:()=>Lh,ColorManagement:()=>sr,CompressedTexture:()=>Nu,CompressedTextureLoader:()=>Yh,ConeBufferGeometry:()=>hp,ConeGeometry:()=>hc,CubeCamera:()=>Ba,CubeReflectionMapping:()=>ke,CubeRefractionMapping:()=>Ee,CubeTexture:()=>Ga,CubeTextureLoader:()=>Jh,CubeUVReflectionMapping:()=>Pe,CubicBezierCurve:()=>Qu,CubicBezierCurve3:()=>Ku,CubicInterpolant:()=>kh,CullFaceBack:()=>P,CullFaceFront:()=>L,CullFaceFrontBack:()=>R,CullFaceNone:()=>C,Curve:()=>Fu,CurvePath:()=>ac,CustomBlending:()=>j,CustomToneMapping:()=>Se,CylinderBufferGeometry:()=>dp,CylinderGeometry:()=>cc,Cylindrical:()=>gf,Data3DTexture:()=>Tr,DataArrayTexture:()=>Mr,DataTexture:()=>su,DataTexture2DArray:()=>op,DataTexture3D:()=>sp,DataTextureLoader:()=>Qh,DataUtils:()=>rp,DecrementStencilOp:()=>fn,DecrementWrapStencilOp:()=>vn,DefaultLoadingManager:()=>Hh,DepthFormat:()=>ot,DepthStencilFormat:()=>st,DepthTexture:()=>wl,DirectionalLight:()=>fd,DirectionalLightHelper:()=>Bf,DiscreteInterpolant:()=>Ah,DodecahedronBufferGeometry:()=>fp,DodecahedronGeometry:()=>fc,DoubleSide:()=>F,DstAlphaFactor:()=>re,DstColorFactor:()=>ae,DynamicCopyUsage:()=>Rn,DynamicDrawUsage:()=>kn,DynamicReadUsage:()=>Cn,EdgesGeometry:()=>yc,EllipseCurve:()=>Bu,EqualDepth:()=>de,EqualStencilFunc:()=>_n,EquirectangularReflectionMapping:()=>Ae,EquirectangularRefractionMapping:()=>Ce,Euler:()=>mi,EventDispatcher:()=>Nn,ExtrudeBufferGeometry:()=>pp,ExtrudeGeometry:()=>Yc,FileLoader:()=>qh,Float16BufferAttribute:()=>na,Float32BufferAttribute:()=>ra,Float64BufferAttribute:()=>ia,FloatType:()=>Je,Fog:()=>Ll,FogExp2:()=>Pl,FramebufferTexture:()=>zu,FrontSide:()=>N,Frustum:()=>Za,GLBufferAttribute:()=>df,GLSL1:()=>Dn,GLSL3:()=>On,GreaterDepth:()=>pe,GreaterEqualDepth:()=>fe,GreaterEqualStencilFunc:()=>Mn,GreaterStencilFunc:()=>bn,GridHelper:()=>Of,Group:()=>_l,HalfFloatType:()=>Qe,HemisphereLight:()=>ed,HemisphereLightHelper:()=>Df,HemisphereLightProbe:()=>Cd,IcosahedronBufferGeometry:()=>vp,IcosahedronGeometry:()=>Jc,ImageBitmapLoader:()=>kd,ImageLoader:()=>Zh,ImageUtils:()=>mr,ImmediateRenderObject:()=>ip,IncrementStencilOp:()=>dn,IncrementWrapStencilOp:()=>pn,InstancedBufferAttribute:()=>hu,InstancedBufferGeometry:()=>xd,InstancedInterleavedBuffer:()=>hf,InstancedMesh:()=>mu,Int16BufferAttribute:()=>Ki,Int32BufferAttribute:()=>ea,Int8BufferAttribute:()=>Zi,IntType:()=>Ye,InterleavedBuffer:()=>Il,InterleavedBufferAttribute:()=>Ol,Interpolant:()=>Th,InterpolateDiscrete:()=>Ht,InterpolateLinear:()=>Vt,InterpolateSmooth:()=>Wt,InvertStencilOp:()=>mn,KeepStencilOp:()=>cn,KeyframeTrack:()=>Ch,LOD:()=>$l,LatheBufferGeometry:()=>mp,LatheGeometry:()=>sc,Layers:()=>gi,LessDepth:()=>ce,LessEqualDepth:()=>he,LessEqualStencilFunc:()=>xn,LessStencilFunc:()=>yn,Light:()=>$h,LightProbe:()=>gd,Line:()=>Mu,Line3:()=>wf,LineBasicMaterial:()=>gu,LineCurve:()=>$u,LineCurve3:()=>ec,LineDashedMaterial:()=>gh,LineLoop:()=>Eu,LineSegments:()=>ku,LinearEncoding:()=>$t,LinearFilter:()=>Fe,LinearInterpolant:()=>Eh,LinearMipMapLinearFilter:()=>Ve,LinearMipMapNearestFilter:()=>Ge,LinearMipmapLinearFilter:()=>He,LinearMipmapNearestFilter:()=>Be,LinearSRGBColorSpace:()=>ln,LinearToneMapping:()=>xe,Loader:()=>Vh,LoaderUtils:()=>_d,LoadingManager:()=>Gh,LoopOnce:()=>Ft,LoopPingPong:()=>Gt,LoopRepeat:()=>Bt,LuminanceAlphaFormat:()=>at,LuminanceFormat:()=>it,MOUSE:()=>E,Material:()=>Wi,MaterialLoader:()=>yd,MathUtils:()=>Qn,Matrix3:()=>$n,Matrix4:()=>oi,MaxEquation:()=>J,Mesh:()=>Pa,MeshBasicMaterial:()=>ji,MeshDepthMaterial:()=>dl,MeshDistanceMaterial:()=>fl,MeshLambertMaterial:()=>vh,MeshMatcapMaterial:()=>mh,MeshNormalMaterial:()=>ph,MeshPhongMaterial:()=>dh,MeshPhysicalMaterial:()=>hh,MeshStandardMaterial:()=>ch,MeshToonMaterial:()=>fh,MinEquation:()=>Z,MirroredRepeatWrapping:()=>Ie,MixOperation:()=>ge,MultiplyBlending:()=>W,MultiplyOperation:()=>me,NearestFilter:()=>De,NearestMipMapLinearFilter:()=>Ue,NearestMipMapNearestFilter:()=>ze,NearestMipmapLinearFilter:()=>Ne,NearestMipmapNearestFilter:()=>Oe,NeverDepth:()=>le,NeverStencilFunc:()=>gn,NoBlending:()=>B,NoColorSpace:()=>on,NoToneMapping:()=>_e,NormalAnimationBlendMode:()=>Yt,NormalBlending:()=>G,NotEqualDepth:()=>ve,NotEqualStencilFunc:()=>wn,NumberKeyframeTrack:()=>Rh,Object3D:()=>Li,ObjectLoader:()=>wd,ObjectSpaceNormalMap:()=>an,OctahedronBufferGeometry:()=>gp,OctahedronGeometry:()=>Qc,OneFactor:()=>K,OneMinusDstAlphaFactor:()=>ie,OneMinusDstColorFactor:()=>oe,OneMinusSrcAlphaFactor:()=>ne,OneMinusSrcColorFactor:()=>ee,OrthographicCamera:()=>lo,PCFShadowMap:()=>D,PCFSoftShadowMap:()=>O,PMREMGenerator:()=>yo,Path:()=>oc,PerspectiveCamera:()=>Ua,Plane:()=>qa,PlaneBufferGeometry:()=>yp,PlaneGeometry:()=>Ka,PlaneHelper:()=>Jf,PointLight:()=>hd,PointLightHelper:()=>Pf,Points:()=>Iu,PointsMaterial:()=>Au,PolarGridHelper:()=>zf,PolyhedronBufferGeometry:()=>_p,PolyhedronGeometry:()=>dc,PositionalAudio:()=>Xd,PropertyBinding:()=>nf,PropertyMixer:()=>Zd,QuadraticBezierCurve:()=>tc,QuadraticBezierCurve3:()=>nc,Quaternion:()=>Ar,QuaternionKeyframeTrack:()=>Dh,QuaternionLinearInterpolant:()=>Ih,REVISION:()=>k,RGBADepthPacking:()=>nn,RGBAFormat:()=>rt,RGBAIntegerFormat:()=>dt,RGBA_ASTC_10x10_Format:()=>Ot,RGBA_ASTC_10x5_Format:()=>Rt,RGBA_ASTC_10x6_Format:()=>It,RGBA_ASTC_10x8_Format:()=>Dt,RGBA_ASTC_12x10_Format:()=>zt,RGBA_ASTC_12x12_Format:()=>Nt,RGBA_ASTC_4x4_Format:()=>St,RGBA_ASTC_5x4_Format:()=>Tt,RGBA_ASTC_5x5_Format:()=>kt,RGBA_ASTC_6x5_Format:()=>Et,RGBA_ASTC_6x6_Format:()=>At,RGBA_ASTC_8x5_Format:()=>Ct,RGBA_ASTC_8x6_Format:()=>Pt,RGBA_ASTC_8x8_Format:()=>Lt,RGBA_BPTC_Format:()=>Ut,RGBA_ETC2_EAC_Format:()=>Mt,RGBA_PVRTC_2BPPV1_Format:()=>xt,RGBA_PVRTC_4BPPV1_Format:()=>_t,RGBA_S3TC_DXT1_Format:()=>pt,RGBA_S3TC_DXT3_Format:()=>vt,RGBA_S3TC_DXT5_Format:()=>mt,RGBFormat:()=>nt,RGB_ETC1_Format:()=>bt,RGB_ETC2_Format:()=>wt,RGB_PVRTC_2BPPV1_Format:()=>yt,RGB_PVRTC_4BPPV1_Format:()=>gt,RGB_S3TC_DXT1_Format:()=>ft,RGFormat:()=>ct,RGIntegerFormat:()=>ht,RawShaderMaterial:()=>uh,Ray:()=>ai,Raycaster:()=>ff,RectAreaLight:()=>vd,RedFormat:()=>lt,RedIntegerFormat:()=>ut,ReinhardToneMapping:()=>be,RepeatWrapping:()=>Le,ReplaceStencilOp:()=>hn,ReverseSubtractEquation:()=>Y,RingBufferGeometry:()=>xp,RingGeometry:()=>Kc,SRGBColorSpace:()=>sn,Scene:()=>Rl,ShaderChunk:()=>$a,ShaderLib:()=>to,ShaderMaterial:()=>za,ShadowMaterial:()=>lh,Shape:()=>_c,ShapeBufferGeometry:()=>bp,ShapeGeometry:()=>$c,ShapePath:()=>ep,ShapeUtils:()=>jc,ShortType:()=>qe,Skeleton:()=>cu,SkeletonHelper:()=>Af,SkinnedMesh:()=>au,Source:()=>gr,Sphere:()=>Qr,SphereBufferGeometry:()=>wp,SphereGeometry:()=>eh,Spherical:()=>mf,SphericalHarmonics3:()=>md,SplineCurve:()=>rc,SpotLight:()=>od,SpotLightHelper:()=>Sf,Sprite:()=>Zl,SpriteMaterial:()=>zl,SrcAlphaFactor:()=>te,SrcAlphaSaturateFactor:()=>se,SrcColorFactor:()=>$,StaticCopyUsage:()=>Ln,StaticDrawUsage:()=>Tn,StaticReadUsage:()=>An,StereoCamera:()=>Dd,StreamCopyUsage:()=>In,StreamDrawUsage:()=>En,StreamReadUsage:()=>Pn,StringKeyframeTrack:()=>Oh,SubtractEquation:()=>X,SubtractiveBlending:()=>V,TOUCH:()=>A,TangentSpaceNormalMap:()=>rn,TetrahedronBufferGeometry:()=>Mp,TetrahedronGeometry:()=>th,Texture:()=>xr,TextureLoader:()=>Kh,TorusBufferGeometry:()=>Sp,TorusGeometry:()=>nh,TorusKnotBufferGeometry:()=>Tp,TorusKnotGeometry:()=>rh,Triangle:()=>Hi,TriangleFanDrawMode:()=>Kt,TriangleStripDrawMode:()=>Qt,TrianglesDrawMode:()=>Jt,TubeBufferGeometry:()=>kp,TubeGeometry:()=>ih,UVMapping:()=>Te,Uint16BufferAttribute:()=>$i,Uint32BufferAttribute:()=>ta,Uint8BufferAttribute:()=>Ji,Uint8ClampedBufferAttribute:()=>Qi,Uniform:()=>lf,UniformsGroup:()=>cf,UniformsLib:()=>eo,UniformsUtils:()=>Oa,UnsignedByteType:()=>We,UnsignedInt248Type:()=>et,UnsignedIntType:()=>Ze,UnsignedShort4444Type:()=>Ke,UnsignedShort5551Type:()=>$e,UnsignedShortType:()=>Xe,VSMShadowMap:()=>z,Vector2:()=>Kn,Vector3:()=>Cr,Vector4:()=>br,VectorKeyframeTrack:()=>zh,VideoTexture:()=>Ou,WebGL1Renderer:()=>Al,WebGL3DRenderTarget:()=>kr,WebGLArrayRenderTarget:()=>Sr,WebGLCubeRenderTarget:()=>Ha,WebGLMultipleRenderTargets:()=>Er,WebGLMultisampleRenderTarget:()=>ap,WebGLRenderTarget:()=>wr,WebGLRenderer:()=>El,WebGLUtils:()=>gl,WireframeGeometry:()=>ah,WrapAroundEnding:()=>Xt,ZeroCurvatureEnding:()=>jt,ZeroFactor:()=>Q,ZeroSlopeEnding:()=>qt,ZeroStencilOp:()=>un,_SRGBAFormat:()=>zn,sRGBEncoding:()=>en});var k="145",E={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},A={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},C=0,P=1,L=2,R=3,I=0,D=1,O=2,z=3,N=0,U=1,F=2,B=0,G=1,H=2,V=3,W=4,j=5,q=100,X=101,Y=102,Z=103,J=104,Q=200,K=201,$=202,ee=203,te=204,ne=205,re=206,ie=207,ae=208,oe=209,se=210,le=0,ue=1,ce=2,he=3,de=4,fe=5,pe=6,ve=7,me=0,ge=1,ye=2,_e=0,xe=1,be=2,we=3,Me=4,Se=5,Te=300,ke=301,Ee=302,Ae=303,Ce=304,Pe=306,Le=1e3,Re=1001,Ie=1002,De=1003,Oe=1004,ze=1004,Ne=1005,Ue=1005,Fe=1006,Be=1007,Ge=1007,He=1008,Ve=1008,We=1009,je=1010,qe=1011,Xe=1012,Ye=1013,Ze=1014,Je=1015,Qe=1016,Ke=1017,$e=1018,et=1020,tt=1021,nt=1022,rt=1023,it=1024,at=1025,ot=1026,st=1027,lt=1028,ut=1029,ct=1030,ht=1031,dt=1033,ft=33776,pt=33777,vt=33778,mt=33779,gt=35840,yt=35841,_t=35842,xt=35843,bt=36196,wt=37492,Mt=37496,St=37808,Tt=37809,kt=37810,Et=37811,At=37812,Ct=37813,Pt=37814,Lt=37815,Rt=37816,It=37817,Dt=37818,Ot=37819,zt=37820,Nt=37821,Ut=36492,Ft=2200,Bt=2201,Gt=2202,Ht=2300,Vt=2301,Wt=2302,jt=2400,qt=2401,Xt=2402,Yt=2500,Zt=2501,Jt=0,Qt=1,Kt=2,$t=3e3,en=3001,tn=3200,nn=3201,rn=0,an=1,on="",sn="srgb",ln="srgb-linear",un=0,cn=7680,hn=7681,dn=7682,fn=7683,pn=34055,vn=34056,mn=5386,gn=512,yn=513,_n=514,xn=515,bn=516,wn=517,Mn=518,Sn=519,Tn=35044,kn=35048,En=35040,An=35045,Cn=35049,Pn=35041,Ln=35046,Rn=35050,In=35042,Dn="100",On="300 es",zn=1035,Nn=function(){function e(){M(this,e)}return T(e,[{key:"addEventListener",value:function(e,t){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}},{key:"hasEventListener",value:function(e,t){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}},{key:"removeEventListener",value:function(e,t){if(void 0!==this._listeners){var n=this._listeners[e];if(void 0!==n){var r=n.indexOf(t);-1!==r&&n.splice(r,1)}}}},{key:"dispatchEvent",value:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var n=t.slice(0),r=0,i=n.length;r<i;r++)n[r].call(this,e);e.target=null}}}}]),e}(),Un=["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"],Fn=1234567,Bn=Math.PI/180,Gn=180/Math.PI;function Hn(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(Un[255&e]+Un[e>>8&255]+Un[e>>16&255]+Un[e>>24&255]+"-"+Un[255&t]+Un[t>>8&255]+"-"+Un[t>>16&15|64]+Un[t>>24&255]+"-"+Un[63&n|128]+Un[n>>8&255]+"-"+Un[n>>16&255]+Un[n>>24&255]+Un[255&r]+Un[r>>8&255]+Un[r>>16&255]+Un[r>>24&255]).toLowerCase()}function Vn(e,t,n){return Math.max(t,Math.min(n,e))}function Wn(e,t){return(e%t+t)%t}function jn(e,t,n){return(1-n)*e+n*t}function qn(e){return 0==(e&e-1)&&0!==e}function Xn(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function Yn(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function Zn(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function Jn(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}var Qn=Object.freeze({__proto__:null,DEG2RAD:Bn,RAD2DEG:Gn,generateUUID:Hn,clamp:Vn,euclideanModulo:Wn,mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:jn,damp:function(e,t,n,r){return jn(e,t,1-Math.exp(-n*r))},pingpong:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t-Math.abs(Wn(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(Fn=e);var t=Fn+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*Bn},radToDeg:function(e){return e*Gn},isPowerOfTwo:qn,ceilPowerOfTwo:Xn,floorPowerOfTwo:Yn,setQuaternionFromProperEuler:function(e,t,n,r,i){var a=Math.cos,o=Math.sin,s=a(n/2),l=o(n/2),u=a((t+r)/2),c=o((t+r)/2),h=a((t-r)/2),d=o((t-r)/2),f=a((r-t)/2),p=o((r-t)/2);switch(i){case"XYX":e.set(s*c,l*h,l*d,s*u);break;case"YZY":e.set(l*d,s*c,l*h,s*u);break;case"ZXZ":e.set(l*h,l*d,s*c,s*u);break;case"XZX":e.set(s*c,l*p,l*f,s*u);break;case"YXY":e.set(l*f,s*c,l*p,s*u);break;case"ZYZ":e.set(l*p,l*f,s*c,s*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}},normalize:Jn,denormalize:Zn}),Kn=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;M(this,t),t.prototype.isVector2=!0,this.x=e,this.y=n}return T(t,[{key:"width",get:function(){return this.x},set:function(e){this.x=e}},{key:"height",get:function(){return this.y},set:function(e){this.y=e}},{key:"set",value:function(e,t){return this.x=e,this.y=t,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setComponent",value:function(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}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}},{key:"sub",value:function(e){return this.x-=e.x,this.y-=e.y,this}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this}},{key:"divide",value:function(e){return this.x/=e.x,this.y/=e.y,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"applyMatrix3",value:function(e){var t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}},{key:"min",value:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}},{key:"max",value:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}},{key:"clamp",value:function(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}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},{key:"roundToZero",value:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y}},{key:"cross",value:function(e){return this.x*e.y-this.y*e.x}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"angle",value:function(){return Math.atan2(-this.y,-this.x)+Math.PI}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceToSquared(e))}},{key:"distanceToSquared",value:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n}},{key:"manhattanDistanceTo",value:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e}},{key:"fromBufferAttribute",value:function(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}},{key:"rotateAround",value:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this}},{key:Symbol.iterator,value:w().mark((function e(){return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:case"end":return e.stop()}}),e,this)}))}]),t}(),$n=function(){function e(){M(this,e),e.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}return T(e,[{key:"set",value:function(e,t,n,r,i,a,o,s,l){var u=this.elements;return u[0]=e,u[1]=r,u[2]=o,u[3]=t,u[4]=i,u[5]=s,u[6]=n,u[7]=a,u[8]=l,this}},{key:"identity",value:function(){return this.set(1,0,0,0,1,0,0,0,1),this}},{key:"copy",value:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}},{key:"extractBasis",value:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}},{key:"setFromMatrix4",value:function(e){var 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}},{key:"multiply",value:function(e){return this.multiplyMatrices(this,e)}},{key:"premultiply",value:function(e){return this.multiplyMatrices(e,this)}},{key:"multiplyMatrices",value:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],l=n[1],u=n[4],c=n[7],h=n[2],d=n[5],f=n[8],p=r[0],v=r[3],m=r[6],g=r[1],y=r[4],_=r[7],x=r[2],b=r[5],w=r[8];return i[0]=a*p+o*g+s*x,i[3]=a*v+o*y+s*b,i[6]=a*m+o*_+s*w,i[1]=l*p+u*g+c*x,i[4]=l*v+u*y+c*b,i[7]=l*m+u*_+c*w,i[2]=h*p+d*g+f*x,i[5]=h*v+d*y+f*b,i[8]=h*m+d*_+f*w,this}},{key:"multiplyScalar",value:function(e){var 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}},{key:"determinant",value:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8];return t*a*u-t*o*l-n*i*u+n*o*s+r*i*l-r*a*s}},{key:"invert",value:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8],c=u*a-o*l,h=o*s-u*i,d=l*i-a*s,f=t*c+n*h+r*d;if(0===f)return this.set(0,0,0,0,0,0,0,0,0);var p=1/f;return e[0]=c*p,e[1]=(r*l-u*n)*p,e[2]=(o*n-r*a)*p,e[3]=h*p,e[4]=(u*t-r*s)*p,e[5]=(r*i-o*t)*p,e[6]=d*p,e[7]=(n*s-l*t)*p,e[8]=(a*t-n*i)*p,this}},{key:"transpose",value:function(){var e,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}},{key:"getNormalMatrix",value:function(e){return this.setFromMatrix4(e).invert().transpose()}},{key:"transposeIntoArray",value:function(e){var 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}},{key:"setUvTransform",value:function(e,t,n,r,i,a,o){var s=Math.cos(i),l=Math.sin(i);return this.set(n*s,n*l,-n*(s*a+l*o)+a+e,-r*l,r*s,-r*(-l*a+s*o)+o+t,0,0,1),this}},{key:"scale",value:function(e,t){var n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}},{key:"rotate",value:function(e){var t=Math.cos(e),n=Math.sin(e),r=this.elements,i=r[0],a=r[3],o=r[6],s=r[1],l=r[4],u=r[7];return r[0]=t*i+n*s,r[3]=t*a+n*l,r[6]=t*o+n*u,r[1]=-n*i+t*s,r[4]=-n*a+t*l,r[7]=-n*o+t*u,this}},{key:"translate",value:function(e,t){var n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}},{key:"equals",value:function(e){for(var t=this.elements,n=e.elements,r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<9;n++)this.elements[n]=e[n+t];return this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}},{key:"clone",value:function(){return(new this.constructor).fromArray(this.elements)}}]),e}();function er(e){for(var t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}var tr={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function nr(e,t){return new tr[e](t)}function rr(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function ir(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function ar(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}var or=(b(e={},sn,b({},ln,ir)),b(e,ln,b({},sn,ar)),e),sr={legacyMode:!0,get workingColorSpace(){return ln},set workingColorSpace(e){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,n){if(this.legacyMode||t===n||!t||!n)return e;if(or[t]&&void 0!==or[t][n]){var r=or[t][n];return e.r=r(e.r),e.g=r(e.g),e.b=r(e.b),e}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}},lr={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},ur={r:0,g:0,b:0},cr={h:0,s:0,l:0},hr={h:0,s:0,l:0};function dr(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function fr(e,t){return t.r=e.r,t.g=e.g,t.b=e.b,t}var pr,vr=function(e){function t(e,n,r){return M(this,t),this.isColor=!0,this.r=1,this.g=1,this.b=1,void 0===n&&void 0===r?this.set(e):this.setRGB(e,n,r)}return T(t,[{key:"set",value:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}},{key:"setScalar",value:function(e){return this.r=e,this.g=e,this.b=e,this}},{key:"setHex",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:sn;return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,sr.toWorkingColorSpace(this,t),this}},{key:"setRGB",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ln;return this.r=e,this.g=t,this.b=n,sr.toWorkingColorSpace(this,r),this}},{key:"setHSL",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ln;if(e=Wn(e,1),t=Vn(t,0,1),n=Vn(n,0,1),0===t)this.r=this.g=this.b=n;else{var i=n<=.5?n*(1+t):n+t-n*t,a=2*n-i;this.r=dr(a,i,e+1/3),this.g=dr(a,i,e),this.b=dr(a,i,e-1/3)}return sr.toWorkingColorSpace(this,r),this}},{key:"setStyle",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:sn;function r(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(t=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){var i,a=t[1],o=t[2];switch(a){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,sr.toWorkingColorSpace(this,n),r(i[4]),this;if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,sr.toWorkingColorSpace(this,n),r(i[4]),this;break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){var s=parseFloat(i[1])/360,l=parseFloat(i[2])/100,u=parseFloat(i[3])/100;return r(i[4]),this.setHSL(s,l,u,n)}}}else if(t=/^\#([A-Fa-f\d]+)$/.exec(e)){var c=t[1],h=c.length;if(3===h)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,sr.toWorkingColorSpace(this,n),this;if(6===h)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,sr.toWorkingColorSpace(this,n),this}return e&&e.length>0?this.setColorName(e,n):this}},{key:"setColorName",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:sn,n=lr[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}},{key:"clone",value:function(){return new this.constructor(this.r,this.g,this.b)}},{key:"copy",value:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}},{key:"copySRGBToLinear",value:function(e){return this.r=ir(e.r),this.g=ir(e.g),this.b=ir(e.b),this}},{key:"copyLinearToSRGB",value:function(e){return this.r=ar(e.r),this.g=ar(e.g),this.b=ar(e.b),this}},{key:"convertSRGBToLinear",value:function(){return this.copySRGBToLinear(this),this}},{key:"convertLinearToSRGB",value:function(){return this.copyLinearToSRGB(this),this}},{key:"getHex",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:sn;return sr.fromWorkingColorSpace(fr(this,ur),e),Vn(255*ur.r,0,255)<<16^Vn(255*ur.g,0,255)<<8^Vn(255*ur.b,0,255)<<0}},{key:"getHexString",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:sn;return("000000"+this.getHex(e).toString(16)).slice(-6)}},{key:"getHSL",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ln;sr.fromWorkingColorSpace(fr(this,ur),t);var n,r,i=ur.r,a=ur.g,o=ur.b,s=Math.max(i,a,o),l=Math.min(i,a,o),u=(l+s)/2;if(l===s)n=0,r=0;else{var c=s-l;switch(r=u<=.5?c/(s+l):c/(2-s-l),s){case i:n=(a-o)/c+(a<o?6:0);break;case a:n=(o-i)/c+2;break;case o:n=(i-a)/c+4}n/=6}return e.h=n,e.s=r,e.l=u,e}},{key:"getRGB",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ln;return sr.fromWorkingColorSpace(fr(this,ur),t),e.r=ur.r,e.g=ur.g,e.b=ur.b,e}},{key:"getStyle",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:sn;return sr.fromWorkingColorSpace(fr(this,ur),e),e!==sn?"color(".concat(e," ").concat(ur.r," ").concat(ur.g," ").concat(ur.b,")"):"rgb(".concat(255*ur.r|0,",").concat(255*ur.g|0,",").concat(255*ur.b|0,")")}},{key:"offsetHSL",value:function(e,t,n){return this.getHSL(cr),cr.h+=e,cr.s+=t,cr.l+=n,this.setHSL(cr.h,cr.s,cr.l),this}},{key:"add",value:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}},{key:"addColors",value:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}},{key:"addScalar",value:function(e){return this.r+=e,this.g+=e,this.b+=e,this}},{key:"sub",value:function(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}},{key:"multiply",value:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}},{key:"multiplyScalar",value:function(e){return this.r*=e,this.g*=e,this.b*=e,this}},{key:"lerp",value:function(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}},{key:"lerpColors",value:function(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}},{key:"lerpHSL",value:function(e,t){this.getHSL(cr),e.getHSL(hr);var n=jn(cr.h,hr.h,t),r=jn(cr.s,hr.s,t),i=jn(cr.l,hr.l,t);return this.setHSL(n,r,i),this}},{key:"equals",value:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}},{key:"fromBufferAttribute",value:function(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}},{key:"toJSON",value:function(){return this.getHex()}},{key:Symbol.iterator,value:w().mark((function e(){return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.r;case 2:return e.next=4,this.g;case 4:return e.next=6,this.b;case 6:case"end":return e.stop()}}),e,this)}))}]),t}();vr.NAMES=lr;var mr=function(){function e(){M(this,e)}return T(e,null,[{key:"getDataURL",value:function(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;var t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===pr&&(pr=rr("canvas")),pr.width=e.width,pr.height=e.height;var n=pr.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=pr}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")}},{key:"sRGBToLinear",value:function(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var t=rr("canvas");t.width=e.width,t.height=e.height;var n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);for(var r=n.getImageData(0,0,e.width,e.height),i=r.data,a=0;a<i.length;a++)i[a]=255*ir(i[a]/255);return n.putImageData(r,0,0),t}if(e.data){for(var o=e.data.slice(0),s=0;s<o.length;s++)o instanceof Uint8Array||o instanceof Uint8ClampedArray?o[s]=Math.floor(255*ir(o[s]/255)):o[s]=ir(o[s]);return{data:o,width:e.width,height:e.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}]),e}(),gr=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;M(this,e),this.isSource=!0,this.uuid=Hn(),this.data=t,this.version=0}return T(e,[{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];var n={uuid:this.uuid,url:""},r=this.data;if(null!==r){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a<o;a++)r[a].isDataTexture?i.push(yr(r[a].image)):i.push(yr(r[a]))}else i=yr(r);n.url=i}return t||(e.images[this.uuid]=n),n}}]),e}();function yr(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?mr.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var _r=0,xr=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.DEFAULT_IMAGE,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.DEFAULT_MAPPING,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Re,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Re,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Fe,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:He,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:rt,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:We,h=arguments.length>8&&void 0!==arguments[8]?arguments[8]:1,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:$t;return M(this,n),(e=t.call(this)).isTexture=!0,Object.defineProperty(y(e),"id",{value:_r++}),e.uuid=Hn(),e.name="",e.source=new gr(r),e.mipmaps=[],e.mapping=i,e.wrapS=a,e.wrapT=o,e.magFilter=s,e.minFilter=l,e.anisotropy=h,e.format=u,e.internalFormat=null,e.type=c,e.offset=new Kn(0,0),e.repeat=new Kn(1,1),e.center=new Kn(0,0),e.rotation=0,e.matrixAutoUpdate=!0,e.matrix=new $n,e.generateMipmaps=!0,e.premultiplyAlpha=!1,e.flipY=!0,e.unpackAlignment=4,e.encoding=d,e.userData={},e.version=0,e.onUpdate=null,e.isRenderTargetTexture=!1,e.needsPMREMUpdate=!1,e}return T(n,[{key:"image",get:function(){return this.source.data},set:function(e){this.source.data=e}},{key:"updateMatrix",value:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,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.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,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,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"transformUv",value:function(e){if(this.mapping!==Te)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Le:e.x=e.x-Math.floor(e.x);break;case Re:e.x=e.x<0?0:1;break;case Ie:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case Le:e.y=e.y-Math.floor(e.y);break;case Re:e.y=e.y<0?0:1;break;case Ie:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}},{key:"needsUpdate",set:function(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}}]),n}(Nn);xr.DEFAULT_IMAGE=null,xr.DEFAULT_MAPPING=Te;var br=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;M(this,t),t.prototype.isVector4=!0,this.x=e,this.y=n,this.z=r,this.w=i}return T(t,[{key:"width",get:function(){return this.z},set:function(e){this.z=e}},{key:"height",get:function(){return this.w},set:function(e){this.w=e}},{key:"set",value:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setZ",value:function(e){return this.z=e,this}},{key:"setW",value:function(e){return this.w=e,this}},{key:"setComponent",value:function(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}},{key:"getComponent",value:function(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)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z,this.w)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}},{key:"addVectors",value:function(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}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}},{key:"sub",value:function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}},{key:"subVectors",value:function(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}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}},{key:"applyMatrix4",value:function(e){var t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"setAxisAngleFromQuaternion",value:function(e){this.w=2*Math.acos(e.w);var 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}},{key:"setAxisAngleFromRotationMatrix",value:function(e){var t,n,r,i,a=.01,o=.1,s=e.elements,l=s[0],u=s[4],c=s[8],h=s[1],d=s[5],f=s[9],p=s[2],v=s[6],m=s[10];if(Math.abs(u-h)<a&&Math.abs(c-p)<a&&Math.abs(f-v)<a){if(Math.abs(u+h)<o&&Math.abs(c+p)<o&&Math.abs(f+v)<o&&Math.abs(l+d+m-3)<o)return this.set(1,0,0,0),this;t=Math.PI;var g=(l+1)/2,y=(d+1)/2,_=(m+1)/2,x=(u+h)/4,b=(c+p)/4,w=(f+v)/4;return g>y&&g>_?g<a?(n=0,r=.707106781,i=.707106781):(r=x/(n=Math.sqrt(g)),i=b/n):y>_?y<a?(n=.707106781,r=0,i=.707106781):(n=x/(r=Math.sqrt(y)),i=w/r):_<a?(n=.707106781,r=.707106781,i=0):(n=b/(i=Math.sqrt(_)),r=w/i),this.set(n,r,i,t),this}var M=Math.sqrt((v-f)*(v-f)+(c-p)*(c-p)+(h-u)*(h-u));return Math.abs(M)<.001&&(M=1),this.x=(v-f)/M,this.y=(c-p)/M,this.z=(h-u)/M,this.w=Math.acos((l+d+m-1)/2),this}},{key:"min",value:function(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}},{key:"max",value:function(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}},{key:"clamp",value:function(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}},{key:"clampScalar",value:function(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}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){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}},{key:"ceil",value:function(){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}},{key:"round",value:function(){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}},{key:"roundToZero",value:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(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}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}},{key:"fromBufferAttribute",value:function(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}},{key:Symbol.iterator,value:w().mark((function e(){return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:return e.next=6,this.z;case 6:return e.next=8,this.w;case 8:case"end":return e.stop()}}),e,this)}))}]),t}(),wr=function(e){p(n,e);var t=m(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};M(this,n),(i=t.call(this)).isWebGLRenderTarget=!0,i.width=e,i.height=r,i.depth=1,i.scissor=new br(0,0,e,r),i.scissorTest=!1,i.viewport=new br(0,0,e,r);var o={width:e,height:r,depth:1};return i.texture=new xr(o,a.mapping,a.wrapS,a.wrapT,a.magFilter,a.minFilter,a.format,a.type,a.anisotropy,a.encoding),i.texture.isRenderTargetTexture=!0,i.texture.flipY=!1,i.texture.generateMipmaps=void 0!==a.generateMipmaps&&a.generateMipmaps,i.texture.internalFormat=void 0!==a.internalFormat?a.internalFormat:null,i.texture.minFilter=void 0!==a.minFilter?a.minFilter:Fe,i.depthBuffer=void 0===a.depthBuffer||a.depthBuffer,i.stencilBuffer=void 0!==a.stencilBuffer&&a.stencilBuffer,i.depthTexture=void 0!==a.depthTexture?a.depthTexture:null,i.samples=void 0!==a.samples?a.samples:0,i}return T(n,[{key:"setSize",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;this.width===e&&this.height===t&&this.depth===n||(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;var t=Object.assign({},e.texture.image);return this.texture.source=new gr(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),n}(Nn),Mr=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return M(this,n),(e=t.call(this,null)).isDataArrayTexture=!0,e.image={data:r,width:i,height:a,depth:o},e.magFilter=De,e.minFilter=De,e.wrapR=Re,e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return T(n)}(xr),Sr=function(e){p(n,e);var t=m(n);function n(e,r,i){var a;return M(this,n),(a=t.call(this,e,r)).isWebGLArrayRenderTarget=!0,a.depth=i,a.texture=new Mr(null,e,r,i),a.texture.isRenderTargetTexture=!0,a}return T(n)}(wr),Tr=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return M(this,n),(e=t.call(this,null)).isData3DTexture=!0,e.image={data:r,width:i,height:a,depth:o},e.magFilter=De,e.minFilter=De,e.wrapR=Re,e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return T(n)}(xr),kr=function(e){p(n,e);var t=m(n);function n(e,r,i){var a;return M(this,n),(a=t.call(this,e,r)).isWebGL3DRenderTarget=!0,a.depth=i,a.texture=new Tr(null,e,r,i),a.texture.isRenderTargetTexture=!0,a}return T(n)}(wr),Er=function(e){p(n,e);var t=m(n);function n(e,r,i){var a,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};M(this,n),(a=t.call(this,e,r,o)).isWebGLMultipleRenderTargets=!0;var s=a.texture;a.texture=[];for(var l=0;l<i;l++)a.texture[l]=s.clone(),a.texture[l].isRenderTargetTexture=!0;return a}return T(n,[{key:"setSize",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(var r=0,i=this.texture.length;r<i;r++)this.texture[r].image.width=e,this.texture[r].image.height=t,this.texture[r].image.depth=n;this.dispose()}return this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t),this}},{key:"copy",value:function(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.texture.length=0;for(var t=0,n=e.texture.length;t<n;t++)this.texture[t]=e.texture[t].clone(),this.texture[t].isRenderTargetTexture=!0;return this}}]),n}(wr),Ar=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;M(this,t),this.isQuaternion=!0,this._x=e,this._y=n,this._z=r,this._w=i}return T(t,[{key:"x",get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}},{key:"set",value:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._w)}},{key:"copy",value:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}},{key:"setFromEuler",value:function(e,t){var n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,l=o(n/2),u=o(r/2),c=o(i/2),h=s(n/2),d=s(r/2),f=s(i/2);switch(a){case"XYZ":this._x=h*u*c+l*d*f,this._y=l*d*c-h*u*f,this._z=l*u*f+h*d*c,this._w=l*u*c-h*d*f;break;case"YXZ":this._x=h*u*c+l*d*f,this._y=l*d*c-h*u*f,this._z=l*u*f-h*d*c,this._w=l*u*c+h*d*f;break;case"ZXY":this._x=h*u*c-l*d*f,this._y=l*d*c+h*u*f,this._z=l*u*f+h*d*c,this._w=l*u*c-h*d*f;break;case"ZYX":this._x=h*u*c-l*d*f,this._y=l*d*c+h*u*f,this._z=l*u*f-h*d*c,this._w=l*u*c+h*d*f;break;case"YZX":this._x=h*u*c+l*d*f,this._y=l*d*c+h*u*f,this._z=l*u*f-h*d*c,this._w=l*u*c-h*d*f;break;case"XZY":this._x=h*u*c-l*d*f,this._y=l*d*c-h*u*f,this._z=l*u*f+h*d*c,this._w=l*u*c+h*d*f;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this}},{key:"setFromAxisAngle",value:function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(e){var t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],l=t[2],u=t[6],c=t[10],h=n+o+c;if(h>0){var d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(u-s)*d,this._y=(i-l)*d,this._z=(a-r)*d}else if(n>o&&n>c){var f=2*Math.sqrt(1+n-o-c);this._w=(u-s)/f,this._x=.25*f,this._y=(r+a)/f,this._z=(i+l)/f}else if(o>c){var p=2*Math.sqrt(1+o-n-c);this._w=(i-l)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(s+u)/p}else{var v=2*Math.sqrt(1+c-n-o);this._w=(a-r)/v,this._x=(i+l)/v,this._y=(s+u)/v,this._z=.25*v}return this._onChangeCallback(),this}},{key:"setFromUnitVectors",value:function(e,t){var n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}},{key:"angleTo",value:function(e){return 2*Math.acos(Math.abs(Vn(this.dot(e),-1,1)))}},{key:"rotateTowards",value:function(e,t){var n=this.angleTo(e);if(0===n)return this;var r=Math.min(1,t/n);return this.slerp(e,r),this}},{key:"identity",value:function(){return this.set(0,0,0,1)}},{key:"invert",value:function(){return this.conjugate()}},{key:"conjugate",value:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}},{key:"dot",value:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}},{key:"lengthSq",value:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}},{key:"length",value:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}},{key:"normalize",value:function(){var e=this.length();return 0===e?(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}},{key:"multiply",value:function(e){return this.multiplyQuaternions(this,e)}},{key:"premultiply",value:function(e){return this.multiplyQuaternions(e,this)}},{key:"multiplyQuaternions",value:function(e,t){var n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,l=t._z,u=t._w;return this._x=n*u+a*o+r*l-i*s,this._y=r*u+a*s+i*o-n*l,this._z=i*u+a*l+n*s-r*o,this._w=a*u-n*o-r*s-i*l,this._onChangeCallback(),this}},{key:"slerp",value:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var l=1-t;return this._w=l*a+t*this._w,this._x=l*n+t*this._x,this._y=l*r+t*this._y,this._z=l*i+t*this._z,this.normalize(),this._onChangeCallback(),this}var u=Math.sqrt(s),c=Math.atan2(u,o),h=Math.sin((1-t)*c)/u,d=Math.sin(t*c)/u;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=r*h+this._y*d,this._z=i*h+this._z*d,this._onChangeCallback(),this}},{key:"slerpQuaternions",value:function(e,t,n){return this.copy(e).slerp(t,n)}},{key:"random",value:function(){var e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),r=2*Math.PI*Math.random(),i=2*Math.PI*Math.random();return this.set(t*Math.cos(r),n*Math.sin(i),n*Math.cos(i),t*Math.sin(r))}},{key:"equals",value:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}},{key:"fromBufferAttribute",value:function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}},{key:"_onChange",value:function(e){return this._onChangeCallback=e,this}},{key:"_onChangeCallback",value:function(){}},{key:Symbol.iterator,value:w().mark((function e(){return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._x;case 2:return e.next=4,this._y;case 4:return e.next=6,this._z;case 6:return e.next=8,this._w;case 8:case"end":return e.stop()}}),e,this)}))}],[{key:"slerpFlat",value:function(e,t,n,r,i,a,o){var s=n[r+0],l=n[r+1],u=n[r+2],c=n[r+3],h=i[a+0],d=i[a+1],f=i[a+2],p=i[a+3];if(0===o)return e[t+0]=s,e[t+1]=l,e[t+2]=u,void(e[t+3]=c);if(1===o)return e[t+0]=h,e[t+1]=d,e[t+2]=f,void(e[t+3]=p);if(c!==p||s!==h||l!==d||u!==f){var v=1-o,m=s*h+l*d+u*f+c*p,g=m>=0?1:-1,y=1-m*m;if(y>Number.EPSILON){var _=Math.sqrt(y),x=Math.atan2(_,m*g);v=Math.sin(v*x)/_,o=Math.sin(o*x)/_}var b=o*g;if(s=s*v+h*b,l=l*v+d*b,u=u*v+f*b,c=c*v+p*b,v===1-o){var w=1/Math.sqrt(s*s+l*l+u*u+c*c);s*=w,l*=w,u*=w,c*=w}}e[t]=s,e[t+1]=l,e[t+2]=u,e[t+3]=c}},{key:"multiplyQuaternionsFlat",value:function(e,t,n,r,i,a){var o=n[r],s=n[r+1],l=n[r+2],u=n[r+3],c=i[a],h=i[a+1],d=i[a+2],f=i[a+3];return e[t]=o*f+u*c+s*d-l*h,e[t+1]=s*f+u*h+l*c-o*d,e[t+2]=l*f+u*d+o*h-s*c,e[t+3]=u*f-o*c-s*h-l*d,e}}]),t}(),Cr=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;M(this,t),t.prototype.isVector3=!0,this.x=e,this.y=n,this.z=r}return T(t,[{key:"set",value:function(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this.z=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setZ",value:function(e){return this.z=e,this}},{key:"setComponent",value:function(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}},{key:"getComponent",value:function(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)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this.z+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}},{key:"sub",value:function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this.z-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this.z*=e,this}},{key:"multiplyVectors",value:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}},{key:"applyEuler",value:function(e){return this.applyQuaternion(Lr.setFromEuler(e))}},{key:"applyAxisAngle",value:function(e,t){return this.applyQuaternion(Lr.setFromAxisAngle(e,t))}},{key:"applyMatrix3",value:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}},{key:"applyNormalMatrix",value:function(e){return this.applyMatrix3(e).normalize()}},{key:"applyMatrix4",value:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}},{key:"applyQuaternion",value:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,l=s*t+a*r-o*n,u=s*n+o*t-i*r,c=s*r+i*n-a*t,h=-i*t-a*n-o*r;return this.x=l*s+h*-i+u*-o-c*-a,this.y=u*s+h*-a+c*-i-l*-o,this.z=c*s+h*-o+l*-a-u*-i,this}},{key:"project",value:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}},{key:"unproject",value:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}},{key:"transformDirection",value:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}},{key:"divide",value:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"min",value:function(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}},{key:"max",value:function(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}},{key:"clamp",value:function(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}},{key:"clampScalar",value:function(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}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}},{key:"roundToZero",value:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y+this.z*e.z}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(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}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}},{key:"cross",value:function(e){return this.crossVectors(this,e)}},{key:"crossVectors",value:function(e,t){var n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}},{key:"projectOnVector",value:function(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}},{key:"projectOnPlane",value:function(e){return Pr.copy(this).projectOnVector(e),this.sub(Pr)}},{key:"reflect",value:function(e){return this.sub(Pr.copy(e).multiplyScalar(2*this.dot(e)))}},{key:"angleTo",value:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(Vn(n,-1,1))}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceToSquared(e))}},{key:"distanceToSquared",value:function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}},{key:"manhattanDistanceTo",value:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}},{key:"setFromSpherical",value:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}},{key:"setFromSphericalCoords",value:function(e,t,n){var r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}},{key:"setFromCylindrical",value:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}},{key:"setFromCylindricalCoords",value:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}},{key:"setFromMatrixPosition",value:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}},{key:"setFromMatrixScale",value:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}},{key:"setFromMatrixColumn",value:function(e,t){return this.fromArray(e.elements,4*t)}},{key:"setFromMatrix3Column",value:function(e,t){return this.fromArray(e.elements,3*t)}},{key:"setFromEuler",value:function(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}},{key:"fromBufferAttribute",value:function(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}},{key:"randomDirection",value:function(){var e=2*(Math.random()-.5),t=Math.random()*Math.PI*2,n=Math.sqrt(1-Math.pow(e,2));return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}},{key:Symbol.iterator,value:w().mark((function e(){return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:return e.next=6,this.z;case 6:case"end":return e.stop()}}),e,this)}))}]),t}(),Pr=new Cr,Lr=new Ar,Rr=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Cr(1/0,1/0,1/0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Cr(-1/0,-1/0,-1/0);M(this,e),this.isBox3=!0,this.min=t,this.max=n}return T(e,[{key:"set",value:function(e,t){return this.min.copy(e),this.max.copy(t),this}},{key:"setFromArray",value:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,l=e.length;s<l;s+=3){var u=e[s],c=e[s+1],h=e[s+2];u<t&&(t=u),c<n&&(n=c),h<r&&(r=h),u>i&&(i=u),c>a&&(a=c),h>o&&(o=h)}return this.min.set(t,n,r),this.max.set(i,a,o),this}},{key:"setFromBufferAttribute",value:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,l=e.count;s<l;s++){var u=e.getX(s),c=e.getY(s),h=e.getZ(s);u<t&&(t=u),c<n&&(n=c),h<r&&(r=h),u>i&&(i=u),c>a&&(a=c),h>o&&(o=h)}return this.min.set(t,n,r),this.max.set(i,a,o),this}},{key:"setFromPoints",value:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}},{key:"setFromCenterAndSize",value:function(e,t){var n=Dr.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}},{key:"setFromObject",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.makeEmpty(),this.expandByObject(e,t)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.min.copy(e.min),this.max.copy(e.max),this}},{key:"makeEmpty",value:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}},{key:"isEmpty",value:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}},{key:"getCenter",value:function(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}},{key:"getSize",value:function(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}},{key:"expandByPoint",value:function(e){return this.min.min(e),this.max.max(e),this}},{key:"expandByVector",value:function(e){return this.min.sub(e),this.max.add(e),this}},{key:"expandByScalar",value:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this}},{key:"expandByObject",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.updateWorldMatrix(!1,!1);var n=e.geometry;if(void 0!==n)if(t&&null!=n.attributes&&void 0!==n.attributes.position)for(var r=n.attributes.position,i=0,a=r.count;i<a;i++)Dr.fromBufferAttribute(r,i).applyMatrix4(e.matrixWorld),this.expandByPoint(Dr);else null===n.boundingBox&&n.computeBoundingBox(),Or.copy(n.boundingBox),Or.applyMatrix4(e.matrixWorld),this.union(Or);for(var o=e.children,s=0,l=o.length;s<l;s++)this.expandByObject(o[s],t);return this}},{key:"containsPoint",value:function(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)}},{key:"containsBox",value:function(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}},{key:"getParameter",value:function(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))}},{key:"intersectsBox",value:function(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)}},{key:"intersectsSphere",value:function(e){return this.clampPoint(e.center,Dr),Dr.distanceToSquared(e.center)<=e.radius*e.radius}},{key:"intersectsPlane",value:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}},{key:"intersectsTriangle",value:function(e){if(this.isEmpty())return!1;this.getCenter(Hr),Vr.subVectors(this.max,Hr),zr.subVectors(e.a,Hr),Nr.subVectors(e.b,Hr),Ur.subVectors(e.c,Hr),Fr.subVectors(Nr,zr),Br.subVectors(Ur,Nr),Gr.subVectors(zr,Ur);var t=[0,-Fr.z,Fr.y,0,-Br.z,Br.y,0,-Gr.z,Gr.y,Fr.z,0,-Fr.x,Br.z,0,-Br.x,Gr.z,0,-Gr.x,-Fr.y,Fr.x,0,-Br.y,Br.x,0,-Gr.y,Gr.x,0];return!!qr(t,zr,Nr,Ur,Vr)&&!!qr(t=[1,0,0,0,1,0,0,0,1],zr,Nr,Ur,Vr)&&(Wr.crossVectors(Fr,Br),qr(t=[Wr.x,Wr.y,Wr.z],zr,Nr,Ur,Vr))}},{key:"clampPoint",value:function(e,t){return t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return Dr.copy(e).clamp(this.min,this.max).sub(e).length()}},{key:"getBoundingSphere",value:function(e){return this.getCenter(e.center),e.radius=.5*this.getSize(Dr).length(),e}},{key:"intersect",value:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}},{key:"union",value:function(e){return this.min.min(e.min),this.max.max(e.max),this}},{key:"applyMatrix4",value:function(e){return this.isEmpty()||(Ir[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ir[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ir[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ir[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ir[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ir[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ir[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ir[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ir)),this}},{key:"translate",value:function(e){return this.min.add(e),this.max.add(e),this}},{key:"equals",value:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}]),e}(),Ir=[new Cr,new Cr,new Cr,new Cr,new Cr,new Cr,new Cr,new Cr],Dr=new Cr,Or=new Rr,zr=new Cr,Nr=new Cr,Ur=new Cr,Fr=new Cr,Br=new Cr,Gr=new Cr,Hr=new Cr,Vr=new Cr,Wr=new Cr,jr=new Cr;function qr(e,t,n,r,i){for(var a=0,o=e.length-3;a<=o;a+=3){jr.fromArray(e,a);var s=i.x*Math.abs(jr.x)+i.y*Math.abs(jr.y)+i.z*Math.abs(jr.z),l=t.dot(jr),u=n.dot(jr),c=r.dot(jr);if(Math.max(-Math.max(l,u,c),Math.min(l,u,c))>s)return!1}return!0}var Xr=new Rr,Yr=new Cr,Zr=new Cr,Jr=new Cr,Qr=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Cr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;M(this,e),this.center=t,this.radius=n}return T(e,[{key:"set",value:function(e,t){return this.center.copy(e),this.radius=t,this}},{key:"setFromPoints",value:function(e,t){var n=this.center;void 0!==t?n.copy(t):Xr.setFromPoints(e).getCenter(n);for(var r=0,i=0,a=e.length;i<a;i++)r=Math.max(r,n.distanceToSquared(e[i]));return this.radius=Math.sqrt(r),this}},{key:"copy",value:function(e){return this.center.copy(e.center),this.radius=e.radius,this}},{key:"isEmpty",value:function(){return this.radius<0}},{key:"makeEmpty",value:function(){return this.center.set(0,0,0),this.radius=-1,this}},{key:"containsPoint",value:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}},{key:"distanceToPoint",value:function(e){return e.distanceTo(this.center)-this.radius}},{key:"intersectsSphere",value:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}},{key:"intersectsBox",value:function(e){return e.intersectsSphere(this)}},{key:"intersectsPlane",value:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}},{key:"clampPoint",value:function(e,t){var n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}},{key:"getBoundingBox",value:function(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}},{key:"applyMatrix4",value:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}},{key:"translate",value:function(e){return this.center.add(e),this}},{key:"expandByPoint",value:function(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Jr.subVectors(e,this.center);var t=Jr.lengthSq();if(t>this.radius*this.radius){var n=Math.sqrt(t),r=.5*(n-this.radius);this.center.add(Jr.multiplyScalar(r/n)),this.radius+=r}return this}},{key:"union",value:function(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?Zr.set(0,0,1).multiplyScalar(e.radius):Zr.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(Yr.copy(e.center).add(Zr)),this.expandByPoint(Yr.copy(e.center).sub(Zr)),this)}},{key:"equals",value:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),Kr=new Cr,$r=new Cr,ei=new Cr,ti=new Cr,ni=new Cr,ri=new Cr,ii=new Cr,ai=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Cr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Cr(0,0,-1);M(this,e),this.origin=t,this.direction=n}return T(e,[{key:"set",value:function(e,t){return this.origin.copy(e),this.direction.copy(t),this}},{key:"copy",value:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}},{key:"at",value:function(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}},{key:"lookAt",value:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this}},{key:"recast",value:function(e){return this.origin.copy(this.at(e,Kr)),this}},{key:"closestPointToPoint",value:function(e,t){t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)}},{key:"distanceToPoint",value:function(e){return Math.sqrt(this.distanceSqToPoint(e))}},{key:"distanceSqToPoint",value:function(e){var t=Kr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Kr.copy(this.direction).multiplyScalar(t).add(this.origin),Kr.distanceToSquared(e))}},{key:"distanceSqToSegment",value:function(e,t,n,r){$r.copy(e).add(t).multiplyScalar(.5),ei.copy(t).sub(e).normalize(),ti.copy(this.origin).sub($r);var i,a,o,s,l=.5*e.distanceTo(t),u=-this.direction.dot(ei),c=ti.dot(this.direction),h=-ti.dot(ei),d=ti.lengthSq(),f=Math.abs(1-u*u);if(f>0)if(a=u*c-h,s=l*f,(i=u*h-c)>=0)if(a>=-s)if(a<=s){var p=1/f;o=(i*=p)*(i+u*(a*=p)+2*c)+a*(u*i+a+2*h)+d}else a=l,o=-(i=Math.max(0,-(u*a+c)))*i+a*(a+2*h)+d;else a=-l,o=-(i=Math.max(0,-(u*a+c)))*i+a*(a+2*h)+d;else a<=-s?o=-(i=Math.max(0,-(-u*l+c)))*i+(a=i>0?-l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d:a<=s?(i=0,o=(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+d):o=-(i=Math.max(0,-(u*l+c)))*i+(a=i>0?l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d;else a=u>0?-l:l,o=-(i=Math.max(0,-(u*a+c)))*i+a*(a+2*h)+d;return n&&n.copy(this.direction).multiplyScalar(i).add(this.origin),r&&r.copy(ei).multiplyScalar(a).add($r),o}},{key:"intersectSphere",value:function(e,t){Kr.subVectors(e.center,this.origin);var n=Kr.dot(this.direction),r=Kr.dot(Kr)-n*n,i=e.radius*e.radius;if(r>i)return null;var a=Math.sqrt(i-r),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)}},{key:"intersectsSphere",value:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}},{key:"distanceToPlane",value:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}},{key:"intersectPlane",value:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}},{key:"intersectsPlane",value:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}},{key:"intersectBox",value:function(e,t){var n,r,i,a,o,s,l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,h=this.origin;return l>=0?(n=(e.min.x-h.x)*l,r=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,r=(e.min.x-h.x)*l),u>=0?(i=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(i=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),n>a||i>r?null:((i>n||n!=n)&&(n=i),(a<r||r!=r)&&(r=a),c>=0?(o=(e.min.z-h.z)*c,s=(e.max.z-h.z)*c):(o=(e.max.z-h.z)*c,s=(e.min.z-h.z)*c),n>s||o>r?null:((o>n||n!=n)&&(n=o),(s<r||r!=r)&&(r=s),r<0?null:this.at(n>=0?n:r,t)))}},{key:"intersectsBox",value:function(e){return null!==this.intersectBox(e,Kr)}},{key:"intersectTriangle",value:function(e,t,n,r,i){ni.subVectors(t,e),ri.subVectors(n,e),ii.crossVectors(ni,ri);var a,o=this.direction.dot(ii);if(o>0){if(r)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}ti.subVectors(this.origin,e);var s=a*this.direction.dot(ri.crossVectors(ti,ri));if(s<0)return null;var l=a*this.direction.dot(ni.cross(ti));if(l<0)return null;if(s+l>o)return null;var u=-a*ti.dot(ii);return u<0?null:this.at(u/o,i)}},{key:"applyMatrix4",value:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}},{key:"equals",value:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),oi=function(){function e(){M(this,e),e.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}return T(e,[{key:"set",value:function(e,t,n,r,i,a,o,s,l,u,c,h,d,f,p,v){var m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=r,m[1]=i,m[5]=a,m[9]=o,m[13]=s,m[2]=l,m[6]=u,m[10]=c,m[14]=h,m[3]=d,m[7]=f,m[11]=p,m[15]=v,this}},{key:"identity",value:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}},{key:"clone",value:function(){return(new e).fromArray(this.elements)}},{key:"copy",value:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}},{key:"copyPosition",value:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}},{key:"setFromMatrix3",value:function(e){var 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}},{key:"extractBasis",value:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}},{key:"makeBasis",value:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}},{key:"extractRotation",value:function(e){var t=this.elements,n=e.elements,r=1/si.setFromMatrixColumn(e,0).length(),i=1/si.setFromMatrixColumn(e,1).length(),a=1/si.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}},{key:"makeRotationFromEuler",value:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),l=Math.sin(r),u=Math.cos(i),c=Math.sin(i);if("XYZ"===e.order){var h=a*u,d=a*c,f=o*u,p=o*c;t[0]=s*u,t[4]=-s*c,t[8]=l,t[1]=d+f*l,t[5]=h-p*l,t[9]=-o*s,t[2]=p-h*l,t[6]=f+d*l,t[10]=a*s}else if("YXZ"===e.order){var v=s*u,m=s*c,g=l*u,y=l*c;t[0]=v+y*o,t[4]=g*o-m,t[8]=a*l,t[1]=a*c,t[5]=a*u,t[9]=-o,t[2]=m*o-g,t[6]=y+v*o,t[10]=a*s}else if("ZXY"===e.order){var _=s*u,x=s*c,b=l*u,w=l*c;t[0]=_-w*o,t[4]=-a*c,t[8]=b+x*o,t[1]=x+b*o,t[5]=a*u,t[9]=w-_*o,t[2]=-a*l,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){var M=a*u,S=a*c,T=o*u,k=o*c;t[0]=s*u,t[4]=T*l-S,t[8]=M*l+k,t[1]=s*c,t[5]=k*l+M,t[9]=S*l-T,t[2]=-l,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var E=a*s,A=a*l,C=o*s,P=o*l;t[0]=s*u,t[4]=P-E*c,t[8]=C*c+A,t[1]=c,t[5]=a*u,t[9]=-o*u,t[2]=-l*u,t[6]=A*c+C,t[10]=E-P*c}else if("XZY"===e.order){var L=a*s,R=a*l,I=o*s,D=o*l;t[0]=s*u,t[4]=-c,t[8]=l*u,t[1]=L*c+D,t[5]=a*u,t[9]=R*c-I,t[2]=I*c-R,t[6]=o*u,t[10]=D*c+L}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}},{key:"makeRotationFromQuaternion",value:function(e){return this.compose(ui,e,ci)}},{key:"lookAt",value:function(e,t,n){var r=this.elements;return fi.subVectors(e,t),0===fi.lengthSq()&&(fi.z=1),fi.normalize(),hi.crossVectors(n,fi),0===hi.lengthSq()&&(1===Math.abs(n.z)?fi.x+=1e-4:fi.z+=1e-4,fi.normalize(),hi.crossVectors(n,fi)),hi.normalize(),di.crossVectors(fi,hi),r[0]=hi.x,r[4]=di.x,r[8]=fi.x,r[1]=hi.y,r[5]=di.y,r[9]=fi.y,r[2]=hi.z,r[6]=di.z,r[10]=fi.z,this}},{key:"multiply",value:function(e){return this.multiplyMatrices(this,e)}},{key:"premultiply",value:function(e){return this.multiplyMatrices(e,this)}},{key:"multiplyMatrices",value:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],u=n[1],c=n[5],h=n[9],d=n[13],f=n[2],p=n[6],v=n[10],m=n[14],g=n[3],y=n[7],_=n[11],x=n[15],b=r[0],w=r[4],M=r[8],S=r[12],T=r[1],k=r[5],E=r[9],A=r[13],C=r[2],P=r[6],L=r[10],R=r[14],I=r[3],D=r[7],O=r[11],z=r[15];return i[0]=a*b+o*T+s*C+l*I,i[4]=a*w+o*k+s*P+l*D,i[8]=a*M+o*E+s*L+l*O,i[12]=a*S+o*A+s*R+l*z,i[1]=u*b+c*T+h*C+d*I,i[5]=u*w+c*k+h*P+d*D,i[9]=u*M+c*E+h*L+d*O,i[13]=u*S+c*A+h*R+d*z,i[2]=f*b+p*T+v*C+m*I,i[6]=f*w+p*k+v*P+m*D,i[10]=f*M+p*E+v*L+m*O,i[14]=f*S+p*A+v*R+m*z,i[3]=g*b+y*T+_*C+x*I,i[7]=g*w+y*k+_*P+x*D,i[11]=g*M+y*E+_*L+x*O,i[15]=g*S+y*A+_*R+x*z,this}},{key:"multiplyScalar",value:function(e){var 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}},{key:"determinant",value:function(){var e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],l=e[13],u=e[2],c=e[6],h=e[10],d=e[14];return e[3]*(+i*s*c-r*l*c-i*o*h+n*l*h+r*o*d-n*s*d)+e[7]*(+t*s*d-t*l*h+i*a*h-r*a*d+r*l*u-i*s*u)+e[11]*(+t*l*c-t*o*d-i*a*c+n*a*d+i*o*u-n*l*u)+e[15]*(-r*o*u-t*s*c+t*o*h+r*a*c-n*a*h+n*s*u)}},{key:"transpose",value:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}},{key:"setPosition",value:function(e,t,n){var 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]=n),this}},{key:"invert",value:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8],c=e[9],h=e[10],d=e[11],f=e[12],p=e[13],v=e[14],m=e[15],g=c*v*l-p*h*l+p*s*d-o*v*d-c*s*m+o*h*m,y=f*h*l-u*v*l-f*s*d+a*v*d+u*s*m-a*h*m,_=u*p*l-f*c*l+f*o*d-a*p*d-u*o*m+a*c*m,x=f*c*s-u*p*s-f*o*h+a*p*h+u*o*v-a*c*v,b=t*g+n*y+r*_+i*x;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var w=1/b;return e[0]=g*w,e[1]=(p*h*i-c*v*i-p*r*d+n*v*d+c*r*m-n*h*m)*w,e[2]=(o*v*i-p*s*i+p*r*l-n*v*l-o*r*m+n*s*m)*w,e[3]=(c*s*i-o*h*i-c*r*l+n*h*l+o*r*d-n*s*d)*w,e[4]=y*w,e[5]=(u*v*i-f*h*i+f*r*d-t*v*d-u*r*m+t*h*m)*w,e[6]=(f*s*i-a*v*i-f*r*l+t*v*l+a*r*m-t*s*m)*w,e[7]=(a*h*i-u*s*i+u*r*l-t*h*l-a*r*d+t*s*d)*w,e[8]=_*w,e[9]=(f*c*i-u*p*i-f*n*d+t*p*d+u*n*m-t*c*m)*w,e[10]=(a*p*i-f*o*i+f*n*l-t*p*l-a*n*m+t*o*m)*w,e[11]=(u*o*i-a*c*i-u*n*l+t*c*l+a*n*d-t*o*d)*w,e[12]=x*w,e[13]=(u*p*r-f*c*r+f*n*h-t*p*h-u*n*v+t*c*v)*w,e[14]=(f*o*r-a*p*r-f*n*s+t*p*s+a*n*v-t*o*v)*w,e[15]=(a*c*r-u*o*r+u*n*s-t*c*s-a*n*h+t*o*h)*w,this}},{key:"scale",value:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}},{key:"getMaxScaleOnAxis",value:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}},{key:"makeTranslation",value:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}},{key:"makeRotationX",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}},{key:"makeRotationY",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}},{key:"makeRotationZ",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}},{key:"makeRotationAxis",value:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,l=i*a,u=i*o;return this.set(l*a+n,l*o-r*s,l*s+r*o,0,l*o+r*s,u*o+n,u*s-r*a,0,l*s-r*o,u*s+r*a,i*s*s+n,0,0,0,0,1),this}},{key:"makeScale",value:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}},{key:"makeShear",value:function(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}},{key:"compose",value:function(e,t,n){var r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,l=i+i,u=a+a,c=o+o,h=i*l,d=i*u,f=i*c,p=a*u,v=a*c,m=o*c,g=s*l,y=s*u,_=s*c,x=n.x,b=n.y,w=n.z;return r[0]=(1-(p+m))*x,r[1]=(d+_)*x,r[2]=(f-y)*x,r[3]=0,r[4]=(d-_)*b,r[5]=(1-(h+m))*b,r[6]=(v+g)*b,r[7]=0,r[8]=(f+y)*w,r[9]=(v-g)*w,r[10]=(1-(h+p))*w,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}},{key:"decompose",value:function(e,t,n){var r=this.elements,i=si.set(r[0],r[1],r[2]).length(),a=si.set(r[4],r[5],r[6]).length(),o=si.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],li.copy(this);var s=1/i,l=1/a,u=1/o;return li.elements[0]*=s,li.elements[1]*=s,li.elements[2]*=s,li.elements[4]*=l,li.elements[5]*=l,li.elements[6]*=l,li.elements[8]*=u,li.elements[9]*=u,li.elements[10]*=u,t.setFromRotationMatrix(li),n.x=i,n.y=a,n.z=o,this}},{key:"makePerspective",value:function(e,t,n,r,i,a){var o=this.elements,s=2*i/(t-e),l=2*i/(n-r),u=(t+e)/(t-e),c=(n+r)/(n-r),h=-(a+i)/(a-i),d=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=u,o[12]=0,o[1]=0,o[5]=l,o[9]=c,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}},{key:"makeOrthographic",value:function(e,t,n,r,i,a){var o=this.elements,s=1/(t-e),l=1/(n-r),u=1/(a-i),c=(t+e)*s,h=(n+r)*l,d=(a+i)*u;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-c,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*u,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}},{key:"equals",value:function(e){for(var t=this.elements,n=e.elements,r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<16;n++)this.elements[n]=e[n+t];return this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}]),e}(),si=new Cr,li=new oi,ui=new Cr(0,0,0),ci=new Cr(1,1,1),hi=new Cr,di=new Cr,fi=new Cr,pi=new oi,vi=new Ar,mi=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.DefaultOrder;M(this,t),this.isEuler=!0,this._x=e,this._y=n,this._z=r,this._order=i}return T(t,[{key:"x",get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},{key:"order",get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}},{key:"set",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this._order;return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._order)}},{key:"copy",value:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],l=r[5],u=r[9],c=r[2],h=r[6],d=r[10];switch(t){case"XYZ":this._y=Math.asin(Vn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Vn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(s,l)):(this._y=Math.atan2(-c,i),this._z=0);break;case"ZXY":this._x=Math.asin(Vn(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(s,i));break;case"ZYX":this._y=Math.asin(-Vn(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(Vn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-c,i)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-Vn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-u,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}},{key:"setFromQuaternion",value:function(e,t,n){return pi.makeRotationFromQuaternion(e),this.setFromRotationMatrix(pi,t,n)}},{key:"setFromVector3",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order;return this.set(e.x,e.y,e.z,t)}},{key:"reorder",value:function(e){return vi.setFromEuler(this),this.setFromQuaternion(vi,e)}},{key:"equals",value:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}},{key:"fromArray",value:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}},{key:"_onChange",value:function(e){return this._onChangeCallback=e,this}},{key:"_onChangeCallback",value:function(){}},{key:Symbol.iterator,value:w().mark((function e(){return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._x;case 2:return e.next=4,this._y;case 4:return e.next=6,this._z;case 6:return e.next=8,this._order;case 8:case"end":return e.stop()}}),e,this)}))},{key:"toVector3",value:function(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")}}]),t}();mi.DefaultOrder="XYZ",mi.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];var gi=function(){function e(){M(this,e),this.mask=1}return T(e,[{key:"set",value:function(e){this.mask=(1<<e|0)>>>0}},{key:"enable",value:function(e){this.mask|=1<<e|0}},{key:"enableAll",value:function(){this.mask=-1}},{key:"toggle",value:function(e){this.mask^=1<<e|0}},{key:"disable",value:function(e){this.mask&=~(1<<e|0)}},{key:"disableAll",value:function(){this.mask=0}},{key:"test",value:function(e){return 0!=(this.mask&e.mask)}},{key:"isEnabled",value:function(e){return 0!=(this.mask&(1<<e|0))}}]),e}(),yi=0,_i=new Cr,xi=new Ar,bi=new oi,wi=new Cr,Mi=new Cr,Si=new Cr,Ti=new Ar,ki=new Cr(1,0,0),Ei=new Cr(0,1,0),Ai=new Cr(0,0,1),Ci={type:"added"},Pi={type:"removed"},Li=function(e){p(n,e);var t=m(n);function n(){var e;M(this,n),(e=t.call(this)).isObject3D=!0,Object.defineProperty(y(e),"id",{value:yi++}),e.uuid=Hn(),e.name="",e.type="Object3D",e.parent=null,e.children=[],e.up=n.DefaultUp.clone();var r=new Cr,i=new mi,a=new Ar,o=new Cr(1,1,1);return i._onChange((function(){a.setFromEuler(i,!1)})),a._onChange((function(){i.setFromQuaternion(a,void 0,!1)})),Object.defineProperties(y(e),{position:{configurable:!0,enumerable:!0,value:r},rotation:{configurable:!0,enumerable:!0,value:i},quaternion:{configurable:!0,enumerable:!0,value:a},scale:{configurable:!0,enumerable:!0,value:o},modelViewMatrix:{value:new oi},normalMatrix:{value:new $n}}),e.matrix=new oi,e.matrixWorld=new oi,e.matrixAutoUpdate=n.DefaultMatrixAutoUpdate,e.matrixWorldNeedsUpdate=!1,e.matrixWorldAutoUpdate=n.DefaultMatrixWorldAutoUpdate,e.layers=new gi,e.visible=!0,e.castShadow=!1,e.receiveShadow=!1,e.frustumCulled=!0,e.renderOrder=0,e.animations=[],e.userData={},e}return T(n,[{key:"onBeforeRender",value:function(){}},{key:"onAfterRender",value:function(){}},{key:"applyMatrix4",value:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}},{key:"applyQuaternion",value:function(e){return this.quaternion.premultiply(e),this}},{key:"setRotationFromAxisAngle",value:function(e,t){this.quaternion.setFromAxisAngle(e,t)}},{key:"setRotationFromEuler",value:function(e){this.quaternion.setFromEuler(e,!0)}},{key:"setRotationFromMatrix",value:function(e){this.quaternion.setFromRotationMatrix(e)}},{key:"setRotationFromQuaternion",value:function(e){this.quaternion.copy(e)}},{key:"rotateOnAxis",value:function(e,t){return xi.setFromAxisAngle(e,t),this.quaternion.multiply(xi),this}},{key:"rotateOnWorldAxis",value:function(e,t){return xi.setFromAxisAngle(e,t),this.quaternion.premultiply(xi),this}},{key:"rotateX",value:function(e){return this.rotateOnAxis(ki,e)}},{key:"rotateY",value:function(e){return this.rotateOnAxis(Ei,e)}},{key:"rotateZ",value:function(e){return this.rotateOnAxis(Ai,e)}},{key:"translateOnAxis",value:function(e,t){return _i.copy(e).applyQuaternion(this.quaternion),this.position.add(_i.multiplyScalar(t)),this}},{key:"translateX",value:function(e){return this.translateOnAxis(ki,e)}},{key:"translateY",value:function(e){return this.translateOnAxis(Ei,e)}},{key:"translateZ",value:function(e){return this.translateOnAxis(Ai,e)}},{key:"localToWorld",value:function(e){return e.applyMatrix4(this.matrixWorld)}},{key:"worldToLocal",value:function(e){return e.applyMatrix4(bi.copy(this.matrixWorld).invert())}},{key:"lookAt",value:function(e,t,n){e.isVector3?wi.copy(e):wi.set(e,t,n);var r=this.parent;this.updateWorldMatrix(!0,!1),Mi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?bi.lookAt(Mi,wi,this.up):bi.lookAt(wi,Mi,this.up),this.quaternion.setFromRotationMatrix(bi),r&&(bi.extractRotation(r.matrixWorld),xi.setFromRotationMatrix(bi),this.quaternion.premultiply(xi.invert()))}},{key:"add",value:function(e){if(arguments.length>1){for(var 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?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(Ci)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}},{key:"remove",value:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return-1!==n&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(Pi)),this}},{key:"removeFromParent",value:function(){var e=this.parent;return null!==e&&e.remove(this),this}},{key:"clear",value:function(){for(var e=0;e<this.children.length;e++){var t=this.children[e];t.parent=null,t.dispatchEvent(Pi)}return this.children.length=0,this}},{key:"attach",value:function(e){return this.updateWorldMatrix(!0,!1),bi.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),bi.multiply(e.parent.matrixWorld)),e.applyMatrix4(bi),this.add(e),e.updateWorldMatrix(!1,!0),this}},{key:"getObjectById",value:function(e){return this.getObjectByProperty("id",e)}},{key:"getObjectByName",value:function(e){return this.getObjectByProperty("name",e)}},{key:"getObjectByProperty",value:function(e,t){if(this[e]===t)return this;for(var n=0,r=this.children.length;n<r;n++){var i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}}},{key:"getWorldPosition",value:function(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}},{key:"getWorldQuaternion",value:function(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Mi,e,Si),e}},{key:"getWorldScale",value:function(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Mi,Ti,e),e}},{key:"getWorldDirection",value:function(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}},{key:"raycast",value:function(){}},{key:"traverse",value:function(e){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverse(e)}},{key:"traverseVisible",value:function(e){if(!1!==this.visible){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}}},{key:"traverseAncestors",value:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}},{key:"updateMatrix",value:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}},{key:"updateMatrixWorld",value:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=this.children,n=0,r=t.length;n<r;n++){var i=t[n];!0!==i.matrixWorldAutoUpdate&&!0!==e||i.updateMatrixWorld(e)}}},{key:"updateWorldMatrix",value:function(e,t){var n=this.parent;if(!0===e&&null!==n&&!0===n.matrixWorldAutoUpdate&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t)for(var r=this.children,i=0,a=r.length;i<a;i++){var o=r[i];!0===o.matrixWorldAutoUpdate&&o.updateWorldMatrix(!1,!0)}}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var r={};function i(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),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&&!0!==this.environment.isRenderTargetTexture&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,l=o.length;s<l;s++){var u=o[s];i(e.shapes,u)}else i(e.shapes,o)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(i(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){for(var c=[],h=0,d=this.material.length;h<d;h++)c.push(i(e.materials,this.material[h]));r.material=c}else r.material=i(e.materials,this.material);if(this.children.length>0){r.children=[];for(var f=0;f<this.children.length;f++)r.children.push(this.children[f].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(var p=0;p<this.animations.length;p++){var v=this.animations[p];r.animations.push(i(e.animations,v))}}if(t){var m=S(e.geometries),g=S(e.materials),y=S(e.textures),_=S(e.images),x=S(e.shapes),b=S(e.skeletons),w=S(e.animations),M=S(e.nodes);m.length>0&&(n.geometries=m),g.length>0&&(n.materials=g),y.length>0&&(n.textures=y),_.length>0&&(n.images=_),x.length>0&&(n.shapes=x),b.length>0&&(n.skeletons=b),w.length>0&&(n.animations=w),M.length>0&&(n.nodes=M)}return n.object=r,n;function S(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}}},{key:"clone",value:function(e){return(new this.constructor).copy(this,e)}},{key:"copy",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n<e.children.length;n++){var r=e.children[n];this.add(r.clone())}return this}}]),n}(Nn);Li.DefaultUp=new Cr(0,1,0),Li.DefaultMatrixAutoUpdate=!0,Li.DefaultMatrixWorldAutoUpdate=!0;var Ri=new Cr,Ii=new Cr,Di=new Cr,Oi=new Cr,zi=new Cr,Ni=new Cr,Ui=new Cr,Fi=new Cr,Bi=new Cr,Gi=new Cr,Hi=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Cr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Cr,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Cr;M(this,e),this.a=t,this.b=n,this.c=r}return T(e,[{key:"set",value:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}},{key:"setFromPointsAndIndices",value:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}},{key:"setFromAttributeAndIndices",value:function(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}},{key:"getArea",value:function(){return Ri.subVectors(this.c,this.b),Ii.subVectors(this.a,this.b),.5*Ri.cross(Ii).length()}},{key:"getMidpoint",value:function(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}},{key:"getNormal",value:function(t){return e.getNormal(this.a,this.b,this.c,t)}},{key:"getPlane",value:function(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}},{key:"getBarycoord",value:function(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}},{key:"getUV",value:function(t,n,r,i,a){return e.getUV(t,this.a,this.b,this.c,n,r,i,a)}},{key:"containsPoint",value:function(t){return e.containsPoint(t,this.a,this.b,this.c)}},{key:"isFrontFacing",value:function(t){return e.isFrontFacing(this.a,this.b,this.c,t)}},{key:"intersectsBox",value:function(e){return e.intersectsTriangle(this)}},{key:"closestPointToPoint",value:function(e,t){var n,r,i=this.a,a=this.b,o=this.c;zi.subVectors(a,i),Ni.subVectors(o,i),Fi.subVectors(e,i);var s=zi.dot(Fi),l=Ni.dot(Fi);if(s<=0&&l<=0)return t.copy(i);Bi.subVectors(e,a);var u=zi.dot(Bi),c=Ni.dot(Bi);if(u>=0&&c<=u)return t.copy(a);var h=s*c-u*l;if(h<=0&&s>=0&&u<=0)return n=s/(s-u),t.copy(i).addScaledVector(zi,n);Gi.subVectors(e,o);var d=zi.dot(Gi),f=Ni.dot(Gi);if(f>=0&&d<=f)return t.copy(o);var p=d*l-s*f;if(p<=0&&l>=0&&f<=0)return r=l/(l-f),t.copy(i).addScaledVector(Ni,r);var v=u*f-d*c;if(v<=0&&c-u>=0&&d-f>=0)return Ui.subVectors(o,a),r=(c-u)/(c-u+(d-f)),t.copy(a).addScaledVector(Ui,r);var m=1/(v+p+h);return n=p*m,r=h*m,t.copy(i).addScaledVector(zi,n).addScaledVector(Ni,r)}},{key:"equals",value:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}],[{key:"getNormal",value:function(e,t,n,r){r.subVectors(n,t),Ri.subVectors(e,t),r.cross(Ri);var i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}},{key:"getBarycoord",value:function(e,t,n,r,i){Ri.subVectors(r,t),Ii.subVectors(n,t),Di.subVectors(e,t);var a=Ri.dot(Ri),o=Ri.dot(Ii),s=Ri.dot(Di),l=Ii.dot(Ii),u=Ii.dot(Di),c=a*l-o*o;if(0===c)return i.set(-2,-1,-1);var h=1/c,d=(l*s-o*u)*h,f=(a*u-o*s)*h;return i.set(1-d-f,f,d)}},{key:"containsPoint",value:function(e,t,n,r){return this.getBarycoord(e,t,n,r,Oi),Oi.x>=0&&Oi.y>=0&&Oi.x+Oi.y<=1}},{key:"getUV",value:function(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,Oi),s.set(0,0),s.addScaledVector(i,Oi.x),s.addScaledVector(a,Oi.y),s.addScaledVector(o,Oi.z),s}},{key:"isFrontFacing",value:function(e,t,n,r){return Ri.subVectors(n,t),Ii.subVectors(e,t),Ri.cross(Ii).dot(r)<0}}]),e}(),Vi=0,Wi=function(e){p(n,e);var t=m(n);function n(){var e;return M(this,n),(e=t.call(this)).isMaterial=!0,Object.defineProperty(y(e),"id",{value:Vi++}),e.uuid=Hn(),e.name="",e.type="Material",e.blending=G,e.side=N,e.vertexColors=!1,e.opacity=1,e.transparent=!1,e.blendSrc=te,e.blendDst=ne,e.blendEquation=q,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthFunc=he,e.depthTest=!0,e.depthWrite=!0,e.stencilWriteMask=255,e.stencilFunc=Sn,e.stencilRef=0,e.stencilFuncMask=255,e.stencilFail=cn,e.stencilZFail=cn,e.stencilZPass=cn,e.stencilWrite=!1,e.clippingPlanes=null,e.clipIntersection=!1,e.clipShadows=!1,e.shadowSide=null,e.colorWrite=!0,e.precision=null,e.polygonOffset=!1,e.polygonOffsetFactor=0,e.polygonOffsetUnits=0,e.dithering=!1,e.alphaToCoverage=!1,e.premultipliedAlpha=!1,e.visible=!0,e.toneMapped=!0,e.userData={},e.version=0,e._alphaTest=0,e}return T(n,[{key:"alphaTest",get:function(){return this._alphaTest},set:function(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}},{key:"onBuild",value:function(){}},{key:"onBeforeRender",value:function(){}},{key:"onBeforeCompile",value:function(){}},{key:"customProgramCacheKey",value:function(){return this.onBeforeCompile.toString()}},{key:"setValues",value:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n){var r=this[t];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==G&&(n.blending=this.blending),this.side!==N&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){var i=r(e.textures),a=r(e.images);i.length>0&&(n.textures=i),a.length>0&&(n.images=a)}return n}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(null!==t){var r=t.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}}]),n}(Nn),ji=function(e){p(n,e);var t=m(n);function n(e){var r;return M(this,n),(r=t.call(this)).isMeshBasicMaterial=!0,r.type="MeshBasicMaterial",r.color=new vr(16777215),r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.specularMap=null,r.alphaMap=null,r.envMap=null,r.combine=me,r.reflectivity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.fog=!0,r.setValues(e),r}return T(n,[{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,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.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}}]),n}(Wi),qi=new Cr,Xi=new Kn,Yi=function(){function e(t,n,r){if(M(this,e),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=n,this.count=void 0!==t?t.length/n:0,this.normalized=!0===r,this.usage=Tn,this.updateRange={offset:0,count:-1},this.version=0}return T(e,[{key:"onUploadCallback",value:function(){}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"copy",value:function(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}},{key:"copyAt",value:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this}},{key:"copyArray",value:function(e){return this.array.set(e),this}},{key:"applyMatrix3",value:function(e){if(2===this.itemSize)for(var t=0,n=this.count;t<n;t++)Xi.fromBufferAttribute(this,t),Xi.applyMatrix3(e),this.setXY(t,Xi.x,Xi.y);else if(3===this.itemSize)for(var r=0,i=this.count;r<i;r++)qi.fromBufferAttribute(this,r),qi.applyMatrix3(e),this.setXYZ(r,qi.x,qi.y,qi.z);return this}},{key:"applyMatrix4",value:function(e){for(var t=0,n=this.count;t<n;t++)qi.fromBufferAttribute(this,t),qi.applyMatrix4(e),this.setXYZ(t,qi.x,qi.y,qi.z);return this}},{key:"applyNormalMatrix",value:function(e){for(var t=0,n=this.count;t<n;t++)qi.fromBufferAttribute(this,t),qi.applyNormalMatrix(e),this.setXYZ(t,qi.x,qi.y,qi.z);return this}},{key:"transformDirection",value:function(e){for(var t=0,n=this.count;t<n;t++)qi.fromBufferAttribute(this,t),qi.transformDirection(e),this.setXYZ(t,qi.x,qi.y,qi.z);return this}},{key:"set",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}},{key:"getX",value:function(e){var t=this.array[e*this.itemSize];return this.normalized&&(t=Zn(t,this.array)),t}},{key:"setX",value:function(e,t){return this.normalized&&(t=Jn(t,this.array)),this.array[e*this.itemSize]=t,this}},{key:"getY",value:function(e){var t=this.array[e*this.itemSize+1];return this.normalized&&(t=Zn(t,this.array)),t}},{key:"setY",value:function(e,t){return this.normalized&&(t=Jn(t,this.array)),this.array[e*this.itemSize+1]=t,this}},{key:"getZ",value:function(e){var t=this.array[e*this.itemSize+2];return this.normalized&&(t=Zn(t,this.array)),t}},{key:"setZ",value:function(e,t){return this.normalized&&(t=Jn(t,this.array)),this.array[e*this.itemSize+2]=t,this}},{key:"getW",value:function(e){var t=this.array[e*this.itemSize+3];return this.normalized&&(t=Zn(t,this.array)),t}},{key:"setW",value:function(e,t){return this.normalized&&(t=Jn(t,this.array)),this.array[e*this.itemSize+3]=t,this}},{key:"setXY",value:function(e,t,n){return e*=this.itemSize,this.normalized&&(t=Jn(t,this.array),n=Jn(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}},{key:"setXYZ",value:function(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Jn(t,this.array),n=Jn(n,this.array),r=Jn(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}},{key:"setXYZW",value:function(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=Jn(t,this.array),n=Jn(n,this.array),r=Jn(r,this.array),i=Jn(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this}},{key:"onUpload",value:function(e){return this.onUploadCallback=e,this}},{key:"clone",value:function(){return new this.constructor(this.array,this.itemSize).copy(this)}},{key:"toJSON",value:function(){var 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!==Tn&&(e.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(e.updateRange=this.updateRange),e}},{key:"copyColorsArray",value:function(){console.error("THREE.BufferAttribute: copyColorsArray() was removed in r144.")}},{key:"copyVector2sArray",value:function(){console.error("THREE.BufferAttribute: copyVector2sArray() was removed in r144.")}},{key:"copyVector3sArray",value:function(){console.error("THREE.BufferAttribute: copyVector3sArray() was removed in r144.")}},{key:"copyVector4sArray",value:function(){console.error("THREE.BufferAttribute: copyVector4sArray() was removed in r144.")}}]),e}(),Zi=function(e){p(n,e);var t=m(n);function n(e,r,i){return M(this,n),t.call(this,new Int8Array(e),r,i)}return T(n)}(Yi),Ji=function(e){p(n,e);var t=m(n);function n(e,r,i){return M(this,n),t.call(this,new Uint8Array(e),r,i)}return T(n)}(Yi),Qi=function(e){p(n,e);var t=m(n);function n(e,r,i){return M(this,n),t.call(this,new Uint8ClampedArray(e),r,i)}return T(n)}(Yi),Ki=function(e){p(n,e);var t=m(n);function n(e,r,i){return M(this,n),t.call(this,new Int16Array(e),r,i)}return T(n)}(Yi),$i=function(e){p(n,e);var t=m(n);function n(e,r,i){return M(this,n),t.call(this,new Uint16Array(e),r,i)}return T(n)}(Yi),ea=function(e){p(n,e);var t=m(n);function n(e,r,i){return M(this,n),t.call(this,new Int32Array(e),r,i)}return T(n)}(Yi),ta=function(e){p(n,e);var t=m(n);function n(e,r,i){return M(this,n),t.call(this,new Uint32Array(e),r,i)}return T(n)}(Yi),na=function(e){p(n,e);var t=m(n);function n(e,r,i){var a;return M(this,n),(a=t.call(this,new Uint16Array(e),r,i)).isFloat16BufferAttribute=!0,a}return T(n)}(Yi),ra=function(e){p(n,e);var t=m(n);function n(e,r,i){return M(this,n),t.call(this,new Float32Array(e),r,i)}return T(n)}(Yi),ia=function(e){p(n,e);var t=m(n);function n(e,r,i){return M(this,n),t.call(this,new Float64Array(e),r,i)}return T(n)}(Yi),aa=0,oa=new oi,sa=new Li,la=new Cr,ua=new Rr,ca=new Rr,ha=new Cr,da=function(e){p(n,e);var t=m(n);function n(){var e;return M(this,n),(e=t.call(this)).isBufferGeometry=!0,Object.defineProperty(y(e),"id",{value:aa++}),e.uuid=Hn(),e.name="",e.type="BufferGeometry",e.index=null,e.attributes={},e.morphAttributes={},e.morphTargetsRelative=!1,e.groups=[],e.boundingBox=null,e.boundingSphere=null,e.drawRange={start:0,count:1/0},e.userData={},e}return T(n,[{key:"getIndex",value:function(){return this.index}},{key:"setIndex",value:function(e){return Array.isArray(e)?this.index=new(er(e)?ta:$i)(e,1):this.index=e,this}},{key:"getAttribute",value:function(e){return this.attributes[e]}},{key:"setAttribute",value:function(e,t){return this.attributes[e]=t,this}},{key:"deleteAttribute",value:function(e){return delete this.attributes[e],this}},{key:"hasAttribute",value:function(e){return void 0!==this.attributes[e]}},{key:"addGroup",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.groups.push({start:e,count:t,materialIndex:n})}},{key:"clearGroups",value:function(){this.groups=[]}},{key:"setDrawRange",value:function(e,t){this.drawRange.start=e,this.drawRange.count=t}},{key:"applyMatrix4",value:function(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var r=(new $n).getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}var i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"applyQuaternion",value:function(e){return oa.makeRotationFromQuaternion(e),this.applyMatrix4(oa),this}},{key:"rotateX",value:function(e){return oa.makeRotationX(e),this.applyMatrix4(oa),this}},{key:"rotateY",value:function(e){return oa.makeRotationY(e),this.applyMatrix4(oa),this}},{key:"rotateZ",value:function(e){return oa.makeRotationZ(e),this.applyMatrix4(oa),this}},{key:"translate",value:function(e,t,n){return oa.makeTranslation(e,t,n),this.applyMatrix4(oa),this}},{key:"scale",value:function(e,t,n){return oa.makeScale(e,t,n),this.applyMatrix4(oa),this}},{key:"lookAt",value:function(e){return sa.lookAt(e),sa.updateMatrix(),this.applyMatrix4(sa.matrix),this}},{key:"center",value:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(la).negate(),this.translate(la.x,la.y,la.z),this}},{key:"setFromPoints",value:function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];t.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new ra(t,3)),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new Rr);var e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new Cr(-1/0,-1/0,-1/0),new Cr(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,r=t.length;n<r;n++){var i=t[n];ua.setFromBufferAttribute(i),this.morphTargetsRelative?(ha.addVectors(this.boundingBox.min,ua.min),this.boundingBox.expandByPoint(ha),ha.addVectors(this.boundingBox.max,ua.max),this.boundingBox.expandByPoint(ha)):(this.boundingBox.expandByPoint(ua.min),this.boundingBox.expandByPoint(ua.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)}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new Qr);var e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new Cr,1/0);if(e){var n=this.boundingSphere.center;if(ua.setFromBufferAttribute(e),t)for(var r=0,i=t.length;r<i;r++){var a=t[r];ca.setFromBufferAttribute(a),this.morphTargetsRelative?(ha.addVectors(ua.min,ca.min),ua.expandByPoint(ha),ha.addVectors(ua.max,ca.max),ua.expandByPoint(ha)):(ua.expandByPoint(ca.min),ua.expandByPoint(ca.max))}ua.getCenter(n);for(var o=0,s=0,l=e.count;s<l;s++)ha.fromBufferAttribute(e,s),o=Math.max(o,n.distanceToSquared(ha));if(t)for(var u=0,c=t.length;u<c;u++)for(var h=t[u],d=this.morphTargetsRelative,f=0,p=h.count;f<p;f++)ha.fromBufferAttribute(h,f),d&&(la.fromBufferAttribute(e,f),ha.add(la)),o=Math.max(o,n.distanceToSquared(ha));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}},{key:"computeTangents",value:function(){var e=this.index,t=this.attributes;if(null!==e&&void 0!==t.position&&void 0!==t.normal&&void 0!==t.uv){var n=e.array,r=t.position.array,i=t.normal.array,a=t.uv.array,o=r.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new Yi(new Float32Array(4*o),4));for(var s=this.getAttribute("tangent").array,l=[],u=[],c=0;c<o;c++)l[c]=new Cr,u[c]=new Cr;var h=new Cr,d=new Cr,f=new Cr,p=new Kn,v=new Kn,m=new Kn,g=new Cr,y=new Cr,_=this.groups;0===_.length&&(_=[{start:0,count:n.length}]);for(var x=0,b=_.length;x<b;++x)for(var w=_[x],M=w.start,S=M,T=M+w.count;S<T;S+=3)z(n[S+0],n[S+1],n[S+2]);for(var k=new Cr,E=new Cr,A=new Cr,C=new Cr,P=0,L=_.length;P<L;++P)for(var R=_[P],I=R.start,D=I,O=I+R.count;D<O;D+=3)N(n[D+0]),N(n[D+1]),N(n[D+2])}else console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");function z(e,t,n){h.fromArray(r,3*e),d.fromArray(r,3*t),f.fromArray(r,3*n),p.fromArray(a,2*e),v.fromArray(a,2*t),m.fromArray(a,2*n),d.sub(h),f.sub(h),v.sub(p),m.sub(p);var i=1/(v.x*m.y-m.x*v.y);isFinite(i)&&(g.copy(d).multiplyScalar(m.y).addScaledVector(f,-v.y).multiplyScalar(i),y.copy(f).multiplyScalar(v.x).addScaledVector(d,-m.x).multiplyScalar(i),l[e].add(g),l[t].add(g),l[n].add(g),u[e].add(y),u[t].add(y),u[n].add(y))}function N(e){A.fromArray(i,3*e),C.copy(A);var t=l[e];k.copy(t),k.sub(A.multiplyScalar(A.dot(t))).normalize(),E.crossVectors(C,t);var n=E.dot(u[e])<0?-1:1;s[4*e]=k.x,s[4*e+1]=k.y,s[4*e+2]=k.z,s[4*e+3]=n}}},{key:"computeVertexNormals",value:function(){var e=this.index,t=this.getAttribute("position");if(void 0!==t){var n=this.getAttribute("normal");if(void 0===n)n=new Yi(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(var r=0,i=n.count;r<i;r++)n.setXYZ(r,0,0,0);var a=new Cr,o=new Cr,s=new Cr,l=new Cr,u=new Cr,c=new Cr,h=new Cr,d=new Cr;if(e)for(var f=0,p=e.count;f<p;f+=3){var v=e.getX(f+0),m=e.getX(f+1),g=e.getX(f+2);a.fromBufferAttribute(t,v),o.fromBufferAttribute(t,m),s.fromBufferAttribute(t,g),h.subVectors(s,o),d.subVectors(a,o),h.cross(d),l.fromBufferAttribute(n,v),u.fromBufferAttribute(n,m),c.fromBufferAttribute(n,g),l.add(h),u.add(h),c.add(h),n.setXYZ(v,l.x,l.y,l.z),n.setXYZ(m,u.x,u.y,u.z),n.setXYZ(g,c.x,c.y,c.z)}else for(var y=0,_=t.count;y<_;y+=3)a.fromBufferAttribute(t,y+0),o.fromBufferAttribute(t,y+1),s.fromBufferAttribute(t,y+2),h.subVectors(s,o),d.subVectors(a,o),h.cross(d),n.setXYZ(y+0,h.x,h.y,h.z),n.setXYZ(y+1,h.x,h.y,h.z),n.setXYZ(y+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}},{key:"merge",value:function(){return console.error("THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeBufferGeometries() instead."),this}},{key:"normalizeNormals",value:function(){for(var e=this.attributes.normal,t=0,n=e.count;t<n;t++)ha.fromBufferAttribute(e,t),ha.normalize(),e.setXYZ(t,ha.x,ha.y,ha.z)}},{key:"toNonIndexed",value:function(){function e(e,t){for(var n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),o=0,s=0,l=0,u=t.length;l<u;l++){o=e.isInterleavedBufferAttribute?t[l]*e.data.stride+e.offset:t[l]*r;for(var c=0;c<r;c++)a[s++]=n[o++]}return new Yi(a,r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;var t=new n,r=this.index.array,i=this.attributes;for(var a in i){var o=e(i[a],r);t.setAttribute(a,o)}var s=this.morphAttributes;for(var l in s){for(var u=[],c=s[l],h=0,d=c.length;h<d;h++){var f=e(c[h],r);u.push(f)}t.morphAttributes[l]=u}t.morphTargetsRelative=this.morphTargetsRelative;for(var p=this.groups,v=0,m=p.length;v<m;v++){var g=p[v];t.addGroup(g.start,g.count,g.materialIndex)}return t}},{key:"toJSON",value:function(){var e={metadata:{version:4.5,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),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var r=this.index;null!==r&&(e.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var a in i){var o=i[a];e.data.attributes[a]=o.toJSON(e.data)}var s={},l=!1;for(var u in this.morphAttributes){for(var c=this.morphAttributes[u],h=[],d=0,f=c.length;d<f;d++){var p=c[d];h.push(p.toJSON(e.data))}h.length>0&&(s[u]=h,l=!0)}l&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);var v=this.groups;v.length>0&&(e.data.groups=JSON.parse(JSON.stringify(v)));var m=this.boundingSphere;return null!==m&&(e.data.boundingSphere={center:m.center.toArray(),radius:m.radius}),e}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;var t={};this.name=e.name;var n=e.index;null!==n&&this.setIndex(n.clone(t));var r=e.attributes;for(var i in r){var a=r[i];this.setAttribute(i,a.clone(t))}var o=e.morphAttributes;for(var s in o){for(var l=[],u=o[s],c=0,h=u.length;c<h;c++)l.push(u[c].clone(t));this.morphAttributes[s]=l}this.morphTargetsRelative=e.morphTargetsRelative;for(var d=e.groups,f=0,p=d.length;f<p;f++){var v=d[f];this.addGroup(v.start,v.count,v.materialIndex)}var m=e.boundingBox;null!==m&&(this.boundingBox=m.clone());var g=e.boundingSphere;return null!==g&&(this.boundingSphere=g.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,void 0!==e.parameters&&(this.parameters=Object.assign({},e.parameters)),this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),n}(Nn),fa=new oi,pa=new ai,va=new Qr,ma=new Cr,ga=new Cr,ya=new Cr,_a=new Cr,xa=new Cr,ba=new Cr,wa=new Cr,Ma=new Cr,Sa=new Cr,Ta=new Kn,ka=new Kn,Ea=new Kn,Aa=new Cr,Ca=new Cr,Pa=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new da,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ji;return M(this,n),(e=t.call(this)).isMesh=!0,e.type="Mesh",e.geometry=r,e.material=i,e.updateMorphTargets(),e}return T(n,[{key:"copy",value:function(e,t){return d(x(n.prototype),"copy",this).call(this,e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}},{key:"updateMorphTargets",value:function(){var e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var r=0,i=n.length;r<i;r++){var a=n[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}},{key:"raycast",value:function(e,t){var n=this.geometry,r=this.material,i=this.matrixWorld;if(void 0!==r&&(null===n.boundingSphere&&n.computeBoundingSphere(),va.copy(n.boundingSphere),va.applyMatrix4(i),!1!==e.ray.intersectsSphere(va)&&(fa.copy(i).invert(),pa.copy(e.ray).applyMatrix4(fa),null===n.boundingBox||!1!==pa.intersectsBox(n.boundingBox)))){var a,o=n.index,s=n.attributes.position,l=n.morphAttributes.position,u=n.morphTargetsRelative,c=n.attributes.uv,h=n.attributes.uv2,d=n.groups,f=n.drawRange;if(null!==o)if(Array.isArray(r))for(var p=0,v=d.length;p<v;p++)for(var m=d[p],g=r[m.materialIndex],y=Math.max(m.start,f.start),_=Math.min(o.count,Math.min(m.start+m.count,f.start+f.count));y<_;y+=3){var x=o.getX(y),b=o.getX(y+1),w=o.getX(y+2);(a=La(this,g,e,pa,s,l,u,c,h,x,b,w))&&(a.faceIndex=Math.floor(y/3),a.face.materialIndex=m.materialIndex,t.push(a))}else for(var M=Math.max(0,f.start),S=Math.min(o.count,f.start+f.count);M<S;M+=3){var T=o.getX(M),k=o.getX(M+1),E=o.getX(M+2);(a=La(this,r,e,pa,s,l,u,c,h,T,k,E))&&(a.faceIndex=Math.floor(M/3),t.push(a))}else if(void 0!==s)if(Array.isArray(r))for(var A=0,C=d.length;A<C;A++)for(var P=d[A],L=r[P.materialIndex],R=Math.max(P.start,f.start),I=Math.min(s.count,Math.min(P.start+P.count,f.start+f.count));R<I;R+=3)(a=La(this,L,e,pa,s,l,u,c,h,R,R+1,R+2))&&(a.faceIndex=Math.floor(R/3),a.face.materialIndex=P.materialIndex,t.push(a));else for(var D=Math.max(0,f.start),O=Math.min(s.count,f.start+f.count);D<O;D+=3)(a=La(this,r,e,pa,s,l,u,c,h,D,D+1,D+2))&&(a.faceIndex=Math.floor(D/3),t.push(a))}}}]),n}(Li);function La(e,t,n,r,i,a,o,s,l,u,c,h){ma.fromBufferAttribute(i,u),ga.fromBufferAttribute(i,c),ya.fromBufferAttribute(i,h);var d=e.morphTargetInfluences;if(a&&d){wa.set(0,0,0),Ma.set(0,0,0),Sa.set(0,0,0);for(var f=0,p=a.length;f<p;f++){var v=d[f],m=a[f];0!==v&&(_a.fromBufferAttribute(m,u),xa.fromBufferAttribute(m,c),ba.fromBufferAttribute(m,h),o?(wa.addScaledVector(_a,v),Ma.addScaledVector(xa,v),Sa.addScaledVector(ba,v)):(wa.addScaledVector(_a.sub(ma),v),Ma.addScaledVector(xa.sub(ga),v),Sa.addScaledVector(ba.sub(ya),v)))}ma.add(wa),ga.add(Ma),ya.add(Sa)}e.isSkinnedMesh&&(e.boneTransform(u,ma),e.boneTransform(c,ga),e.boneTransform(h,ya));var g=function(e,t,n,r,i,a,o,s){if(null===(t.side===U?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side!==F,s)))return null;Ca.copy(s),Ca.applyMatrix4(e.matrixWorld);var l=n.ray.origin.distanceTo(Ca);return l<n.near||l>n.far?null:{distance:l,point:Ca.clone(),object:e}}(e,t,n,r,ma,ga,ya,Aa);if(g){s&&(Ta.fromBufferAttribute(s,u),ka.fromBufferAttribute(s,c),Ea.fromBufferAttribute(s,h),g.uv=Hi.getUV(Aa,ma,ga,ya,Ta,ka,Ea,new Kn)),l&&(Ta.fromBufferAttribute(l,u),ka.fromBufferAttribute(l,c),Ea.fromBufferAttribute(l,h),g.uv2=Hi.getUV(Aa,ma,ga,ya,Ta,ka,Ea,new Kn));var y={a:u,b:c,c:h,normal:new Cr,materialIndex:0};Hi.getNormal(ma,ga,ya,y.normal),g.face=y}return g}var Ra=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;M(this,n),(e=t.call(this)).type="BoxGeometry",e.parameters={width:r,height:i,depth:a,widthSegments:o,heightSegments:s,depthSegments:l};var u=y(e);o=Math.floor(o),s=Math.floor(s),l=Math.floor(l);var c=[],h=[],d=[],f=[],p=0,v=0;function m(e,t,n,r,i,a,o,s,l,m,g){for(var y=a/l,_=o/m,x=a/2,b=o/2,w=s/2,M=l+1,S=m+1,T=0,k=0,E=new Cr,A=0;A<S;A++)for(var C=A*_-b,P=0;P<M;P++){var L=P*y-x;E[e]=L*r,E[t]=C*i,E[n]=w,h.push(E.x,E.y,E.z),E[e]=0,E[t]=0,E[n]=s>0?1:-1,d.push(E.x,E.y,E.z),f.push(P/l),f.push(1-A/m),T+=1}for(var R=0;R<m;R++)for(var I=0;I<l;I++){var D=p+I+M*R,O=p+I+M*(R+1),z=p+(I+1)+M*(R+1),N=p+(I+1)+M*R;c.push(D,O,N),c.push(O,z,N),k+=6}u.addGroup(v,k,g),v+=k,p+=T}return m("z","y","x",-1,-1,a,i,r,l,s,0),m("z","y","x",1,-1,a,i,-r,l,s,1),m("x","z","y",1,1,r,a,i,o,l,2),m("x","z","y",1,-1,r,a,-i,o,l,3),m("x","y","z",1,-1,r,i,a,o,s,4),m("x","y","z",-1,-1,r,i,-a,o,s,5),e.setIndex(c),e.setAttribute("position",new ra(h,3)),e.setAttribute("normal",new ra(d,3)),e.setAttribute("uv",new ra(f,2)),e}return T(n,null,[{key:"fromJSON",value:function(e){return new n(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}]),n}(da);function Ia(e){var t={};for(var n in e)for(var r in t[n]={},e[n]){var i=e[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?t[n][r]=i.clone():Array.isArray(i)?t[n][r]=i.slice():t[n][r]=i}return t}function Da(e){for(var t={},n=0;n<e.length;n++){var r=Ia(e[n]);for(var i in r)t[i]=r[i]}return t}var Oa={clone:Ia,merge:Da},za=function(e){p(n,e);var t=m(n);function n(e){var r;return M(this,n),(r=t.call(this)).isShaderMaterial=!0,r.type="ShaderMaterial",r.defines={},r.uniforms={},r.uniformsGroups=[],r.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",r.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",r.linewidth=1,r.wireframe=!1,r.wireframeLinewidth=1,r.fog=!1,r.lights=!1,r.clipping=!1,r.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},r.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},r.index0AttributeName=void 0,r.uniformsNeedUpdate=!1,r.glslVersion=null,void 0!==e&&r.setValues(e),r}return T(n,[{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Ia(e.uniforms),this.uniformsGroups=function(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n].clone());return t}(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}},{key:"toJSON",value:function(e){var t=d(x(n.prototype),"toJSON",this).call(this,e);for(var r in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){var i=this.uniforms[r].value;i&&i.isTexture?t.uniforms[r]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[r]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[r]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[r]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[r]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[r]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[r]={type:"m4",value:i.toArray()}:t.uniforms[r]={value:i}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var a={};for(var o in this.extensions)!0===this.extensions[o]&&(a[o]=!0);return Object.keys(a).length>0&&(t.extensions=a),t}}]),n}(Wi),Na=function(e){p(n,e);var t=m(n);function n(){var e;return M(this,n),(e=t.call(this)).isCamera=!0,e.type="Camera",e.matrixWorldInverse=new oi,e.projectionMatrix=new oi,e.projectionMatrixInverse=new oi,e}return T(n,[{key:"copy",value:function(e,t){return d(x(n.prototype),"copy",this).call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}},{key:"getWorldDirection",value:function(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}},{key:"updateMatrixWorld",value:function(e){d(x(n.prototype),"updateMatrixWorld",this).call(this,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"updateWorldMatrix",value:function(e,t){d(x(n.prototype),"updateWorldMatrix",this).call(this,e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),n}(Li),Ua=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2e3;return M(this,n),(e=t.call(this)).isPerspectiveCamera=!0,e.type="PerspectiveCamera",e.fov=r,e.zoom=1,e.near=a,e.far=o,e.focus=10,e.aspect=i,e.view=null,e.filmGauge=35,e.filmOffset=0,e.updateProjectionMatrix(),e}return T(n,[{key:"copy",value:function(e,t){return d(x(n.prototype),"copy",this).call(this,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=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}},{key:"setFocalLength",value:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*Gn*Math.atan(t),this.updateProjectionMatrix()}},{key:"getFocalLength",value:function(){var e=Math.tan(.5*Bn*this.fov);return.5*this.getFilmHeight()/e}},{key:"getEffectiveFOV",value:function(){return 2*Gn*Math.atan(Math.tan(.5*Bn*this.fov)/this.zoom)}},{key:"getFilmWidth",value:function(){return this.filmGauge*Math.min(this.aspect,1)}},{key:"getFilmHeight",value:function(){return this.filmGauge/Math.max(this.aspect,1)}},{key:"setViewOffset",value:function(e,t,n,r,i,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}},{key:"clearViewOffset",value:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}},{key:"updateProjectionMatrix",value:function(){var e=this.near,t=e*Math.tan(.5*Bn*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/o,t-=a.offsetY*n/s,r*=a.width/o,n*=a.height/s}var l=this.filmOffset;0!==l&&(i+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(e){var t=d(x(n.prototype),"toJSON",this).call(this,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,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}]),n}(Na),Fa=90,Ba=function(e){p(n,e);var t=m(n);function n(e,r,i){var a;M(this,n),(a=t.call(this)).type="CubeCamera",a.renderTarget=i;var o=new Ua(Fa,1,e,r);o.layers=a.layers,o.up.set(0,-1,0),o.lookAt(new Cr(1,0,0)),a.add(o);var s=new Ua(Fa,1,e,r);s.layers=a.layers,s.up.set(0,-1,0),s.lookAt(new Cr(-1,0,0)),a.add(s);var l=new Ua(Fa,1,e,r);l.layers=a.layers,l.up.set(0,0,1),l.lookAt(new Cr(0,1,0)),a.add(l);var u=new Ua(Fa,1,e,r);u.layers=a.layers,u.up.set(0,0,-1),u.lookAt(new Cr(0,-1,0)),a.add(u);var c=new Ua(Fa,1,e,r);c.layers=a.layers,c.up.set(0,-1,0),c.lookAt(new Cr(0,0,1)),a.add(c);var h=new Ua(Fa,1,e,r);return h.layers=a.layers,h.up.set(0,-1,0),h.lookAt(new Cr(0,0,-1)),a.add(h),a}return T(n,[{key:"update",value:function(e,t){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||c(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(this.children,6),i=r[0],a=r[1],o=r[2],s=r[3],l=r[4],u=r[5],h=e.getRenderTarget(),d=e.toneMapping,f=e.xr.enabled;e.toneMapping=_e,e.xr.enabled=!1;var p=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,a),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,s),e.setRenderTarget(n,4),e.render(t,l),n.texture.generateMipmaps=p,e.setRenderTarget(n,5),e.render(t,u),e.setRenderTarget(h),e.toneMapping=d,e.xr.enabled=f,n.texture.needsPMREMUpdate=!0}}]),n}(Li),Ga=function(e){p(n,e);var t=m(n);function n(e,r,i,a,o,s,l,u,c,h){var d;return M(this,n),e=void 0!==e?e:[],r=void 0!==r?r:ke,(d=t.call(this,e,r,i,a,o,s,l,u,c,h)).isCubeTexture=!0,d.flipY=!1,d}return T(n,[{key:"images",get:function(){return this.image},set:function(e){this.image=e}}]),n}(xr),Ha=function(e){p(n,e);var t=m(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};M(this,n),(r=t.call(this,e,e,i)).isWebGLCubeRenderTarget=!0;var a={width:e,height:e,depth:1},o=[a,a,a,a,a,a];return r.texture=new Ga(o,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),r.texture.isRenderTargetTexture=!0,r.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,r.texture.minFilter=void 0!==i.minFilter?i.minFilter:Fe,r}return T(n,[{key:"fromEquirectangularTexture",value:function(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;var n=new Ra(5,5,5),r=new za({name:"CubemapFromEquirect",uniforms:Ia({tEquirect:{value:null}}),vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",side:U,blending:B});r.uniforms.tEquirect.value=t;var i=new Pa(n,r),a=t.minFilter;return t.minFilter===He&&(t.minFilter=Fe),new Ba(1,10,this).update(e,i),t.minFilter=a,i.geometry.dispose(),i.material.dispose(),this}},{key:"clear",value:function(e,t,n,r){for(var i=e.getRenderTarget(),a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(i)}}]),n}(wr),Va=new Cr,Wa=new Cr,ja=new $n,qa=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Cr(1,0,0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;M(this,e),this.isPlane=!0,this.normal=t,this.constant=n}return T(e,[{key:"set",value:function(e,t){return this.normal.copy(e),this.constant=t,this}},{key:"setComponents",value:function(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}},{key:"setFromNormalAndCoplanarPoint",value:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}},{key:"setFromCoplanarPoints",value:function(e,t,n){var r=Va.subVectors(n,t).cross(Wa.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}},{key:"copy",value:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this}},{key:"normalize",value:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}},{key:"negate",value:function(){return this.constant*=-1,this.normal.negate(),this}},{key:"distanceToPoint",value:function(e){return this.normal.dot(e)+this.constant}},{key:"distanceToSphere",value:function(e){return this.distanceToPoint(e.center)-e.radius}},{key:"projectPoint",value:function(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}},{key:"intersectLine",value:function(e,t){var n=e.delta(Va),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;var i=-(e.start.dot(this.normal)+this.constant)/r;return i<0||i>1?null:t.copy(n).multiplyScalar(i).add(e.start)}},{key:"intersectsLine",value:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}},{key:"intersectsBox",value:function(e){return e.intersectsPlane(this)}},{key:"intersectsSphere",value:function(e){return e.intersectsPlane(this)}},{key:"coplanarPoint",value:function(e){return e.copy(this.normal).multiplyScalar(-this.constant)}},{key:"applyMatrix4",value:function(e,t){var n=t||ja.getNormalMatrix(e),r=this.coplanarPoint(Va).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}},{key:"translate",value:function(e){return this.constant-=e.dot(this.normal),this}},{key:"equals",value:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),Xa=new Qr,Ya=new Cr,Za=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new qa,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new qa,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new qa,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new qa,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:new qa,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:new qa;M(this,e),this.planes=[t,n,r,i,a,o]}return T(e,[{key:"set",value:function(e,t,n,r,i,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}},{key:"copy",value:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this}},{key:"setFromProjectionMatrix",value:function(e){var t=this.planes,n=e.elements,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],l=n[5],u=n[6],c=n[7],h=n[8],d=n[9],f=n[10],p=n[11],v=n[12],m=n[13],g=n[14],y=n[15];return t[0].setComponents(o-r,c-s,p-h,y-v).normalize(),t[1].setComponents(o+r,c+s,p+h,y+v).normalize(),t[2].setComponents(o+i,c+l,p+d,y+m).normalize(),t[3].setComponents(o-i,c-l,p-d,y-m).normalize(),t[4].setComponents(o-a,c-u,p-f,y-g).normalize(),t[5].setComponents(o+a,c+u,p+f,y+g).normalize(),this}},{key:"intersectsObject",value:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Xa.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Xa)}},{key:"intersectsSprite",value:function(e){return Xa.center.set(0,0,0),Xa.radius=.7071067811865476,Xa.applyMatrix4(e.matrixWorld),this.intersectsSphere(Xa)}},{key:"intersectsSphere",value:function(e){for(var t=this.planes,n=e.center,r=-e.radius,i=0;i<6;i++)if(t[i].distanceToPoint(n)<r)return!1;return!0}},{key:"intersectsBox",value:function(e){for(var t=this.planes,n=0;n<6;n++){var r=t[n];if(Ya.x=r.normal.x>0?e.max.x:e.min.x,Ya.y=r.normal.y>0?e.max.y:e.min.y,Ya.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Ya)<0)return!1}return!0}},{key:"containsPoint",value:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}();function Ja(){var e=null,t=!1,n=null,r=null;function i(t,a){n(t,a),r=e.requestAnimationFrame(i)}return{start:function(){!0!==t&&null!==n&&(r=e.requestAnimationFrame(i),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function Qa(e,t){var n=t.isWebGL2,r=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),r.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);var n=r.get(t);n&&(e.deleteBuffer(n.buffer),r.delete(t))},update:function(t,i){if(t.isGLBufferAttribute){var a=r.get(t);(!a||a.version<t.version)&&r.set(t,{buffer:t.buffer,type:t.type,bytesPerElement:t.elementSize,version:t.version})}else{t.isInterleavedBufferAttribute&&(t=t.data);var o=r.get(t);void 0===o?r.set(t,function(t,r){var i,a=t.array,o=t.usage,s=e.createBuffer();if(e.bindBuffer(r,s),e.bufferData(r,a,o),t.onUploadCallback(),a instanceof Float32Array)i=5126;else if(a instanceof Uint16Array)if(t.isFloat16BufferAttribute){if(!n)throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");i=5131}else i=5123;else if(a instanceof Int16Array)i=5122;else if(a instanceof Uint32Array)i=5125;else if(a instanceof Int32Array)i=5124;else if(a instanceof Int8Array)i=5120;else if(a instanceof Uint8Array)i=5121;else{if(!(a instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+a);i=5121}return{buffer:s,type:i,bytesPerElement:a.BYTES_PER_ELEMENT,version:t.version}}(t,i)):o.version<t.version&&(function(t,r,i){var a=r.array,o=r.updateRange;e.bindBuffer(i,t),-1===o.count?e.bufferSubData(i,0,a):(n?e.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):e.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1)}(o.buffer,t,i),o.version=t.version)}}}}var Ka=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;M(this,n),(e=t.call(this)).type="PlaneGeometry",e.parameters={width:r,height:i,widthSegments:a,heightSegments:o};for(var s=r/2,l=i/2,u=Math.floor(a),c=Math.floor(o),h=u+1,d=c+1,f=r/u,p=i/c,v=[],m=[],g=[],y=[],_=0;_<d;_++)for(var x=_*p-l,b=0;b<h;b++){var w=b*f-s;m.push(w,-x,0),g.push(0,0,1),y.push(b/u),y.push(1-_/c)}for(var S=0;S<c;S++)for(var T=0;T<u;T++){var k=T+h*S,E=T+h*(S+1),A=T+1+h*(S+1),C=T+1+h*S;v.push(k,E,C),v.push(E,A,C)}return e.setIndex(v),e.setAttribute("position",new ra(m,3)),e.setAttribute("normal",new ra(g,3)),e.setAttribute("uv",new ra(y,2)),e}return T(n,null,[{key:"fromJSON",value:function(e){return new n(e.width,e.height,e.widthSegments,e.heightSegments)}}]),n}(da),$a={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\n#ifdef USE_IRIDESCENCE\n\tvec3 BRDF_GGX_Iridescence( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float iridescence, const in vec3 iridescenceFresnel, const in float roughness ) {\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = mix( F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\t return vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat R21 = R12;\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos.xyz );\n\t\tvec3 vSigmaY = dFdy( surf_pos.xyz );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_v0 0.339\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_v1 0.276\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_v4 0.046\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_v5 0.016\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_v6 0.0038\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert\n#define Material_LightProbeLOD( material )\t(0)",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );\n\t#else\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if defined( USE_SHADOWMAP ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_COORDS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tuniform int boneTextureSize;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\ty = dy * ( y + 0.5 );\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\treturn bone;\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tgl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );\n\t#endif\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}"},eo={common:{diffuse:{value:new vr(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new $n},uv2Transform:{value:new $n},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Kn(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new vr(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new vr(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new $n}},sprite:{diffuse:{value:new vr(16777215)},opacity:{value:1},center:{value:new Kn(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new $n}}},to={basic:{uniforms:Da([eo.common,eo.specularmap,eo.envmap,eo.aomap,eo.lightmap,eo.fog]),vertexShader:$a.meshbasic_vert,fragmentShader:$a.meshbasic_frag},lambert:{uniforms:Da([eo.common,eo.specularmap,eo.envmap,eo.aomap,eo.lightmap,eo.emissivemap,eo.bumpmap,eo.normalmap,eo.displacementmap,eo.fog,eo.lights,{emissive:{value:new vr(0)}}]),vertexShader:$a.meshlambert_vert,fragmentShader:$a.meshlambert_frag},phong:{uniforms:Da([eo.common,eo.specularmap,eo.envmap,eo.aomap,eo.lightmap,eo.emissivemap,eo.bumpmap,eo.normalmap,eo.displacementmap,eo.fog,eo.lights,{emissive:{value:new vr(0)},specular:{value:new vr(1118481)},shininess:{value:30}}]),vertexShader:$a.meshphong_vert,fragmentShader:$a.meshphong_frag},standard:{uniforms:Da([eo.common,eo.envmap,eo.aomap,eo.lightmap,eo.emissivemap,eo.bumpmap,eo.normalmap,eo.displacementmap,eo.roughnessmap,eo.metalnessmap,eo.fog,eo.lights,{emissive:{value:new vr(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:$a.meshphysical_vert,fragmentShader:$a.meshphysical_frag},toon:{uniforms:Da([eo.common,eo.aomap,eo.lightmap,eo.emissivemap,eo.bumpmap,eo.normalmap,eo.displacementmap,eo.gradientmap,eo.fog,eo.lights,{emissive:{value:new vr(0)}}]),vertexShader:$a.meshtoon_vert,fragmentShader:$a.meshtoon_frag},matcap:{uniforms:Da([eo.common,eo.bumpmap,eo.normalmap,eo.displacementmap,eo.fog,{matcap:{value:null}}]),vertexShader:$a.meshmatcap_vert,fragmentShader:$a.meshmatcap_frag},points:{uniforms:Da([eo.points,eo.fog]),vertexShader:$a.points_vert,fragmentShader:$a.points_frag},dashed:{uniforms:Da([eo.common,eo.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:$a.linedashed_vert,fragmentShader:$a.linedashed_frag},depth:{uniforms:Da([eo.common,eo.displacementmap]),vertexShader:$a.depth_vert,fragmentShader:$a.depth_frag},normal:{uniforms:Da([eo.common,eo.bumpmap,eo.normalmap,eo.displacementmap,{opacity:{value:1}}]),vertexShader:$a.meshnormal_vert,fragmentShader:$a.meshnormal_frag},sprite:{uniforms:Da([eo.sprite,eo.fog]),vertexShader:$a.sprite_vert,fragmentShader:$a.sprite_frag},background:{uniforms:{uvTransform:{value:new $n},t2D:{value:null}},vertexShader:$a.background_vert,fragmentShader:$a.background_frag},cube:{uniforms:Da([eo.envmap,{opacity:{value:1}}]),vertexShader:$a.cube_vert,fragmentShader:$a.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:$a.equirect_vert,fragmentShader:$a.equirect_frag},distanceRGBA:{uniforms:Da([eo.common,eo.displacementmap,{referencePosition:{value:new Cr},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:$a.distanceRGBA_vert,fragmentShader:$a.distanceRGBA_frag},shadow:{uniforms:Da([eo.lights,eo.fog,{color:{value:new vr(0)},opacity:{value:1}}]),vertexShader:$a.shadow_vert,fragmentShader:$a.shadow_frag}};function no(e,t,n,r,i,a){var o,s,l=new vr(0),u=!0===i?0:1,c=null,h=0,d=null;function f(e,t){n.buffers.color.setClear(e.r,e.g,e.b,t,a)}return{getClearColor:function(){return l},setClearColor:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;l.set(e),f(l,u=t)},getClearAlpha:function(){return u},setClearAlpha:function(e){f(l,u=e)},render:function(n,i){var a=!1,p=!0===i.isScene?i.background:null;p&&p.isTexture&&(p=t.get(p));var v=e.xr,m=v.getSession&&v.getSession();m&&"additive"===m.environmentBlendMode&&(p=null),null===p?f(l,u):p&&p.isColor&&(f(p,1),a=!0),(e.autoClear||a)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),p&&(p.isCubeTexture||p.mapping===Pe)?(void 0===s&&((s=new Pa(new Ra(1,1,1),new za({name:"BackgroundCubeMaterial",uniforms:Ia(to.cube.uniforms),vertexShader:to.cube.vertexShader,fragmentShader:to.cube.fragmentShader,side:U,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),s.geometry.deleteAttribute("uv"),s.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(s.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(s)),s.material.uniforms.envMap.value=p,s.material.uniforms.flipEnvMap.value=p.isCubeTexture&&!1===p.isRenderTargetTexture?-1:1,c===p&&h===p.version&&d===e.toneMapping||(s.material.needsUpdate=!0,c=p,h=p.version,d=e.toneMapping),s.layers.enableAll(),n.unshift(s,s.geometry,s.material,0,0,null)):p&&p.isTexture&&(void 0===o&&((o=new Pa(new Ka(2,2),new za({name:"BackgroundMaterial",uniforms:Ia(to.background.uniforms),vertexShader:to.background.vertexShader,fragmentShader:to.background.fragmentShader,side:N,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(o)),o.material.uniforms.t2D.value=p,!0===p.matrixAutoUpdate&&p.updateMatrix(),o.material.uniforms.uvTransform.value.copy(p.matrix),c===p&&h===p.version&&d===e.toneMapping||(o.material.needsUpdate=!0,c=p,h=p.version,d=e.toneMapping),o.layers.enableAll(),n.unshift(o,o.geometry,o.material,0,0,null))}}}function ro(e,t,n,r){var i=e.getParameter(34921),a=r.isWebGL2?null:t.get("OES_vertex_array_object"),o=r.isWebGL2||null!==a,s={},l=f(null),u=l,c=!1;function h(t){return r.isWebGL2?e.bindVertexArray(t):a.bindVertexArrayOES(t)}function d(t){return r.isWebGL2?e.deleteVertexArray(t):a.deleteVertexArrayOES(t)}function f(e){for(var t=[],n=[],r=[],a=0;a<i;a++)t[a]=0,n[a]=0,r[a]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:n,attributeDivisors:r,object:e,attributes:{},index:null}}function p(){for(var e=u.newAttributes,t=0,n=e.length;t<n;t++)e[t]=0}function v(e){m(e,0)}function m(n,i){var a=u.newAttributes,o=u.enabledAttributes,s=u.attributeDivisors;a[n]=1,0===o[n]&&(e.enableVertexAttribArray(n),o[n]=1),s[n]!==i&&((r.isWebGL2?e:t.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,i),s[n]=i)}function g(){for(var t=u.newAttributes,n=u.enabledAttributes,r=0,i=n.length;r<i;r++)n[r]!==t[r]&&(e.disableVertexAttribArray(r),n[r]=0)}function y(t,n,i,a,o,s){!0!==r.isWebGL2||5124!==i&&5125!==i?e.vertexAttribPointer(t,n,i,a,o,s):e.vertexAttribIPointer(t,n,i,o,s)}function _(){x(),c=!0,u!==l&&h((u=l).object)}function x(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(i,l,d,_,x){var b=!1;if(o){var w=function(t,n,i){var o=!0===i.wireframe,l=s[t.id];void 0===l&&(l={},s[t.id]=l);var u=l[n.id];void 0===u&&(u={},l[n.id]=u);var c=u[o];return void 0===c&&(c=f(r.isWebGL2?e.createVertexArray():a.createVertexArrayOES()),u[o]=c),c}(_,d,l);u!==w&&h((u=w).object),b=function(e,t,n,r){var i=u.attributes,a=t.attributes,o=0,s=n.getAttributes();for(var l in s)if(s[l].location>=0){var c=i[l],h=a[l];if(void 0===h&&("instanceMatrix"===l&&e.instanceMatrix&&(h=e.instanceMatrix),"instanceColor"===l&&e.instanceColor&&(h=e.instanceColor)),void 0===c)return!0;if(c.attribute!==h)return!0;if(h&&c.data!==h.data)return!0;o++}return u.attributesNum!==o||u.index!==r}(i,_,d,x),b&&function(e,t,n,r){var i={},a=t.attributes,o=0,s=n.getAttributes();for(var l in s)if(s[l].location>=0){var c=a[l];void 0===c&&("instanceMatrix"===l&&e.instanceMatrix&&(c=e.instanceMatrix),"instanceColor"===l&&e.instanceColor&&(c=e.instanceColor));var h={};h.attribute=c,c&&c.data&&(h.data=c.data),i[l]=h,o++}u.attributes=i,u.attributesNum=o,u.index=r}(i,_,d,x)}else{var M=!0===l.wireframe;u.geometry===_.id&&u.program===d.id&&u.wireframe===M||(u.geometry=_.id,u.program=d.id,u.wireframe=M,b=!0)}null!==x&&n.update(x,34963),(b||c)&&(c=!1,function(i,a,o,s){if(!1!==r.isWebGL2||!i.isInstancedMesh&&!s.isInstancedBufferGeometry||null!==t.get("ANGLE_instanced_arrays")){p();var l=s.attributes,u=o.getAttributes(),c=a.defaultAttributeValues;for(var h in u){var d=u[h];if(d.location>=0){var f=l[h];if(void 0===f&&("instanceMatrix"===h&&i.instanceMatrix&&(f=i.instanceMatrix),"instanceColor"===h&&i.instanceColor&&(f=i.instanceColor)),void 0!==f){var _=f.normalized,x=f.itemSize,b=n.get(f);if(void 0===b)continue;var w=b.buffer,M=b.type,S=b.bytesPerElement;if(f.isInterleavedBufferAttribute){var T=f.data,k=T.stride,E=f.offset;if(T.isInstancedInterleavedBuffer){for(var A=0;A<d.locationSize;A++)m(d.location+A,T.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=T.meshPerAttribute*T.count)}else for(var C=0;C<d.locationSize;C++)v(d.location+C);e.bindBuffer(34962,w);for(var P=0;P<d.locationSize;P++)y(d.location+P,x/d.locationSize,M,_,k*S,(E+x/d.locationSize*P)*S)}else{if(f.isInstancedBufferAttribute){for(var L=0;L<d.locationSize;L++)m(d.location+L,f.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=f.meshPerAttribute*f.count)}else for(var R=0;R<d.locationSize;R++)v(d.location+R);e.bindBuffer(34962,w);for(var I=0;I<d.locationSize;I++)y(d.location+I,x/d.locationSize,M,_,x*S,x/d.locationSize*I*S)}}else if(void 0!==c){var D=c[h];if(void 0!==D)switch(D.length){case 2:e.vertexAttrib2fv(d.location,D);break;case 3:e.vertexAttrib3fv(d.location,D);break;case 4:e.vertexAttrib4fv(d.location,D);break;default:e.vertexAttrib1fv(d.location,D)}}}}g()}}(i,l,d,_),null!==x&&e.bindBuffer(34963,n.get(x).buffer))},reset:_,resetDefaultState:x,dispose:function(){for(var e in _(),s){var t=s[e];for(var n in t){var r=t[n];for(var i in r)d(r[i].object),delete r[i];delete t[n]}delete s[e]}},releaseStatesOfGeometry:function(e){if(void 0!==s[e.id]){var t=s[e.id];for(var n in t){var r=t[n];for(var i in r)d(r[i].object),delete r[i];delete t[n]}delete s[e.id]}},releaseStatesOfProgram:function(e){for(var t in s){var n=s[t];if(void 0!==n[e.id]){var r=n[e.id];for(var i in r)d(r[i].object),delete r[i];delete n[e.id]}}},initAttributes:p,enableAttribute:v,disableUnusedAttributes:g}}function io(e,t,n,r){var i,a=r.isWebGL2;this.setMode=function(e){i=e},this.render=function(t,r){e.drawArrays(i,t,r),n.update(r,i,1)},this.renderInstances=function(r,o,s){if(0!==s){var l,u;if(a)l=e,u="drawArraysInstanced";else if(u="drawArraysInstancedANGLE",null===(l=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[u](i,r,o,s),n.update(o,i,s)}}}function ao(e,t,n){var r;function i(t){if("highp"===t){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext,o=void 0!==n.precision?n.precision:"highp",s=i(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var l=a||t.has("WEBGL_draw_buffers"),u=!0===n.logarithmicDepthBuffer,c=e.getParameter(34930),h=e.getParameter(35660),d=e.getParameter(3379),f=e.getParameter(34076),p=e.getParameter(34921),v=e.getParameter(36347),m=e.getParameter(36348),g=e.getParameter(36349),y=h>0,_=a||t.has("OES_texture_float");return{isWebGL2:a,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){var n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:u,maxTextures:c,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:f,maxAttributes:p,maxVertexUniforms:v,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:y,floatFragmentTextures:_,floatVertexTextures:y&&_,maxSamples:a?e.getParameter(36183):0}}function oo(e){var t=this,n=null,r=0,i=!1,a=!1,o=new qa,s=new $n,l={value:null,needsUpdate:!1};function u(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0}function c(e,n,r,i){var a=null!==e?e.length:0,u=null;if(0!==a){if(u=l.value,!0!==i||null===u){var c=r+4*a,h=n.matrixWorldInverse;s.getNormalMatrix(h),(null===u||u.length<c)&&(u=new Float32Array(c));for(var d=0,f=r;d!==a;++d,f+=4)o.copy(e[d]).applyMatrix4(h,s),o.normal.toArray(u,f),u[f+3]=o.constant}l.value=u,l.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,u}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t,a){var o=0!==e.length||t||0!==r||i;return i=t,n=c(e,a,0),r=e.length,o},this.beginShadows=function(){a=!0,c(null)},this.endShadows=function(){a=!1,u()},this.setState=function(t,o,s){var h=t.clippingPlanes,d=t.clipIntersection,f=t.clipShadows,p=e.get(t);if(!i||null===h||0===h.length||a&&!f)a?c(null):u();else{var v=a?0:r,m=4*v,g=p.clippingState||null;l.value=g,g=c(h,o,m,s);for(var y=0;y!==m;++y)g[y]=n[y];p.clippingState=g,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=v}}}function so(e){var t=new WeakMap;function n(e,t){return t===Ae?e.mapping=ke:t===Ce&&(e.mapping=Ee),e}function r(e){var n=e.target;n.removeEventListener("dispose",r);var i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture&&!1===i.isRenderTargetTexture){var a=i.mapping;if(a===Ae||a===Ce){if(t.has(i))return n(t.get(i).texture,i.mapping);var o=i.image;if(o&&o.height>0){var s=new Ha(o.height/2);return s.fromEquirectangularTexture(e,i),t.set(i,s),i.addEventListener("dispose",r),n(s.texture,i.mapping)}return null}}return i},dispose:function(){t=new WeakMap}}}to.physical={uniforms:Da([to.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Kn(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new vr(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Kn},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new vr(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new vr(1,1,1)},specularColorMap:{value:null}}]),vertexShader:$a.meshphysical_vert,fragmentShader:$a.meshphysical_frag};var lo=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.1,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2e3;return M(this,n),(e=t.call(this)).isOrthographicCamera=!0,e.type="OrthographicCamera",e.zoom=1,e.view=null,e.left=r,e.right=i,e.top=a,e.bottom=o,e.near=s,e.far=l,e.updateProjectionMatrix(),e}return T(n,[{key:"copy",value:function(e,t){return d(x(n.prototype),"copy",this).call(this,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=null===e.view?null:Object.assign({},e.view),this}},{key:"setViewOffset",value:function(e,t,n,r,i,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}},{key:"clearViewOffset",value:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}},{key:"updateProjectionMatrix",value:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(null!==this.view&&this.view.enabled){var l=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a=(i+=l*this.view.offsetX)+l*this.view.width,s=(o-=u*this.view.offsetY)-u*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(e){var t=d(x(n.prototype),"toJSON",this).call(this,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,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}]),n}(Na),uo=[.125,.215,.35,.446,.526,.582],co=20,ho=new lo,fo=new vr,po=null,vo=(1+Math.sqrt(5))/2,mo=1/vo,go=[new Cr(1,1,1),new Cr(-1,1,1),new Cr(1,1,-1),new Cr(-1,1,-1),new Cr(0,vo,mo),new Cr(0,vo,-mo),new Cr(mo,0,vo),new Cr(-mo,0,vo),new Cr(vo,mo,0),new Cr(-vo,mo,0)],yo=function(){function e(t){M(this,e),this._renderer=t,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)}return T(e,[{key:"fromScene",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100;po=this._renderer.getRenderTarget(),this._setSize(256);var i=this._allocateTargets();return i.depthBuffer=!0,this._sceneToCubeUV(e,n,r,i),t>0&&this._blur(i,0,0,t),this._applyPMREM(i),this._cleanup(i),i}},{key:"fromEquirectangular",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}},{key:"fromCubemap",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}},{key:"compileCubemapShader",value:function(){null===this._cubemapMaterial&&(this._cubemapMaterial=wo(),this._compileMaterial(this._cubemapMaterial))}},{key:"compileEquirectangularShader",value:function(){null===this._equirectMaterial&&(this._equirectMaterial=bo(),this._compileMaterial(this._equirectMaterial))}},{key:"dispose",value:function(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}},{key:"_setSize",value:function(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}},{key:"_dispose",value:function(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(var e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}},{key:"_cleanup",value:function(e){this._renderer.setRenderTarget(po),e.scissorTest=!1,xo(e,0,0,e.width,e.height)}},{key:"_fromTexture",value:function(e,t){e.mapping===ke||e.mapping===Ee?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),po=this._renderer.getRenderTarget();var n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}},{key:"_allocateTargets",value:function(){var e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:Fe,minFilter:Fe,generateMipmaps:!1,type:Qe,format:rt,encoding:$t,depthBuffer:!1},r=_o(e,t,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=_o(e,t,n);var i=this._lodMax,a=function(e){for(var t=[],n=[],r=[],i=e,a=e-4+1+uo.length,o=0;o<a;o++){var s=Math.pow(2,i);n.push(s);var l=1/s;o>e-4?l=uo[o-e+4-1]:0===o&&(l=0),r.push(l);for(var u=1/(s-2),c=-u,h=1+u,d=[c,c,h,c,h,h,c,c,h,h,c,h],f=new Float32Array(108),p=new Float32Array(72),v=new Float32Array(36),m=0;m<6;m++){var g=m%3*2/3-1,y=m>2?0:-1,_=[g,y,0,g+2/3,y,0,g+2/3,y+1,0,g,y,0,g+2/3,y+1,0,g,y+1,0];f.set(_,18*m),p.set(d,12*m);var x=[m,m,m,m,m,m];v.set(x,6*m)}var b=new da;b.setAttribute("position",new Yi(f,3)),b.setAttribute("uv",new Yi(p,2)),b.setAttribute("faceIndex",new Yi(v,1)),t.push(b),i>4&&i--}return{lodPlanes:t,sizeLods:n,sigmas:r}}(i);this._sizeLods=a.sizeLods,this._lodPlanes=a.lodPlanes,this._sigmas=a.sigmas,this._blurMaterial=function(e,t,n){var r=new Float32Array(co),i=new Cr(0,1,0);return new za({name:"SphericalGaussianBlur",defines:{n:co,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:"".concat(e,".0")},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:B,depthTest:!1,depthWrite:!1})}(i,e,t)}return r}},{key:"_compileMaterial",value:function(e){var t=new Pa(this._lodPlanes[0],e);this._renderer.compile(t,ho)}},{key:"_sceneToCubeUV",value:function(e,t,n,r){var i=new Ua(90,1,t,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,l=s.autoClear,u=s.toneMapping;s.getClearColor(fo),s.toneMapping=_e,s.autoClear=!1;var c=new ji({name:"PMREM.Background",side:U,depthWrite:!1,depthTest:!1}),h=new Pa(new Ra,c),d=!1,f=e.background;f?f.isColor&&(c.color.copy(f),e.background=null,d=!0):(c.color.copy(fo),d=!0);for(var p=0;p<6;p++){var v=p%3;0===v?(i.up.set(0,a[p],0),i.lookAt(o[p],0,0)):1===v?(i.up.set(0,0,a[p]),i.lookAt(0,o[p],0)):(i.up.set(0,a[p],0),i.lookAt(0,0,o[p]));var m=this._cubeSize;xo(r,v*m,p>2?m:0,m,m),s.setRenderTarget(r),d&&s.render(h,i),s.render(e,i)}h.geometry.dispose(),h.material.dispose(),s.toneMapping=u,s.autoClear=l,e.background=f}},{key:"_textureToCubeUV",value:function(e,t){var n=this._renderer,r=e.mapping===ke||e.mapping===Ee;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=wo()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=bo());var i=r?this._cubemapMaterial:this._equirectMaterial,a=new Pa(this._lodPlanes[0],i);i.uniforms.envMap.value=e;var o=this._cubeSize;xo(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(a,ho)}},{key:"_applyPMREM",value:function(e){var t=this._renderer,n=t.autoClear;t.autoClear=!1;for(var r=1;r<this._lodPlanes.length;r++){var i=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),a=go[(r-1)%go.length];this._blur(e,r-1,r,i,a)}t.autoClear=n}},{key:"_blur",value:function(e,t,n,r,i){var a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",i),this._halfBlur(a,e,n,n,r,"longitudinal",i)}},{key:"_halfBlur",value:function(e,t,n,r,i,a,o){var s=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");var u=new Pa(this._lodPlanes[r],l),c=l.uniforms,h=this._sizeLods[n]-1,d=isFinite(i)?Math.PI/(2*h):2*Math.PI/39,f=i/d,p=isFinite(i)?1+Math.floor(3*f):co;p>co&&console.warn("sigmaRadians, ".concat(i,", is too large and will clip, as it requested ").concat(p," samples when the maximum is set to ").concat(co));for(var v=[],m=0,g=0;g<co;++g){var y=g/f,_=Math.exp(-y*y/2);v.push(_),0===g?m+=_:g<p&&(m+=2*_)}for(var x=0;x<v.length;x++)v[x]=v[x]/m;c.envMap.value=e.texture,c.samples.value=p,c.weights.value=v,c.latitudinal.value="latitudinal"===a,o&&(c.poleAxis.value=o);var b=this._lodMax;c.dTheta.value=d,c.mipInt.value=b-n;var w=this._sizeLods[r];xo(t,3*w*(r>b-4?r-b+4:0),4*(this._cubeSize-w),3*w,2*w),s.setRenderTarget(t),s.render(u,ho)}}]),e}();function _o(e,t,n){var r=new wr(e,t,n);return r.texture.mapping=Pe,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function xo(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function bo(){return new za({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:B,depthTest:!1,depthWrite:!1})}function wo(){return new za({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:B,depthTest:!1,depthWrite:!1})}function Mo(e){var t=new WeakMap,n=null;function r(e){var n=e.target;n.removeEventListener("dispose",r);var i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){var a=i.mapping,o=a===Ae||a===Ce,s=a===ke||a===Ee;if(o||s){if(i.isRenderTargetTexture&&!0===i.needsPMREMUpdate){i.needsPMREMUpdate=!1;var l=t.get(i);return null===n&&(n=new yo(e)),l=o?n.fromEquirectangular(i,l):n.fromCubemap(i,l),t.set(i,l),l.texture}if(t.has(i))return t.get(i).texture;var u=i.image;if(o&&u&&u.height>0||s&&u&&function(e){for(var t=0,n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(u)){null===n&&(n=new yo(e));var c=o?n.fromEquirectangular(i):n.fromCubemap(i);return t.set(i,c),i.addEventListener("dispose",r),c.texture}return null}}return i},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function So(e){var t={};function n(n){if(void 0!==t[n])return t[n];var r;switch(n){case"WEBGL_depth_texture":r=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=e.getExtension(n)}return t[n]=r,r}return{has:function(e){return null!==n(e)},init:function(e){e.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(e){var t=n(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function To(e,t,n,r){var i={},a=new WeakMap;function o(e){var s=e.target;for(var l in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[l]);s.removeEventListener("dispose",o),delete i[s.id];var u=a.get(s);u&&(t.remove(u),a.delete(s)),r.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(e){var n=[],r=e.index,i=e.attributes.position,o=0;if(null!==r){var s=r.array;o=r.version;for(var l=0,u=s.length;l<u;l+=3){var c=s[l+0],h=s[l+1],d=s[l+2];n.push(c,h,h,d,d,c)}}else{var f=i.array;o=i.version;for(var p=0,v=f.length/3-1;p<v;p+=3){var m=p+0,g=p+1,y=p+2;n.push(m,g,g,y,y,m)}}var _=new(er(n)?ta:$i)(n,1);_.version=o;var x=a.get(e);x&&t.remove(x),a.set(e,_)}return{get:function(e,t){return!0===i[t.id]||(t.addEventListener("dispose",o),i[t.id]=!0,n.memory.geometries++),t},update:function(e){var n=e.attributes;for(var r in n)t.update(n[r],34962);var i=e.morphAttributes;for(var a in i)for(var o=i[a],s=0,l=o.length;s<l;s++)t.update(o[s],34962)},getWireframeAttribute:function(e){var t=a.get(e);if(t){var n=e.index;null!==n&&t.version<n.version&&s(e)}else s(e);return a.get(e)}}}function ko(e,t,n,r){var i,a,o,s=r.isWebGL2;this.setMode=function(e){i=e},this.setIndex=function(e){a=e.type,o=e.bytesPerElement},this.render=function(t,r){e.drawElements(i,r,a,t*o),n.update(r,i,1)},this.renderInstances=function(r,l,u){if(0!==u){var c,h;if(s)c=e,h="drawElementsInstanced";else if(h="drawElementsInstancedANGLE",null===(c=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[h](i,l,a,r*o,u),n.update(l,i,u)}}}function Eo(e){var t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(e,n,r){switch(t.calls++,n){case 4:t.triangles+=r*(e/3);break;case 1:t.lines+=r*(e/2);break;case 3:t.lines+=r*(e-1);break;case 2:t.lines+=r*e;break;case 0:t.points+=r*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function Ao(e,t){return e[0]-t[0]}function Co(e,t){return Math.abs(t[1])-Math.abs(e[1])}function Po(e,t,n){for(var r={},i=new Float32Array(8),a=new WeakMap,o=new br,s=[],l=0;l<8;l++)s[l]=[l,0];return{update:function(l,u,c,h){var d=l.morphTargetInfluences;if(!0===t.isWebGL2){var f=u.morphAttributes.position||u.morphAttributes.normal||u.morphAttributes.color,p=void 0!==f?f.length:0,v=a.get(u);if(void 0===v||v.count!==p){void 0!==v&&v.texture.dispose();var m=void 0!==u.morphAttributes.position,g=void 0!==u.morphAttributes.normal,y=void 0!==u.morphAttributes.color,_=u.morphAttributes.position||[],x=u.morphAttributes.normal||[],b=u.morphAttributes.color||[],w=0;!0===m&&(w=1),!0===g&&(w=2),!0===y&&(w=3);var M=u.attributes.position.count*w,S=1;M>t.maxTextureSize&&(S=Math.ceil(M/t.maxTextureSize),M=t.maxTextureSize);var T=new Float32Array(M*S*4*p),k=new Mr(T,M,S,p);k.type=Je,k.needsUpdate=!0;for(var E=4*w,A=0;A<p;A++)for(var C=_[A],P=x[A],L=b[A],R=M*S*4*A,I=0;I<C.count;I++){var D=I*E;!0===m&&(o.fromBufferAttribute(C,I),T[R+D+0]=o.x,T[R+D+1]=o.y,T[R+D+2]=o.z,T[R+D+3]=0),!0===g&&(o.fromBufferAttribute(P,I),T[R+D+4]=o.x,T[R+D+5]=o.y,T[R+D+6]=o.z,T[R+D+7]=0),!0===y&&(o.fromBufferAttribute(L,I),T[R+D+8]=o.x,T[R+D+9]=o.y,T[R+D+10]=o.z,T[R+D+11]=4===L.itemSize?o.w:1)}v={count:p,texture:k,size:new Kn(M,S)},a.set(u,v),u.addEventListener("dispose",(function e(){k.dispose(),a.delete(u),u.removeEventListener("dispose",e)}))}for(var O=0,z=0;z<d.length;z++)O+=d[z];var N=u.morphTargetsRelative?1:1-O;h.getUniforms().setValue(e,"morphTargetBaseInfluence",N),h.getUniforms().setValue(e,"morphTargetInfluences",d),h.getUniforms().setValue(e,"morphTargetsTexture",v.texture,n),h.getUniforms().setValue(e,"morphTargetsTextureSize",v.size)}else{var U=void 0===d?0:d.length,F=r[u.id];if(void 0===F||F.length!==U){F=[];for(var B=0;B<U;B++)F[B]=[B,0];r[u.id]=F}for(var G=0;G<U;G++){var H=F[G];H[0]=G,H[1]=d[G]}F.sort(Co);for(var V=0;V<8;V++)V<U&&F[V][1]?(s[V][0]=F[V][0],s[V][1]=F[V][1]):(s[V][0]=Number.MAX_SAFE_INTEGER,s[V][1]=0);s.sort(Ao);for(var W=u.morphAttributes.position,j=u.morphAttributes.normal,q=0,X=0;X<8;X++){var Y=s[X],Z=Y[0],J=Y[1];Z!==Number.MAX_SAFE_INTEGER&&J?(W&&u.getAttribute("morphTarget"+X)!==W[Z]&&u.setAttribute("morphTarget"+X,W[Z]),j&&u.getAttribute("morphNormal"+X)!==j[Z]&&u.setAttribute("morphNormal"+X,j[Z]),i[X]=J,q+=J):(W&&!0===u.hasAttribute("morphTarget"+X)&&u.deleteAttribute("morphTarget"+X),j&&!0===u.hasAttribute("morphNormal"+X)&&u.deleteAttribute("morphNormal"+X),i[X]=0)}var Q=u.morphTargetsRelative?1:1-q;h.getUniforms().setValue(e,"morphTargetBaseInfluence",Q),h.getUniforms().setValue(e,"morphTargetInfluences",i)}}}}function Lo(e,t,n,r){var i=new WeakMap;function a(e){var t=e.target;t.removeEventListener("dispose",a),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(e){var o=r.render.frame,s=e.geometry,l=t.get(e,s);return i.get(l)!==o&&(t.update(l),i.set(l,o)),e.isInstancedMesh&&(!1===e.hasEventListener("dispose",a)&&e.addEventListener("dispose",a),n.update(e.instanceMatrix,34962),null!==e.instanceColor&&n.update(e.instanceColor,34962)),l},dispose:function(){i=new WeakMap}}}var Ro=new xr,Io=new Mr,Do=new Tr,Oo=new Ga,zo=[],No=[],Uo=new Float32Array(16),Fo=new Float32Array(9),Bo=new Float32Array(4);function Go(e,t,n){var r=e[0];if(r<=0||r>0)return e;var i=t*n,a=zo[i];if(void 0===a&&(a=new Float32Array(i),zo[i]=a),0!==t){r.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function Ho(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function Vo(e,t){for(var n=0,r=t.length;n<r;n++)e[n]=t[n]}function Wo(e,t){var n=No[t];void 0===n&&(n=new Int32Array(t),No[t]=n);for(var r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function jo(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function qo(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(Ho(n,t))return;e.uniform2fv(this.addr,t),Vo(n,t)}}function Xo(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(Ho(n,t))return;e.uniform3fv(this.addr,t),Vo(n,t)}}function Yo(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(Ho(n,t))return;e.uniform4fv(this.addr,t),Vo(n,t)}}function Zo(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(Ho(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Vo(n,t)}else{if(Ho(n,r))return;Bo.set(r),e.uniformMatrix2fv(this.addr,!1,Bo),Vo(n,r)}}function Jo(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(Ho(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Vo(n,t)}else{if(Ho(n,r))return;Fo.set(r),e.uniformMatrix3fv(this.addr,!1,Fo),Vo(n,r)}}function Qo(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(Ho(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Vo(n,t)}else{if(Ho(n,r))return;Uo.set(r),e.uniformMatrix4fv(this.addr,!1,Uo),Vo(n,r)}}function Ko(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function $o(e,t){var n=this.cache;Ho(n,t)||(e.uniform2iv(this.addr,t),Vo(n,t))}function es(e,t){var n=this.cache;Ho(n,t)||(e.uniform3iv(this.addr,t),Vo(n,t))}function ts(e,t){var n=this.cache;Ho(n,t)||(e.uniform4iv(this.addr,t),Vo(n,t))}function ns(e,t){var n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function rs(e,t){var n=this.cache;Ho(n,t)||(e.uniform2uiv(this.addr,t),Vo(n,t))}function is(e,t){var n=this.cache;Ho(n,t)||(e.uniform3uiv(this.addr,t),Vo(n,t))}function as(e,t){var n=this.cache;Ho(n,t)||(e.uniform4uiv(this.addr,t),Vo(n,t))}function os(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2D(t||Ro,i)}function ss(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||Do,i)}function ls(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(t||Oo,i)}function us(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||Io,i)}function cs(e,t){e.uniform1fv(this.addr,t)}function hs(e,t){var n=Go(t,this.size,2);e.uniform2fv(this.addr,n)}function ds(e,t){var n=Go(t,this.size,3);e.uniform3fv(this.addr,n)}function fs(e,t){var n=Go(t,this.size,4);e.uniform4fv(this.addr,n)}function ps(e,t){var n=Go(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function vs(e,t){var n=Go(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function ms(e,t){var n=Go(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function gs(e,t){e.uniform1iv(this.addr,t)}function ys(e,t){e.uniform2iv(this.addr,t)}function _s(e,t){e.uniform3iv(this.addr,t)}function xs(e,t){e.uniform4iv(this.addr,t)}function bs(e,t){e.uniform1uiv(this.addr,t)}function ws(e,t){e.uniform2uiv(this.addr,t)}function Ms(e,t){e.uniform3uiv(this.addr,t)}function Ss(e,t){e.uniform4uiv(this.addr,t)}function Ts(e,t,n){var r=this.cache,i=t.length,a=Wo(n,i);Ho(r,a)||(e.uniform1iv(this.addr,a),Vo(r,a));for(var o=0;o!==i;++o)n.setTexture2D(t[o]||Ro,a[o])}function ks(e,t,n){var r=this.cache,i=t.length,a=Wo(n,i);Ho(r,a)||(e.uniform1iv(this.addr,a),Vo(r,a));for(var o=0;o!==i;++o)n.setTexture3D(t[o]||Do,a[o])}function Es(e,t,n){var r=this.cache,i=t.length,a=Wo(n,i);Ho(r,a)||(e.uniform1iv(this.addr,a),Vo(r,a));for(var o=0;o!==i;++o)n.setTextureCube(t[o]||Oo,a[o])}function As(e,t,n){var r=this.cache,i=t.length,a=Wo(n,i);Ho(r,a)||(e.uniform1iv(this.addr,a),Vo(r,a));for(var o=0;o!==i;++o)n.setTexture2DArray(t[o]||Io,a[o])}var Cs=T((function e(t,n,r){M(this,e),this.id=t,this.addr=r,this.cache=[],this.setValue=function(e){switch(e){case 5126:return jo;case 35664:return qo;case 35665:return Xo;case 35666:return Yo;case 35674:return Zo;case 35675:return Jo;case 35676:return Qo;case 5124:case 35670:return Ko;case 35667:case 35671:return $o;case 35668:case 35672:return es;case 35669:case 35673:return ts;case 5125:return ns;case 36294:return rs;case 36295:return is;case 36296:return as;case 35678:case 36198:case 36298:case 36306:case 35682:return os;case 35679:case 36299:case 36307:return ss;case 35680:case 36300:case 36308:case 36293:return ls;case 36289:case 36303:case 36311:case 36292:return us}}(n.type)})),Ps=T((function e(t,n,r){M(this,e),this.id=t,this.addr=r,this.cache=[],this.size=n.size,this.setValue=function(e){switch(e){case 5126:return cs;case 35664:return hs;case 35665:return ds;case 35666:return fs;case 35674:return ps;case 35675:return vs;case 35676:return ms;case 5124:case 35670:return gs;case 35667:case 35671:return ys;case 35668:case 35672:return _s;case 35669:case 35673:return xs;case 5125:return bs;case 36294:return ws;case 36295:return Ms;case 36296:return Ss;case 35678:case 36198:case 36298:case 36306:case 35682:return Ts;case 35679:case 36299:case 36307:return ks;case 35680:case 36300:case 36308:case 36293:return Es;case 36289:case 36303:case 36311:case 36292:return As}}(n.type)})),Ls=function(){function e(t){M(this,e),this.id=t,this.seq=[],this.map={}}return T(e,[{key:"setValue",value:function(e,t,n){for(var r=this.seq,i=0,a=r.length;i!==a;++i){var o=r[i];o.setValue(e,t[o.id],n)}}}]),e}(),Rs=/(\w+)(\])?(\[|\.)?/g;function Is(e,t){e.seq.push(t),e.map[t.id]=t}function Ds(e,t,n){var r=e.name,i=r.length;for(Rs.lastIndex=0;;){var a=Rs.exec(r),o=Rs.lastIndex,s=a[1],l="]"===a[2],u=a[3];if(l&&(s|=0),void 0===u||"["===u&&o+2===i){Is(n,void 0===u?new Cs(s,e,t):new Ps(s,e,t));break}var c=n.map[s];void 0===c&&Is(n,c=new Ls(s)),n=c}}var Os=function(){function e(t,n){M(this,e),this.seq=[],this.map={};for(var r=t.getProgramParameter(n,35718),i=0;i<r;++i){var a=t.getActiveUniform(n,i);Ds(a,t.getUniformLocation(n,a.name),this)}}return T(e,[{key:"setValue",value:function(e,t,n,r){var i=this.map[t];void 0!==i&&i.setValue(e,n,r)}},{key:"setOptional",value:function(e,t,n){var r=t[n];void 0!==r&&this.setValue(e,n,r)}}],[{key:"upload",value:function(e,t,n,r){for(var i=0,a=t.length;i!==a;++i){var o=t[i],s=n[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,r)}}},{key:"seqWithValue",value:function(e,t){for(var n=[],r=0,i=e.length;r!==i;++r){var a=e[r];a.id in t&&n.push(a)}return n}}]),e}();function zs(e,t,n){var r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}var Ns=0;function Us(e,t,n){var r=e.getShaderParameter(t,35713),i=e.getShaderInfoLog(t).trim();if(r&&""===i)return"";var a=/ERROR: 0:(\d+)/.exec(i);if(a){var o=parseInt(a[1]);return n.toUpperCase()+"\n\n"+i+"\n\n"+function(e,t){for(var n=e.split("\n"),r=[],i=Math.max(t-6,0),a=Math.min(t+6,n.length),o=i;o<a;o++){var s=o+1;r.push("".concat(s===t?">":" "," ").concat(s,": ").concat(n[o]))}return r.join("\n")}(e.getShaderSource(t),o)}return i}function Fs(e,t){var n;switch(t){case xe:n="Linear";break;case be:n="Reinhard";break;case we:n="OptimizedCineon";break;case Me:n="ACESFilmic";break;case Se:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function Bs(e){return""!==e}function Gs(e,t){var n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Hs(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var Vs=/^[ \t]*#include +<([\w\d./]+)>/gm;function Ws(e){return e.replace(Vs,js)}function js(e,t){var n=$a[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return Ws(n)}var qs=/#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 Xs(e){return e.replace(qs,Ys)}function Ys(e,t,n,r){for(var i="",a=parseInt(t);a<parseInt(n);a++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return i}function Zs(e){var t="precision "+e.precision+" float;\nprecision "+e.precision+" int;";return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function Js(e,t,n,r){var i,a,o,s,l,u=e.getContext(),c=n.defines,h=n.vertexShader,d=n.fragmentShader,f=function(e){var t="SHADOWMAP_TYPE_BASIC";return e.shadowMapType===D?t="SHADOWMAP_TYPE_PCF":e.shadowMapType===O?t="SHADOWMAP_TYPE_PCF_SOFT":e.shadowMapType===z&&(t="SHADOWMAP_TYPE_VSM"),t}(n),p=function(e){var t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case ke:case Ee:t="ENVMAP_TYPE_CUBE";break;case Pe:t="ENVMAP_TYPE_CUBE_UV"}return t}(n),v=function(e){var t="ENVMAP_MODE_REFLECTION";return e.envMap&&e.envMapMode===Ee&&(t="ENVMAP_MODE_REFRACTION"),t}(n),m=function(e){var t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case me:t="ENVMAP_BLENDING_MULTIPLY";break;case ge:t="ENVMAP_BLENDING_MIX";break;case ye:t="ENVMAP_BLENDING_ADD"}return t}(n),g=function(e){var t=e.envMapCubeUVHeight;if(null===t)return null;var n=Math.log2(t)-2,r=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:r,maxMip:n}}(n),y=n.isWebGL2?"":function(e){return[e.extensionDerivatives||e.envMapCubeUVHeight||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||"physical"===e.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap||e.transmission)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Bs).join("\n")}(n),_=function(e){var t=[];for(var n in e){var r=e[n];!1!==r&&t.push("#define "+n+" "+r)}return t.join("\n")}(c),x=u.createProgram(),b=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?((i=[_].filter(Bs).join("\n")).length>0&&(i+="\n"),(a=[y,_].filter(Bs).join("\n")).length>0&&(a+="\n")):(i=[Zs(n),"#define SHADER_NAME "+n.shaderName,_,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+v:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+f:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Bs).join("\n"),a=[y,Zs(n),"#define SHADER_NAME "+n.shaderName,_,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+p:"",n.envMap?"#define "+v:"",n.envMap?"#define "+m:"",g?"#define CUBEUV_TEXEL_WIDTH "+g.texelWidth:"",g?"#define CUBEUV_TEXEL_HEIGHT "+g.texelHeight:"",g?"#define CUBEUV_MAX_MIP "+g.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+f:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==_e?"#define TONE_MAPPING":"",n.toneMapping!==_e?$a.tonemapping_pars_fragment:"",n.toneMapping!==_e?Fs("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",$a.encodings_pars_fragment,(o="linearToOutputTexel",s=n.outputEncoding,l=function(e){switch(e){case $t:return["Linear","( value )"];case en:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",e),["Linear","( value )"]}}(s),"vec4 "+o+"( vec4 value ) { return LinearTo"+l[0]+l[1]+"; }"),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Bs).join("\n")),h=Hs(h=Gs(h=Ws(h),n),n),d=Hs(d=Gs(d=Ws(d),n),n),h=Xs(h),d=Xs(d),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(b="#version 300 es\n",i=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+i,a=["#define varying in",n.glslVersion===On?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===On?"":"#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("\n")+"\n"+a);var w,M,S=b+a+d,T=zs(u,35633,b+i+h),k=zs(u,35632,S);if(u.attachShader(x,T),u.attachShader(x,k),void 0!==n.index0AttributeName?u.bindAttribLocation(x,0,n.index0AttributeName):!0===n.morphTargets&&u.bindAttribLocation(x,0,"position"),u.linkProgram(x),e.debug.checkShaderErrors){var E=u.getProgramInfoLog(x).trim(),A=u.getShaderInfoLog(T).trim(),C=u.getShaderInfoLog(k).trim(),P=!0,L=!0;if(!1===u.getProgramParameter(x,35714)){P=!1;var R=Us(u,T,"vertex"),I=Us(u,k,"fragment");console.error("THREE.WebGLProgram: Shader Error "+u.getError()+" - VALIDATE_STATUS "+u.getProgramParameter(x,35715)+"\n\nProgram Info Log: "+E+"\n"+R+"\n"+I)}else""!==E?console.warn("THREE.WebGLProgram: Program Info Log:",E):""!==A&&""!==C||(L=!1);L&&(this.diagnostics={runnable:P,programLog:E,vertexShader:{log:A,prefix:i},fragmentShader:{log:C,prefix:a}})}return u.deleteShader(T),u.deleteShader(k),this.getUniforms=function(){return void 0===w&&(w=new Os(u,x)),w},this.getAttributes=function(){return void 0===M&&(M=function(e,t){for(var n={},r=e.getProgramParameter(t,35721),i=0;i<r;i++){var a=e.getActiveAttrib(t,i),o=a.name,s=1;35674===a.type&&(s=2),35675===a.type&&(s=3),35676===a.type&&(s=4),n[o]={type:a.type,location:e.getAttribLocation(t,o),locationSize:s}}return n}(u,x)),M},this.destroy=function(){r.releaseStatesOfProgram(this),u.deleteProgram(x),this.program=void 0},this.name=n.shaderName,this.id=Ns++,this.cacheKey=t,this.usedTimes=1,this.program=x,this.vertexShader=T,this.fragmentShader=k,this}var Qs=0,Ks=function(){function e(){M(this,e),this.shaderCache=new Map,this.materialCache=new Map}return T(e,[{key:"update",value:function(e){var t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),i=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return!1===a.has(r)&&(a.add(r),r.usedTimes++),!1===a.has(i)&&(a.add(i),i.usedTimes++),this}},{key:"remove",value:function(e){var t,n=u(this.materialCache.get(e));try{for(n.s();!(t=n.n()).done;){var r=t.value;r.usedTimes--,0===r.usedTimes&&this.shaderCache.delete(r.code)}}catch(e){n.e(e)}finally{n.f()}return this.materialCache.delete(e),this}},{key:"getVertexShaderID",value:function(e){return this._getShaderStage(e.vertexShader).id}},{key:"getFragmentShaderID",value:function(e){return this._getShaderStage(e.fragmentShader).id}},{key:"dispose",value:function(){this.shaderCache.clear(),this.materialCache.clear()}},{key:"_getShaderCacheForMaterial",value:function(e){var t=this.materialCache,n=t.get(e);return void 0===n&&(n=new Set,t.set(e,n)),n}},{key:"_getShaderStage",value:function(e){var t=this.shaderCache,n=t.get(e);return void 0===n&&(n=new $s(e),t.set(e,n)),n}}]),e}(),$s=T((function e(t){M(this,e),this.id=Qs++,this.code=t,this.usedTimes=0}));function el(e,t,n,r,i,a,o){var s=new gi,l=new Ks,u=[],c=i.isWebGL2,h=i.logarithmicDepthBuffer,d=i.vertexTextures,f=i.precision,p={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"};return{getParameters:function(a,s,u,v,m){var g=v.fog,y=m.geometry,_=a.isMeshStandardMaterial?v.environment:null,x=(a.isMeshStandardMaterial?n:t).get(a.envMap||_),b=x&&x.mapping===Pe?x.image.height:null,w=p[a.type];null!==a.precision&&(f=i.getMaxPrecision(a.precision))!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",f,"instead.");var M,S,T,k,E=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,A=void 0!==E?E.length:0,C=0;if(void 0!==y.morphAttributes.position&&(C=1),void 0!==y.morphAttributes.normal&&(C=2),void 0!==y.morphAttributes.color&&(C=3),w){var P=to[w];M=P.vertexShader,S=P.fragmentShader}else M=a.vertexShader,S=a.fragmentShader,l.update(a),T=l.getVertexShaderID(a),k=l.getFragmentShaderID(a);var L=e.getRenderTarget(),R=a.alphaTest>0,I=a.clearcoat>0,D=a.iridescence>0;return{isWebGL2:c,shaderID:w,shaderName:a.type,vertexShader:M,fragmentShader:S,defines:a.defines,customVertexShaderID:T,customFragmentShaderID:k,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:f,instancing:!0===m.isInstancedMesh,instancingColor:!0===m.isInstancedMesh&&null!==m.instanceColor,supportsVertexTextures:d,outputEncoding:null===L?e.outputEncoding:!0===L.isXRRenderTarget?L.texture.encoding:$t,map:!!a.map,matcap:!!a.matcap,envMap:!!x,envMapMode:x&&x.mapping,envMapCubeUVHeight:b,lightMap:!!a.lightMap,aoMap:!!a.aoMap,emissiveMap:!!a.emissiveMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,objectSpaceNormalMap:a.normalMapType===an,tangentSpaceNormalMap:a.normalMapType===rn,decodeVideoTexture:!!a.map&&!0===a.map.isVideoTexture&&a.map.encoding===en,clearcoat:I,clearcoatMap:I&&!!a.clearcoatMap,clearcoatRoughnessMap:I&&!!a.clearcoatRoughnessMap,clearcoatNormalMap:I&&!!a.clearcoatNormalMap,iridescence:D,iridescenceMap:D&&!!a.iridescenceMap,iridescenceThicknessMap:D&&!!a.iridescenceThicknessMap,displacementMap:!!a.displacementMap,roughnessMap:!!a.roughnessMap,metalnessMap:!!a.metalnessMap,specularMap:!!a.specularMap,specularIntensityMap:!!a.specularIntensityMap,specularColorMap:!!a.specularColorMap,opaque:!1===a.transparent&&a.blending===G,alphaMap:!!a.alphaMap,alphaTest:R,gradientMap:!!a.gradientMap,sheen:a.sheen>0,sheenColorMap:!!a.sheenColorMap,sheenRoughnessMap:!!a.sheenRoughnessMap,transmission:a.transmission>0,transmissionMap:!!a.transmissionMap,thicknessMap:!!a.thicknessMap,combine:a.combine,vertexTangents:!!a.normalMap&&!!y.attributes.tangent,vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!y.attributes.color&&4===y.attributes.color.itemSize,vertexUvs:!!(a.map||a.bumpMap||a.normalMap||a.specularMap||a.alphaMap||a.emissiveMap||a.roughnessMap||a.metalnessMap||a.clearcoatMap||a.clearcoatRoughnessMap||a.clearcoatNormalMap||a.iridescenceMap||a.iridescenceThicknessMap||a.displacementMap||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularColorMap||a.sheenColorMap||a.sheenRoughnessMap),uvsVertexOnly:!(a.map||a.bumpMap||a.normalMap||a.specularMap||a.alphaMap||a.emissiveMap||a.roughnessMap||a.metalnessMap||a.clearcoatNormalMap||a.iridescenceMap||a.iridescenceThicknessMap||a.transmission>0||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularColorMap||a.sheen>0||a.sheenColorMap||a.sheenRoughnessMap||!a.displacementMap),fog:!!g,useFog:!0===a.fog,fogExp2:g&&g.isFogExp2,flatShading:!!a.flatShading,sizeAttenuation:a.sizeAttenuation,logarithmicDepthBuffer:h,skinning:!0===m.isSkinnedMesh,morphTargets:void 0!==y.morphAttributes.position,morphNormals:void 0!==y.morphAttributes.normal,morphColors:void 0!==y.morphAttributes.color,morphTargetsCount:A,morphTextureStride:C,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:a.toneMapped?e.toneMapping:_e,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===F,flipSided:a.side===U,useDepthPacking:!!a.depthPacking,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionDerivatives:a.extensions&&a.extensions.derivatives,extensionFragDepth:a.extensions&&a.extensions.fragDepth,extensionDrawBuffers:a.extensions&&a.extensions.drawBuffers,extensionShaderTextureLOD:a.extensions&&a.extensions.shaderTextureLOD,rendererExtensionFragDepth:c||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||r.has("EXT_shader_texture_lod"),customProgramCacheKey:a.customProgramCacheKey()}},getProgramCacheKey:function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(var r in t.defines)n.push(r),n.push(t.defines[r]);return!1===t.isRawShaderMaterial&&(function(e,t){e.push(t.precision),e.push(t.outputEncoding),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.combine),e.push(t.vertexUvs),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){s.disableAll(),t.isWebGL2&&s.enable(0),t.supportsVertexTextures&&s.enable(1),t.instancing&&s.enable(2),t.instancingColor&&s.enable(3),t.map&&s.enable(4),t.matcap&&s.enable(5),t.envMap&&s.enable(6),t.lightMap&&s.enable(7),t.aoMap&&s.enable(8),t.emissiveMap&&s.enable(9),t.bumpMap&&s.enable(10),t.normalMap&&s.enable(11),t.objectSpaceNormalMap&&s.enable(12),t.tangentSpaceNormalMap&&s.enable(13),t.clearcoat&&s.enable(14),t.clearcoatMap&&s.enable(15),t.clearcoatRoughnessMap&&s.enable(16),t.clearcoatNormalMap&&s.enable(17),t.iridescence&&s.enable(18),t.iridescenceMap&&s.enable(19),t.iridescenceThicknessMap&&s.enable(20),t.displacementMap&&s.enable(21),t.specularMap&&s.enable(22),t.roughnessMap&&s.enable(23),t.metalnessMap&&s.enable(24),t.gradientMap&&s.enable(25),t.alphaMap&&s.enable(26),t.alphaTest&&s.enable(27),t.vertexColors&&s.enable(28),t.vertexAlphas&&s.enable(29),t.vertexUvs&&s.enable(30),t.vertexTangents&&s.enable(31),t.uvsVertexOnly&&s.enable(32),e.push(s.mask),s.disableAll(),t.fog&&s.enable(0),t.useFog&&s.enable(1),t.flatShading&&s.enable(2),t.logarithmicDepthBuffer&&s.enable(3),t.skinning&&s.enable(4),t.morphTargets&&s.enable(5),t.morphNormals&&s.enable(6),t.morphColors&&s.enable(7),t.premultipliedAlpha&&s.enable(8),t.shadowMapEnabled&&s.enable(9),t.physicallyCorrectLights&&s.enable(10),t.doubleSided&&s.enable(11),t.flipSided&&s.enable(12),t.useDepthPacking&&s.enable(13),t.dithering&&s.enable(14),t.specularIntensityMap&&s.enable(15),t.specularColorMap&&s.enable(16),t.transmission&&s.enable(17),t.transmissionMap&&s.enable(18),t.thicknessMap&&s.enable(19),t.sheen&&s.enable(20),t.sheenColorMap&&s.enable(21),t.sheenRoughnessMap&&s.enable(22),t.decodeVideoTexture&&s.enable(23),t.opaque&&s.enable(24),e.push(s.mask)}(n,t),n.push(e.outputEncoding)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){var t,n=p[e.type];if(n){var r=to[n];t=Oa.clone(r.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,n){for(var r,i=0,o=u.length;i<o;i++){var s=u[i];if(s.cacheKey===n){++(r=s).usedTimes;break}}return void 0===r&&(r=new Js(e,n,t,a),u.push(r)),r},releaseProgram:function(e){if(0==--e.usedTimes){var t=u.indexOf(e);u[t]=u[u.length-1],u.pop(),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:u,dispose:function(){l.dispose()}}}function tl(){var e=new WeakMap;return{get:function(t){var n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,r){e.get(t)[n]=r},dispose:function(){e=new WeakMap}}}function nl(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function rl(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function il(){var e=[],t=0,n=[],r=[],i=[];function a(n,r,i,a,o,s){var l=e[t];return void 0===l?(l={id:n.id,object:n,geometry:r,material:i,groupOrder:a,renderOrder:n.renderOrder,z:o,group:s},e[t]=l):(l.id=n.id,l.object=n,l.geometry=r,l.material=i,l.groupOrder=a,l.renderOrder=n.renderOrder,l.z=o,l.group=s),t++,l}return{opaque:n,transmissive:r,transparent:i,init:function(){t=0,n.length=0,r.length=0,i.length=0},push:function(e,t,o,s,l,u){var c=a(e,t,o,s,l,u);o.transmission>0?r.push(c):!0===o.transparent?i.push(c):n.push(c)},unshift:function(e,t,o,s,l,u){var c=a(e,t,o,s,l,u);o.transmission>0?r.unshift(c):!0===o.transparent?i.unshift(c):n.unshift(c)},finish:function(){for(var n=t,r=e.length;n<r;n++){var i=e[n];if(null===i.id)break;i.id=null,i.object=null,i.geometry=null,i.material=null,i.group=null}},sort:function(e,t){n.length>1&&n.sort(e||nl),r.length>1&&r.sort(t||rl),i.length>1&&i.sort(t||rl)}}}function al(){var e=new WeakMap;return{get:function(t,n){var r,i=e.get(t);return void 0===i?(r=new il,e.set(t,[r])):n>=i.length?(r=new il,i.push(r)):r=i[n],r},dispose:function(){e=new WeakMap}}}function ol(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new Cr,color:new vr};break;case"SpotLight":n={position:new Cr,direction:new Cr,color:new vr,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Cr,color:new vr,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Cr,skyColor:new vr,groundColor:new vr};break;case"RectAreaLight":n={color:new vr,position:new Cr,halfWidth:new Cr,halfHeight:new Cr}}return e[t.id]=n,n}}}var sl=0;function ll(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function ul(e,t){for(var n,r=new ol,i=(n={},{get:function(e){if(void 0!==n[e.id])return n[e.id];var t;switch(e.type){case"DirectionalLight":case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Kn};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Kn,shadowCameraNear:1,shadowCameraFar:1e3}}return n[e.id]=t,t}}),a={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0},o=0;o<9;o++)a.probe.push(new Cr);var s=new Cr,l=new oi,u=new oi;return{setup:function(n,o){for(var s=0,l=0,u=0,c=0;c<9;c++)a.probe[c].set(0,0,0);var h=0,d=0,f=0,p=0,v=0,m=0,g=0,y=0,_=0,x=0;n.sort(ll);for(var b=!0!==o?Math.PI:1,w=0,M=n.length;w<M;w++){var S=n[w],T=S.color,k=S.intensity,E=S.distance,A=S.shadow&&S.shadow.map?S.shadow.map.texture:null;if(S.isAmbientLight)s+=T.r*k*b,l+=T.g*k*b,u+=T.b*k*b;else if(S.isLightProbe)for(var C=0;C<9;C++)a.probe[C].addScaledVector(S.sh.coefficients[C],k);else if(S.isDirectionalLight){var P=r.get(S);if(P.color.copy(S.color).multiplyScalar(S.intensity*b),S.castShadow){var L=S.shadow,R=i.get(S);R.shadowBias=L.bias,R.shadowNormalBias=L.normalBias,R.shadowRadius=L.radius,R.shadowMapSize=L.mapSize,a.directionalShadow[h]=R,a.directionalShadowMap[h]=A,a.directionalShadowMatrix[h]=S.shadow.matrix,m++}a.directional[h]=P,h++}else if(S.isSpotLight){var I=r.get(S);I.position.setFromMatrixPosition(S.matrixWorld),I.color.copy(T).multiplyScalar(k*b),I.distance=E,I.coneCos=Math.cos(S.angle),I.penumbraCos=Math.cos(S.angle*(1-S.penumbra)),I.decay=S.decay,a.spot[f]=I;var D=S.shadow;if(S.map&&(a.spotLightMap[_]=S.map,_++,D.updateMatrices(S),S.castShadow&&x++),a.spotLightMatrix[f]=D.matrix,S.castShadow){var O=i.get(S);O.shadowBias=D.bias,O.shadowNormalBias=D.normalBias,O.shadowRadius=D.radius,O.shadowMapSize=D.mapSize,a.spotShadow[f]=O,a.spotShadowMap[f]=A,y++}f++}else if(S.isRectAreaLight){var z=r.get(S);z.color.copy(T).multiplyScalar(k),z.halfWidth.set(.5*S.width,0,0),z.halfHeight.set(0,.5*S.height,0),a.rectArea[p]=z,p++}else if(S.isPointLight){var N=r.get(S);if(N.color.copy(S.color).multiplyScalar(S.intensity*b),N.distance=S.distance,N.decay=S.decay,S.castShadow){var U=S.shadow,F=i.get(S);F.shadowBias=U.bias,F.shadowNormalBias=U.normalBias,F.shadowRadius=U.radius,F.shadowMapSize=U.mapSize,F.shadowCameraNear=U.camera.near,F.shadowCameraFar=U.camera.far,a.pointShadow[d]=F,a.pointShadowMap[d]=A,a.pointShadowMatrix[d]=S.shadow.matrix,g++}a.point[d]=N,d++}else if(S.isHemisphereLight){var B=r.get(S);B.skyColor.copy(S.color).multiplyScalar(k*b),B.groundColor.copy(S.groundColor).multiplyScalar(k*b),a.hemi[v]=B,v++}}p>0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(a.rectAreaLTC1=eo.LTC_FLOAT_1,a.rectAreaLTC2=eo.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(a.rectAreaLTC1=eo.LTC_HALF_1,a.rectAreaLTC2=eo.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),a.ambient[0]=s,a.ambient[1]=l,a.ambient[2]=u;var G=a.hash;G.directionalLength===h&&G.pointLength===d&&G.spotLength===f&&G.rectAreaLength===p&&G.hemiLength===v&&G.numDirectionalShadows===m&&G.numPointShadows===g&&G.numSpotShadows===y&&G.numSpotMaps===_||(a.directional.length=h,a.spot.length=f,a.rectArea.length=p,a.point.length=d,a.hemi.length=v,a.directionalShadow.length=m,a.directionalShadowMap.length=m,a.pointShadow.length=g,a.pointShadowMap.length=g,a.spotShadow.length=y,a.spotShadowMap.length=y,a.directionalShadowMatrix.length=m,a.pointShadowMatrix.length=g,a.spotLightMatrix.length=y+_-x,a.spotLightMap.length=_,a.numSpotLightShadowsWithMaps=x,G.directionalLength=h,G.pointLength=d,G.spotLength=f,G.rectAreaLength=p,G.hemiLength=v,G.numDirectionalShadows=m,G.numPointShadows=g,G.numSpotShadows=y,G.numSpotMaps=_,a.version=sl++)},setupView:function(e,t){for(var n=0,r=0,i=0,o=0,c=0,h=t.matrixWorldInverse,d=0,f=e.length;d<f;d++){var p=e[d];if(p.isDirectionalLight){var v=a.directional[n];v.direction.setFromMatrixPosition(p.matrixWorld),s.setFromMatrixPosition(p.target.matrixWorld),v.direction.sub(s),v.direction.transformDirection(h),n++}else if(p.isSpotLight){var m=a.spot[i];m.position.setFromMatrixPosition(p.matrixWorld),m.position.applyMatrix4(h),m.direction.setFromMatrixPosition(p.matrixWorld),s.setFromMatrixPosition(p.target.matrixWorld),m.direction.sub(s),m.direction.transformDirection(h),i++}else if(p.isRectAreaLight){var g=a.rectArea[o];g.position.setFromMatrixPosition(p.matrixWorld),g.position.applyMatrix4(h),u.identity(),l.copy(p.matrixWorld),l.premultiply(h),u.extractRotation(l),g.halfWidth.set(.5*p.width,0,0),g.halfHeight.set(0,.5*p.height,0),g.halfWidth.applyMatrix4(u),g.halfHeight.applyMatrix4(u),o++}else if(p.isPointLight){var y=a.point[r];y.position.setFromMatrixPosition(p.matrixWorld),y.position.applyMatrix4(h),r++}else if(p.isHemisphereLight){var _=a.hemi[c];_.direction.setFromMatrixPosition(p.matrixWorld),_.direction.transformDirection(h),c++}}},state:a}}function cl(e,t){var n=new ul(e,t),r=[],i=[];return{init:function(){r.length=0,i.length=0},state:{lightsArray:r,shadowsArray:i,lights:n},setupLights:function(e){n.setup(r,e)},setupLightsView:function(e){n.setupView(r,e)},pushLight:function(e){r.push(e)},pushShadow:function(e){i.push(e)}}}function hl(e,t){var n=new WeakMap;return{get:function(r){var i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=n.get(r);return void 0===o?(i=new cl(e,t),n.set(r,[i])):a>=o.length?(i=new cl(e,t),o.push(i)):i=o[a],i},dispose:function(){n=new WeakMap}}}var dl=function(e){p(n,e);var t=m(n);function n(e){var r;return M(this,n),(r=t.call(this)).isMeshDepthMaterial=!0,r.type="MeshDepthMaterial",r.depthPacking=tn,r.map=null,r.alphaMap=null,r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.wireframe=!1,r.wireframeLinewidth=1,r.setValues(e),r}return T(n,[{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,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}}]),n}(Wi),fl=function(e){p(n,e);var t=m(n);function n(e){var r;return M(this,n),(r=t.call(this)).isMeshDistanceMaterial=!0,r.type="MeshDistanceMaterial",r.referencePosition=new Cr,r.nearDistance=1,r.farDistance=1e3,r.map=null,r.alphaMap=null,r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.setValues(e),r}return T(n,[{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}]),n}(Wi);function pl(e,t,n){var r=new Za,i=new Kn,a=new Kn,o=new br,s=new dl({depthPacking:nn}),l=new fl,u={},c=n.maxTextureSize,h={0:U,1:N,2:F},d=new za({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Kn},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),f=d.clone();f.defines.HORIZONTAL_PASS=1;var p=new da;p.setAttribute("position",new Yi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var v=new Pa(p,d),m=this;function g(n,r){var a=t.update(v);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,f.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new wr(i.x,i.y)),d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,a,d,v,null),f.uniforms.shadow_pass.value=n.mapPass.texture,f.uniforms.resolution.value=n.mapSize,f.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,a,f,v,null)}function y(t,n,r,i,a,o){var c=null,d=!0===r.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(c=void 0!==d?d:!0===r.isPointLight?l:s,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0){var f=c.uuid,p=n.uuid,v=u[f];void 0===v&&(v={},u[f]=v);var m=v[p];void 0===m&&(m=c.clone(),v[p]=m),c=m}return c.visible=n.visible,c.wireframe=n.wireframe,c.side=o===z?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:h[n.side],c.alphaMap=n.alphaMap,c.alphaTest=n.alphaTest,c.clipShadows=n.clipShadows,c.clippingPlanes=n.clippingPlanes,c.clipIntersection=n.clipIntersection,c.displacementMap=n.displacementMap,c.displacementScale=n.displacementScale,c.displacementBias=n.displacementBias,c.wireframeLinewidth=n.wireframeLinewidth,c.linewidth=n.linewidth,!0===r.isPointLight&&!0===c.isMeshDistanceMaterial&&(c.referencePosition.setFromMatrixPosition(r.matrixWorld),c.nearDistance=i,c.farDistance=a),c}function _(n,i,a,o,s){if(!1!==n.visible){if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===z)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var l=t.update(n),u=n.material;if(Array.isArray(u))for(var c=l.groups,h=0,d=c.length;h<d;h++){var f=c[h],p=u[f.materialIndex];if(p&&p.visible){var v=y(n,p,o,a.near,a.far,s);e.renderBufferDirect(a,null,l,v,n,f)}}else if(u.visible){var m=y(n,u,o,a.near,a.far,s);e.renderBufferDirect(a,null,l,m,n,null)}}for(var g=n.children,x=0,b=g.length;x<b;x++)_(g[x],i,a,o,s)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=D,this.render=function(t,n,s){if(!1!==m.enabled&&(!1!==m.autoUpdate||!1!==m.needsUpdate)&&0!==t.length){var l=e.getRenderTarget(),u=e.getActiveCubeFace(),h=e.getActiveMipmapLevel(),d=e.state;d.setBlending(B),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(var f=0,p=t.length;f<p;f++){var v=t[f],y=v.shadow;if(void 0!==y){if(!1!==y.autoUpdate||!1!==y.needsUpdate){i.copy(y.mapSize);var x=y.getFrameExtents();if(i.multiply(x),a.copy(y.mapSize),(i.x>c||i.y>c)&&(i.x>c&&(a.x=Math.floor(c/x.x),i.x=a.x*x.x,y.mapSize.x=a.x),i.y>c&&(a.y=Math.floor(c/x.y),i.y=a.y*x.y,y.mapSize.y=a.y)),null===y.map){var b=this.type!==z?{minFilter:De,magFilter:De}:{};y.map=new wr(i.x,i.y,b),y.map.texture.name=v.name+".shadowMap",y.camera.updateProjectionMatrix()}e.setRenderTarget(y.map),e.clear();for(var w=y.getViewportCount(),M=0;M<w;M++){var S=y.getViewport(M);o.set(a.x*S.x,a.y*S.y,a.x*S.z,a.y*S.w),d.viewport(o),y.updateMatrices(v,M),r=y.getFrustum(),_(n,s,y.camera,v,this.type)}!0!==y.isPointLightShadow&&this.type===z&&g(y,s),y.needsUpdate=!1}}else console.warn("THREE.WebGLShadowMap:",v,"has no shadow.")}m.needsUpdate=!1,e.setRenderTarget(l,u,h)}}}function vl(e,t,n){var r,i,a=n.isWebGL2,o=new function(){var t=!1,n=new br,r=null,i=new br(0,0,0,0);return{setMask:function(n){r===n||t||(e.colorMask(n,n,n,n),r=n)},setLocked:function(e){t=e},setClear:function(t,r,a,o,s){!0===s&&(t*=o,r*=o,a*=o),n.set(t,r,a,o),!1===i.equals(n)&&(e.clearColor(t,r,a,o),i.copy(n))},reset:function(){t=!1,r=null,i.set(-1,0,0,0)}}},s=new function(){var t=!1,n=null,r=null,i=null;return{setTest:function(e){e?Se(2929):Te(2929)},setMask:function(r){n===r||t||(e.depthMask(r),n=r)},setFunc:function(t){if(r!==t){switch(t){case le:e.depthFunc(512);break;case ue:e.depthFunc(519);break;case ce:e.depthFunc(513);break;case he:e.depthFunc(515);break;case de:e.depthFunc(514);break;case fe:e.depthFunc(518);break;case pe:e.depthFunc(516);break;case ve:e.depthFunc(517);break;default:e.depthFunc(515)}r=t}},setLocked:function(e){t=e},setClear:function(t){i!==t&&(e.clearDepth(t),i=t)},reset:function(){t=!1,n=null,r=null,i=null}}},l=new function(){var t=!1,n=null,r=null,i=null,a=null,o=null,s=null,l=null,u=null;return{setTest:function(e){t||(e?Se(2960):Te(2960))},setMask:function(r){n===r||t||(e.stencilMask(r),n=r)},setFunc:function(t,n,o){r===t&&i===n&&a===o||(e.stencilFunc(t,n,o),r=t,i=n,a=o)},setOp:function(t,n,r){o===t&&s===n&&l===r||(e.stencilOp(t,n,r),o=t,s=n,l=r)},setLocked:function(e){t=e},setClear:function(t){u!==t&&(e.clearStencil(t),u=t)},reset:function(){t=!1,n=null,r=null,i=null,a=null,o=null,s=null,l=null,u=null}}},u=new WeakMap,c=new WeakMap,h={},d={},f=new WeakMap,p=[],v=null,m=!1,g=null,y=null,_=null,x=null,w=null,M=null,S=null,T=!1,k=null,E=null,A=null,R=null,I=null,D=e.getParameter(35661),O=!1,z=0,N=e.getParameter(7938);-1!==N.indexOf("WebGL")?(z=parseFloat(/^WebGL (\d)/.exec(N)[1]),O=z>=1):-1!==N.indexOf("OpenGL ES")&&(z=parseFloat(/^OpenGL ES (\d)/.exec(N)[1]),O=z>=2);var me=null,ge={},ye=e.getParameter(3088),_e=e.getParameter(2978),xe=(new br).fromArray(ye),be=(new br).fromArray(_e);function we(t,n,r){var i=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var o=0;o<r;o++)e.texImage2D(n+o,0,6408,1,1,0,6408,5121,i);return a}var Me={};function Se(t){!0!==h[t]&&(e.enable(t),h[t]=!0)}function Te(t){!1!==h[t]&&(e.disable(t),h[t]=!1)}Me[3553]=we(3553,3553,1),Me[34067]=we(34067,34069,6),o.setClear(0,0,0,1),s.setClear(1),l.setClear(0),Se(2929),s.setFunc(he),Pe(!1),Le(P),Se(2884),Ce(B);var ke=(b(r={},q,32774),b(r,X,32778),b(r,Y,32779),r);if(a)ke[Z]=32775,ke[J]=32776;else{var Ee=t.get("EXT_blend_minmax");null!==Ee&&(ke[Z]=Ee.MIN_EXT,ke[J]=Ee.MAX_EXT)}var Ae=(b(i={},Q,0),b(i,K,1),b(i,$,768),b(i,te,770),b(i,se,776),b(i,ae,774),b(i,re,772),b(i,ee,769),b(i,ne,771),b(i,oe,775),b(i,ie,773),i);function Ce(t,n,r,i,a,o,s,l){if(t!==B){if(!1===m&&(Se(3042),m=!0),t===j)a=a||n,o=o||r,s=s||i,n===y&&a===w||(e.blendEquationSeparate(ke[n],ke[a]),y=n,w=a),r===_&&i===x&&o===M&&s===S||(e.blendFuncSeparate(Ae[r],Ae[i],Ae[o],Ae[s]),_=r,x=i,M=o,S=s),g=t,T=null;else if(t!==g||l!==T){if(y===q&&w===q||(e.blendEquation(32774),y=q,w=q),l)switch(t){case G:e.blendFuncSeparate(1,771,1,771);break;case H:e.blendFunc(1,1);break;case V:e.blendFuncSeparate(0,769,0,1);break;case W:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case G:e.blendFuncSeparate(770,771,1,771);break;case H:e.blendFunc(770,1);break;case V:e.blendFuncSeparate(0,769,0,1);break;case W:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}_=null,x=null,M=null,S=null,g=t,T=l}}else!0===m&&(Te(3042),m=!1)}function Pe(t){k!==t&&(t?e.frontFace(2304):e.frontFace(2305),k=t)}function Le(t){t!==C?(Se(2884),t!==E&&(t===P?e.cullFace(1029):t===L?e.cullFace(1028):e.cullFace(1032))):Te(2884),E=t}function Re(t,n,r){t?(Se(32823),R===n&&I===r||(e.polygonOffset(n,r),R=n,I=r)):Te(32823)}return{buffers:{color:o,depth:s,stencil:l},enable:Se,disable:Te,bindFramebuffer:function(t,n){return d[t]!==n&&(e.bindFramebuffer(t,n),d[t]=n,a&&(36009===t&&(d[36160]=n),36160===t&&(d[36009]=n)),!0)},drawBuffers:function(r,i){var a=p,o=!1;if(r)if(void 0===(a=f.get(i))&&(a=[],f.set(i,a)),r.isWebGLMultipleRenderTargets){var s=r.texture;if(a.length!==s.length||36064!==a[0]){for(var l=0,u=s.length;l<u;l++)a[l]=36064+l;a.length=s.length,o=!0}}else 36064!==a[0]&&(a[0]=36064,o=!0);else 1029!==a[0]&&(a[0]=1029,o=!0);o&&(n.isWebGL2?e.drawBuffers(a):t.get("WEBGL_draw_buffers").drawBuffersWEBGL(a))},useProgram:function(t){return v!==t&&(e.useProgram(t),v=t,!0)},setBlending:Ce,setMaterial:function(e,t){e.side===F?Te(2884):Se(2884);var n=e.side===U;t&&(n=!n),Pe(n),e.blending===G&&!1===e.transparent?Ce(B):Ce(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),s.setFunc(e.depthFunc),s.setTest(e.depthTest),s.setMask(e.depthWrite),o.setMask(e.colorWrite);var r=e.stencilWrite;l.setTest(r),r&&(l.setMask(e.stencilWriteMask),l.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),l.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),Re(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?Se(32926):Te(32926)},setFlipSided:Pe,setCullFace:Le,setLineWidth:function(t){t!==A&&(O&&e.lineWidth(t),A=t)},setPolygonOffset:Re,setScissorTest:function(e){e?Se(3089):Te(3089)},activeTexture:function(t){void 0===t&&(t=33984+D-1),me!==t&&(e.activeTexture(t),me=t)},bindTexture:function(t,n,r){void 0===r&&(r=null===me?33984+D-1:me);var i=ge[r];void 0===i&&(i={type:void 0,texture:void 0},ge[r]=i),i.type===t&&i.texture===n||(me!==r&&(e.activeTexture(r),me=r),e.bindTexture(t,n||Me[t]),i.type=t,i.texture=n)},unbindTexture:function(){var t=ge[me];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},updateUBOMapping:function(t,n){var r=c.get(n);void 0===r&&(r=new WeakMap,c.set(n,r));var i=r.get(t);void 0===i&&(i=e.getUniformBlockIndex(n,t.name),r.set(t,i))},uniformBlockBinding:function(t,n){var r=c.get(n).get(t);u.get(t)!==r&&(e.uniformBlockBinding(n,r,t.__bindingPointIndex),u.set(t,r))},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===xe.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),xe.copy(t))},viewport:function(t){!1===be.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),be.copy(t))},reset:function(){e.disable(3042),e.disable(2884),e.disable(2929),e.disable(32823),e.disable(3089),e.disable(2960),e.disable(32926),e.blendEquation(32774),e.blendFunc(1,0),e.blendFuncSeparate(1,0,1,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(513),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(519,0,4294967295),e.stencilOp(7680,7680,7680),e.clearStencil(0),e.cullFace(1029),e.frontFace(2305),e.polygonOffset(0,0),e.activeTexture(33984),e.bindFramebuffer(36160,null),!0===a&&(e.bindFramebuffer(36009,null),e.bindFramebuffer(36008,null)),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),h={},me=null,ge={},d={},f=new WeakMap,p=[],v=null,m=!1,g=null,y=null,_=null,x=null,w=null,M=null,S=null,T=!1,k=null,E=null,A=null,R=null,I=null,xe.set(0,0,e.canvas.width,e.canvas.height),be.set(0,0,e.canvas.width,e.canvas.height),o.reset(),s.reset(),l.reset()}}}function ml(e,t,n,r,i,a,o){var s,l,u,c=i.isWebGL2,h=i.maxTextures,d=i.maxCubemapSize,f=i.maxTextureSize,p=i.maxSamples,v=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,m=/OculusBrowser/g.test(navigator.userAgent),g=new WeakMap,y=new WeakMap,_=!1;try{_="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function x(e,t){return _?new OffscreenCanvas(e,t):rr("canvas")}function w(e,t,n,r){var i=1;if((e.width>r||e.height>r)&&(i=r/Math.max(e.width,e.height)),i<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var a=t?Yn:Math.floor,o=a(i*e.width),s=a(i*e.height);void 0===u&&(u=x(o,s));var l=n?x(o,s):u;return l.width=o,l.height=s,l.getContext("2d").drawImage(e,0,0,o,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+s+")."),l}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function M(e){return qn(e.width)&&qn(e.height)}function S(e,t){return e.generateMipmaps&&t&&e.minFilter!==De&&e.minFilter!==Fe}function T(t){e.generateMipmap(t)}function k(n,r,i,a){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!1===c)return r;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var s=r;return 6403===r&&(5126===i&&(s=33326),5131===i&&(s=33325),5121===i&&(s=33321)),33319===r&&(5126===i&&(s=33328),5131===i&&(s=33327),5121===i&&(s=33323)),6408===r&&(5126===i&&(s=34836),5131===i&&(s=34842),5121===i&&(s=a===en&&!1===o?35907:32856),32819===i&&(s=32854),32820===i&&(s=32855)),33325!==s&&33326!==s&&33327!==s&&33328!==s&&34842!==s&&34836!==s||t.get("EXT_color_buffer_float"),s}function E(e,t,n){return!0===S(e,n)||e.isFramebufferTexture&&e.minFilter!==De&&e.minFilter!==Fe?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function A(e){return e===De||e===Oe||e===Ne?9728:9729}function C(e){var t=e.target;t.removeEventListener("dispose",C),function(e){var t=r.get(e);if(void 0!==t.__webglInit){var n=e.source,i=y.get(n);if(i){var a=i[t.__cacheKey];a.usedTimes--,0===a.usedTimes&&L(e),0===Object.keys(i).length&&y.delete(n)}r.remove(e)}}(t),t.isVideoTexture&&g.delete(t)}function P(t){var n=t.target;n.removeEventListener("dispose",P),function(t){var n=t.texture,i=r.get(t),a=r.get(n);if(void 0!==a.__webglTexture&&(e.deleteTexture(a.__webglTexture),o.memory.textures--),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(var s=0;s<6;s++)e.deleteFramebuffer(i.__webglFramebuffer[s]),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer[s]);else{if(e.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&e.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer)for(var l=0;l<i.__webglColorRenderbuffer.length;l++)i.__webglColorRenderbuffer[l]&&e.deleteRenderbuffer(i.__webglColorRenderbuffer[l]);i.__webglDepthRenderbuffer&&e.deleteRenderbuffer(i.__webglDepthRenderbuffer)}if(t.isWebGLMultipleRenderTargets)for(var u=0,c=n.length;u<c;u++){var h=r.get(n[u]);h.__webglTexture&&(e.deleteTexture(h.__webglTexture),o.memory.textures--),r.remove(n[u])}r.remove(n),r.remove(t)}(n)}function L(t){var n=r.get(t);e.deleteTexture(n.__webglTexture);var i=t.source;delete y.get(i)[n.__cacheKey],o.memory.textures--}var R=0;function I(e,t){var i=r.get(e);if(e.isVideoTexture&&function(e){var t=o.render.frame;g.get(e)!==t&&(g.set(e,t),e.update())}(e),!1===e.isRenderTargetTexture&&e.version>0&&i.__version!==e.version){var a=e.image;if(null===a)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==a.complete)return void U(i,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(3553,i.__webglTexture,33984+t)}var D=(b(s={},Le,10497),b(s,Re,33071),b(s,Ie,33648),s),O=(b(l={},De,9728),b(l,Oe,9984),b(l,Ne,9986),b(l,Fe,9729),b(l,Be,9985),b(l,He,9987),l);function z(n,a,o){if(o?(e.texParameteri(n,10242,D[a.wrapS]),e.texParameteri(n,10243,D[a.wrapT]),32879!==n&&35866!==n||e.texParameteri(n,32882,D[a.wrapR]),e.texParameteri(n,10240,O[a.magFilter]),e.texParameteri(n,10241,O[a.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879!==n&&35866!==n||e.texParameteri(n,32882,33071),a.wrapS===Re&&a.wrapT===Re||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,10240,A(a.magFilter)),e.texParameteri(n,10241,A(a.minFilter)),a.minFilter!==De&&a.minFilter!==Fe&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===t.has("EXT_texture_filter_anisotropic")){var s=t.get("EXT_texture_filter_anisotropic");if(a.type===Je&&!1===t.has("OES_texture_float_linear"))return;if(!1===c&&a.type===Qe&&!1===t.has("OES_texture_half_float_linear"))return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function N(t,n){var r=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",C));var i=n.source,a=y.get(i);void 0===a&&(a={},y.set(i,a));var s=function(e){var t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.encoding),t.join()}(n);if(s!==t.__cacheKey){void 0===a[s]&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,r=!0),a[s].usedTimes++;var l=a[t.__cacheKey];void 0!==l&&(a[t.__cacheKey].usedTimes--,0===l.usedTimes&&L(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return r}function U(t,i,o){var s=3553;i.isDataArrayTexture&&(s=35866),i.isData3DTexture&&(s=32879);var l=N(t,i),u=i.source;n.bindTexture(s,t.__webglTexture,33984+o);var h=r.get(u);if(u.version!==h.__version||!0===l){n.activeTexture(33984+o),e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment),e.pixelStorei(37443,0);var d,p=function(e){return!c&&(e.wrapS!==Re||e.wrapT!==Re||e.minFilter!==De&&e.minFilter!==Fe)}(i)&&!1===M(i.image),v=w(i.image,p,!1,f),m=M(v=W(i,v))||c,g=a.convert(i.format,i.encoding),y=a.convert(i.type),_=k(i.internalFormat,g,y,i.encoding,i.isVideoTexture);z(s,i,m);var x=i.mipmaps,b=c&&!0!==i.isVideoTexture,A=void 0===h.__version||!0===l,C=E(i,v,m);if(i.isDepthTexture)_=6402,c?_=i.type===Je?36012:i.type===Ze?33190:i.type===et?35056:33189:i.type===Je&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===ot&&6402===_&&i.type!==Xe&&i.type!==Ze&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=Ze,y=a.convert(i.type)),i.format===st&&6402===_&&(_=34041,i.type!==et&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=et,y=a.convert(i.type))),A&&(b?n.texStorage2D(3553,1,_,v.width,v.height):n.texImage2D(3553,0,_,v.width,v.height,0,g,y,null));else if(i.isDataTexture)if(x.length>0&&m){b&&A&&n.texStorage2D(3553,C,_,x[0].width,x[0].height);for(var P=0,L=x.length;P<L;P++)d=x[P],b?n.texSubImage2D(3553,P,0,0,d.width,d.height,g,y,d.data):n.texImage2D(3553,P,_,d.width,d.height,0,g,y,d.data);i.generateMipmaps=!1}else b?(A&&n.texStorage2D(3553,C,_,v.width,v.height),n.texSubImage2D(3553,0,0,0,v.width,v.height,g,y,v.data)):n.texImage2D(3553,0,_,v.width,v.height,0,g,y,v.data);else if(i.isCompressedTexture){b&&A&&n.texStorage2D(3553,C,_,x[0].width,x[0].height);for(var R=0,I=x.length;R<I;R++)d=x[R],i.format!==rt?null!==g?b?n.compressedTexSubImage2D(3553,R,0,0,d.width,d.height,g,d.data):n.compressedTexImage2D(3553,R,_,d.width,d.height,0,d.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):b?n.texSubImage2D(3553,R,0,0,d.width,d.height,g,y,d.data):n.texImage2D(3553,R,_,d.width,d.height,0,g,y,d.data)}else if(i.isDataArrayTexture)b?(A&&n.texStorage3D(35866,C,_,v.width,v.height,v.depth),n.texSubImage3D(35866,0,0,0,0,v.width,v.height,v.depth,g,y,v.data)):n.texImage3D(35866,0,_,v.width,v.height,v.depth,0,g,y,v.data);else if(i.isData3DTexture)b?(A&&n.texStorage3D(32879,C,_,v.width,v.height,v.depth),n.texSubImage3D(32879,0,0,0,0,v.width,v.height,v.depth,g,y,v.data)):n.texImage3D(32879,0,_,v.width,v.height,v.depth,0,g,y,v.data);else if(i.isFramebufferTexture){if(A)if(b)n.texStorage2D(3553,C,_,v.width,v.height);else for(var D=v.width,O=v.height,U=0;U<C;U++)n.texImage2D(3553,U,_,D,O,0,g,y,null),D>>=1,O>>=1}else if(x.length>0&&m){b&&A&&n.texStorage2D(3553,C,_,x[0].width,x[0].height);for(var F=0,B=x.length;F<B;F++)d=x[F],b?n.texSubImage2D(3553,F,0,0,g,y,d):n.texImage2D(3553,F,_,g,y,d);i.generateMipmaps=!1}else b?(A&&n.texStorage2D(3553,C,_,v.width,v.height),n.texSubImage2D(3553,0,0,0,g,y,v)):n.texImage2D(3553,0,_,g,y,v);S(i,m)&&T(s),h.__version=u.version,i.onUpdate&&i.onUpdate(i)}t.__version=i.version}function F(t,i,o,s,l){var u=a.convert(o.format,o.encoding),c=a.convert(o.type),h=k(o.internalFormat,u,c,o.encoding);r.get(i).__hasExternalTextures||(32879===l||35866===l?n.texImage3D(l,0,h,i.width,i.height,i.depth,0,u,c,null):n.texImage2D(l,0,h,i.width,i.height,0,u,c,null)),n.bindFramebuffer(36160,t),V(i)?v.framebufferTexture2DMultisampleEXT(36160,s,l,r.get(o).__webglTexture,0,H(i)):e.framebufferTexture2D(36160,s,l,r.get(o).__webglTexture,0),n.bindFramebuffer(36160,null)}function B(t,n,r){if(e.bindRenderbuffer(36161,t),n.depthBuffer&&!n.stencilBuffer){var i=33189;if(r||V(n)){var o=n.depthTexture;o&&o.isDepthTexture&&(o.type===Je?i=36012:o.type===Ze&&(i=33190));var s=H(n);V(n)?v.renderbufferStorageMultisampleEXT(36161,s,i,n.width,n.height):e.renderbufferStorageMultisample(36161,s,i,n.width,n.height)}else e.renderbufferStorage(36161,i,n.width,n.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(n.depthBuffer&&n.stencilBuffer){var l=H(n);r&&!1===V(n)?e.renderbufferStorageMultisample(36161,l,35056,n.width,n.height):V(n)?v.renderbufferStorageMultisampleEXT(36161,l,35056,n.width,n.height):e.renderbufferStorage(36161,34041,n.width,n.height),e.framebufferRenderbuffer(36160,33306,36161,t)}else for(var u=!0===n.isWebGLMultipleRenderTargets?n.texture:[n.texture],c=0;c<u.length;c++){var h=u[c],d=a.convert(h.format,h.encoding),f=a.convert(h.type),p=k(h.internalFormat,d,f,h.encoding),m=H(n);r&&!1===V(n)?e.renderbufferStorageMultisample(36161,m,p,n.width,n.height):V(n)?v.renderbufferStorageMultisampleEXT(36161,m,p,n.width,n.height):e.renderbufferStorage(36161,p,n.width,n.height)}e.bindRenderbuffer(36161,null)}function G(t){var i=r.get(t),a=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture&&!i.__autoAllocateDepthBuffer){if(a)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,i){if(i&&i.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(36160,t),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),I(i.depthTexture,0);var a=r.get(i.depthTexture).__webglTexture,o=H(i);if(i.depthTexture.format===ot)V(i)?v.framebufferTexture2DMultisampleEXT(36160,36096,3553,a,0,o):e.framebufferTexture2D(36160,36096,3553,a,0);else{if(i.depthTexture.format!==st)throw new Error("Unknown depthTexture format");V(i)?v.framebufferTexture2DMultisampleEXT(36160,33306,3553,a,0,o):e.framebufferTexture2D(36160,33306,3553,a,0)}}(i.__webglFramebuffer,t)}else if(a){i.__webglDepthbuffer=[];for(var o=0;o<6;o++)n.bindFramebuffer(36160,i.__webglFramebuffer[o]),i.__webglDepthbuffer[o]=e.createRenderbuffer(),B(i.__webglDepthbuffer[o],t,!1)}else n.bindFramebuffer(36160,i.__webglFramebuffer),i.__webglDepthbuffer=e.createRenderbuffer(),B(i.__webglDepthbuffer,t,!1);n.bindFramebuffer(36160,null)}function H(e){return Math.min(p,e.samples)}function V(e){var n=r.get(e);return c&&e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function W(e,n){var r=e.encoding,i=e.format,a=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||e.format===zn||r!==$t&&(r===en?!1===c?!0===t.has("EXT_sRGB")&&i===rt?(e.format=zn,e.minFilter=Fe,e.generateMipmaps=!1):n=mr.sRGBToLinear(n):i===rt&&a===We||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",r)),n}this.allocateTextureUnit=function(){var e=R;return e>=h&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+h),R+=1,e},this.resetTextureUnits=function(){R=0},this.setTexture2D=I,this.setTexture2DArray=function(e,t){var i=r.get(e);e.version>0&&i.__version!==e.version?U(i,e,t):n.bindTexture(35866,i.__webglTexture,33984+t)},this.setTexture3D=function(e,t){var i=r.get(e);e.version>0&&i.__version!==e.version?U(i,e,t):n.bindTexture(32879,i.__webglTexture,33984+t)},this.setTextureCube=function(t,i){var o=r.get(t);t.version>0&&o.__version!==t.version?function(t,i,o){if(6===i.image.length){var s=N(t,i),l=i.source;n.bindTexture(34067,t.__webglTexture,33984+o);var u=r.get(l);if(l.version!==u.__version||!0===s){n.activeTexture(33984+o),e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment),e.pixelStorei(37443,0);for(var h=i.isCompressedTexture||i.image[0].isCompressedTexture,f=i.image[0]&&i.image[0].isDataTexture,p=[],v=0;v<6;v++)p[v]=h||f?f?i.image[v].image:i.image[v]:w(i.image[v],!1,!0,d),p[v]=W(i,p[v]);var m,g=p[0],y=M(g)||c,_=a.convert(i.format,i.encoding),x=a.convert(i.type),b=k(i.internalFormat,_,x,i.encoding),A=c&&!0!==i.isVideoTexture,C=void 0===u.__version||!0===s,P=E(i,g,y);if(z(34067,i,y),h){A&&C&&n.texStorage2D(34067,P,b,g.width,g.height);for(var L=0;L<6;L++){m=p[L].mipmaps;for(var R=0;R<m.length;R++){var I=m[R];i.format!==rt?null!==_?A?n.compressedTexSubImage2D(34069+L,R,0,0,I.width,I.height,_,I.data):n.compressedTexImage2D(34069+L,R,b,I.width,I.height,0,I.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):A?n.texSubImage2D(34069+L,R,0,0,I.width,I.height,_,x,I.data):n.texImage2D(34069+L,R,b,I.width,I.height,0,_,x,I.data)}}}else{m=i.mipmaps,A&&C&&(m.length>0&&P++,n.texStorage2D(34067,P,b,p[0].width,p[0].height));for(var D=0;D<6;D++)if(f){A?n.texSubImage2D(34069+D,0,0,0,p[D].width,p[D].height,_,x,p[D].data):n.texImage2D(34069+D,0,b,p[D].width,p[D].height,0,_,x,p[D].data);for(var O=0;O<m.length;O++){var U=m[O].image[D].image;A?n.texSubImage2D(34069+D,O+1,0,0,U.width,U.height,_,x,U.data):n.texImage2D(34069+D,O+1,b,U.width,U.height,0,_,x,U.data)}}else{A?n.texSubImage2D(34069+D,0,0,0,_,x,p[D]):n.texImage2D(34069+D,0,b,_,x,p[D]);for(var F=0;F<m.length;F++){var B=m[F];A?n.texSubImage2D(34069+D,F+1,0,0,_,x,B.image[D]):n.texImage2D(34069+D,F+1,b,_,x,B.image[D])}}}S(i,y)&&T(34067),u.__version=l.version,i.onUpdate&&i.onUpdate(i)}t.__version=i.version}}(o,t,i):n.bindTexture(34067,o.__webglTexture,33984+i)},this.rebindTextures=function(e,t,n){var i=r.get(e);void 0!==t&&F(i.__webglFramebuffer,e,e.texture,36064,3553),void 0!==n&&G(e)},this.setupRenderTarget=function(t){var s=t.texture,l=r.get(t),u=r.get(s);t.addEventListener("dispose",P),!0!==t.isWebGLMultipleRenderTargets&&(void 0===u.__webglTexture&&(u.__webglTexture=e.createTexture()),u.__version=s.version,o.memory.textures++);var h=!0===t.isWebGLCubeRenderTarget,d=!0===t.isWebGLMultipleRenderTargets,f=M(t)||c;if(h){l.__webglFramebuffer=[];for(var p=0;p<6;p++)l.__webglFramebuffer[p]=e.createFramebuffer()}else{if(l.__webglFramebuffer=e.createFramebuffer(),d)if(i.drawBuffers)for(var v=t.texture,m=0,g=v.length;m<g;m++){var y=r.get(v[m]);void 0===y.__webglTexture&&(y.__webglTexture=e.createTexture(),o.memory.textures++)}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(c&&t.samples>0&&!1===V(t)){var _=d?s:[s];l.__webglMultisampledFramebuffer=e.createFramebuffer(),l.__webglColorRenderbuffer=[],n.bindFramebuffer(36160,l.__webglMultisampledFramebuffer);for(var x=0;x<_.length;x++){var b=_[x];l.__webglColorRenderbuffer[x]=e.createRenderbuffer(),e.bindRenderbuffer(36161,l.__webglColorRenderbuffer[x]);var w=a.convert(b.format,b.encoding),E=a.convert(b.type),A=k(b.internalFormat,w,E,b.encoding,!0===t.isXRRenderTarget),C=H(t);e.renderbufferStorageMultisample(36161,C,A,t.width,t.height),e.framebufferRenderbuffer(36160,36064+x,36161,l.__webglColorRenderbuffer[x])}e.bindRenderbuffer(36161,null),t.depthBuffer&&(l.__webglDepthRenderbuffer=e.createRenderbuffer(),B(l.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(36160,null)}}if(h){n.bindTexture(34067,u.__webglTexture),z(34067,s,f);for(var L=0;L<6;L++)F(l.__webglFramebuffer[L],t,s,36064,34069+L);S(s,f)&&T(34067),n.unbindTexture()}else if(d){for(var R=t.texture,I=0,D=R.length;I<D;I++){var O=R[I],N=r.get(O);n.bindTexture(3553,N.__webglTexture),z(3553,O,f),F(l.__webglFramebuffer,t,O,36064+I,3553),S(O,f)&&T(3553)}n.unbindTexture()}else{var U=3553;(t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(c?U=t.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),n.bindTexture(U,u.__webglTexture),z(U,s,f),F(l.__webglFramebuffer,t,s,36064,U),S(s,f)&&T(U),n.unbindTexture()}t.depthBuffer&&G(t)},this.updateRenderTargetMipmap=function(e){for(var t=M(e)||c,i=!0===e.isWebGLMultipleRenderTargets?e.texture:[e.texture],a=0,o=i.length;a<o;a++){var s=i[a];if(S(s,t)){var l=e.isWebGLCubeRenderTarget?34067:3553,u=r.get(s).__webglTexture;n.bindTexture(l,u),T(l),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(c&&t.samples>0&&!1===V(t)){var i=t.isWebGLMultipleRenderTargets?t.texture:[t.texture],a=t.width,o=t.height,s=16384,l=[],u=t.stencilBuffer?33306:36096,h=r.get(t),d=!0===t.isWebGLMultipleRenderTargets;if(d)for(var f=0;f<i.length;f++)n.bindFramebuffer(36160,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064+f,36161,null),n.bindFramebuffer(36160,h.__webglFramebuffer),e.framebufferTexture2D(36009,36064+f,3553,null,0);n.bindFramebuffer(36008,h.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,h.__webglFramebuffer);for(var p=0;p<i.length;p++){l.push(36064+p),t.depthBuffer&&l.push(u);var v=void 0!==h.__ignoreDepthValues&&h.__ignoreDepthValues;if(!1===v&&(t.depthBuffer&&(s|=256),t.stencilBuffer&&(s|=1024)),d&&e.framebufferRenderbuffer(36008,36064,36161,h.__webglColorRenderbuffer[p]),!0===v&&(e.invalidateFramebuffer(36008,[u]),e.invalidateFramebuffer(36009,[u])),d){var g=r.get(i[p]).__webglTexture;e.framebufferTexture2D(36009,36064,3553,g,0)}e.blitFramebuffer(0,0,a,o,0,0,a,o,s,9728),m&&e.invalidateFramebuffer(36008,l)}if(n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,null),d)for(var y=0;y<i.length;y++){n.bindFramebuffer(36160,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064+y,36161,h.__webglColorRenderbuffer[y]);var _=r.get(i[y]).__webglTexture;n.bindFramebuffer(36160,h.__webglFramebuffer),e.framebufferTexture2D(36009,36064+y,3553,_,0)}n.bindFramebuffer(36009,h.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=G,this.setupFrameBufferTexture=F,this.useMultisampledRTT=V}function gl(e,t,n){var r=n.isWebGL2;return{convert:function(n){var i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(n===We)return 5121;if(n===Ke)return 32819;if(n===$e)return 32820;if(n===je)return 5120;if(n===qe)return 5122;if(n===Xe)return 5123;if(n===Ye)return 5124;if(n===Ze)return 5125;if(n===Je)return 5126;if(n===Qe)return r?5131:null!==(i=t.get("OES_texture_half_float"))?i.HALF_FLOAT_OES:null;if(n===tt)return 6406;if(n===rt)return 6408;if(n===it)return 6409;if(n===at)return 6410;if(n===ot)return 6402;if(n===st)return 34041;if(n===lt)return 6403;if(n===nt)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(n===zn)return null!==(i=t.get("EXT_sRGB"))?i.SRGB_ALPHA_EXT:null;if(n===ut)return 36244;if(n===ct)return 33319;if(n===ht)return 33320;if(n===dt)return 36249;if(n===ft||n===pt||n===vt||n===mt)if(a===en){if(null===(i=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(n===ft)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===pt)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===vt)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===mt)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(i=t.get("WEBGL_compressed_texture_s3tc")))return null;if(n===ft)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===pt)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===vt)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===mt)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===gt||n===yt||n===_t||n===xt){if(null===(i=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(n===gt)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===yt)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===_t)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===xt)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===bt)return null!==(i=t.get("WEBGL_compressed_texture_etc1"))?i.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===wt||n===Mt){if(null===(i=t.get("WEBGL_compressed_texture_etc")))return null;if(n===wt)return a===en?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(n===Mt)return a===en?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC}if(n===St||n===Tt||n===kt||n===Et||n===At||n===Ct||n===Pt||n===Lt||n===Rt||n===It||n===Dt||n===Ot||n===zt||n===Nt){if(null===(i=t.get("WEBGL_compressed_texture_astc")))return null;if(n===St)return a===en?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Tt)return a===en?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===kt)return a===en?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Et)return a===en?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===At)return a===en?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Ct)return a===en?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Pt)return a===en?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Lt)return a===en?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Rt)return a===en?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===It)return a===en?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Dt)return a===en?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Ot)return a===en?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===zt)return a===en?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Nt)return a===en?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===Ut){if(null===(i=t.get("EXT_texture_compression_bptc")))return null;if(n===Ut)return a===en?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT}return n===et?r?34042:null!==(i=t.get("WEBGL_depth_texture"))?i.UNSIGNED_INT_24_8_WEBGL:null:void 0!==e[n]?e[n]:null}}}var yl=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return M(this,n),(e=t.call(this)).isArrayCamera=!0,e.cameras=r,e}return T(n)}(Ua),_l=function(e){p(n,e);var t=m(n);function n(){var e;return M(this,n),(e=t.call(this)).isGroup=!0,e.type="Group",e}return T(n)}(Li),xl={type:"move"},bl=function(){function e(){M(this,e),this._targetRay=null,this._grip=null,this._hand=null}return T(e,[{key:"getHandSpace",value:function(){return null===this._hand&&(this._hand=new _l,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}},{key:"getTargetRaySpace",value:function(){return null===this._targetRay&&(this._targetRay=new _l,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Cr,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Cr),this._targetRay}},{key:"getGripSpace",value:function(){return null===this._grip&&(this._grip=new _l,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Cr,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Cr),this._grip}},{key:"dispatchEvent",value:function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}},{key:"disconnect",value:function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}},{key:"update",value:function(e,t,n){var r=null,i=null,a=null,o=this._targetRay,s=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){a=!0;var c,h=u(e.hand.values());try{for(h.s();!(c=h.n()).done;){var d=c.value,f=t.getJointPose(d,n);if(void 0===l.joints[d.jointName]){var p=new _l;p.matrixAutoUpdate=!1,p.visible=!1,l.joints[d.jointName]=p,l.add(p)}var v=l.joints[d.jointName];null!==f&&(v.matrix.fromArray(f.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.jointRadius=f.radius),v.visible=null!==f}}catch(e){h.e(e)}finally{h.f()}var m=l.joints["index-finger-tip"],g=l.joints["thumb-tip"],y=m.position.distanceTo(g.position);l.inputState.pinching&&y>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&y<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==s&&e.gripSpace&&null!==(i=t.getPose(e.gripSpace,n))&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1);null!==o&&(null===(r=t.getPose(e.targetRaySpace,n))&&null!==i&&(r=i),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(xl)))}return null!==o&&(o.visible=null!==r),null!==s&&(s.visible=null!==i),null!==l&&(l.visible=null!==a),this}}]),e}(),wl=function(e){p(n,e);var t=m(n);function n(e,r,i,a,o,s,l,u,c,h){var d;if(M(this,n),(h=void 0!==h?h:ot)!==ot&&h!==st)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");return void 0===i&&h===ot&&(i=Ze),void 0===i&&h===st&&(i=et),(d=t.call(this,null,a,o,s,l,u,h,i,c)).isDepthTexture=!0,d.image={width:e,height:r},d.magFilter=void 0!==l?l:De,d.minFilter=void 0!==u?u:De,d.flipY=!1,d.generateMipmaps=!1,d}return T(n)}(xr),Ml=function(e){p(n,e);var t=m(n);function n(e,r){var i;M(this,n);var a=y(i=t.call(this)),o=null,s=1,u=null,c="local-floor",h=null,d=null,f=null,p=null,v=null,m=null,g=r.getContextAttributes(),_=null,x=null,b=[],S=[],T=new Ua;T.layers.enable(1),T.viewport=new br;var k=new Ua;k.layers.enable(2),k.viewport=new br;var E=[T,k],A=new yl;A.layers.enable(1),A.layers.enable(2);var C=null,P=null;function L(e){var t=S.indexOf(e.inputSource);if(-1!==t){var n=b[t];void 0!==n&&n.dispatchEvent({type:e.type,data:e.inputSource})}}function R(){o.removeEventListener("select",L),o.removeEventListener("selectstart",L),o.removeEventListener("selectend",L),o.removeEventListener("squeeze",L),o.removeEventListener("squeezestart",L),o.removeEventListener("squeezeend",L),o.removeEventListener("end",R),o.removeEventListener("inputsourceschange",I);for(var t=0;t<b.length;t++){var n=S[t];null!==n&&(S[t]=null,b[t].disconnect(n))}C=null,P=null,e.setRenderTarget(_),v=null,p=null,f=null,o=null,x=null,U.stop(),a.isPresenting=!1,a.dispatchEvent({type:"sessionend"})}function I(e){for(var t=0;t<e.removed.length;t++){var n=e.removed[t],r=S.indexOf(n);r>=0&&(S[r]=null,b[r].dispatchEvent({type:"disconnected",data:n}))}for(var i=0;i<e.added.length;i++){var a=e.added[i],o=S.indexOf(a);if(-1===o){for(var s=0;s<b.length;s++){if(s>=S.length){S.push(a),o=s;break}if(null===S[s]){S[s]=a,o=s;break}}if(-1===o)break}var l=b[o];l&&l.dispatchEvent({type:"connected",data:a})}}i.cameraAutoUpdate=!0,i.enabled=!1,i.isPresenting=!1,i.getController=function(e){var t=b[e];return void 0===t&&(t=new bl,b[e]=t),t.getTargetRaySpace()},i.getControllerGrip=function(e){var t=b[e];return void 0===t&&(t=new bl,b[e]=t),t.getGripSpace()},i.getHand=function(e){var t=b[e];return void 0===t&&(t=new bl,b[e]=t),t.getHandSpace()},i.setFramebufferScaleFactor=function(e){s=e,!0===a.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},i.setReferenceSpaceType=function(e){c=e,!0===a.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},i.getReferenceSpace=function(){return h||u},i.setReferenceSpace=function(e){h=e},i.getBaseLayer=function(){return null!==p?p:v},i.getBinding=function(){return f},i.getFrame=function(){return m},i.getSession=function(){return o},i.setSession=function(){var t=l(w().mark((function t(n){var i,l,d,m,y;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===(o=n)){t.next=25;break}if(_=e.getRenderTarget(),o.addEventListener("select",L),o.addEventListener("selectstart",L),o.addEventListener("selectend",L),o.addEventListener("squeeze",L),o.addEventListener("squeezestart",L),o.addEventListener("squeezeend",L),o.addEventListener("end",R),o.addEventListener("inputsourceschange",I),!0===g.xrCompatible){t.next=14;break}return t.next=14,r.makeXRCompatible();case 14:return void 0===o.renderState.layers||!1===e.capabilities.isWebGL2?(i={antialias:void 0!==o.renderState.layers||g.antialias,alpha:g.alpha,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:s},v=new XRWebGLLayer(o,r,i),o.updateRenderState({baseLayer:v}),x=new wr(v.framebufferWidth,v.framebufferHeight,{format:rt,type:We,encoding:e.outputEncoding,stencilBuffer:g.stencil})):(l=null,d=null,m=null,g.depth&&(m=g.stencil?35056:33190,l=g.stencil?st:ot,d=g.stencil?et:Ze),y={colorFormat:32856,depthFormat:m,scaleFactor:s},f=new XRWebGLBinding(o,r),p=f.createProjectionLayer(y),o.updateRenderState({layers:[p]}),x=new wr(p.textureWidth,p.textureHeight,{format:rt,type:We,depthTexture:new wl(p.textureWidth,p.textureHeight,d,void 0,void 0,void 0,void 0,void 0,void 0,l),stencilBuffer:g.stencil,encoding:e.outputEncoding,samples:g.antialias?4:0}),e.properties.get(x).__ignoreDepthValues=p.ignoreDepthValues),x.isXRRenderTarget=!0,this.setFoveation(1),h=null,t.next=20,o.requestReferenceSpace(c);case 20:u=t.sent,U.setContext(o),U.start(),a.isPresenting=!0,a.dispatchEvent({type:"sessionstart"});case 25:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}();var D=new Cr,O=new Cr;function z(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}i.updateCamera=function(e){if(null!==o){A.near=k.near=T.near=e.near,A.far=k.far=T.far=e.far,C===A.near&&P===A.far||(o.updateRenderState({depthNear:A.near,depthFar:A.far}),C=A.near,P=A.far);var t=e.parent,n=A.cameras;z(A,t);for(var r=0;r<n.length;r++)z(n[r],t);A.matrixWorld.decompose(A.position,A.quaternion,A.scale),e.matrix.copy(A.matrix),e.matrix.decompose(e.position,e.quaternion,e.scale);for(var i=e.children,a=0,s=i.length;a<s;a++)i[a].updateMatrixWorld(!0);2===n.length?function(e,t,n){D.setFromMatrixPosition(t.matrixWorld),O.setFromMatrixPosition(n.matrixWorld);var r=D.distanceTo(O),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),l=(i[9]+1)/i[5],u=(i[9]-1)/i[5],c=(i[8]-1)/i[0],h=(a[8]+1)/a[0],d=o*c,f=o*h,p=r/(-c+h),v=p*-c;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(v),e.translateZ(p),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert();var m=o+p,g=s+p,y=d-v,_=f+(r-v),x=l*s/g*m,b=u*s/g*m;e.projectionMatrix.makePerspective(y,_,x,b,m,g)}(A,T,k):A.projectionMatrix.copy(T.projectionMatrix)}},i.getCamera=function(){return A},i.getFoveation=function(){return null!==p?p.fixedFoveation:null!==v?v.fixedFoveation:void 0},i.setFoveation=function(e){null!==p&&(p.fixedFoveation=e),null!==v&&void 0!==v.fixedFoveation&&(v.fixedFoveation=e)};var N=null,U=new Ja;return U.setAnimationLoop((function(t,n){if(d=n.getViewerPose(h||u),m=n,null!==d){var r=d.views;null!==v&&(e.setRenderTargetFramebuffer(x,v.framebuffer),e.setRenderTarget(x));var i=!1;r.length!==A.cameras.length&&(A.cameras.length=0,i=!0);for(var a=0;a<r.length;a++){var o=r[a],s=null;if(null!==v)s=v.getViewport(o);else{var l=f.getViewSubImage(p,o);s=l.viewport,0===a&&(e.setRenderTargetTextures(x,l.colorTexture,p.ignoreDepthValues?void 0:l.depthStencilTexture),e.setRenderTarget(x))}var c=E[a];void 0===c&&((c=new Ua).layers.enable(a),c.viewport=new br,E[a]=c),c.matrix.fromArray(o.transform.matrix),c.projectionMatrix.fromArray(o.projectionMatrix),c.viewport.set(s.x,s.y,s.width,s.height),0===a&&A.matrix.copy(c.matrix),!0===i&&A.cameras.push(c)}}for(var g=0;g<b.length;g++){var y=S[g],_=b[g];null!==y&&void 0!==_&&_.update(y,n,h||u)}N&&N(t,n),m=null})),i.setAnimationLoop=function(e){N=e},i.dispose=function(){},i}return T(n)}(Nn);function Sl(e,t){function n(n,r){n.opacity.value=r.opacity,r.color&&n.diffuse.value.copy(r.color),r.emissive&&n.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(n.map.value=r.map),r.alphaMap&&(n.alphaMap.value=r.alphaMap),r.bumpMap&&(n.bumpMap.value=r.bumpMap,n.bumpScale.value=r.bumpScale,r.side===U&&(n.bumpScale.value*=-1)),r.displacementMap&&(n.displacementMap.value=r.displacementMap,n.displacementScale.value=r.displacementScale,n.displacementBias.value=r.displacementBias),r.emissiveMap&&(n.emissiveMap.value=r.emissiveMap),r.normalMap&&(n.normalMap.value=r.normalMap,n.normalScale.value.copy(r.normalScale),r.side===U&&n.normalScale.value.negate()),r.specularMap&&(n.specularMap.value=r.specularMap),r.alphaTest>0&&(n.alphaTest.value=r.alphaTest);var i,a,o=t.get(r).envMap;if(o&&(n.envMap.value=o,n.flipEnvMap.value=o.isCubeTexture&&!1===o.isRenderTargetTexture?-1:1,n.reflectivity.value=r.reflectivity,n.ior.value=r.ior,n.refractionRatio.value=r.refractionRatio),r.lightMap){n.lightMap.value=r.lightMap;var s=!0!==e.physicallyCorrectLights?Math.PI:1;n.lightMapIntensity.value=r.lightMapIntensity*s}r.aoMap&&(n.aoMap.value=r.aoMap,n.aoMapIntensity.value=r.aoMapIntensity),r.map?i=r.map:r.specularMap?i=r.specularMap:r.displacementMap?i=r.displacementMap:r.normalMap?i=r.normalMap:r.bumpMap?i=r.bumpMap:r.roughnessMap?i=r.roughnessMap:r.metalnessMap?i=r.metalnessMap:r.alphaMap?i=r.alphaMap:r.emissiveMap?i=r.emissiveMap:r.clearcoatMap?i=r.clearcoatMap:r.clearcoatNormalMap?i=r.clearcoatNormalMap:r.clearcoatRoughnessMap?i=r.clearcoatRoughnessMap:r.iridescenceMap?i=r.iridescenceMap:r.iridescenceThicknessMap?i=r.iridescenceThicknessMap:r.specularIntensityMap?i=r.specularIntensityMap:r.specularColorMap?i=r.specularColorMap:r.transmissionMap?i=r.transmissionMap:r.thicknessMap?i=r.thicknessMap:r.sheenColorMap?i=r.sheenColorMap:r.sheenRoughnessMap&&(i=r.sheenRoughnessMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),n.uvTransform.value.copy(i.matrix)),r.aoMap?a=r.aoMap:r.lightMap&&(a=r.lightMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),n.uv2Transform.value.copy(a.matrix))}return{refreshFogUniforms:function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,r,i,a,o){r.isMeshBasicMaterial||r.isMeshLambertMaterial?n(e,r):r.isMeshToonMaterial?(n(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(n(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r)):r.isMeshStandardMaterial?(n(e,r),function(e,n){e.roughness.value=n.roughness,e.metalness.value=n.metalness,n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap),t.get(n).envMap&&(e.envMapIntensity.value=n.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&function(e,t,n){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap)),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap),t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,t.side===U&&e.clearcoatNormalScale.value.negate())),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap)),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=n.texture,e.transmissionSamplerSize.value.set(n.width,n.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap)}(e,r,o)):r.isMeshMatcapMaterial?(n(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?n(e,r):r.isMeshDistanceMaterial?(n(e,r),function(e,t){e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,r)):r.isMeshNormalMaterial?n(e,r):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,n,r){var i;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=.5*r,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest),t.map?i=t.map:t.alphaMap&&(i=t.alphaMap),void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),e.uvTransform.value.copy(i.matrix))}(e,r,i,a):r.isSpriteMaterial?function(e,t){var n;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest),t.map?n=t.map:t.alphaMap&&(n=t.alphaMap),void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function Tl(e,t,n,r){var i={},a={},o=[],s=n.isWebGL2?e.getParameter(35375):0;function l(e,t,n){var r=e.value;if(void 0===n[t])return n[t]="number"==typeof r?r:r.clone(),!0;if("number"==typeof r){if(n[t]!==r)return n[t]=r,!0}else{var i=n[t];if(!1===i.equals(r))return i.copy(r),!0}return!1}function u(e){var t=e.value,n={boundary:0,storage:0};return"number"==typeof t?(n.boundary=4,n.storage=4):t.isVector2?(n.boundary=8,n.storage=8):t.isVector3||t.isColor?(n.boundary=16,n.storage=12):t.isVector4?(n.boundary=16,n.storage=16):t.isMatrix3?(n.boundary=48,n.storage=48):t.isMatrix4?(n.boundary=64,n.storage=64):t.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",t),n}function c(t){var n=t.target;n.removeEventListener("dispose",c);var r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}return{bind:function(e,t){var n=t.program;r.uniformBlockBinding(e,n)},update:function(n,h){var d=i[n.id];void 0===d&&(function(e){for(var t=e.uniforms,n=0,r=0,i=0,a=t.length;i<a;i++){var o=t[i],s=u(o);o.__data=new Float32Array(s.storage/Float32Array.BYTES_PER_ELEMENT),o.__offset=n,i>0&&0!=(r=n%16)&&16-r-s.boundary<0&&(n+=16-r,o.__offset=n),n+=s.storage}(r=n%16)>0&&(n+=16-r),e.__size=n,e.__cache={}}(n),d=function(t){var n=function(){for(var e=0;e<s;e++)if(-1===o.indexOf(e))return o.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();t.__bindingPointIndex=n;var r=e.createBuffer(),i=t.__size,a=t.usage;return e.bindBuffer(35345,r),e.bufferData(35345,i,a),e.bindBuffer(35345,null),e.bindBufferBase(35345,n,r),r}(n),i[n.id]=d,n.addEventListener("dispose",c));var f=h.program;r.updateUBOMapping(n,f);var p=t.render.frame;a[n.id]!==p&&(function(t){var n=i[t.id],r=t.uniforms,a=t.__cache;e.bindBuffer(35345,n);for(var o=0,s=r.length;o<s;o++){var u=r[o];if(!0===l(u,o,a)){var c=u.value,h=u.__offset;"number"==typeof c?(u.__data[0]=c,e.bufferSubData(35345,h,u.__data)):(u.value.isMatrix3?(u.__data[0]=u.value.elements[0],u.__data[1]=u.value.elements[1],u.__data[2]=u.value.elements[2],u.__data[3]=u.value.elements[0],u.__data[4]=u.value.elements[3],u.__data[5]=u.value.elements[4],u.__data[6]=u.value.elements[5],u.__data[7]=u.value.elements[0],u.__data[8]=u.value.elements[6],u.__data[9]=u.value.elements[7],u.__data[10]=u.value.elements[8],u.__data[11]=u.value.elements[0]):c.toArray(u.__data),e.bufferSubData(35345,h,u.__data))}}e.bindBuffer(35345,null)}(n),a[n.id]=p)},dispose:function(){for(var t in i)e.deleteBuffer(i[t]);o=[],i={},a={}}}}function kl(){var e=rr("canvas");return e.style.display="block",e}function El(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.isWebGLRenderer=!0;var t,n=void 0!==e.canvas?e.canvas:kl(),r=void 0!==e.context?e.context:null,i=void 0===e.depth||e.depth,a=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,l=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,u=void 0!==e.powerPreference?e.powerPreference:"default",c=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat;t=null!==r?r.getContextAttributes().alpha:void 0!==e.alpha&&e.alpha;var h=null,d=null,f=[],p=[];this.domElement=n,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=$t,this.physicallyCorrectLights=!1,this.toneMapping=_e,this.toneMappingExposure=1,Object.defineProperties(this,{gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}});var v=this,m=!1,g=0,y=0,_=null,x=-1,b=null,w=new br,M=new br,S=null,T=n.width,E=n.height,A=1,C=null,P=null,L=new br(0,0,T,E),R=new br(0,0,T,E),I=!1,D=new Za,O=!1,z=!1,B=null,G=new oi,H=new Kn,V=new Cr,W={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function j(){return null===_?A:1}var q,X,Y,Z,J,Q,K,$,ee,te,ne,re,ie,ae,oe,se,le,ue,ce,he,de,fe,pe,ve,me=r;function ge(e,t){for(var r=0;r<e.length;r++){var i=e[r],a=n.getContext(i,t);if(null!==a)return a}return null}try{var ye={alpha:!0,depth:i,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:c};if("setAttribute"in n&&n.setAttribute("data-engine","three.js r".concat(k)),n.addEventListener("webglcontextlost",Me,!1),n.addEventListener("webglcontextrestored",Se,!1),n.addEventListener("webglcontextcreationerror",Te,!1),null===me){var xe=["webgl2","webgl","experimental-webgl"];if(!0===v.isWebGL1Renderer&&xe.shift(),null===(me=ge(xe,ye)))throw ge(xe)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===me.getShaderPrecisionFormat&&(me.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function be(){q=new So(me),X=new ao(me,q,e),q.init(X),fe=new gl(me,q,X),Y=new vl(me,q,X),Z=new Eo,J=new tl,Q=new ml(me,q,Y,J,X,fe,Z),K=new so(v),$=new Mo(v),ee=new Qa(me,X),pe=new ro(me,q,ee,X),te=new To(me,ee,Z,pe),ne=new Lo(me,te,ee,Z),ce=new Po(me,X,Q),se=new oo(J),re=new el(v,K,$,q,X,pe,se),ie=new Sl(v,J),ae=new al,oe=new hl(q,X),ue=new no(v,K,Y,ne,t,s),le=new pl(v,ne,X),ve=new Tl(me,Z,X,Y),he=new io(me,q,Z,X),de=new ko(me,q,Z,X),Z.programs=re.programs,v.capabilities=X,v.extensions=q,v.properties=J,v.renderLists=ae,v.shadowMap=le,v.state=Y,v.info=Z}be();var we=new Ml(v,me);function Me(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),m=!0}function Se(){console.log("THREE.WebGLRenderer: Context Restored."),m=!1;var e=Z.autoReset,t=le.enabled,n=le.autoUpdate,r=le.needsUpdate,i=le.type;be(),Z.autoReset=e,le.enabled=t,le.autoUpdate=n,le.needsUpdate=r,le.type=i}function Te(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function ke(e){var t=e.target;t.removeEventListener("dispose",ke),Ee(t)}function Ee(e){Ae(e),J.remove(e)}function Ae(e){var t=J.get(e).programs;void 0!==t&&(t.forEach((function(e){re.releaseProgram(e)})),e.isShaderMaterial&&re.releaseShaderCache(e))}this.xr=we,this.getContext=function(){return me},this.getContextAttributes=function(){return me.getContextAttributes()},this.forceContextLoss=function(){var e=q.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=q.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return A},this.setPixelRatio=function(e){void 0!==e&&(A=e,this.setSize(T,E,!1))},this.getSize=function(e){return e.set(T,E)},this.setSize=function(e,t,r){we.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(T=e,E=t,n.width=Math.floor(e*A),n.height=Math.floor(t*A),!1!==r&&(n.style.width=e+"px",n.style.height=t+"px"),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return e.set(T*A,E*A).floor()},this.setDrawingBufferSize=function(e,t,r){T=e,E=t,A=r,n.width=Math.floor(e*r),n.height=Math.floor(t*r),this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return e.copy(w)},this.getViewport=function(e){return e.copy(L)},this.setViewport=function(e,t,n,r){e.isVector4?L.set(e.x,e.y,e.z,e.w):L.set(e,t,n,r),Y.viewport(w.copy(L).multiplyScalar(A).floor())},this.getScissor=function(e){return e.copy(R)},this.setScissor=function(e,t,n,r){e.isVector4?R.set(e.x,e.y,e.z,e.w):R.set(e,t,n,r),Y.scissor(M.copy(R).multiplyScalar(A).floor())},this.getScissorTest=function(){return I},this.setScissorTest=function(e){Y.setScissorTest(I=e)},this.setOpaqueSort=function(e){C=e},this.setTransparentSort=function(e){P=e},this.getClearColor=function(e){return e.copy(ue.getClearColor())},this.setClearColor=function(){ue.setClearColor.apply(ue,arguments)},this.getClearAlpha=function(){return ue.getClearAlpha()},this.setClearAlpha=function(){ue.setClearAlpha.apply(ue,arguments)},this.clear=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=0;e&&(r|=16384),t&&(r|=256),n&&(r|=1024),me.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",Me,!1),n.removeEventListener("webglcontextrestored",Se,!1),n.removeEventListener("webglcontextcreationerror",Te,!1),ae.dispose(),oe.dispose(),J.dispose(),K.dispose(),$.dispose(),ne.dispose(),pe.dispose(),ve.dispose(),re.dispose(),we.dispose(),we.removeEventListener("sessionstart",Le),we.removeEventListener("sessionend",Re),B&&(B.dispose(),B=null),Ie.stop()},this.renderBufferDirect=function(e,t,n,r,i,a){null===t&&(t=W);var o=i.isMesh&&i.matrixWorld.determinant()<0,s=Ge(e,t,n,r,i);Y.setMaterial(r,o);var l=n.index,u=n.attributes.position;if(null===l){if(void 0===u||0===u.count)return}else if(0===l.count)return;var c,h=1;!0===r.wireframe&&(l=te.getWireframeAttribute(n),h=2),pe.setup(i,r,s,n,l);var d=he;null!==l&&(c=ee.get(l),(d=de).setIndex(c));var f=null!==l?l.count:u.count,p=n.drawRange.start*h,v=n.drawRange.count*h,m=null!==a?a.start*h:0,g=null!==a?a.count*h:1/0,y=Math.max(p,m),_=Math.min(f,p+v,m+g)-1,x=Math.max(0,_-y+1);if(0!==x){if(i.isMesh)!0===r.wireframe?(Y.setLineWidth(r.wireframeLinewidth*j()),d.setMode(1)):d.setMode(4);else if(i.isLine){var b=r.linewidth;void 0===b&&(b=1),Y.setLineWidth(b*j()),i.isLineSegments?d.setMode(1):i.isLineLoop?d.setMode(2):d.setMode(3)}else i.isPoints?d.setMode(0):i.isSprite&&d.setMode(4);if(i.isInstancedMesh)d.renderInstances(y,x,i.count);else if(n.isInstancedBufferGeometry){var w=Math.min(n.instanceCount,n._maxInstanceCount);d.renderInstances(y,x,w)}else d.render(y,x)}},this.compile=function(e,t){function n(e,t,n){!0===e.transparent&&e.side===F?(e.side=U,e.needsUpdate=!0,Fe(e,t,n),e.side=N,e.needsUpdate=!0,Fe(e,t,n),e.side=F):Fe(e,t,n)}(d=oe.get(e)).init(),p.push(d),e.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(d.pushLight(e),e.castShadow&&d.pushShadow(e))})),d.setupLights(v.physicallyCorrectLights),e.traverse((function(t){var r=t.material;if(r)if(Array.isArray(r))for(var i=0;i<r.length;i++)n(r[i],e,t);else n(r,e,t)})),p.pop(),d=null};var Ce=null;function Pe(e){Ce&&Ce(e)}function Le(){Ie.stop()}function Re(){Ie.start()}var Ie=new Ja;function De(e,t,n,r){if(!1!==e.visible){if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)d.pushLight(e),e.castShadow&&d.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||D.intersectsSprite(e)){r&&V.setFromMatrixPosition(e.matrixWorld).applyMatrix4(G);var i=ne.update(e),a=e.material;a.visible&&h.push(e,i,a,n,V.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==Z.render.frame&&(e.skeleton.update(),e.skeleton.frame=Z.render.frame),!e.frustumCulled||D.intersectsObject(e))){r&&V.setFromMatrixPosition(e.matrixWorld).applyMatrix4(G);var o=ne.update(e),s=e.material;if(Array.isArray(s))for(var l=o.groups,u=0,c=l.length;u<c;u++){var f=l[u],p=s[f.materialIndex];p&&p.visible&&h.push(e,o,p,n,V.z,f)}else s.visible&&h.push(e,o,s,n,V.z,null)}for(var v=e.children,m=0,g=v.length;m<g;m++)De(v[m],t,n,r)}}function Oe(e,t,n,r){var i=e.opaque,a=e.transmissive,o=e.transparent;d.setupLightsView(n),a.length>0&&ze(i,t,n),r&&Y.viewport(w.copy(r)),i.length>0&&Ne(i,t,n),a.length>0&&Ne(a,t,n),o.length>0&&Ne(o,t,n),Y.buffers.depth.setTest(!0),Y.buffers.depth.setMask(!0),Y.buffers.color.setMask(!0),Y.setPolygonOffset(!1)}function ze(e,t,n){var r=X.isWebGL2;null===B&&(B=new wr(1,1,{generateMipmaps:!0,type:q.has("EXT_color_buffer_half_float")?Qe:We,minFilter:He,samples:r&&!0===o?4:0})),v.getDrawingBufferSize(H),r?B.setSize(H.x,H.y):B.setSize(Yn(H.x),Yn(H.y));var i=v.getRenderTarget();v.setRenderTarget(B),v.clear();var a=v.toneMapping;v.toneMapping=_e,Ne(e,t,n),v.toneMapping=a,Q.updateMultisampleRenderTarget(B),Q.updateRenderTargetMipmap(B),v.setRenderTarget(i)}function Ne(e,t,n){for(var r=!0===t.isScene?t.overrideMaterial:null,i=0,a=e.length;i<a;i++){var o=e[i],s=o.object,l=o.geometry,u=null===r?o.material:r,c=o.group;s.layers.test(n.layers)&&Ue(s,t,n,l,u,c)}}function Ue(e,t,n,r,i,a){e.onBeforeRender(v,t,n,r,i,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),i.onBeforeRender(v,t,n,r,e,a),!0===i.transparent&&i.side===F?(i.side=U,i.needsUpdate=!0,v.renderBufferDirect(n,t,r,i,e,a),i.side=N,i.needsUpdate=!0,v.renderBufferDirect(n,t,r,i,e,a),i.side=F):v.renderBufferDirect(n,t,r,i,e,a),e.onAfterRender(v,t,n,r,i,a)}function Fe(e,t,n){!0!==t.isScene&&(t=W);var r=J.get(e),i=d.state.lights,a=d.state.shadowsArray,o=i.state.version,s=re.getParameters(e,i.state,a,t,n),l=re.getProgramCacheKey(s),u=r.programs;r.environment=e.isMeshStandardMaterial?t.environment:null,r.fog=t.fog,r.envMap=(e.isMeshStandardMaterial?$:K).get(e.envMap||r.environment),void 0===u&&(e.addEventListener("dispose",ke),u=new Map,r.programs=u);var c=u.get(l);if(void 0!==c){if(r.currentProgram===c&&r.lightsStateVersion===o)return Be(e,s),c}else s.uniforms=re.getUniforms(e),e.onBuild(n,s,v),e.onBeforeCompile(s,v),c=re.acquireProgram(s,l),u.set(l,c),r.uniforms=s.uniforms;var h=r.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(h.clippingPlanes=se.uniform),Be(e,s),r.needsLights=je(e),r.lightsStateVersion=o,r.needsLights&&(h.ambientLightColor.value=i.state.ambient,h.lightProbe.value=i.state.probe,h.directionalLights.value=i.state.directional,h.directionalLightShadows.value=i.state.directionalShadow,h.spotLights.value=i.state.spot,h.spotLightShadows.value=i.state.spotShadow,h.rectAreaLights.value=i.state.rectArea,h.ltc_1.value=i.state.rectAreaLTC1,h.ltc_2.value=i.state.rectAreaLTC2,h.pointLights.value=i.state.point,h.pointLightShadows.value=i.state.pointShadow,h.hemisphereLights.value=i.state.hemi,h.directionalShadowMap.value=i.state.directionalShadowMap,h.directionalShadowMatrix.value=i.state.directionalShadowMatrix,h.spotShadowMap.value=i.state.spotShadowMap,h.spotLightMatrix.value=i.state.spotLightMatrix,h.spotLightMap.value=i.state.spotLightMap,h.pointShadowMap.value=i.state.pointShadowMap,h.pointShadowMatrix.value=i.state.pointShadowMatrix);var f=c.getUniforms(),p=Os.seqWithValue(f.seq,h);return r.currentProgram=c,r.uniformsList=p,c}function Be(e,t){var n=J.get(e);n.outputEncoding=t.outputEncoding,n.instancing=t.instancing,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}function Ge(e,t,n,r,i){!0!==t.isScene&&(t=W),Q.resetTextureUnits();var a=t.fog,o=r.isMeshStandardMaterial?t.environment:null,s=null===_?v.outputEncoding:!0===_.isXRRenderTarget?_.texture.encoding:$t,l=(r.isMeshStandardMaterial?$:K).get(r.envMap||o),u=!0===r.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,c=!!r.normalMap&&!!n.attributes.tangent,h=!!n.morphAttributes.position,f=!!n.morphAttributes.normal,p=!!n.morphAttributes.color,m=r.toneMapped?v.toneMapping:_e,g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,y=void 0!==g?g.length:0,w=J.get(r),M=d.state.lights;if(!0===O&&(!0===z||e!==b)){var S=e===b&&r.id===x;se.setState(r,e,S)}var T=!1;r.version===w.__version?w.needsLights&&w.lightsStateVersion!==M.state.version||w.outputEncoding!==s||i.isInstancedMesh&&!1===w.instancing?T=!0:i.isInstancedMesh||!0!==w.instancing?i.isSkinnedMesh&&!1===w.skinning?T=!0:i.isSkinnedMesh||!0!==w.skinning?w.envMap!==l||!0===r.fog&&w.fog!==a?T=!0:void 0===w.numClippingPlanes||w.numClippingPlanes===se.numPlanes&&w.numIntersection===se.numIntersection?(w.vertexAlphas!==u||w.vertexTangents!==c||w.morphTargets!==h||w.morphNormals!==f||w.morphColors!==p||w.toneMapping!==m||!0===X.isWebGL2&&w.morphTargetsCount!==y)&&(T=!0):T=!0:T=!0:T=!0:(T=!0,w.__version=r.version);var k=w.currentProgram;!0===T&&(k=Fe(r,t,i));var C=!1,P=!1,L=!1,R=k.getUniforms(),I=w.uniforms;if(Y.useProgram(k.program)&&(C=!0,P=!0,L=!0),r.id!==x&&(x=r.id,P=!0),C||b!==e){if(R.setValue(me,"projectionMatrix",e.projectionMatrix),X.logarithmicDepthBuffer&&R.setValue(me,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),b!==e&&(b=e,P=!0,L=!0),r.isShaderMaterial||r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshStandardMaterial||r.envMap){var D=R.map.cameraPosition;void 0!==D&&D.setValue(me,V.setFromMatrixPosition(e.matrixWorld))}(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&R.setValue(me,"isOrthographic",!0===e.isOrthographicCamera),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial||r.isShadowMaterial||i.isSkinnedMesh)&&R.setValue(me,"viewMatrix",e.matrixWorldInverse)}if(i.isSkinnedMesh){R.setOptional(me,i,"bindMatrix"),R.setOptional(me,i,"bindMatrixInverse");var N=i.skeleton;N&&(X.floatVertexTextures?(null===N.boneTexture&&N.computeBoneTexture(),R.setValue(me,"boneTexture",N.boneTexture,Q),R.setValue(me,"boneTextureSize",N.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}var U=n.morphAttributes;if((void 0!==U.position||void 0!==U.normal||void 0!==U.color&&!0===X.isWebGL2)&&ce.update(i,n,r,k),(P||w.receiveShadow!==i.receiveShadow)&&(w.receiveShadow=i.receiveShadow,R.setValue(me,"receiveShadow",i.receiveShadow)),r.isMeshGouraudMaterial&&null!==r.envMap&&(I.envMap.value=l,I.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),P&&(R.setValue(me,"toneMappingExposure",v.toneMappingExposure),w.needsLights&&Ve(I,L),a&&!0===r.fog&&ie.refreshFogUniforms(I,a),ie.refreshMaterialUniforms(I,r,A,E,B),Os.upload(me,w.uniformsList,I,Q)),r.isShaderMaterial&&!0===r.uniformsNeedUpdate&&(Os.upload(me,w.uniformsList,I,Q),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&R.setValue(me,"center",i.center),R.setValue(me,"modelViewMatrix",i.modelViewMatrix),R.setValue(me,"normalMatrix",i.normalMatrix),R.setValue(me,"modelMatrix",i.matrixWorld),r.isShaderMaterial||r.isRawShaderMaterial)for(var F=r.uniformsGroups,G=0,H=F.length;G<H;G++)if(X.isWebGL2){var j=F[G];ve.update(j,k),ve.bind(j,k)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.");return k}function Ve(e,t){e.ambientLightColor.needsUpdate=t,e.lightProbe.needsUpdate=t,e.directionalLights.needsUpdate=t,e.directionalLightShadows.needsUpdate=t,e.pointLights.needsUpdate=t,e.pointLightShadows.needsUpdate=t,e.spotLights.needsUpdate=t,e.spotLightShadows.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function je(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}Ie.setAnimationLoop(Pe),"undefined"!=typeof self&&Ie.setContext(self),this.setAnimationLoop=function(e){Ce=e,we.setAnimationLoop(e),null===e?Ie.stop():Ie.start()},we.addEventListener("sessionstart",Le),we.addEventListener("sessionend",Re),this.render=function(e,t){if(void 0===t||!0===t.isCamera){if(!0!==m){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===we.enabled&&!0===we.isPresenting&&(!0===we.cameraAutoUpdate&&we.updateCamera(t),t=we.getCamera()),!0===e.isScene&&e.onBeforeRender(v,e,t,_),(d=oe.get(e,p.length)).init(),p.push(d),G.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),D.setFromProjectionMatrix(G),z=this.localClippingEnabled,O=se.init(this.clippingPlanes,z,t),(h=ae.get(e,f.length)).init(),f.push(h),De(e,t,0,v.sortObjects),h.finish(),!0===v.sortObjects&&h.sort(C,P),!0===O&&se.beginShadows();var n=d.state.shadowsArray;if(le.render(n,e,t),!0===O&&se.endShadows(),!0===this.info.autoReset&&this.info.reset(),ue.render(h,e),d.setupLights(v.physicallyCorrectLights),t.isArrayCamera)for(var r=t.cameras,i=0,a=r.length;i<a;i++){var o=r[i];Oe(h,e,o,o.viewport)}else Oe(h,e,t);null!==_&&(Q.updateMultisampleRenderTarget(_),Q.updateRenderTargetMipmap(_)),!0===e.isScene&&e.onAfterRender(v,e,t),pe.resetDefaultState(),x=-1,b=null,p.pop(),d=p.length>0?p[p.length-1]:null,f.pop(),h=f.length>0?f[f.length-1]:null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.getActiveCubeFace=function(){return g},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return _},this.setRenderTargetTextures=function(e,t,n){J.get(e.texture).__webglTexture=t,J.get(e.depthTexture).__webglTexture=n;var r=J.get(e);r.__hasExternalTextures=!0,r.__hasExternalTextures&&(r.__autoAllocateDepthBuffer=void 0===n,r.__autoAllocateDepthBuffer||!0===q.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),r.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){var n=J.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;_=e,g=t,y=n;var r=!0;if(e){var i=J.get(e);void 0!==i.__useDefaultFramebuffer?(Y.bindFramebuffer(36160,null),r=!1):void 0===i.__webglFramebuffer?Q.setupRenderTarget(e):i.__hasExternalTextures&&Q.rebindTextures(e,J.get(e.texture).__webglTexture,J.get(e.depthTexture).__webglTexture)}var a=null,o=!1,s=!1;if(e){var l=e.texture;(l.isData3DTexture||l.isDataArrayTexture)&&(s=!0);var u=J.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(a=u[t],o=!0):a=X.isWebGL2&&e.samples>0&&!1===Q.useMultisampledRTT(e)?J.get(e).__webglMultisampledFramebuffer:u,w.copy(e.viewport),M.copy(e.scissor),S=e.scissorTest}else w.copy(L).multiplyScalar(A).floor(),M.copy(R).multiplyScalar(A).floor(),S=I;var c=Y.bindFramebuffer(36160,a);if(c&&X.drawBuffers&&r&&Y.drawBuffers(e,a),Y.viewport(w),Y.scissor(M),Y.setScissorTest(S),o){var h=J.get(e.texture);me.framebufferTexture2D(36160,36064,34069+t,h.__webglTexture,n)}else if(s){var d=J.get(e.texture),f=t||0;me.framebufferTextureLayer(36160,36064,d.__webglTexture,n||0,f)}x=-1},this.readRenderTargetPixels=function(e,t,n,r,i,a,o){if(e&&e.isWebGLRenderTarget){var s=J.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){Y.bindFramebuffer(36160,s);try{var l=e.texture,u=l.format,c=l.type;if(u!==rt&&fe.convert(u)!==me.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");var h=c===Qe&&(q.has("EXT_color_buffer_half_float")||X.isWebGL2&&q.has("EXT_color_buffer_float"));if(!(c===We||fe.convert(c)===me.getParameter(35738)||c===Je&&(X.isWebGL2||q.has("OES_texture_float")||q.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&me.readPixels(t,n,r,i,fe.convert(u),fe.convert(c),a)}finally{var d=null!==_?J.get(_).__webglFramebuffer:null;Y.bindFramebuffer(36160,d)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=Math.pow(2,-n),i=Math.floor(t.image.width*r),a=Math.floor(t.image.height*r);Q.setTexture2D(t,0),me.copyTexSubImage2D(3553,n,0,0,e.x,e.y,i,a),Y.unbindTexture()},this.copyTextureToTexture=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=t.image.width,a=t.image.height,o=fe.convert(n.format),s=fe.convert(n.type);Q.setTexture2D(n,0),me.pixelStorei(37440,n.flipY),me.pixelStorei(37441,n.premultiplyAlpha),me.pixelStorei(3317,n.unpackAlignment),t.isDataTexture?me.texSubImage2D(3553,r,e.x,e.y,i,a,o,s,t.image.data):t.isCompressedTexture?me.compressedTexSubImage2D(3553,r,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):me.texSubImage2D(3553,r,e.x,e.y,o,s,t.image),0===r&&n.generateMipmaps&&me.generateMipmap(3553),Y.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(v.isWebGL1Renderer)console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");else{var a,o=e.max.x-e.min.x+1,s=e.max.y-e.min.y+1,l=e.max.z-e.min.z+1,u=fe.convert(r.format),c=fe.convert(r.type);if(r.isData3DTexture)Q.setTexture3D(r,0),a=32879;else{if(!r.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");Q.setTexture2DArray(r,0),a=35866}me.pixelStorei(37440,r.flipY),me.pixelStorei(37441,r.premultiplyAlpha),me.pixelStorei(3317,r.unpackAlignment);var h=me.getParameter(3314),d=me.getParameter(32878),f=me.getParameter(3316),p=me.getParameter(3315),m=me.getParameter(32877),g=n.isCompressedTexture?n.mipmaps[0]:n.image;me.pixelStorei(3314,g.width),me.pixelStorei(32878,g.height),me.pixelStorei(3316,e.min.x),me.pixelStorei(3315,e.min.y),me.pixelStorei(32877,e.min.z),n.isDataTexture||n.isData3DTexture?me.texSubImage3D(a,i,t.x,t.y,t.z,o,s,l,u,c,g.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),me.compressedTexSubImage3D(a,i,t.x,t.y,t.z,o,s,l,u,g.data)):me.texSubImage3D(a,i,t.x,t.y,t.z,o,s,l,u,c,g),me.pixelStorei(3314,h),me.pixelStorei(32878,d),me.pixelStorei(3316,f),me.pixelStorei(3315,p),me.pixelStorei(32877,m),0===i&&r.generateMipmaps&&me.generateMipmap(a),Y.unbindTexture()}},this.initTexture=function(e){e.isCubeTexture?Q.setTextureCube(e,0):e.isData3DTexture?Q.setTexture3D(e,0):e.isDataArrayTexture?Q.setTexture2DArray(e,0):Q.setTexture2D(e,0),Y.unbindTexture()},this.resetState=function(){g=0,y=0,_=null,Y.reset(),pe.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}var Al=function(e){p(n,e);var t=m(n);function n(){return M(this,n),t.apply(this,arguments)}return T(n)}(El);Al.prototype.isWebGL1Renderer=!0;var Cl,Pl=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:25e-5;M(this,e),this.isFogExp2=!0,this.name="",this.color=new vr(t),this.density=n}return T(e,[{key:"clone",value:function(){return new e(this.color,this.density)}},{key:"toJSON",value:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}]),e}(),Ll=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;M(this,e),this.isFog=!0,this.name="",this.color=new vr(t),this.near=n,this.far=r}return T(e,[{key:"clone",value:function(){return new e(this.color,this.near,this.far)}},{key:"toJSON",value:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}]),e}(),Rl=function(e){p(n,e);var t=m(n);function n(){var e;return M(this,n),(e=t.call(this)).isScene=!0,e.type="Scene",e.background=null,e.environment=null,e.fog=null,e.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:y(e)})),e}return T(n,[{key:"copy",value:function(e,t){return d(x(n.prototype),"copy",this).call(this,e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}},{key:"toJSON",value:function(e){var t=d(x(n.prototype),"toJSON",this).call(this,e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),t}},{key:"autoUpdate",get:function(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate},set:function(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}]),n}(Li),Il=function(){function e(t,n){M(this,e),this.isInterleavedBuffer=!0,this.array=t,this.stride=n,this.count=void 0!==t?t.length/n:0,this.usage=Tn,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Hn()}return T(e,[{key:"onUploadCallback",value:function(){}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"copy",value:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}},{key:"copyAt",value:function(e,t,n){e*=this.stride,n*=t.stride;for(var r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this}},{key:"set",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}},{key:"clone",value:function(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Hn()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);var t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}},{key:"onUpload",value:function(e){return this.onUploadCallback=e,this}},{key:"toJSON",value:function(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Hn()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(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}}}]),e}(),Dl=new Cr,Ol=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];M(this,e),this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=n,this.offset=r,this.normalized=!0===i}return T(e,[{key:"count",get:function(){return this.data.count}},{key:"array",get:function(){return this.data.array}},{key:"needsUpdate",set:function(e){this.data.needsUpdate=e}},{key:"applyMatrix4",value:function(e){for(var t=0,n=this.data.count;t<n;t++)Dl.fromBufferAttribute(this,t),Dl.applyMatrix4(e),this.setXYZ(t,Dl.x,Dl.y,Dl.z);return this}},{key:"applyNormalMatrix",value:function(e){for(var t=0,n=this.count;t<n;t++)Dl.fromBufferAttribute(this,t),Dl.applyNormalMatrix(e),this.setXYZ(t,Dl.x,Dl.y,Dl.z);return this}},{key:"transformDirection",value:function(e){for(var t=0,n=this.count;t<n;t++)Dl.fromBufferAttribute(this,t),Dl.transformDirection(e),this.setXYZ(t,Dl.x,Dl.y,Dl.z);return this}},{key:"setX",value:function(e,t){return this.normalized&&(t=Jn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}},{key:"setY",value:function(e,t){return this.normalized&&(t=Jn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}},{key:"setZ",value:function(e,t){return this.normalized&&(t=Jn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}},{key:"setW",value:function(e,t){return this.normalized&&(t=Jn(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}},{key:"getX",value:function(e){var t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Zn(t,this.array)),t}},{key:"getY",value:function(e){var t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Zn(t,this.array)),t}},{key:"getZ",value:function(e){var t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Zn(t,this.array)),t}},{key:"getW",value:function(e){var t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Zn(t,this.array)),t}},{key:"setXY",value:function(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Jn(t,this.array),n=Jn(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}},{key:"setXYZ",value:function(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Jn(t,this.array),n=Jn(n,this.array),r=Jn(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}},{key:"setXYZW",value:function(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Jn(t,this.array),n=Jn(n,this.array),r=Jn(r,this.array),i=Jn(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this}},{key:"clone",value:function(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will deinterleave buffer data.");for(var n=[],r=0;r<this.count;r++)for(var i=r*this.data.stride+this.offset,a=0;a<this.itemSize;a++)n.push(this.data.array[i+a]);return new Yi(new this.array.constructor(n),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new e(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}},{key:"toJSON",value:function(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will deinterleave buffer data.");for(var t=[],n=0;n<this.count;n++)for(var r=n*this.data.stride+this.offset,i=0;i<this.itemSize;i++)t.push(this.data.array[r+i]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}]),e}(),zl=function(e){p(n,e);var t=m(n);function n(e){var r;return M(this,n),(r=t.call(this)).isSpriteMaterial=!0,r.type="SpriteMaterial",r.color=new vr(16777215),r.map=null,r.alphaMap=null,r.rotation=0,r.sizeAttenuation=!0,r.transparent=!0,r.fog=!0,r.setValues(e),r}return T(n,[{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,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}}]),n}(Wi),Nl=new Cr,Ul=new Cr,Fl=new Cr,Bl=new Kn,Gl=new Kn,Hl=new oi,Vl=new Cr,Wl=new Cr,jl=new Cr,ql=new Kn,Xl=new Kn,Yl=new Kn,Zl=function(e){p(n,e);var t=m(n);function n(e){var r;if(M(this,n),(r=t.call(this)).isSprite=!0,r.type="Sprite",void 0===Cl){Cl=new da;var i=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),a=new Il(i,5);Cl.setIndex([0,1,2,0,2,3]),Cl.setAttribute("position",new Ol(a,3,0,!1)),Cl.setAttribute("uv",new Ol(a,2,3,!1))}return r.geometry=Cl,r.material=void 0!==e?e:new zl,r.center=new Kn(.5,.5),r}return T(n,[{key:"raycast",value:function(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Ul.setFromMatrixScale(this.matrixWorld),Hl.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Fl.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Ul.multiplyScalar(-Fl.z);var n,r,i=this.material.rotation;0!==i&&(r=Math.cos(i),n=Math.sin(i));var a=this.center;Jl(Vl.set(-.5,-.5,0),Fl,a,Ul,n,r),Jl(Wl.set(.5,-.5,0),Fl,a,Ul,n,r),Jl(jl.set(.5,.5,0),Fl,a,Ul,n,r),ql.set(0,0),Xl.set(1,0),Yl.set(1,1);var o=e.ray.intersectTriangle(Vl,Wl,jl,!1,Nl);if(null!==o||(Jl(Wl.set(-.5,.5,0),Fl,a,Ul,n,r),Xl.set(0,1),null!==(o=e.ray.intersectTriangle(Vl,jl,Wl,!1,Nl)))){var s=e.ray.origin.distanceTo(Nl);s<e.near||s>e.far||t.push({distance:s,point:Nl.clone(),uv:Hi.getUV(Nl,Vl,Wl,jl,ql,Xl,Yl,new Kn),face:null,object:this})}}},{key:"copy",value:function(e,t){return d(x(n.prototype),"copy",this).call(this,e,t),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}]),n}(Li);function Jl(e,t,n,r,i,a){Bl.subVectors(e,n).addScalar(.5).multiply(r),void 0!==i?(Gl.x=a*Bl.x-i*Bl.y,Gl.y=i*Bl.x+a*Bl.y):Gl.copy(Bl),e.copy(t),e.x+=Gl.x,e.y+=Gl.y,e.applyMatrix4(Hl)}var Ql=new Cr,Kl=new Cr,$l=function(e){p(n,e);var t=m(n);function n(){var e;return M(this,n),(e=t.call(this))._currentLevel=0,e.type="LOD",Object.defineProperties(y(e),{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),e.autoUpdate=!0,e}return T(n,[{key:"copy",value:function(e){d(x(n.prototype),"copy",this).call(this,e,!1);for(var t=e.levels,r=0,i=t.length;r<i;r++){var a=t[r];this.addLevel(a.object.clone(),a.distance)}return this.autoUpdate=e.autoUpdate,this}},{key:"addLevel",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;t=Math.abs(t);var n,r=this.levels;for(n=0;n<r.length&&!(t<r[n].distance);n++);return r.splice(n,0,{distance:t,object:e}),this.add(e),this}},{key:"getCurrentLevel",value:function(){return this._currentLevel}},{key:"getObjectForDistance",value:function(e){var t=this.levels;if(t.length>0){var n,r;for(n=1,r=t.length;n<r&&!(e<t[n].distance);n++);return t[n-1].object}return null}},{key:"raycast",value:function(e,t){if(this.levels.length>0){Ql.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(Ql);this.getObjectForDistance(n).raycast(e,t)}}},{key:"update",value:function(e){var t=this.levels;if(t.length>1){Ql.setFromMatrixPosition(e.matrixWorld),Kl.setFromMatrixPosition(this.matrixWorld);var n,r,i=Ql.distanceTo(Kl)/e.zoom;for(t[0].object.visible=!0,n=1,r=t.length;n<r&&i>=t[n].distance;n++)t[n-1].object.visible=!1,t[n].object.visible=!0;for(this._currentLevel=n-1;n<r;n++)t[n].object.visible=!1}}},{key:"toJSON",value:function(e){var t=d(x(n.prototype),"toJSON",this).call(this,e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];for(var r=this.levels,i=0,a=r.length;i<a;i++){var o=r[i];t.object.levels.push({object:o.object.uuid,distance:o.distance})}return t}}]),n}(Li),eu=new Cr,tu=new br,nu=new br,ru=new Cr,iu=new oi,au=function(e){p(n,e);var t=m(n);function n(e,r){var i;return M(this,n),(i=t.call(this,e,r)).isSkinnedMesh=!0,i.type="SkinnedMesh",i.bindMode="attached",i.bindMatrix=new oi,i.bindMatrixInverse=new oi,i}return T(n,[{key:"copy",value:function(e,t){return d(x(n.prototype),"copy",this).call(this,e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}},{key:"bind",value:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}},{key:"pose",value:function(){this.skeleton.pose()}},{key:"normalizeSkinWeights",value:function(){for(var e=new br,t=this.geometry.attributes.skinWeight,n=0,r=t.count;n<r;n++){e.fromBufferAttribute(t,n);var i=1/e.manhattanLength();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}},{key:"updateMatrixWorld",value:function(e){d(x(n.prototype),"updateMatrixWorld",this).call(this,e),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}},{key:"boneTransform",value:function(e,t){var n=this.skeleton,r=this.geometry;tu.fromBufferAttribute(r.attributes.skinIndex,e),nu.fromBufferAttribute(r.attributes.skinWeight,e),eu.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(var i=0;i<4;i++){var a=nu.getComponent(i);if(0!==a){var o=tu.getComponent(i);iu.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(ru.copy(eu).applyMatrix4(iu),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}]),n}(Pa),ou=function(e){p(n,e);var t=m(n);function n(){var e;return M(this,n),(e=t.call(this)).isBone=!0,e.type="Bone",e}return T(n)}(Li),su=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0,l=arguments.length>5?arguments[5]:void 0,u=arguments.length>6?arguments[6]:void 0,c=arguments.length>7?arguments[7]:void 0,h=arguments.length>8&&void 0!==arguments[8]?arguments[8]:De,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:De,f=arguments.length>10?arguments[10]:void 0,p=arguments.length>11?arguments[11]:void 0;return M(this,n),(e=t.call(this,null,l,u,c,h,d,o,s,f,p)).isDataTexture=!0,e.image={data:r,width:i,height:a},e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return T(n)}(xr),lu=new oi,uu=new oi,cu=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];M(this,e),this.uuid=Hn(),this.bones=t.slice(0),this.boneInverses=n,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}return T(e,[{key:"init",value:function(){var e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)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(var n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new oi)}}},{key:"calculateInverses",value:function(){this.boneInverses.length=0;for(var e=0,t=this.bones.length;e<t;e++){var n=new oi;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}},{key:"pose",value:function(){for(var e=0,t=this.bones.length;e<t;e++){var n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(var r=0,i=this.bones.length;r<i;r++){var a=this.bones[r];a&&(a.parent&&a.parent.isBone?(a.matrix.copy(a.parent.matrixWorld).invert(),a.matrix.multiply(a.matrixWorld)):a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale))}}},{key:"update",value:function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture,i=0,a=e.length;i<a;i++){var o=e[i]?e[i].matrixWorld:uu;lu.multiplyMatrices(o,t[i]),lu.toArray(n,16*i)}null!==r&&(r.needsUpdate=!0)}},{key:"clone",value:function(){return new e(this.bones,this.boneInverses)}},{key:"computeBoneTexture",value:function(){var e=Math.sqrt(4*this.bones.length);e=Xn(e),e=Math.max(e,4);var t=new Float32Array(e*e*4);t.set(this.boneMatrices);var n=new su(t,e,e,rt,Je);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this.boneTextureSize=e,this}},{key:"getBoneByName",value:function(e){for(var t=0,n=this.bones.length;t<n;t++){var r=this.bones[t];if(r.name===e)return r}}},{key:"dispose",value:function(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}},{key:"fromJSON",value:function(e,t){this.uuid=e.uuid;for(var n=0,r=e.bones.length;n<r;n++){var i=e.bones[n],a=t[i];void 0===a&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),a=new ou),this.bones.push(a),this.boneInverses.push((new oi).fromArray(e.boneInverses[n]))}return this.init(),this}},{key:"toJSON",value:function(){var e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;for(var t=this.bones,n=this.boneInverses,r=0,i=t.length;r<i;r++){var a=t[r];e.bones.push(a.uuid);var o=n[r];e.boneInverses.push(o.toArray())}return e}}]),e}(),hu=function(e){p(n,e);var t=m(n);function n(e,r,i){var a,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return M(this,n),(a=t.call(this,e,r,i)).isInstancedBufferAttribute=!0,a.meshPerAttribute=o,a}return T(n,[{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}},{key:"toJSON",value:function(){var e=d(x(n.prototype),"toJSON",this).call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}]),n}(Yi),du=new oi,fu=new oi,pu=[],vu=new Pa,mu=function(e){p(n,e);var t=m(n);function n(e,r,i){var a;return M(this,n),(a=t.call(this,e,r)).isInstancedMesh=!0,a.instanceMatrix=new hu(new Float32Array(16*i),16),a.instanceColor=null,a.count=i,a.frustumCulled=!1,a}return T(n,[{key:"copy",value:function(e,t){return d(x(n.prototype),"copy",this).call(this,e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}},{key:"getColorAt",value:function(e,t){t.fromArray(this.instanceColor.array,3*e)}},{key:"getMatrixAt",value:function(e,t){t.fromArray(this.instanceMatrix.array,16*e)}},{key:"raycast",value:function(e,t){var n=this.matrixWorld,r=this.count;if(vu.geometry=this.geometry,vu.material=this.material,void 0!==vu.material)for(var i=0;i<r;i++){this.getMatrixAt(i,du),fu.multiplyMatrices(n,du),vu.matrixWorld=fu,vu.raycast(e,pu);for(var a=0,o=pu.length;a<o;a++){var s=pu[a];s.instanceId=i,s.object=this,t.push(s)}pu.length=0}}},{key:"setColorAt",value:function(e,t){null===this.instanceColor&&(this.instanceColor=new hu(new Float32Array(3*this.instanceMatrix.count),3)),t.toArray(this.instanceColor.array,3*e)}},{key:"setMatrixAt",value:function(e,t){t.toArray(this.instanceMatrix.array,16*e)}},{key:"updateMorphTargets",value:function(){}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),n}(Pa),gu=function(e){p(n,e);var t=m(n);function n(e){var r;return M(this,n),(r=t.call(this)).isLineBasicMaterial=!0,r.type="LineBasicMaterial",r.color=new vr(16777215),r.linewidth=1,r.linecap="round",r.linejoin="round",r.fog=!0,r.setValues(e),r}return T(n,[{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}]),n}(Wi),yu=new Cr,_u=new Cr,xu=new oi,bu=new ai,wu=new Qr,Mu=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new da,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new gu;return M(this,n),(e=t.call(this)).isLine=!0,e.type="Line",e.geometry=r,e.material=i,e.updateMorphTargets(),e}return T(n,[{key:"copy",value:function(e,t){return d(x(n.prototype),"copy",this).call(this,e,t),this.material=e.material,this.geometry=e.geometry,this}},{key:"computeLineDistances",value:function(){var e=this.geometry;if(null===e.index){for(var t=e.attributes.position,n=[0],r=1,i=t.count;r<i;r++)yu.fromBufferAttribute(t,r-1),_u.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=yu.distanceTo(_u);e.setAttribute("lineDistance",new ra(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},{key:"raycast",value:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),wu.copy(n.boundingSphere),wu.applyMatrix4(r),wu.radius+=i,!1!==e.ray.intersectsSphere(wu)){xu.copy(r).invert(),bu.copy(e.ray).applyMatrix4(xu);var o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,l=new Cr,u=new Cr,c=new Cr,h=new Cr,d=this.isLineSegments?2:1,f=n.index,p=n.attributes.position;if(null!==f)for(var v=Math.max(0,a.start),m=Math.min(f.count,a.start+a.count)-1;v<m;v+=d){var g=f.getX(v),y=f.getX(v+1);if(l.fromBufferAttribute(p,g),u.fromBufferAttribute(p,y),!(bu.distanceSqToSegment(l,u,h,c)>s)){h.applyMatrix4(this.matrixWorld);var _=e.ray.origin.distanceTo(h);_<e.near||_>e.far||t.push({distance:_,point:c.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else for(var x=Math.max(0,a.start),b=Math.min(p.count,a.start+a.count)-1;x<b;x+=d)if(l.fromBufferAttribute(p,x),u.fromBufferAttribute(p,x+1),!(bu.distanceSqToSegment(l,u,h,c)>s)){h.applyMatrix4(this.matrixWorld);var w=e.ray.origin.distanceTo(h);w<e.near||w>e.far||t.push({distance:w,point:c.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}},{key:"updateMorphTargets",value:function(){var e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var r=0,i=n.length;r<i;r++){var a=n[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}}]),n}(Li),Su=new Cr,Tu=new Cr,ku=function(e){p(n,e);var t=m(n);function n(e,r){var i;return M(this,n),(i=t.call(this,e,r)).isLineSegments=!0,i.type="LineSegments",i}return T(n,[{key:"computeLineDistances",value:function(){var e=this.geometry;if(null===e.index){for(var t=e.attributes.position,n=[],r=0,i=t.count;r<i;r+=2)Su.fromBufferAttribute(t,r),Tu.fromBufferAttribute(t,r+1),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+Su.distanceTo(Tu);e.setAttribute("lineDistance",new ra(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}]),n}(Mu),Eu=function(e){p(n,e);var t=m(n);function n(e,r){var i;return M(this,n),(i=t.call(this,e,r)).isLineLoop=!0,i.type="LineLoop",i}return T(n)}(Mu),Au=function(e){p(n,e);var t=m(n);function n(e){var r;return M(this,n),(r=t.call(this)).isPointsMaterial=!0,r.type="PointsMaterial",r.color=new vr(16777215),r.map=null,r.alphaMap=null,r.size=1,r.sizeAttenuation=!0,r.fog=!0,r.setValues(e),r}return T(n,[{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,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}}]),n}(Wi),Cu=new oi,Pu=new ai,Lu=new Qr,Ru=new Cr,Iu=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new da,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Au;return M(this,n),(e=t.call(this)).isPoints=!0,e.type="Points",e.geometry=r,e.material=i,e.updateMorphTargets(),e}return T(n,[{key:"copy",value:function(e,t){return d(x(n.prototype),"copy",this).call(this,e,t),this.material=e.material,this.geometry=e.geometry,this}},{key:"raycast",value:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Lu.copy(n.boundingSphere),Lu.applyMatrix4(r),Lu.radius+=i,!1!==e.ray.intersectsSphere(Lu)){Cu.copy(r).invert(),Pu.copy(e.ray).applyMatrix4(Cu);var o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,l=n.index,u=n.attributes.position;if(null!==l)for(var c=Math.max(0,a.start),h=Math.min(l.count,a.start+a.count);c<h;c++){var d=l.getX(c);Ru.fromBufferAttribute(u,d),Du(Ru,d,s,r,e,t,this)}else for(var f=Math.max(0,a.start),p=Math.min(u.count,a.start+a.count);f<p;f++)Ru.fromBufferAttribute(u,f),Du(Ru,f,s,r,e,t,this)}}},{key:"updateMorphTargets",value:function(){var e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var r=0,i=n.length;r<i;r++){var a=n[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}}]),n}(Li);function Du(e,t,n,r,i,a,o){var s=Pu.distanceSqToPoint(e);if(s<n){var l=new Cr;Pu.closestPointToPoint(e,l),l.applyMatrix4(r);var u=i.ray.origin.distanceTo(l);if(u<i.near||u>i.far)return;a.push({distance:u,distanceToRay:Math.sqrt(s),point:l,index:t,face:null,object:o})}}var Ou=function(e){p(n,e);var t=m(n);function n(e,r,i,a,o,s,l,u,c){var h;M(this,n),(h=t.call(this,e,r,i,a,o,s,l,u,c)).isVideoTexture=!0,h.minFilter=void 0!==s?s:Fe,h.magFilter=void 0!==o?o:Fe,h.generateMipmaps=!1;var d=y(h);return"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback((function t(){d.needsUpdate=!0,e.requestVideoFrameCallback(t)})),h}return T(n,[{key:"clone",value:function(){return new this.constructor(this.image).copy(this)}},{key:"update",value:function(){var e=this.image;!1=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}]),n}(xr),zu=function(e){p(n,e);var t=m(n);function n(e,r,i){var a;return M(this,n),(a=t.call(this,{width:e,height:r})).isFramebufferTexture=!0,a.format=i,a.magFilter=De,a.minFilter=De,a.generateMipmaps=!1,a.needsUpdate=!0,a}return T(n)}(xr),Nu=function(e){p(n,e);var t=m(n);function n(e,r,i,a,o,s,l,u,c,h,d,f){var p;return M(this,n),(p=t.call(this,null,s,l,u,c,h,a,o,d,f)).isCompressedTexture=!0,p.image={width:r,height:i},p.mipmaps=e,p.flipY=!1,p.generateMipmaps=!1,p}return T(n)}(xr),Uu=function(e){p(n,e);var t=m(n);function n(e,r,i,a,o,s,l,u,c){var h;return M(this,n),(h=t.call(this,e,r,i,a,o,s,l,u,c)).isCanvasTexture=!0,h.needsUpdate=!0,h}return T(n)}(xr),Fu=function(){function e(){M(this,e),this.type="Curve",this.arcLengthDivisions=200}return T(e,[{key:"getPoint",value:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}},{key:"getPointAt",value:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)}},{key:"getPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}},{key:"getSpacedPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}},{key:"getLength",value:function(){var e=this.getLengths();return e[e.length-1]}},{key:"getLengths",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.arcLengthDivisions;if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n=[],r=this.getPoint(0),i=0;n.push(0);for(var a=1;a<=e;a++)i+=(t=this.getPoint(a/e)).distanceTo(r),n.push(i),r=t;return this.cacheArcLengths=n,n}},{key:"updateArcLengths",value:function(){this.needsUpdate=!0,this.getLengths()}},{key:"getUtoTmapping",value:function(e,t){var n,r=this.getLengths(),i=0,a=r.length;n=t||e*r[a-1];for(var o,s=0,l=a-1;s<=l;)if((o=r[i=Math.floor(s+(l-s)/2)]-n)<0)s=i+1;else{if(!(o>0)){l=i;break}l=i-1}if(r[i=l]===n)return i/(a-1);var u=r[i];return(i+(n-u)/(r[i+1]-u))/(a-1)}},{key:"getTangent",value:function(e,t){var n=1e-4,r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);var a=this.getPoint(r),o=this.getPoint(i),s=t||(a.isVector2?new Kn:new Cr);return s.copy(o).sub(a).normalize(),s}},{key:"getTangentAt",value:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)}},{key:"computeFrenetFrames",value:function(e,t){for(var n=new Cr,r=[],i=[],a=[],o=new Cr,s=new oi,l=0;l<=e;l++){var u=l/e;r[l]=this.getTangentAt(u,new Cr)}i[0]=new Cr,a[0]=new Cr;var c=Number.MAX_VALUE,h=Math.abs(r[0].x),d=Math.abs(r[0].y),f=Math.abs(r[0].z);h<=c&&(c=h,n.set(1,0,0)),d<=c&&(c=d,n.set(0,1,0)),f<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]);for(var p=1;p<=e;p++){if(i[p]=i[p-1].clone(),a[p]=a[p-1].clone(),o.crossVectors(r[p-1],r[p]),o.length()>Number.EPSILON){o.normalize();var v=Math.acos(Vn(r[p-1].dot(r[p]),-1,1));i[p].applyMatrix4(s.makeRotationAxis(o,v))}a[p].crossVectors(r[p],i[p])}if(!0===t){var m=Math.acos(Vn(i[0].dot(i[e]),-1,1));m/=e,r[0].dot(o.crossVectors(i[0],i[e]))>0&&(m=-m);for(var g=1;g<=e;g++)i[g].applyMatrix4(s.makeRotationAxis(r[g],m*g)),a[g].crossVectors(r[g],i[g])}return{tangents:r,normals:i,binormals:a}}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},{key:"toJSON",value:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}},{key:"fromJSON",value:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}]),e}(),Bu=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2*Math.PI,u=arguments.length>6&&void 0!==arguments[6]&&arguments[6],c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0;return M(this,n),(e=t.call(this)).isEllipseCurve=!0,e.type="EllipseCurve",e.aX=r,e.aY=i,e.xRadius=a,e.yRadius=o,e.aStartAngle=s,e.aEndAngle=l,e.aClockwise=u,e.aRotation=c,e}return T(n,[{key:"getPoint",value:function(e,t){for(var n=t||new Kn,r=2*Math.PI,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<Number.EPSILON;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=a?0:r),!0!==this.aClockwise||a||(i===r?i=-r:i-=r);var o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var u=Math.cos(this.aRotation),c=Math.sin(this.aRotation),h=s-this.aX,d=l-this.aY;s=h*u-d*c+this.aX,l=h*c+d*u+this.aY}return n.set(s,l)}},{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,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}},{key:"toJSON",value:function(){var e=d(x(n.prototype),"toJSON",this).call(this);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}},{key:"fromJSON",value:function(e){return d(x(n.prototype),"fromJSON",this).call(this,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}}]),n}(Fu),Gu=function(e){p(n,e);var t=m(n);function n(e,r,i,a,o,s){var l;return M(this,n),(l=t.call(this,e,r,i,i,a,o,s)).isArcCurve=!0,l.type="ArcCurve",l}return T(n)}(Bu);function Hu(){var e=0,t=0,n=0,r=0;function i(i,a,o,s){e=i,t=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(e,t,n,r,a){i(t,n,a*(n-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,a,o,s){var l=(t-e)/a-(n-e)/(a+o)+(n-t)/o,u=(n-t)/o-(r-t)/(o+s)+(r-n)/s;i(t,n,l*=o,u*=o)},calc:function(i){var a=i*i;return e+t*i+n*a+r*(a*i)}}}var Vu=new Cr,Wu=new Hu,ju=new Hu,qu=new Hu,Xu=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"centripetal",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5;return M(this,n),(e=t.call(this)).isCatmullRomCurve3=!0,e.type="CatmullRomCurve3",e.points=r,e.closed=i,e.curveType=a,e.tension=o,e}return T(n,[{key:"getPoint",value:function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Cr,i=r,a=this.points,o=a.length,s=(o-(this.closed?0:1))*e,l=Math.floor(s),u=s-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/o)+1)*o:0===u&&l===o-1&&(l=o-2,u=1),this.closed||l>0?t=a[(l-1)%o]:(Vu.subVectors(a[0],a[1]).add(a[0]),t=Vu);var c=a[l%o],h=a[(l+1)%o];if(this.closed||l+2<o?n=a[(l+2)%o]:(Vu.subVectors(a[o-1],a[o-2]).add(a[o-1]),n=Vu),"centripetal"===this.curveType||"chordal"===this.curveType){var d="chordal"===this.curveType?.5:.25,f=Math.pow(t.distanceToSquared(c),d),p=Math.pow(c.distanceToSquared(h),d),v=Math.pow(h.distanceToSquared(n),d);p<1e-4&&(p=1),f<1e-4&&(f=p),v<1e-4&&(v=p),Wu.initNonuniformCatmullRom(t.x,c.x,h.x,n.x,f,p,v),ju.initNonuniformCatmullRom(t.y,c.y,h.y,n.y,f,p,v),qu.initNonuniformCatmullRom(t.z,c.z,h.z,n.z,f,p,v)}else"catmullrom"===this.curveType&&(Wu.initCatmullRom(t.x,c.x,h.x,n.x,this.tension),ju.initCatmullRom(t.y,c.y,h.y,n.y,this.tension),qu.initCatmullRom(t.z,c.z,h.z,n.z,this.tension));return i.set(Wu.calc(u),ju.calc(u),qu.calc(u)),i}},{key:"copy",value:function(e){d(x(n.prototype),"copy",this).call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}},{key:"toJSON",value:function(){var e=d(x(n.prototype),"toJSON",this).call(this);e.points=[];for(var t=0,r=this.points.length;t<r;t++){var i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}},{key:"fromJSON",value:function(e){d(x(n.prototype),"fromJSON",this).call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var i=e.points[t];this.points.push((new Cr).fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}]),n}(Fu);function Yu(e,t,n,r,i){var a=.5*(r-t),o=.5*(i-n),s=e*e;return(2*n-2*r+a+o)*(e*s)+(-3*n+3*r-2*a-o)*s+a*e+n}function Zu(e,t,n,r){return function(e,t){var n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,r)}function Ju(e,t,n,r,i){return function(e,t){var n=1-e;return n*n*n*t}(e,t)+function(e,t){var n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,r)+function(e,t){return e*e*e*t}(e,i)}var Qu=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Kn,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Kn,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Kn,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Kn;return M(this,n),(e=t.call(this)).isCubicBezierCurve=!0,e.type="CubicBezierCurve",e.v0=r,e.v1=i,e.v2=a,e.v3=o,e}return T(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Kn,n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Ju(e,r.x,i.x,a.x,o.x),Ju(e,r.y,i.y,a.y,o.y)),n}},{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}},{key:"toJSON",value:function(){var e=d(x(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}},{key:"fromJSON",value:function(e){return d(x(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}]),n}(Fu),Ku=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Cr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Cr,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Cr,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Cr;return M(this,n),(e=t.call(this)).isCubicBezierCurve3=!0,e.type="CubicBezierCurve3",e.v0=r,e.v1=i,e.v2=a,e.v3=o,e}return T(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Cr,n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Ju(e,r.x,i.x,a.x,o.x),Ju(e,r.y,i.y,a.y,o.y),Ju(e,r.z,i.z,a.z,o.z)),n}},{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}},{key:"toJSON",value:function(){var e=d(x(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}},{key:"fromJSON",value:function(e){return d(x(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}]),n}(Fu),$u=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Kn,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Kn;return M(this,n),(e=t.call(this)).isLineCurve=!0,e.type="LineCurve",e.v1=r,e.v2=i,e}return T(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Kn,n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}},{key:"getPointAt",value:function(e,t){return this.getPoint(e,t)}},{key:"getTangent",value:function(e,t){var n=t||new Kn;return n.copy(this.v2).sub(this.v1).normalize(),n}},{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=d(x(n.prototype),"toJSON",this).call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return d(x(n.prototype),"fromJSON",this).call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(Fu),ec=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Cr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Cr;return M(this,n),(e=t.call(this)).isLineCurve3=!0,e.type="LineCurve3",e.v1=r,e.v2=i,e}return T(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Cr,n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}},{key:"getPointAt",value:function(e,t){return this.getPoint(e,t)}},{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=d(x(n.prototype),"toJSON",this).call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return d(x(n.prototype),"fromJSON",this).call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(Fu),tc=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Kn,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Kn,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Kn;return M(this,n),(e=t.call(this)).isQuadraticBezierCurve=!0,e.type="QuadraticBezierCurve",e.v0=r,e.v1=i,e.v2=a,e}return T(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Kn,n=t,r=this.v0,i=this.v1,a=this.v2;return n.set(Zu(e,r.x,i.x,a.x),Zu(e,r.y,i.y,a.y)),n}},{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=d(x(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return d(x(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(Fu),nc=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Cr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Cr,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Cr;return M(this,n),(e=t.call(this)).isQuadraticBezierCurve3=!0,e.type="QuadraticBezierCurve3",e.v0=r,e.v1=i,e.v2=a,e}return T(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Cr,n=t,r=this.v0,i=this.v1,a=this.v2;return n.set(Zu(e,r.x,i.x,a.x),Zu(e,r.y,i.y,a.y),Zu(e,r.z,i.z,a.z)),n}},{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=d(x(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return d(x(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(Fu),rc=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return M(this,n),(e=t.call(this)).isSplineCurve=!0,e.type="SplineCurve",e.points=r,e}return T(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Kn,n=t,r=this.points,i=(r.length-1)*e,a=Math.floor(i),o=i-a,s=r[0===a?a:a-1],l=r[a],u=r[a>r.length-2?r.length-1:a+1],c=r[a>r.length-3?r.length-1:a+2];return n.set(Yu(o,s.x,l.x,u.x,c.x),Yu(o,s.y,l.y,u.y,c.y)),n}},{key:"copy",value:function(e){d(x(n.prototype),"copy",this).call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var i=e.points[t];this.points.push(i.clone())}return this}},{key:"toJSON",value:function(){var e=d(x(n.prototype),"toJSON",this).call(this);e.points=[];for(var t=0,r=this.points.length;t<r;t++){var i=this.points[t];e.points.push(i.toArray())}return e}},{key:"fromJSON",value:function(e){d(x(n.prototype),"fromJSON",this).call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var i=e.points[t];this.points.push((new Kn).fromArray(i))}return this}}]),n}(Fu),ic=Object.freeze({__proto__:null,ArcCurve:Gu,CatmullRomCurve3:Xu,CubicBezierCurve:Qu,CubicBezierCurve3:Ku,EllipseCurve:Bu,LineCurve:$u,LineCurve3:ec,QuadraticBezierCurve:tc,QuadraticBezierCurve3:nc,SplineCurve:rc}),ac=function(e){p(n,e);var t=m(n);function n(){var e;return M(this,n),(e=t.call(this)).type="CurvePath",e.curves=[],e.autoClose=!1,e}return T(n,[{key:"add",value:function(e){this.curves.push(e)}},{key:"closePath",value:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new $u(t,e))}},{key:"getPoint",value:function(e,t){for(var n=e*this.getLength(),r=this.getCurveLengths(),i=0;i<r.length;){if(r[i]>=n){var a=r[i]-n,o=this.curves[i],s=o.getLength(),l=0===s?0:1-a/s;return o.getPointAt(l,t)}i++}return null}},{key:"getLength",value:function(){var e=this.getCurveLengths();return e[e.length-1]}},{key:"updateArcLengths",value:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}},{key:"getCurveLengths",value:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}},{key:"getSpacedPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:40,t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}},{key:"getPoints",value:function(){for(var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12,n=[],r=0,i=this.curves;r<i.length;r++)for(var a=i[r],o=a.isEllipseCurve?2*t:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o),l=0;l<s.length;l++){var u=s[l];e&&e.equals(u)||(n.push(u),e=u)}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}},{key:"copy",value:function(e){d(x(n.prototype),"copy",this).call(this,e),this.curves=[];for(var t=0,r=e.curves.length;t<r;t++){var i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}},{key:"toJSON",value:function(){var e=d(x(n.prototype),"toJSON",this).call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,r=this.curves.length;t<r;t++){var i=this.curves[t];e.curves.push(i.toJSON())}return e}},{key:"fromJSON",value:function(e){d(x(n.prototype),"fromJSON",this).call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,r=e.curves.length;t<r;t++){var i=e.curves[t];this.curves.push((new ic[i.type]).fromJSON(i))}return this}}]),n}(Fu),oc=function(e){p(n,e);var t=m(n);function n(e){var r;return M(this,n),(r=t.call(this)).type="Path",r.currentPoint=new Kn,e&&r.setFromPoints(e),r}return T(n,[{key:"setFromPoints",value:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}},{key:"moveTo",value:function(e,t){return this.currentPoint.set(e,t),this}},{key:"lineTo",value:function(e,t){var n=new $u(this.currentPoint.clone(),new Kn(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}},{key:"quadraticCurveTo",value:function(e,t,n,r){var i=new tc(this.currentPoint.clone(),new Kn(e,t),new Kn(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this}},{key:"bezierCurveTo",value:function(e,t,n,r,i,a){var o=new Qu(this.currentPoint.clone(),new Kn(e,t),new Kn(n,r),new Kn(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this}},{key:"splineThru",value:function(e){var t=[this.currentPoint.clone()].concat(e),n=new rc(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}},{key:"arc",value:function(e,t,n,r,i,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,r,i,a),this}},{key:"absarc",value:function(e,t,n,r,i,a){return this.absellipse(e,t,n,n,r,i,a),this}},{key:"ellipse",value:function(e,t,n,r,i,a,o,s){var l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+l,t+u,n,r,i,a,o,s),this}},{key:"absellipse",value:function(e,t,n,r,i,a,o,s){var l=new Bu(e,t,n,r,i,a,o,s);if(this.curves.length>0){var u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(l);var c=l.getPoint(1);return this.currentPoint.copy(c),this}},{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,e),this.currentPoint.copy(e.currentPoint),this}},{key:"toJSON",value:function(){var e=d(x(n.prototype),"toJSON",this).call(this);return e.currentPoint=this.currentPoint.toArray(),e}},{key:"fromJSON",value:function(e){return d(x(n.prototype),"fromJSON",this).call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}]),n}(ac),sc=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[new Kn(0,-.5),new Kn(.5,0),new Kn(0,.5)],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;M(this,n),(e=t.call(this)).type="LatheGeometry",e.parameters={points:r,segments:i,phiStart:a,phiLength:o},i=Math.floor(i),o=Vn(o,0,2*Math.PI);for(var s=[],l=[],u=[],c=[],h=[],d=1/i,f=new Cr,p=new Kn,v=new Cr,m=new Cr,g=new Cr,y=0,_=0,x=0;x<=r.length-1;x++)switch(x){case 0:y=r[x+1].x-r[x].x,_=r[x+1].y-r[x].y,v.x=1*_,v.y=-y,v.z=0*_,g.copy(v),v.normalize(),c.push(v.x,v.y,v.z);break;case r.length-1:c.push(g.x,g.y,g.z);break;default:y=r[x+1].x-r[x].x,_=r[x+1].y-r[x].y,v.x=1*_,v.y=-y,v.z=0*_,m.copy(v),v.x+=g.x,v.y+=g.y,v.z+=g.z,v.normalize(),c.push(v.x,v.y,v.z),g.copy(m)}for(var b=0;b<=i;b++)for(var w=a+b*d*o,S=Math.sin(w),T=Math.cos(w),k=0;k<=r.length-1;k++){f.x=r[k].x*S,f.y=r[k].y,f.z=r[k].x*T,l.push(f.x,f.y,f.z),p.x=b/i,p.y=k/(r.length-1),u.push(p.x,p.y);var E=c[3*k+0]*S,A=c[3*k+1],C=c[3*k+0]*T;h.push(E,A,C)}for(var P=0;P<i;P++)for(var L=0;L<r.length-1;L++){var R=L+P*r.length,I=R,D=R+r.length,O=R+r.length+1,z=R+1;s.push(I,D,z),s.push(O,z,D)}return e.setIndex(s),e.setAttribute("position",new ra(l,3)),e.setAttribute("uv",new ra(u,2)),e.setAttribute("normal",new ra(h,3)),e}return T(n,null,[{key:"fromJSON",value:function(e){return new n(e.points,e.segments,e.phiStart,e.phiLength)}}]),n}(da),lc=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8;M(this,n);var s=new oc;return s.absarc(0,-i/2,r,1.5*Math.PI,0),s.absarc(0,i/2,r,0,.5*Math.PI),(e=t.call(this,s.getPoints(a),o)).type="CapsuleGeometry",e.parameters={radius:r,height:i,capSegments:a,radialSegments:o},e}return T(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.length,e.capSegments,e.radialSegments)}}]),n}(sc),uc=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;M(this,n),(e=t.call(this)).type="CircleGeometry",e.parameters={radius:r,segments:i,thetaStart:a,thetaLength:o},i=Math.max(3,i);var s=[],l=[],u=[],c=[],h=new Cr,d=new Kn;l.push(0,0,0),u.push(0,0,1),c.push(.5,.5);for(var f=0,p=3;f<=i;f++,p+=3){var v=a+f/i*o;h.x=r*Math.cos(v),h.y=r*Math.sin(v),l.push(h.x,h.y,h.z),u.push(0,0,1),d.x=(l[p]/r+1)/2,d.y=(l[p+1]/r+1)/2,c.push(d.x,d.y)}for(var m=1;m<=i;m++)s.push(m,m+1,0);return e.setIndex(s),e.setAttribute("position",new ra(l,3)),e.setAttribute("normal",new ra(u,3)),e.setAttribute("uv",new ra(c,2)),e}return T(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.segments,e.thetaStart,e.thetaLength)}}]),n}(da),cc=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,l=arguments.length>5&&void 0!==arguments[5]&&arguments[5],u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:2*Math.PI;M(this,n),(e=t.call(this)).type="CylinderGeometry",e.parameters={radiusTop:r,radiusBottom:i,height:a,radialSegments:o,heightSegments:s,openEnded:l,thetaStart:u,thetaLength:c};var h=y(e);o=Math.floor(o),s=Math.floor(s);var d=[],f=[],p=[],v=[],m=0,g=[],_=a/2,x=0;function b(){for(var e=new Cr,t=new Cr,n=0,l=(i-r)/a,y=0;y<=s;y++){for(var b=[],w=y/s,M=w*(i-r)+r,S=0;S<=o;S++){var T=S/o,k=T*c+u,E=Math.sin(k),A=Math.cos(k);t.x=M*E,t.y=-w*a+_,t.z=M*A,f.push(t.x,t.y,t.z),e.set(E,l,A).normalize(),p.push(e.x,e.y,e.z),v.push(T,1-w),b.push(m++)}g.push(b)}for(var C=0;C<o;C++)for(var P=0;P<s;P++){var L=g[P][C],R=g[P+1][C],I=g[P+1][C+1],D=g[P][C+1];d.push(L,R,D),d.push(R,I,D),n+=6}h.addGroup(x,n,0),x+=n}function w(e){for(var t=m,n=new Kn,a=new Cr,s=0,l=!0===e?r:i,g=!0===e?1:-1,y=1;y<=o;y++)f.push(0,_*g,0),p.push(0,g,0),v.push(.5,.5),m++;for(var b=m,w=0;w<=o;w++){var M=w/o*c+u,S=Math.cos(M),T=Math.sin(M);a.x=l*T,a.y=_*g,a.z=l*S,f.push(a.x,a.y,a.z),p.push(0,g,0),n.x=.5*S+.5,n.y=.5*T*g+.5,v.push(n.x,n.y),m++}for(var k=0;k<o;k++){var E=t+k,A=b+k;!0===e?d.push(A,A+1,E):d.push(A+1,A,E),s+=3}h.addGroup(x,s,!0===e?1:2),x+=s}return b(),!1===l&&(r>0&&w(!0),i>0&&w(!1)),e.setIndex(d),e.setAttribute("position",new ra(f,3)),e.setAttribute("normal",new ra(p,3)),e.setAttribute("uv",new ra(v,2)),e}return T(n,null,[{key:"fromJSON",value:function(e){return new n(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}]),n}(da),hc=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:2*Math.PI;return M(this,n),(e=t.call(this,0,r,i,a,o,s,l,u)).type="ConeGeometry",e.parameters={radius:r,height:i,radialSegments:a,heightSegments:o,openEnded:s,thetaStart:l,thetaLength:u},e}return T(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}]),n}(cc),dc=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;M(this,n),(e=t.call(this)).type="PolyhedronGeometry",e.parameters={vertices:r,indices:i,radius:a,detail:o};var s=[],l=[];function u(e){for(var t=new Cr,n=new Cr,r=new Cr,a=0;a<i.length;a+=3)v(i[a+0],t),v(i[a+1],n),v(i[a+2],r),c(t,n,r,e)}function c(e,t,n,r){for(var i=r+1,a=[],o=0;o<=i;o++){a[o]=[];for(var s=e.clone().lerp(n,o/i),l=t.clone().lerp(n,o/i),u=i-o,c=0;c<=u;c++)a[o][c]=0===c&&o===i?s:s.clone().lerp(l,c/u)}for(var h=0;h<i;h++)for(var d=0;d<2*(i-h)-1;d++){var f=Math.floor(d/2);d%2==0?(p(a[h][f+1]),p(a[h+1][f]),p(a[h][f])):(p(a[h][f+1]),p(a[h+1][f+1]),p(a[h+1][f]))}}function h(e){for(var t=new Cr,n=0;n<s.length;n+=3)t.x=s[n+0],t.y=s[n+1],t.z=s[n+2],t.normalize().multiplyScalar(e),s[n+0]=t.x,s[n+1]=t.y,s[n+2]=t.z}function d(){for(var e=new Cr,t=0;t<s.length;t+=3){e.x=s[t+0],e.y=s[t+1],e.z=s[t+2];var n=y(e)/2/Math.PI+.5,r=_(e)/Math.PI+.5;l.push(n,1-r)}m(),f()}function f(){for(var e=0;e<l.length;e+=6){var t=l[e+0],n=l[e+2],r=l[e+4],i=Math.max(t,n,r),a=Math.min(t,n,r);i>.9&&a<.1&&(t<.2&&(l[e+0]+=1),n<.2&&(l[e+2]+=1),r<.2&&(l[e+4]+=1))}}function p(e){s.push(e.x,e.y,e.z)}function v(e,t){var n=3*e;t.x=r[n+0],t.y=r[n+1],t.z=r[n+2]}function m(){for(var e=new Cr,t=new Cr,n=new Cr,r=new Cr,i=new Kn,a=new Kn,o=new Kn,u=0,c=0;u<s.length;u+=9,c+=6){e.set(s[u+0],s[u+1],s[u+2]),t.set(s[u+3],s[u+4],s[u+5]),n.set(s[u+6],s[u+7],s[u+8]),i.set(l[c+0],l[c+1]),a.set(l[c+2],l[c+3]),o.set(l[c+4],l[c+5]),r.copy(e).add(t).add(n).divideScalar(3);var h=y(r);g(i,c+0,e,h),g(a,c+2,t,h),g(o,c+4,n,h)}}function g(e,t,n,r){r<0&&1===e.x&&(l[t]=e.x-1),0===n.x&&0===n.z&&(l[t]=r/2/Math.PI+.5)}function y(e){return Math.atan2(e.z,-e.x)}function _(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}return u(o),h(a),d(),e.setAttribute("position",new ra(s,3)),e.setAttribute("normal",new ra(s.slice(),3)),e.setAttribute("uv",new ra(l,2)),0===o?e.computeVertexNormals():e.normalizeNormals(),e}return T(n,null,[{key:"fromJSON",value:function(e){return new n(e.vertices,e.indices,e.radius,e.details)}}]),n}(da),fc=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;M(this,n);var a=(1+Math.sqrt(5))/2,o=1/a,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,-o,-a,0,-o,a,0,o,-a,0,o,a,-o,-a,0,-o,a,0,o,-a,0,o,a,0,-a,0,-o,a,0,-o,-a,0,o,a,0,o],l=[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];return(e=t.call(this,s,l,r,i)).type="DodecahedronGeometry",e.parameters={radius:r,detail:i},e}return T(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.detail)}}]),n}(dc),pc=new Cr,vc=new Cr,mc=new Cr,gc=new Hi,yc=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(M(this,n),(e=t.call(this)).type="EdgesGeometry",e.parameters={geometry:r,thresholdAngle:i},null!==r){for(var a=4,o=Math.pow(10,a),s=Math.cos(Bn*i),l=r.getIndex(),u=r.getAttribute("position"),c=l?l.count:u.count,h=[0,0,0],d=["a","b","c"],f=new Array(3),p={},v=[],m=0;m<c;m+=3){l?(h[0]=l.getX(m),h[1]=l.getX(m+1),h[2]=l.getX(m+2)):(h[0]=m,h[1]=m+1,h[2]=m+2);var g=gc.a,y=gc.b,_=gc.c;if(g.fromBufferAttribute(u,h[0]),y.fromBufferAttribute(u,h[1]),_.fromBufferAttribute(u,h[2]),gc.getNormal(mc),f[0]="".concat(Math.round(g.x*o),",").concat(Math.round(g.y*o),",").concat(Math.round(g.z*o)),f[1]="".concat(Math.round(y.x*o),",").concat(Math.round(y.y*o),",").concat(Math.round(y.z*o)),f[2]="".concat(Math.round(_.x*o),",").concat(Math.round(_.y*o),",").concat(Math.round(_.z*o)),f[0]!==f[1]&&f[1]!==f[2]&&f[2]!==f[0])for(var x=0;x<3;x++){var b=(x+1)%3,w=f[x],S=f[b],T=gc[d[x]],k=gc[d[b]],E="".concat(w,"_").concat(S),A="".concat(S,"_").concat(w);A in p&&p[A]?(mc.dot(p[A].normal)<=s&&(v.push(T.x,T.y,T.z),v.push(k.x,k.y,k.z)),p[A]=null):E in p||(p[E]={index0:h[x],index1:h[b],normal:mc.clone()})}}for(var C in p)if(p[C]){var P=p[C],L=P.index0,R=P.index1;pc.fromBufferAttribute(u,L),vc.fromBufferAttribute(u,R),v.push(pc.x,pc.y,pc.z),v.push(vc.x,vc.y,vc.z)}e.setAttribute("position",new ra(v,3))}return e}return T(n)}(da),_c=function(e){p(n,e);var t=m(n);function n(e){var r;return M(this,n),(r=t.call(this,e)).uuid=Hn(),r.type="Shape",r.holes=[],r}return T(n,[{key:"getPointsHoles",value:function(e){for(var t=[],n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}},{key:"extractPoints",value:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}},{key:"copy",value:function(e){d(x(n.prototype),"copy",this).call(this,e),this.holes=[];for(var t=0,r=e.holes.length;t<r;t++){var i=e.holes[t];this.holes.push(i.clone())}return this}},{key:"toJSON",value:function(){var e=d(x(n.prototype),"toJSON",this).call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,r=this.holes.length;t<r;t++){var i=this.holes[t];e.holes.push(i.toJSON())}return e}},{key:"fromJSON",value:function(e){d(x(n.prototype),"fromJSON",this).call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,r=e.holes.length;t<r;t++){var i=e.holes[t];this.holes.push((new oc).fromJSON(i))}return this}}]),n}(oc);function xc(e,t,n,r,i){var a,o;if(i===function(e,t,n,r){for(var i=0,a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}(e,t,n,r)>0)for(a=t;a<n;a+=r)o=Hc(a,e[a],e[a+1],o);else for(a=n-r;a>=t;a-=r)o=Hc(a,e[a],e[a+1],o);return o&&zc(o,o.next)&&(Vc(o),o=o.next),o}function bc(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!zc(r,r.next)&&0!==Oc(r.prev,r,r.next))r=r.next;else{if(Vc(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function wc(e,t,n,r,i,a,o){if(e){!o&&a&&function(e,t,n,r){var i=e;do{null===i.z&&(i.z=Lc(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,n,r,i,a,o,s,l,u=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,r=n,s=0,t=0;t<u&&(s++,r=r.nextZ);t++);for(l=u;s>0||l>0&&r;)0!==s&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,l--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,u*=2}while(o>1)}(i)}(e,r,i,a);for(var s,l,u=e;e.prev!==e.next;)if(s=e.prev,l=e.next,a?Sc(e,r,i,a):Mc(e))t.push(s.i/n),t.push(e.i/n),t.push(l.i/n),Vc(e),e=l.next,u=l.next;else if((e=l)===u){o?1===o?wc(e=Tc(bc(e),t,n),t,n,r,i,a,2):2===o&&kc(e,t,n,r,i,a):wc(bc(e),t,n,r,i,a,1);break}}}function Mc(e){var t=e.prev,n=e,r=e.next;if(Oc(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(Ic(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&Oc(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Sc(e,t,n,r){var i=e.prev,a=e,o=e.next;if(Oc(i,a,o)>=0)return!1;for(var s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,l=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,u=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,c=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,h=Lc(s,l,t,n,r),d=Lc(u,c,t,n,r),f=e.prevZ,p=e.nextZ;f&&f.z>=h&&p&&p.z<=d;){if(f!==e.prev&&f!==e.next&&Ic(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Oc(f.prev,f,f.next)>=0)return!1;if(f=f.prevZ,p!==e.prev&&p!==e.next&&Ic(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&Oc(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;f&&f.z>=h;){if(f!==e.prev&&f!==e.next&&Ic(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Oc(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;p&&p.z<=d;){if(p!==e.prev&&p!==e.next&&Ic(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&Oc(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function Tc(e,t,n){var r=e;do{var i=r.prev,a=r.next.next;!zc(i,a)&&Nc(i,r,r.next,a)&&Bc(i,a)&&Bc(a,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(a.i/n),Vc(r),Vc(r.next),r=e=a),r=r.next}while(r!==e);return bc(r)}function kc(e,t,n,r,i,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Dc(o,s)){var l=Gc(o,s);return o=bc(o,o.next),l=bc(l,l.next),wc(o,t,n,r,i,a),void wc(l,t,n,r,i,a)}s=s.next}o=o.next}while(o!==e)}function Ec(e,t,n,r){var i,a,o,s=[];for(i=0,a=t.length;i<a;i++)(o=xc(e,t[i]*r,i<a-1?t[i+1]*r:e.length,r,!1))===o.next&&(o.steiner=!0),s.push(Rc(o));for(s.sort(Ac),i=0;i<s.length;i++)Cc(s[i],n),n=bc(n,n.next);return n}function Ac(e,t){return e.x-t.x}function Cc(e,t){if(t=function(e,t){var n,r=t,i=e.x,a=e.y,o=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&s>o){if(o=s,s===i){if(a===r.y)return r;if(a===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!n)return null;if(i===o)return n;var l,u=n,c=n.x,h=n.y,d=1/0;r=n;do{i>=r.x&&r.x>=c&&i!==r.x&&Ic(a<h?i:o,a,c,h,a<h?o:i,a,r.x,r.y)&&(l=Math.abs(a-r.y)/(i-r.x),Bc(r,e)&&(l<d||l===d&&(r.x>n.x||r.x===n.x&&Pc(n,r)))&&(n=r,d=l)),r=r.next}while(r!==u);return n}(e,t),t){var n=Gc(t,e);bc(t,t.next),bc(n,n.next)}}function Pc(e,t){return Oc(e.prev,e,t.prev)<0&&Oc(t.next,e,e.next)<0}function Lc(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Rc(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function Ic(e,t,n,r,i,a,o,s){return(i-o)*(t-s)-(e-o)*(a-s)>=0&&(e-o)*(r-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function Dc(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Nc(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(Bc(e,t)&&Bc(t,e)&&function(e,t){var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(Oc(e.prev,e,t.prev)||Oc(e,t.prev,t))||zc(e,t)&&Oc(e.prev,e,e.next)>0&&Oc(t.prev,t,t.next)>0)}function Oc(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function zc(e,t){return e.x===t.x&&e.y===t.y}function Nc(e,t,n,r){var i=Fc(Oc(e,t,n)),a=Fc(Oc(e,t,r)),o=Fc(Oc(n,r,e)),s=Fc(Oc(n,r,t));return i!==a&&o!==s||!(0!==i||!Uc(e,n,t))||!(0!==a||!Uc(e,r,t))||!(0!==o||!Uc(n,e,r))||!(0!==s||!Uc(n,t,r))}function Uc(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Fc(e){return e>0?1:e<0?-1:0}function Bc(e,t){return Oc(e.prev,e,e.next)<0?Oc(e,t,e.next)>=0&&Oc(e,e.prev,t)>=0:Oc(e,t,e.prev)<0||Oc(e,e.next,t)<0}function Gc(e,t){var n=new Wc(e.i,e.x,e.y),r=new Wc(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Hc(e,t,n,r){var i=new Wc(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Vc(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Wc(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var jc=function(){function e(){M(this,e)}return T(e,null,[{key:"area",value:function(e){for(var t=e.length,n=0,r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return.5*n}},{key:"isClockWise",value:function(t){return e.area(t)<0}},{key:"triangulateShape",value:function(e,t){var n=[],r=[],i=[];qc(e),Xc(n,e);var a=e.length;t.forEach(qc);for(var o=0;o<t.length;o++)r.push(a),a+=t[o].length,Xc(n,t[o]);for(var s=function(e,t){var n,r,i,a,o,s,l,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,c=t&&t.length,h=c?t[0]*u:e.length,d=xc(e,0,h,u,!0),f=[];if(!d||d.next===d.prev)return f;if(c&&(d=Ec(e,t,d,u)),e.length>80*u){n=i=e[0],r=a=e[1];for(var p=u;p<h;p+=u)(o=e[p])<n&&(n=o),(s=e[p+1])<r&&(r=s),o>i&&(i=o),s>a&&(a=s);l=0!==(l=Math.max(i-n,a-r))?1/l:0}return wc(d,f,u,n,r,l),f}(n,r),l=0;l<s.length;l+=3)i.push(s.slice(l,l+3));return i}}]),e}();function qc(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Xc(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}var Yc=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new _c([new Kn(.5,.5),new Kn(-.5,.5),new Kn(-.5,-.5),new Kn(.5,-.5)]),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};M(this,n),(e=t.call(this)).type="ExtrudeGeometry",e.parameters={shapes:r,options:i},r=Array.isArray(r)?r:[r];for(var a=y(e),o=[],s=[],l=0,u=r.length;l<u;l++){var c=r[l];h(c)}function h(e){var t,n,r,l,u,c=[],h=void 0!==i.curveSegments?i.curveSegments:12,d=void 0!==i.steps?i.steps:1,f=void 0!==i.depth?i.depth:1,p=void 0===i.bevelEnabled||i.bevelEnabled,v=void 0!==i.bevelThickness?i.bevelThickness:.2,m=void 0!==i.bevelSize?i.bevelSize:v-.1,g=void 0!==i.bevelOffset?i.bevelOffset:0,y=void 0!==i.bevelSegments?i.bevelSegments:3,_=i.extrudePath,x=void 0!==i.UVGenerator?i.UVGenerator:Zc,b=!1;_&&(t=_.getSpacedPoints(d),b=!0,p=!1,n=_.computeFrenetFrames(d,!1),r=new Cr,l=new Cr,u=new Cr),p||(y=0,v=0,m=0,g=0);var w=e.extractPoints(h),M=w.shape,S=w.holes;if(!jc.isClockWise(M)){M=M.reverse();for(var T=0,k=S.length;T<k;T++){var E=S[T];jc.isClockWise(E)&&(S[T]=E.reverse())}}for(var A=jc.triangulateShape(M,S),C=M,P=0,L=S.length;P<L;P++){var R=S[P];M=M.concat(R)}function I(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(n).add(e)}var D=M.length,O=A.length;function z(e,t,n){var r,i,a,o=e.x-t.x,s=e.y-t.y,l=n.x-e.x,u=n.y-e.y,c=o*o+s*s,h=o*u-s*l;if(Math.abs(h)>Number.EPSILON){var d=Math.sqrt(c),f=Math.sqrt(l*l+u*u),p=t.x-s/d,v=t.y+o/d,m=((n.x-u/f-p)*u-(n.y+l/f-v)*l)/(o*u-s*l),g=(r=p+o*m-e.x)*r+(i=v+s*m-e.y)*i;if(g<=2)return new Kn(r,i);a=Math.sqrt(g/2)}else{var y=!1;o>Number.EPSILON?l>Number.EPSILON&&(y=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(u)&&(y=!0),y?(r=-s,i=o,a=Math.sqrt(c)):(r=o,i=s,a=Math.sqrt(c/2))}return new Kn(r/a,i/a)}for(var N=[],U=0,F=C.length,B=F-1,G=U+1;U<F;U++,B++,G++)B===F&&(B=0),G===F&&(G=0),N[U]=z(C[U],C[B],C[G]);for(var H,V=[],W=N.concat(),j=0,q=S.length;j<q;j++){var X=S[j];H=[];for(var Y=0,Z=X.length,J=Z-1,Q=Y+1;Y<Z;Y++,J++,Q++)J===Z&&(J=0),Q===Z&&(Q=0),H[Y]=z(X[Y],X[J],X[Q]);V.push(H),W=W.concat(H)}for(var K=0;K<y;K++){for(var $=K/y,ee=v*Math.cos($*Math.PI/2),te=m*Math.sin($*Math.PI/2)+g,ne=0,re=C.length;ne<re;ne++){var ie=I(C[ne],N[ne],te);Le(ie.x,ie.y,-ee)}for(var ae=0,oe=S.length;ae<oe;ae++){var se=S[ae];H=V[ae];for(var le=0,ue=se.length;le<ue;le++){var ce=I(se[le],H[le],te);Le(ce.x,ce.y,-ee)}}}for(var he=m+g,de=0;de<D;de++){var fe=p?I(M[de],W[de],he):M[de];b?(l.copy(n.normals[0]).multiplyScalar(fe.x),r.copy(n.binormals[0]).multiplyScalar(fe.y),u.copy(t[0]).add(l).add(r),Le(u.x,u.y,u.z)):Le(fe.x,fe.y,0)}for(var pe=1;pe<=d;pe++)for(var ve=0;ve<D;ve++){var me=p?I(M[ve],W[ve],he):M[ve];b?(l.copy(n.normals[pe]).multiplyScalar(me.x),r.copy(n.binormals[pe]).multiplyScalar(me.y),u.copy(t[pe]).add(l).add(r),Le(u.x,u.y,u.z)):Le(me.x,me.y,f/d*pe)}for(var ge=y-1;ge>=0;ge--){for(var ye=ge/y,_e=v*Math.cos(ye*Math.PI/2),xe=m*Math.sin(ye*Math.PI/2)+g,be=0,we=C.length;be<we;be++){var Me=I(C[be],N[be],xe);Le(Me.x,Me.y,f+_e)}for(var Se=0,Te=S.length;Se<Te;Se++){var ke=S[Se];H=V[Se];for(var Ee=0,Ae=ke.length;Ee<Ae;Ee++){var Ce=I(ke[Ee],H[Ee],xe);b?Le(Ce.x,Ce.y+t[d-1].y,t[d-1].x+_e):Le(Ce.x,Ce.y,f+_e)}}}function Pe(e,t){for(var n=e.length;--n>=0;){var r=n,i=n-1;i<0&&(i=e.length-1);for(var a=0,o=d+2*y;a<o;a++){var s=D*a,l=D*(a+1);Ie(t+r+s,t+i+s,t+i+l,t+r+l)}}}function Le(e,t,n){c.push(e),c.push(t),c.push(n)}function Re(e,t,n){De(e),De(t),De(n);var r=o.length/3,i=x.generateTopUV(a,o,r-3,r-2,r-1);Oe(i[0]),Oe(i[1]),Oe(i[2])}function Ie(e,t,n,r){De(e),De(t),De(r),De(t),De(n),De(r);var i=o.length/3,s=x.generateSideWallUV(a,o,i-6,i-3,i-2,i-1);Oe(s[0]),Oe(s[1]),Oe(s[3]),Oe(s[1]),Oe(s[2]),Oe(s[3])}function De(e){o.push(c[3*e+0]),o.push(c[3*e+1]),o.push(c[3*e+2])}function Oe(e){s.push(e.x),s.push(e.y)}!function(){var e=o.length/3;if(p){for(var t=0,n=D*t,r=0;r<O;r++){var i=A[r];Re(i[2]+n,i[1]+n,i[0]+n)}n=D*(t=d+2*y);for(var s=0;s<O;s++){var l=A[s];Re(l[0]+n,l[1]+n,l[2]+n)}}else{for(var u=0;u<O;u++){var c=A[u];Re(c[2],c[1],c[0])}for(var h=0;h<O;h++){var f=A[h];Re(f[0]+D*d,f[1]+D*d,f[2]+D*d)}}a.addGroup(e,o.length/3-e,0)}(),function(){var e=o.length/3,t=0;Pe(C,t),t+=C.length;for(var n=0,r=S.length;n<r;n++){var i=S[n];Pe(i,t),t+=i.length}a.addGroup(e,o.length/3-e,1)}()}return e.setAttribute("position",new ra(o,3)),e.setAttribute("uv",new ra(s,2)),e.computeVertexNormals(),e}return T(n,[{key:"toJSON",value:function(){var e=d(x(n.prototype),"toJSON",this).call(this);return function(e,t,n){if(n.shapes=[],Array.isArray(e))for(var r=0,i=e.length;r<i;r++){var a=e[r];n.shapes.push(a.uuid)}else n.shapes.push(e.uuid);return n.options=Object.assign({},t),void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON()),n}(this.parameters.shapes,this.parameters.options,e)}}],[{key:"fromJSON",value:function(e,t){for(var r=[],i=0,a=e.shapes.length;i<a;i++){var o=t[e.shapes[i]];r.push(o)}var s=e.options.extrudePath;return void 0!==s&&(e.options.extrudePath=(new ic[s.type]).fromJSON(s)),new n(r,e.options)}}]),n}(da),Zc={generateTopUV:function(e,t,n,r,i){var a=t[3*n],o=t[3*n+1],s=t[3*r],l=t[3*r+1],u=t[3*i],c=t[3*i+1];return[new Kn(a,o),new Kn(s,l),new Kn(u,c)]},generateSideWallUV:function(e,t,n,r,i,a){var o=t[3*n],s=t[3*n+1],l=t[3*n+2],u=t[3*r],c=t[3*r+1],h=t[3*r+2],d=t[3*i],f=t[3*i+1],p=t[3*i+2],v=t[3*a],m=t[3*a+1],g=t[3*a+2];return Math.abs(s-c)<Math.abs(o-u)?[new Kn(o,1-l),new Kn(u,1-h),new Kn(d,1-p),new Kn(v,1-g)]:[new Kn(s,1-l),new Kn(c,1-h),new Kn(f,1-p),new Kn(m,1-g)]}},Jc=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;M(this,n);var a=(1+Math.sqrt(5))/2,o=[-1,a,0,1,a,0,-1,-a,0,1,-a,0,0,-1,a,0,1,a,0,-1,-a,0,1,-a,a,0,-1,a,0,1,-a,0,-1,-a,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];return(e=t.call(this,o,s,r,i)).type="IcosahedronGeometry",e.parameters={radius:r,detail:i},e}return T(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.detail)}}]),n}(dc),Qc=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;M(this,n);var a=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],o=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];return(e=t.call(this,a,o,r,i)).type="OctahedronGeometry",e.parameters={radius:r,detail:i},e}return T(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.detail)}}]),n}(dc),Kc=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.5,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2*Math.PI;M(this,n),(e=t.call(this)).type="RingGeometry",e.parameters={innerRadius:r,outerRadius:i,thetaSegments:a,phiSegments:o,thetaStart:s,thetaLength:l},a=Math.max(3,a);for(var u=[],c=[],h=[],d=[],f=r,p=(i-r)/(o=Math.max(1,o)),v=new Cr,m=new Kn,g=0;g<=o;g++){for(var y=0;y<=a;y++){var _=s+y/a*l;v.x=f*Math.cos(_),v.y=f*Math.sin(_),c.push(v.x,v.y,v.z),h.push(0,0,1),m.x=(v.x/i+1)/2,m.y=(v.y/i+1)/2,d.push(m.x,m.y)}f+=p}for(var x=0;x<o;x++)for(var b=x*(a+1),w=0;w<a;w++){var S=w+b,T=S,k=S+a+1,E=S+a+2,A=S+1;u.push(T,k,A),u.push(k,E,A)}return e.setIndex(u),e.setAttribute("position",new ra(c,3)),e.setAttribute("normal",new ra(h,3)),e.setAttribute("uv",new ra(d,2)),e}return T(n,null,[{key:"fromJSON",value:function(e){return new n(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}]),n}(da),$c=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new _c([new Kn(0,.5),new Kn(-.5,-.5),new Kn(.5,-.5)]),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12;M(this,n),(e=t.call(this)).type="ShapeGeometry",e.parameters={shapes:r,curveSegments:i};var a=[],o=[],s=[],l=[],u=0,c=0;if(!1===Array.isArray(r))d(r);else for(var h=0;h<r.length;h++)d(r[h]),e.addGroup(u,c,h),u+=c,c=0;function d(e){var t=o.length/3,n=e.extractPoints(i),r=n.shape,u=n.holes;!1===jc.isClockWise(r)&&(r=r.reverse());for(var h=0,d=u.length;h<d;h++){var f=u[h];!0===jc.isClockWise(f)&&(u[h]=f.reverse())}for(var p=jc.triangulateShape(r,u),v=0,m=u.length;v<m;v++){var g=u[v];r=r.concat(g)}for(var y=0,_=r.length;y<_;y++){var x=r[y];o.push(x.x,x.y,0),s.push(0,0,1),l.push(x.x,x.y)}for(var b=0,w=p.length;b<w;b++){var M=p[b],S=M[0]+t,T=M[1]+t,k=M[2]+t;a.push(S,T,k),c+=3}}return e.setIndex(a),e.setAttribute("position",new ra(o,3)),e.setAttribute("normal",new ra(s,3)),e.setAttribute("uv",new ra(l,2)),e}return T(n,[{key:"toJSON",value:function(){var e=d(x(n.prototype),"toJSON",this).call(this);return function(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,r=e.length;n<r;n++){var i=e[n];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}}],[{key:"fromJSON",value:function(e,t){for(var r=[],i=0,a=e.shapes.length;i<a;i++){var o=t[e.shapes[i]];r.push(o)}return new n(r,e.curveSegments)}}]),n}(da),eh=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:Math.PI;M(this,n),(e=t.call(this)).type="SphereGeometry",e.parameters={radius:r,widthSegments:i,heightSegments:a,phiStart:o,phiLength:s,thetaStart:l,thetaLength:u},i=Math.max(3,Math.floor(i)),a=Math.max(2,Math.floor(a));for(var c=Math.min(l+u,Math.PI),h=0,d=[],f=new Cr,p=new Cr,v=[],m=[],g=[],y=[],_=0;_<=a;_++){var x=[],b=_/a,w=0;0==_&&0==l?w=.5/i:_==a&&c==Math.PI&&(w=-.5/i);for(var S=0;S<=i;S++){var T=S/i;f.x=-r*Math.cos(o+T*s)*Math.sin(l+b*u),f.y=r*Math.cos(l+b*u),f.z=r*Math.sin(o+T*s)*Math.sin(l+b*u),m.push(f.x,f.y,f.z),p.copy(f).normalize(),g.push(p.x,p.y,p.z),y.push(T+w,1-b),x.push(h++)}d.push(x)}for(var k=0;k<a;k++)for(var E=0;E<i;E++){var A=d[k][E+1],C=d[k][E],P=d[k+1][E],L=d[k+1][E+1];(0!==k||l>0)&&v.push(A,C,L),(k!==a-1||c<Math.PI)&&v.push(C,P,L)}return e.setIndex(v),e.setAttribute("position",new ra(m,3)),e.setAttribute("normal",new ra(g,3)),e.setAttribute("uv",new ra(y,2)),e}return T(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}]),n}(da),th=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;M(this,n);var a=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],o=[2,1,0,0,3,2,1,3,0,2,3,1];return(e=t.call(this,a,o,r,i)).type="TetrahedronGeometry",e.parameters={radius:r,detail:i},e}return T(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.detail)}}]),n}(dc),nh=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.4,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:6,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI;M(this,n),(e=t.call(this)).type="TorusGeometry",e.parameters={radius:r,tube:i,radialSegments:a,tubularSegments:o,arc:s},a=Math.floor(a),o=Math.floor(o);for(var l=[],u=[],c=[],h=[],d=new Cr,f=new Cr,p=new Cr,v=0;v<=a;v++)for(var m=0;m<=o;m++){var g=m/o*s,y=v/a*Math.PI*2;f.x=(r+i*Math.cos(y))*Math.cos(g),f.y=(r+i*Math.cos(y))*Math.sin(g),f.z=i*Math.sin(y),u.push(f.x,f.y,f.z),d.x=r*Math.cos(g),d.y=r*Math.sin(g),p.subVectors(f,d).normalize(),c.push(p.x,p.y,p.z),h.push(m/o),h.push(v/a)}for(var _=1;_<=a;_++)for(var x=1;x<=o;x++){var b=(o+1)*_+x-1,w=(o+1)*(_-1)+x-1,S=(o+1)*(_-1)+x,T=(o+1)*_+x;l.push(b,w,T),l.push(w,S,T)}return e.setIndex(l),e.setAttribute("position",new ra(u,3)),e.setAttribute("normal",new ra(c,3)),e.setAttribute("uv",new ra(h,2)),e}return T(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}]),n}(da),rh=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.4,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:64,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:3;M(this,n),(e=t.call(this)).type="TorusKnotGeometry",e.parameters={radius:r,tube:i,tubularSegments:a,radialSegments:o,p:s,q:l},a=Math.floor(a),o=Math.floor(o);for(var u=[],c=[],h=[],d=[],f=new Cr,p=new Cr,v=new Cr,m=new Cr,g=new Cr,y=new Cr,_=new Cr,x=0;x<=a;++x){var b=x/a*s*Math.PI*2;I(b,s,l,r,v),I(b+.01,s,l,r,m),y.subVectors(m,v),_.addVectors(m,v),g.crossVectors(y,_),_.crossVectors(g,y),g.normalize(),_.normalize();for(var w=0;w<=o;++w){var S=w/o*Math.PI*2,T=-i*Math.cos(S),k=i*Math.sin(S);f.x=v.x+(T*_.x+k*g.x),f.y=v.y+(T*_.y+k*g.y),f.z=v.z+(T*_.z+k*g.z),c.push(f.x,f.y,f.z),p.subVectors(f,v).normalize(),h.push(p.x,p.y,p.z),d.push(x/a),d.push(w/o)}}for(var E=1;E<=a;E++)for(var A=1;A<=o;A++){var C=(o+1)*(E-1)+(A-1),P=(o+1)*E+(A-1),L=(o+1)*E+A,R=(o+1)*(E-1)+A;u.push(C,P,R),u.push(P,L,R)}function I(e,t,n,r,i){var a=Math.cos(e),o=Math.sin(e),s=n/t*e,l=Math.cos(s);i.x=r*(2+l)*.5*a,i.y=r*(2+l)*o*.5,i.z=r*Math.sin(s)*.5}return e.setIndex(u),e.setAttribute("position",new ra(c,3)),e.setAttribute("normal",new ra(h,3)),e.setAttribute("uv",new ra(d,2)),e}return T(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}]),n}(da),ih=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new nc(new Cr(-1,-1,0),new Cr(-1,1,0),new Cr(1,1,0)),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];M(this,n),(e=t.call(this)).type="TubeGeometry",e.parameters={path:r,tubularSegments:i,radius:a,radialSegments:o,closed:s};var l=r.computeFrenetFrames(i,s);e.tangents=l.tangents,e.normals=l.normals,e.binormals=l.binormals;var u=new Cr,c=new Cr,h=new Kn,d=new Cr,f=[],p=[],v=[],m=[];function g(){for(var e=0;e<i;e++)y(e);y(!1===s?i:0),x(),_()}function y(e){d=r.getPointAt(e/i,d);for(var t=l.normals[e],n=l.binormals[e],s=0;s<=o;s++){var h=s/o*Math.PI*2,v=Math.sin(h),m=-Math.cos(h);c.x=m*t.x+v*n.x,c.y=m*t.y+v*n.y,c.z=m*t.z+v*n.z,c.normalize(),p.push(c.x,c.y,c.z),u.x=d.x+a*c.x,u.y=d.y+a*c.y,u.z=d.z+a*c.z,f.push(u.x,u.y,u.z)}}function _(){for(var e=1;e<=i;e++)for(var t=1;t<=o;t++){var n=(o+1)*(e-1)+(t-1),r=(o+1)*e+(t-1),a=(o+1)*e+t,s=(o+1)*(e-1)+t;m.push(n,r,s),m.push(r,a,s)}}function x(){for(var e=0;e<=i;e++)for(var t=0;t<=o;t++)h.x=e/i,h.y=t/o,v.push(h.x,h.y)}return g(),e.setIndex(m),e.setAttribute("position",new ra(f,3)),e.setAttribute("normal",new ra(p,3)),e.setAttribute("uv",new ra(v,2)),e}return T(n,[{key:"toJSON",value:function(){var e=d(x(n.prototype),"toJSON",this).call(this);return e.path=this.parameters.path.toJSON(),e}}],[{key:"fromJSON",value:function(e){return new n((new ic[e.path.type]).fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}]),n}(da),ah=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(M(this,n),(e=t.call(this)).type="WireframeGeometry",e.parameters={geometry:r},null!==r){var i=[],a=new Set,o=new Cr,s=new Cr;if(null!==r.index){var l=r.attributes.position,u=r.index,c=r.groups;0===c.length&&(c=[{start:0,count:u.count,materialIndex:0}]);for(var h=0,d=c.length;h<d;++h)for(var f=c[h],p=f.start,v=f.count,m=p,g=p+v;m<g;m+=3)for(var y=0;y<3;y++){var _=u.getX(m+y),x=u.getX(m+(y+1)%3);o.fromBufferAttribute(l,_),s.fromBufferAttribute(l,x),!0===oh(o,s,a)&&(i.push(o.x,o.y,o.z),i.push(s.x,s.y,s.z))}}else for(var b=r.attributes.position,w=0,S=b.count/3;w<S;w++)for(var T=0;T<3;T++){var k=3*w+T,E=3*w+(T+1)%3;o.fromBufferAttribute(b,k),s.fromBufferAttribute(b,E),!0===oh(o,s,a)&&(i.push(o.x,o.y,o.z),i.push(s.x,s.y,s.z))}e.setAttribute("position",new ra(i,3))}return e}return T(n)}(da);function oh(e,t,n){var r="".concat(e.x,",").concat(e.y,",").concat(e.z,"-").concat(t.x,",").concat(t.y,",").concat(t.z),i="".concat(t.x,",").concat(t.y,",").concat(t.z,"-").concat(e.x,",").concat(e.y,",").concat(e.z);return!0!==n.has(r)&&!0!==n.has(i)&&(n.add(r),n.add(i),!0)}var sh=Object.freeze({__proto__:null,BoxGeometry:Ra,CapsuleGeometry:lc,CircleGeometry:uc,ConeGeometry:hc,CylinderGeometry:cc,DodecahedronGeometry:fc,EdgesGeometry:yc,ExtrudeGeometry:Yc,IcosahedronGeometry:Jc,LatheGeometry:sc,OctahedronGeometry:Qc,PlaneGeometry:Ka,PolyhedronGeometry:dc,RingGeometry:Kc,ShapeGeometry:$c,SphereGeometry:eh,TetrahedronGeometry:th,TorusGeometry:nh,TorusKnotGeometry:rh,TubeGeometry:ih,WireframeGeometry:ah}),lh=function(e){p(n,e);var t=m(n);function n(e){var r;return M(this,n),(r=t.call(this)).isShadowMaterial=!0,r.type="ShadowMaterial",r.color=new vr(0),r.transparent=!0,r.fog=!0,r.setValues(e),r}return T(n,[{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.fog=e.fog,this}}]),n}(Wi),uh=function(e){p(n,e);var t=m(n);function n(e){var r;return M(this,n),(r=t.call(this,e)).isRawShaderMaterial=!0,r.type="RawShaderMaterial",r}return T(n)}(za),ch=function(e){p(n,e);var t=m(n);function n(e){var r;return M(this,n),(r=t.call(this)).isMeshStandardMaterial=!0,r.defines={STANDARD:""},r.type="MeshStandardMaterial",r.color=new vr(16777215),r.roughness=1,r.metalness=0,r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new vr(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=rn,r.normalScale=new Kn(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.roughnessMap=null,r.metalnessMap=null,r.alphaMap=null,r.envMap=null,r.envMapIntensity=1,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.flatShading=!1,r.fog=!0,r.setValues(e),r}return T(n,[{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,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.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}}]),n}(Wi),hh=function(e){p(n,e);var t=m(n);function n(e){var r;return M(this,n),(r=t.call(this)).isMeshPhysicalMaterial=!0,r.defines={STANDARD:"",PHYSICAL:""},r.type="MeshPhysicalMaterial",r.clearcoatMap=null,r.clearcoatRoughness=0,r.clearcoatRoughnessMap=null,r.clearcoatNormalScale=new Kn(1,1),r.clearcoatNormalMap=null,r.ior=1.5,Object.defineProperty(y(r),"reflectivity",{get:function(){return Vn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),r.iridescenceMap=null,r.iridescenceIOR=1.3,r.iridescenceThicknessRange=[100,400],r.iridescenceThicknessMap=null,r.sheenColor=new vr(0),r.sheenColorMap=null,r.sheenRoughness=1,r.sheenRoughnessMap=null,r.transmissionMap=null,r.thickness=0,r.thicknessMap=null,r.attenuationDistance=1/0,r.attenuationColor=new vr(1,1,1),r.specularIntensity=1,r.specularIntensityMap=null,r.specularColor=new vr(1,1,1),r.specularColorMap=null,r._sheen=0,r._clearcoat=0,r._iridescence=0,r._transmission=0,r.setValues(e),r}return T(n,[{key:"sheen",get:function(){return this._sheen},set:function(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}},{key:"clearcoat",get:function(){return this._clearcoat},set:function(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}},{key:"iridescence",get:function(){return this._iridescence},set:function(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}},{key:"transmission",get:function(){return this._transmission},set:function(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}},{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=function(e){if(Array.isArray(e))return h(e)}(t=e.iridescenceThicknessRange)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||c(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),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;var t}}]),n}(ch),dh=function(e){p(n,e);var t=m(n);function n(e){var r;return M(this,n),(r=t.call(this)).isMeshPhongMaterial=!0,r.type="MeshPhongMaterial",r.color=new vr(16777215),r.specular=new vr(1118481),r.shininess=30,r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new vr(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=rn,r.normalScale=new Kn(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.specularMap=null,r.alphaMap=null,r.envMap=null,r.combine=me,r.reflectivity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.flatShading=!1,r.fog=!0,r.setValues(e),r}return T(n,[{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}]),n}(Wi),fh=function(e){p(n,e);var t=m(n);function n(e){var r;return M(this,n),(r=t.call(this)).isMeshToonMaterial=!0,r.defines={TOON:""},r.type="MeshToonMaterial",r.color=new vr(16777215),r.map=null,r.gradientMap=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new vr(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=rn,r.normalScale=new Kn(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.alphaMap=null,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.fog=!0,r.setValues(e),r}return T(n,[{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,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}}]),n}(Wi),ph=function(e){p(n,e);var t=m(n);function n(e){var r;return M(this,n),(r=t.call(this)).isMeshNormalMaterial=!0,r.type="MeshNormalMaterial",r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=rn,r.normalScale=new Kn(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.wireframe=!1,r.wireframeLinewidth=1,r.flatShading=!1,r.setValues(e),r}return T(n,[{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,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}}]),n}(Wi),vh=function(e){p(n,e);var t=m(n);function n(e){var r;return M(this,n),(r=t.call(this)).isMeshLambertMaterial=!0,r.type="MeshLambertMaterial",r.color=new vr(16777215),r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new vr(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=rn,r.normalScale=new Kn(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.specularMap=null,r.alphaMap=null,r.envMap=null,r.combine=me,r.reflectivity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.flatShading=!1,r.fog=!0,r.setValues(e),r}return T(n,[{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}]),n}(Wi),mh=function(e){p(n,e);var t=m(n);function n(e){var r;return M(this,n),(r=t.call(this)).isMeshMatcapMaterial=!0,r.defines={MATCAP:""},r.type="MeshMatcapMaterial",r.color=new vr(16777215),r.matcap=null,r.map=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=rn,r.normalScale=new Kn(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.alphaMap=null,r.flatShading=!1,r.fog=!0,r.setValues(e),r}return T(n,[{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,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}}]),n}(Wi),gh=function(e){p(n,e);var t=m(n);function n(e){var r;return M(this,n),(r=t.call(this)).isLineDashedMaterial=!0,r.type="LineDashedMaterial",r.scale=1,r.dashSize=3,r.gapSize=1,r.setValues(e),r}return T(n,[{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}]),n}(gu);function yh(e,t,n){return xh(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)}function _h(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)}function xh(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function bh(e){for(var t=e.length,n=new Array(t),r=0;r!==t;++r)n[r]=r;return n.sort((function(t,n){return e[t]-e[n]})),n}function wh(e,t,n){for(var r=e.length,i=new e.constructor(r),a=0,o=0;o!==r;++a)for(var s=n[a]*t,l=0;l!==t;++l)i[o++]=e[s+l];return i}function Mh(e,t,n,r){for(var i=1,a=e[0];void 0!==a&&void 0===a[r];)a=e[i++];if(void 0!==a){var o=a[r];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[r])&&(t.push(a.time),n.push.apply(n,o)),a=e[i++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[r])&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++]}while(void 0!==a);else do{void 0!==(o=a[r])&&(t.push(a.time),n.push(o)),a=e[i++]}while(void 0!==a)}}var Sh=Object.freeze({__proto__:null,arraySlice:yh,convertArray:_h,isTypedArray:xh,getKeyframeOrder:bh,sortedArray:wh,flattenJSON:Mh,subclip:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:30,a=e.clone();a.name=t;for(var o=[],s=0;s<a.tracks.length;++s){for(var l=a.tracks[s],u=l.getValueSize(),c=[],h=[],d=0;d<l.times.length;++d){var f=l.times[d]*i;if(!(f<n||f>=r)){c.push(l.times[d]);for(var p=0;p<u;++p)h.push(l.values[d*u+p])}}0!==c.length&&(l.times=_h(c,l.times.constructor),l.values=_h(h,l.values.constructor),o.push(l))}a.tracks=o;for(var v=1/0,m=0;m<a.tracks.length;++m)v>a.tracks[m].times[0]&&(v=a.tracks[m].times[0]);for(var g=0;g<a.tracks.length;++g)a.tracks[g].shift(-1*v);return a.resetDuration(),a},makeClipAdditive:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30;r<=0&&(r=30);for(var i=n.tracks.length,a=t/r,o=function(t){var r=n.tracks[t],i=r.ValueTypeName;if("bool"===i||"string"===i)return"continue";var o=e.tracks.find((function(e){return e.name===r.name&&e.ValueTypeName===i}));if(void 0===o)return"continue";var s=0,l=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(s=l/3);var u=0,c=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=c/3);var h=r.times.length-1,d=void 0;if(a<=r.times[0]){var f=s,p=l-s;d=yh(r.values,f,p)}else if(a>=r.times[h]){var v=h*l+s,m=v+l-s;d=yh(r.values,v,m)}else{var g=r.createInterpolant(),y=s,_=l-s;g.evaluate(a),d=yh(g.resultBuffer,y,_)}"quaternion"===i&&(new Ar).fromArray(d).normalize().conjugate().toArray(d);for(var x=o.times.length,b=0;b<x;++b){var w=b*c+u;if("quaternion"===i)Ar.multiplyQuaternionsFlat(o.values,w,d,0,o.values,w);else for(var M=c-2*u,S=0;S<M;++S)o.values[w+S]-=d[S]}},s=0;s<i;++s)o(s);return e.blendMode=Zt,e}}),Th=function(){function e(t,n,r,i){M(this,e),this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new n.constructor(r),this.sampleValues=n,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}return T(e,[{key:"evaluate",value:function(e){var t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];e:{t:{var a;n:{r:if(!(e<r)){for(var o=n+2;;){if(void 0===r){if(e<i)break r;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(i=r,e<(r=t[++n]))break t}a=t.length;break n}if(e>=i)break e;var s=t[1];e<s&&(n=2,i=s);for(var l=n-2;;){if(void 0===i)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(r=i,e>=(i=t[--n-1]))break t}a=n,n=0}for(;n<a;){var u=n+a>>>1;e<t[u]?a=u:n=u+1}if(r=t[n],void 0===(i=t[n-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===r)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)}},{key:"getSettings_",value:function(){return this.settings||this.DefaultSettings_}},{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r,a=0;a!==r;++a)t[a]=n[i+a];return t}},{key:"interpolate_",value:function(){throw new Error("call to abstract method")}},{key:"intervalChanged_",value:function(){}}]),e}(),kh=function(e){p(n,e);var t=m(n);function n(e,r,i,a){var o;return M(this,n),(o=t.call(this,e,r,i,a))._weightPrev=-0,o._offsetPrev=-0,o._weightNext=-0,o._offsetNext=-0,o.DefaultSettings_={endingStart:jt,endingEnd:jt},o}return T(n,[{key:"intervalChanged_",value:function(e,t,n){var r=this.parameterPositions,i=e-2,a=e+1,o=r[i],s=r[a];if(void 0===o)switch(this.getSettings_().endingStart){case qt:i=e,o=2*t-n;break;case Xt:o=t+r[i=r.length-2]-r[i+1];break;default:i=e,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case qt:a=e,s=2*n-t;break;case Xt:a=1,s=n+r[1]-r[0];break;default:a=e-1,s=t}var l=.5*(n-t),u=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(s-n),this._offsetPrev=i*u,this._offsetNext=a*u}},{key:"interpolate_",value:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,u=this._offsetPrev,c=this._offsetNext,h=this._weightPrev,d=this._weightNext,f=(n-t)/(r-t),p=f*f,v=p*f,m=-h*v+2*h*p-h*f,g=(1+h)*v+(-1.5-2*h)*p+(-.5+h)*f+1,y=(-1-d)*v+(1.5+d)*p+.5*f,_=d*v-d*p,x=0;x!==o;++x)i[x]=m*a[u+x]+g*a[l+x]+y*a[s+x]+_*a[c+x];return i}}]),n}(Th),Eh=function(e){p(n,e);var t=m(n);function n(e,r,i,a){return M(this,n),t.call(this,e,r,i,a)}return T(n,[{key:"interpolate_",value:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,u=(n-t)/(r-t),c=1-u,h=0;h!==o;++h)i[h]=a[l+h]*c+a[s+h]*u;return i}}]),n}(Th),Ah=function(e){p(n,e);var t=m(n);function n(e,r,i,a){return M(this,n),t.call(this,e,r,i,a)}return T(n,[{key:"interpolate_",value:function(e){return this.copySampleValue_(e-1)}}]),n}(Th),Ch=function(){function e(t,n,r,i){if(M(this,e),void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===n||0===n.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=_h(n,this.TimeBufferType),this.values=_h(r,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}return T(e,[{key:"InterpolantFactoryMethodDiscrete",value:function(e){return new Ah(this.times,this.values,this.getValueSize(),e)}},{key:"InterpolantFactoryMethodLinear",value:function(e){return new Eh(this.times,this.values,this.getValueSize(),e)}},{key:"InterpolantFactoryMethodSmooth",value:function(e){return new kh(this.times,this.values,this.getValueSize(),e)}},{key:"setInterpolation",value:function(e){var t;switch(e){case Ht:t=this.InterpolantFactoryMethodDiscrete;break;case Vt:t=this.InterpolantFactoryMethodLinear;break;case Wt:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}},{key:"getInterpolation",value:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Ht;case this.InterpolantFactoryMethodLinear:return Vt;case this.InterpolantFactoryMethodSmooth:return Wt}}},{key:"getValueSize",value:function(){return this.values.length/this.times.length}},{key:"shift",value:function(e){if(0!==e)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]+=e;return this}},{key:"scale",value:function(e){if(1!==e)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]*=e;return this}},{key:"trim",value:function(e,t){for(var n=this.times,r=n.length,i=0,a=r-1;i!==r&&n[i]<e;)++i;for(;-1!==a&&n[a]>t;)--a;if(++a,0!==i||a!==r){i>=a&&(i=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=yh(n,i,a),this.values=yh(this.values,i*o,a*o)}return this}},{key:"validate",value:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==i;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==r&&xh(r))for(var l=0,u=r.length;l!==u;++l){var c=r[l];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,c),e=!1;break}}return e}},{key:"optimize",value:function(){for(var e=yh(this.times),t=yh(this.values),n=this.getValueSize(),r=this.getInterpolation()===Wt,i=e.length-1,a=1,o=1;o<i;++o){var s=!1,l=e[o];if(l!==e[o+1]&&(1!==o||l!==e[0]))if(r)s=!0;else for(var u=o*n,c=u-n,h=u+n,d=0;d!==n;++d){var f=t[u+d];if(f!==t[c+d]||f!==t[h+d]){s=!0;break}}if(s){if(o!==a){e[a]=e[o];for(var p=o*n,v=a*n,m=0;m!==n;++m)t[v+m]=t[p+m]}++a}}if(i>0){e[a]=e[i];for(var g=i*n,y=a*n,_=0;_!==n;++_)t[y+_]=t[g+_];++a}return a!==e.length?(this.times=yh(e,0,a),this.values=yh(t,0,a*n)):(this.times=e,this.values=t),this}},{key:"clone",value:function(){var e=yh(this.times,0),t=yh(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}],[{key:"toJSON",value:function(e){var t,n=e.constructor;if(n.toJSON!==this.toJSON)t=n.toJSON(e);else{t={name:e.name,times:_h(e.times,Array),values:_h(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t}}]),e}();Ch.prototype.TimeBufferType=Float32Array,Ch.prototype.ValueBufferType=Float32Array,Ch.prototype.DefaultInterpolation=Vt;var Ph=function(e){p(n,e);var t=m(n);function n(){return M(this,n),t.apply(this,arguments)}return T(n)}(Ch);Ph.prototype.ValueTypeName="bool",Ph.prototype.ValueBufferType=Array,Ph.prototype.DefaultInterpolation=Ht,Ph.prototype.InterpolantFactoryMethodLinear=void 0,Ph.prototype.InterpolantFactoryMethodSmooth=void 0;var Lh=function(e){p(n,e);var t=m(n);function n(){return M(this,n),t.apply(this,arguments)}return T(n)}(Ch);Lh.prototype.ValueTypeName="color";var Rh=function(e){p(n,e);var t=m(n);function n(){return M(this,n),t.apply(this,arguments)}return T(n)}(Ch);Rh.prototype.ValueTypeName="number";var Ih=function(e){p(n,e);var t=m(n);function n(e,r,i,a){return M(this,n),t.call(this,e,r,i,a)}return T(n,[{key:"interpolate_",value:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(r-t),l=e*o,u=l+o;l!==u;l+=4)Ar.slerpFlat(i,0,a,l-o,a,l,s);return i}}]),n}(Th),Dh=function(e){p(n,e);var t=m(n);function n(){return M(this,n),t.apply(this,arguments)}return T(n,[{key:"InterpolantFactoryMethodLinear",value:function(e){return new Ih(this.times,this.values,this.getValueSize(),e)}}]),n}(Ch);Dh.prototype.ValueTypeName="quaternion",Dh.prototype.DefaultInterpolation=Vt,Dh.prototype.InterpolantFactoryMethodSmooth=void 0;var Oh=function(e){p(n,e);var t=m(n);function n(){return M(this,n),t.apply(this,arguments)}return T(n)}(Ch);Oh.prototype.ValueTypeName="string",Oh.prototype.ValueBufferType=Array,Oh.prototype.DefaultInterpolation=Ht,Oh.prototype.InterpolantFactoryMethodLinear=void 0,Oh.prototype.InterpolantFactoryMethodSmooth=void 0;var zh=function(e){p(n,e);var t=m(n);function n(){return M(this,n),t.apply(this,arguments)}return T(n)}(Ch);zh.prototype.ValueTypeName="vector";var Nh=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Yt;M(this,e),this.name=t,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=Hn(),this.duration<0&&this.resetDuration()}return T(e,[{key:"resetDuration",value:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t){var r=this.tracks[t];e=Math.max(e,r.times[r.times.length-1])}return this.duration=e,this}},{key:"trim",value:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}},{key:"validate",value:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}},{key:"optimize",value:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}},{key:"clone",value:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}},{key:"toJSON",value:function(){return this.constructor.toJSON(this)}}],[{key:"parse",value:function(e){for(var t=[],n=e.tracks,r=1/(e.fps||1),i=0,a=n.length;i!==a;++i)t.push(Uh(n[i]).scale(r));var o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o}},{key:"toJSON",value:function(e){for(var t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},i=0,a=n.length;i!==a;++i)t.push(Ch.toJSON(n[i]));return r}},{key:"CreateFromMorphTargetSequence",value:function(e,t,n,r){for(var i=t.length,a=[],o=0;o<i;o++){var s=[],l=[];s.push((o+i-1)%i,o,(o+1)%i),l.push(0,1,0);var u=bh(s);s=wh(s,1,u),l=wh(l,1,u),r||0!==s[0]||(s.push(i),l.push(l[0])),a.push(new Rh(".morphTargetInfluences["+t[o].name+"]",s,l).scale(1/n))}return new this(e,-1,a)}},{key:"findByName",value:function(e,t){var n=e;if(!Array.isArray(e)){var r=e;n=r.geometry&&r.geometry.animations||r.animations}for(var i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}},{key:"CreateClipsFromMorphTargetSequences",value:function(e,t,n){for(var r={},i=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],l=s.name.match(i);if(l&&l.length>1){var u=l[1],c=r[u];c||(r[u]=c=[]),c.push(s)}}var h=[];for(var d in r)h.push(this.CreateFromMorphTargetSequence(d,r[d],t,n));return h}},{key:"parseAnimation",value:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,r,i){if(0!==n.length){var a=[],o=[];Mh(n,a,o,r),0!==a.length&&i.push(new e(t,a,o))}},r=[],i=e.name||"default",a=e.fps||30,o=e.blendMode,s=e.length||-1,l=e.hierarchy||[],u=0;u<l.length;u++){var c=l[u].keys;if(c&&0!==c.length)if(c[0].morphTargets){var h={},d=void 0;for(d=0;d<c.length;d++)if(c[d].morphTargets)for(var f=0;f<c[d].morphTargets.length;f++)h[c[d].morphTargets[f]]=-1;for(var p in h){for(var v=[],m=[],g=0;g!==c[d].morphTargets.length;++g){var y=c[d];v.push(y.time),m.push(y.morphTarget===p?1:0)}r.push(new Rh(".morphTargetInfluence["+p+"]",v,m))}s=h.length*a}else{var _=".bones["+t[u].name+"]";n(zh,_+".position",c,"pos",r),n(Dh,_+".quaternion",c,"rot",r),n(zh,_+".scale",c,"scl",r)}}return 0===r.length?null:new this(i,s,r,o)}}]),e}();function Uh(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Rh;case"vector":case"vector2":case"vector3":case"vector4":return zh;case"color":return Lh;case"quaternion":return Dh;case"bool":case"boolean":return Ph;case"string":return Oh}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var n=[],r=[];Mh(e.keys,n,r,"value"),e.times=n,e.values=r}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}var Fh,Bh={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},Gh=T((function e(t,n,r){M(this,e);var i=this,a=!1,o=0,s=0,l=void 0,u=[];this.onStart=void 0,this.onLoad=t,this.onProgress=n,this.onError=r,this.itemStart=function(e){s++,!1===a&&void 0!==i.onStart&&i.onStart(e,o,s),a=!0},this.itemEnd=function(e){o++,void 0!==i.onProgress&&i.onProgress(e,o,s),o===s&&(a=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return l?l(e):e},this.setURLModifier=function(e){return l=e,this},this.addHandler=function(e,t){return u.push(e,t),this},this.removeHandler=function(e){var t=u.indexOf(e);return-1!==t&&u.splice(t,2),this},this.getHandler=function(e){for(var t=0,n=u.length;t<n;t+=2){var r=u[t],i=u[t+1];if(r.global&&(r.lastIndex=0),r.test(e))return i}return null}})),Hh=new Gh,Vh=function(){function e(t){M(this,e),this.manager=void 0!==t?t:Hh,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}return T(e,[{key:"load",value:function(){}},{key:"loadAsync",value:function(e,t){var n=this;return new Promise((function(r,i){n.load(e,r,t,i)}))}},{key:"parse",value:function(){}},{key:"setCrossOrigin",value:function(e){return this.crossOrigin=e,this}},{key:"setWithCredentials",value:function(e){return this.withCredentials=e,this}},{key:"setPath",value:function(e){return this.path=e,this}},{key:"setResourcePath",value:function(e){return this.resourcePath=e,this}},{key:"setRequestHeader",value:function(e){return this.requestHeader=e,this}}]),e}(),Wh={},jh=function(e){p(n,e);var t=m(n);function n(e,r){var i;return M(this,n),(i=t.call(this,e)).response=r,i}return T(n)}(a(Error)),qh=function(e){p(n,e);var t=m(n);function n(e){return M(this,n),t.call(this,e)}return T(n,[{key:"load",value:function(e,t,n,r){var i=this;void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var a=Bh.get(e);if(void 0!==a)return this.manager.itemStart(e),setTimeout((function(){t&&t(a),i.manager.itemEnd(e)}),0),a;if(void 0===Wh[e]){Wh[e]=[],Wh[e].push({onLoad:t,onProgress:n,onError:r});var o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),s=this.mimeType,l=this.responseType;fetch(o).then((function(t){if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;var n=Wh[e],r=t.body.getReader(),i=t.headers.get("Content-Length"),a=i?parseInt(i):0,o=0!==a,s=0,l=new ReadableStream({start:function(e){!function t(){r.read().then((function(r){var i=r.done,l=r.value;if(i)e.close();else{s+=l.byteLength;for(var u=new ProgressEvent("progress",{lengthComputable:o,loaded:s,total:a}),c=0,h=n.length;c<h;c++){var d=n[c];d.onProgress&&d.onProgress(u)}e.enqueue(l),t()}}))}()}});return new Response(l)}throw new jh('fetch for "'.concat(t.url,'" responded with ').concat(t.status,": ").concat(t.statusText),t)})).then((function(e){switch(l){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((function(e){return(new DOMParser).parseFromString(e,s)}));case"json":return e.json();default:if(void 0===s)return e.text();var t=/charset="?([^;"\s]*)"?/i.exec(s),n=t&&t[1]?t[1].toLowerCase():void 0,r=new TextDecoder(n);return e.arrayBuffer().then((function(e){return r.decode(e)}))}})).then((function(t){Bh.add(e,t);var n=Wh[e];delete Wh[e];for(var r=0,i=n.length;r<i;r++){var a=n[r];a.onLoad&&a.onLoad(t)}})).catch((function(t){var n=Wh[e];if(void 0===n)throw i.manager.itemError(e),t;delete Wh[e];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(t)}i.manager.itemError(e)})).finally((function(){i.manager.itemEnd(e)})),this.manager.itemStart(e)}else Wh[e].push({onLoad:t,onProgress:n,onError:r})}},{key:"setResponseType",value:function(e){return this.responseType=e,this}},{key:"setMimeType",value:function(e){return this.mimeType=e,this}}]),n}(Vh),Xh=function(e){p(n,e);var t=m(n);function n(e){return M(this,n),t.call(this,e)}return T(n,[{key:"load",value:function(e,t,n,r){var i=this,a=new qh(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)}},{key:"parse",value:function(e){for(var t=[],n=0;n<e.length;n++){var r=Nh.parse(e[n]);t.push(r)}return t}}]),n}(Vh),Yh=function(e){p(n,e);var t=m(n);function n(e){return M(this,n),t.call(this,e)}return T(n,[{key:"load",value:function(e,t,n,r){var i=this,a=[],o=new Nu,s=new qh(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(i.withCredentials);var l=0;function u(u){s.load(e[u],(function(e){var n=i.parse(e,!0);a[u]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(l+=1)&&(1===n.mipmapCount&&(o.minFilter=Fe),o.image=a,o.format=n.format,o.needsUpdate=!0,t&&t(o))}),n,r)}if(Array.isArray(e))for(var c=0,h=e.length;c<h;++c)u(c);else s.load(e,(function(e){var n=i.parse(e,!0);if(n.isCubemap){for(var r=n.mipmaps.length/n.mipmapCount,s=0;s<r;s++){a[s]={mipmaps:[]};for(var l=0;l<n.mipmapCount;l++)a[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+l]),a[s].format=n.format,a[s].width=n.width,a[s].height=n.height}o.image=a}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;1===n.mipmapCount&&(o.minFilter=Fe),o.format=n.format,o.needsUpdate=!0,t&&t(o)}),n,r);return o}}]),n}(Vh),Zh=function(e){p(n,e);var t=m(n);function n(e){return M(this,n),t.call(this,e)}return T(n,[{key:"load",value:function(e,t,n,r){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=Bh.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout((function(){t&&t(a),i.manager.itemEnd(e)}),0),a;var o=rr("img");function s(){u(),Bh.add(e,this),t&&t(this),i.manager.itemEnd(e)}function l(t){u(),r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}function u(){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",s,!1),o.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(e),o.src=e,o}}]),n}(Vh),Jh=function(e){p(n,e);var t=m(n);function n(e){return M(this,n),t.call(this,e)}return T(n,[{key:"load",value:function(e,t,n,r){var i=new Ga,a=new Zh(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(n){a.load(e[n],(function(e){i.images[n]=e,6==++o&&(i.needsUpdate=!0,t&&t(i))}),void 0,r)}for(var l=0;l<e.length;++l)s(l);return i}}]),n}(Vh),Qh=function(e){p(n,e);var t=m(n);function n(e){return M(this,n),t.call(this,e)}return T(n,[{key:"load",value:function(e,t,n,r){var i=this,a=new su,o=new qh(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(i.withCredentials),o.load(e,(function(e){var n=i.parse(e);n&&(void 0!==n.image?a.image=n.image:void 0!==n.data&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data),a.wrapS=void 0!==n.wrapS?n.wrapS:Re,a.wrapT=void 0!==n.wrapT?n.wrapT:Re,a.magFilter=void 0!==n.magFilter?n.magFilter:Fe,a.minFilter=void 0!==n.minFilter?n.minFilter:Fe,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.encoding&&(a.encoding=n.encoding),void 0!==n.flipY&&(a.flipY=n.flipY),void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=He),1===n.mipmapCount&&(a.minFilter=Fe),void 0!==n.generateMipmaps&&(a.generateMipmaps=n.generateMipmaps),a.needsUpdate=!0,t&&t(a,n))}),n,r),a}}]),n}(Vh),Kh=function(e){p(n,e);var t=m(n);function n(e){return M(this,n),t.call(this,e)}return T(n,[{key:"load",value:function(e,t,n,r){var i=new xr,a=new Zh(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,(function(e){i.image=e,i.needsUpdate=!0,void 0!==t&&t(i)}),n,r),i}}]),n}(Vh),$h=function(e){p(n,e);var t=m(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return M(this,n),(r=t.call(this)).isLight=!0,r.type="Light",r.color=new vr(e),r.intensity=i,r}return T(n,[{key:"dispose",value:function(){}},{key:"copy",value:function(e,t){return d(x(n.prototype),"copy",this).call(this,e,t),this.color.copy(e.color),this.intensity=e.intensity,this}},{key:"toJSON",value:function(e){var t=d(x(n.prototype),"toJSON",this).call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}]),n}(Li),ed=function(e){p(n,e);var t=m(n);function n(e,r,i){var a;return M(this,n),(a=t.call(this,e,i)).isHemisphereLight=!0,a.type="HemisphereLight",a.position.copy(Li.DefaultUp),a.updateMatrix(),a.groundColor=new vr(r),a}return T(n,[{key:"copy",value:function(e,t){return d(x(n.prototype),"copy",this).call(this,e,t),this.groundColor.copy(e.groundColor),this}}]),n}($h),td=new oi,nd=new Cr,rd=new Cr,id=function(){function e(t){M(this,e),this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Kn(512,512),this.map=null,this.mapPass=null,this.matrix=new oi,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Za,this._frameExtents=new Kn(1,1),this._viewportCount=1,this._viewports=[new br(0,0,1,1)]}return T(e,[{key:"getViewportCount",value:function(){return this._viewportCount}},{key:"getFrustum",value:function(){return this._frustum}},{key:"updateMatrices",value:function(e){var t=this.camera,n=this.matrix;nd.setFromMatrixPosition(e.matrixWorld),t.position.copy(nd),rd.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(rd),t.updateMatrixWorld(),td.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(td),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(td)}},{key:"getViewport",value:function(e){return this._viewports[e]}},{key:"getFrameExtents",value:function(){return this._frameExtents}},{key:"dispose",value:function(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}},{key:"copy",value:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"toJSON",value:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}]),e}(),ad=function(e){p(n,e);var t=m(n);function n(){var e;return M(this,n),(e=t.call(this,new Ua(50,1,.5,500))).isSpotLightShadow=!0,e.focus=1,e}return T(n,[{key:"updateMatrices",value:function(e){var t=this.camera,r=2*Gn*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,a=e.distance||t.far;r===t.fov&&i===t.aspect&&a===t.far||(t.fov=r,t.aspect=i,t.far=a,t.updateProjectionMatrix()),d(x(n.prototype),"updateMatrices",this).call(this,e)}},{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,e),this.focus=e.focus,this}}]),n}(id),od=function(e){p(n,e);var t=m(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Math.PI/3,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;return M(this,n),(i=t.call(this,e,r)).isSpotLight=!0,i.type="SpotLight",i.position.copy(Li.DefaultUp),i.updateMatrix(),i.target=new Li,i.distance=a,i.angle=o,i.penumbra=s,i.decay=l,i.map=null,i.shadow=new ad,i}return T(n,[{key:"power",get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}},{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e,t){return d(x(n.prototype),"copy",this).call(this,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}}]),n}($h),sd=new oi,ld=new Cr,ud=new Cr,cd=function(e){p(n,e);var t=m(n);function n(){var e;return M(this,n),(e=t.call(this,new Ua(90,1,.5,500))).isPointLightShadow=!0,e._frameExtents=new Kn(4,2),e._viewportCount=6,e._viewports=[new br(2,1,1,1),new br(0,1,1,1),new br(3,1,1,1),new br(1,1,1,1),new br(3,0,1,1),new br(1,0,1,1)],e._cubeDirections=[new Cr(1,0,0),new Cr(-1,0,0),new Cr(0,0,1),new Cr(0,0,-1),new Cr(0,1,0),new Cr(0,-1,0)],e._cubeUps=[new Cr(0,1,0),new Cr(0,1,0),new Cr(0,1,0),new Cr(0,1,0),new Cr(0,0,1),new Cr(0,0,-1)],e}return T(n,[{key:"updateMatrices",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.camera,r=this.matrix,i=e.distance||n.far;i!==n.far&&(n.far=i,n.updateProjectionMatrix()),ld.setFromMatrixPosition(e.matrixWorld),n.position.copy(ld),ud.copy(n.position),ud.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(ud),n.updateMatrixWorld(),r.makeTranslation(-ld.x,-ld.y,-ld.z),sd.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(sd)}}]),n}(id),hd=function(e){p(n,e);var t=m(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return M(this,n),(i=t.call(this,e,r)).isPointLight=!0,i.type="PointLight",i.distance=a,i.decay=o,i.shadow=new cd,i}return T(n,[{key:"power",get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}},{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e,t){return d(x(n.prototype),"copy",this).call(this,e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}]),n}($h),dd=function(e){p(n,e);var t=m(n);function n(){var e;return M(this,n),(e=t.call(this,new lo(-5,5,5,-5,.5,500))).isDirectionalLightShadow=!0,e}return T(n)}(id),fd=function(e){p(n,e);var t=m(n);function n(e,r){var i;return M(this,n),(i=t.call(this,e,r)).isDirectionalLight=!0,i.type="DirectionalLight",i.position.copy(Li.DefaultUp),i.updateMatrix(),i.target=new Li,i.shadow=new dd,i}return T(n,[{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}]),n}($h),pd=function(e){p(n,e);var t=m(n);function n(e,r){var i;return M(this,n),(i=t.call(this,e,r)).isAmbientLight=!0,i.type="AmbientLight",i}return T(n)}($h),vd=function(e){p(n,e);var t=m(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10;return M(this,n),(i=t.call(this,e,r)).isRectAreaLight=!0,i.type="RectAreaLight",i.width=a,i.height=o,i}return T(n,[{key:"power",get:function(){return this.intensity*this.width*this.height*Math.PI},set:function(e){this.intensity=e/(this.width*this.height*Math.PI)}},{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,e),this.width=e.width,this.height=e.height,this}},{key:"toJSON",value:function(e){var t=d(x(n.prototype),"toJSON",this).call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}]),n}($h),md=function(){function e(){M(this,e),this.isSphericalHarmonics3=!0,this.coefficients=[];for(var t=0;t<9;t++)this.coefficients.push(new Cr)}return T(e,[{key:"set",value:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}},{key:"zero",value:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}},{key:"getAt",value:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*r),t.addScaledVector(a[2],.488603*i),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],n*r*1.092548),t.addScaledVector(a[5],r*i*1.092548),t.addScaledVector(a[6],.315392*(3*i*i-1)),t.addScaledVector(a[7],n*i*1.092548),t.addScaledVector(a[8],.546274*(n*n-r*r)),t}},{key:"getIrradianceAt",value:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*r),t.addScaledVector(a[2],1.023328*i),t.addScaledVector(a[3],1.023328*n),t.addScaledVector(a[4],.858086*n*r),t.addScaledVector(a[5],.858086*r*i),t.addScaledVector(a[6],.743125*i*i-.247708),t.addScaledVector(a[7],.858086*n*i),t.addScaledVector(a[8],.429043*(n*n-r*r)),t}},{key:"add",value:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}},{key:"addScaledSH",value:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}},{key:"scale",value:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}},{key:"lerp",value:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}},{key:"equals",value:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}},{key:"copy",value:function(e){return this.set(e.coefficients)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.coefficients,r=0;r<9;r++)n[r].fromArray(e,t+3*r);return this}},{key:"toArray",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.coefficients,r=0;r<9;r++)n[r].toArray(e,t+3*r);return e}}],[{key:"getBasisAt",value:function(e,t){var n=e.x,r=e.y,i=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*i,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*i,t[6]=.315392*(3*i*i-1),t[7]=1.092548*n*i,t[8]=.546274*(n*n-r*r)}}]),e}(),gd=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new md,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return M(this,n),(e=t.call(this,void 0,i)).isLightProbe=!0,e.sh=r,e}return T(n,[{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,e),this.sh.copy(e.sh),this}},{key:"fromJSON",value:function(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}},{key:"toJSON",value:function(e){var t=d(x(n.prototype),"toJSON",this).call(this,e);return t.object.sh=this.sh.toArray(),t}}]),n}($h),yd=function(e){p(n,e);var t=m(n);function n(e){var r;return M(this,n),(r=t.call(this,e)).textures={},r}return T(n,[{key:"load",value:function(e,t,n,r){var i=this,a=new qh(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)}},{key:"parse",value:function(e){var t=this.textures;function r(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}var i=n.createMaterialFromType(e.type);if(void 0!==e.uuid&&(i.uuid=e.uuid),void 0!==e.name&&(i.name=e.name),void 0!==e.color&&void 0!==i.color&&i.color.setHex(e.color),void 0!==e.roughness&&(i.roughness=e.roughness),void 0!==e.metalness&&(i.metalness=e.metalness),void 0!==e.sheen&&(i.sheen=e.sheen),void 0!==e.sheenColor&&(i.sheenColor=(new vr).setHex(e.sheenColor)),void 0!==e.sheenRoughness&&(i.sheenRoughness=e.sheenRoughness),void 0!==e.emissive&&void 0!==i.emissive&&i.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==i.specular&&i.specular.setHex(e.specular),void 0!==e.specularIntensity&&(i.specularIntensity=e.specularIntensity),void 0!==e.specularColor&&void 0!==i.specularColor&&i.specularColor.setHex(e.specularColor),void 0!==e.shininess&&(i.shininess=e.shininess),void 0!==e.clearcoat&&(i.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(i.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.iridescence&&(i.iridescence=e.iridescence),void 0!==e.iridescenceIOR&&(i.iridescenceIOR=e.iridescenceIOR),void 0!==e.iridescenceThicknessRange&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),void 0!==e.transmission&&(i.transmission=e.transmission),void 0!==e.thickness&&(i.thickness=e.thickness),void 0!==e.attenuationDistance&&(i.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(e.attenuationColor),void 0!==e.fog&&(i.fog=e.fog),void 0!==e.flatShading&&(i.flatShading=e.flatShading),void 0!==e.blending&&(i.blending=e.blending),void 0!==e.combine&&(i.combine=e.combine),void 0!==e.side&&(i.side=e.side),void 0!==e.shadowSide&&(i.shadowSide=e.shadowSide),void 0!==e.opacity&&(i.opacity=e.opacity),void 0!==e.transparent&&(i.transparent=e.transparent),void 0!==e.alphaTest&&(i.alphaTest=e.alphaTest),void 0!==e.depthTest&&(i.depthTest=e.depthTest),void 0!==e.depthWrite&&(i.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(i.colorWrite=e.colorWrite),void 0!==e.stencilWrite&&(i.stencilWrite=e.stencilWrite),void 0!==e.stencilWriteMask&&(i.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(i.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(i.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(i.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(i.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(i.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(i.stencilZPass=e.stencilZPass),void 0!==e.wireframe&&(i.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(i.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(i.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(i.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(i.rotation=e.rotation),1!==e.linewidth&&(i.linewidth=e.linewidth),void 0!==e.dashSize&&(i.dashSize=e.dashSize),void 0!==e.gapSize&&(i.gapSize=e.gapSize),void 0!==e.scale&&(i.scale=e.scale),void 0!==e.polygonOffset&&(i.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(i.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(i.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.dithering&&(i.dithering=e.dithering),void 0!==e.alphaToCoverage&&(i.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(i.premultipliedAlpha=e.premultipliedAlpha),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.toneMapped&&(i.toneMapped=e.toneMapped),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),void 0!==e.uniforms)for(var a in e.uniforms){var o=e.uniforms[a];switch(i.uniforms[a]={},o.type){case"t":i.uniforms[a].value=r(o.value);break;case"c":i.uniforms[a].value=(new vr).setHex(o.value);break;case"v2":i.uniforms[a].value=(new Kn).fromArray(o.value);break;case"v3":i.uniforms[a].value=(new Cr).fromArray(o.value);break;case"v4":i.uniforms[a].value=(new br).fromArray(o.value);break;case"m3":i.uniforms[a].value=(new $n).fromArray(o.value);break;case"m4":i.uniforms[a].value=(new oi).fromArray(o.value);break;default:i.uniforms[a].value=o.value}}if(void 0!==e.defines&&(i.defines=e.defines),void 0!==e.vertexShader&&(i.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(i.fragmentShader=e.fragmentShader),void 0!==e.glslVersion&&(i.glslVersion=e.glslVersion),void 0!==e.extensions)for(var s in e.extensions)i.extensions[s]=e.extensions[s];if(void 0!==e.size&&(i.size=e.size),void 0!==e.sizeAttenuation&&(i.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(i.map=r(e.map)),void 0!==e.matcap&&(i.matcap=r(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=r(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=r(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=r(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){var l=e.normalScale;!1===Array.isArray(l)&&(l=[l,l]),i.normalScale=(new Kn).fromArray(l)}return void 0!==e.displacementMap&&(i.displacementMap=r(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=r(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=r(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=r(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=r(e.specularMap)),void 0!==e.specularIntensityMap&&(i.specularIntensityMap=r(e.specularIntensityMap)),void 0!==e.specularColorMap&&(i.specularColorMap=r(e.specularColorMap)),void 0!==e.envMap&&(i.envMap=r(e.envMap)),void 0!==e.envMapIntensity&&(i.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(i.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(i.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(i.lightMap=r(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=r(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=r(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=r(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=r(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=r(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=(new Kn).fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(i.iridescenceMap=r(e.iridescenceMap)),void 0!==e.iridescenceThicknessMap&&(i.iridescenceThicknessMap=r(e.iridescenceThicknessMap)),void 0!==e.transmissionMap&&(i.transmissionMap=r(e.transmissionMap)),void 0!==e.thicknessMap&&(i.thicknessMap=r(e.thicknessMap)),void 0!==e.sheenColorMap&&(i.sheenColorMap=r(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(i.sheenRoughnessMap=r(e.sheenRoughnessMap)),i}},{key:"setTextures",value:function(e){return this.textures=e,this}}],[{key:"createMaterialFromType",value:function(e){return new{ShadowMaterial:lh,SpriteMaterial:zl,RawShaderMaterial:uh,ShaderMaterial:za,PointsMaterial:Au,MeshPhysicalMaterial:hh,MeshStandardMaterial:ch,MeshPhongMaterial:dh,MeshToonMaterial:fh,MeshNormalMaterial:ph,MeshLambertMaterial:vh,MeshDepthMaterial:dl,MeshDistanceMaterial:fl,MeshBasicMaterial:ji,MeshMatcapMaterial:mh,LineDashedMaterial:gh,LineBasicMaterial:gu,Material:Wi}[e]}}]),n}(Vh),_d=function(){function e(){M(this,e)}return T(e,null,[{key:"decodeText",value:function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}}},{key:"extractUrlBase",value:function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)}},{key:"resolveURL",value:function(e,t){return"string"!=typeof e||""===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)}}]),e}(),xd=function(e){p(n,e);var t=m(n);function n(){var e;return M(this,n),(e=t.call(this)).isInstancedBufferGeometry=!0,e.type="InstancedBufferGeometry",e.instanceCount=1/0,e}return T(n,[{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,e),this.instanceCount=e.instanceCount,this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"toJSON",value:function(){var e=d(x(n.prototype),"toJSON",this).call(this,this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}]),n}(da),bd=function(e){p(n,e);var t=m(n);function n(e){return M(this,n),t.call(this,e)}return T(n,[{key:"load",value:function(e,t,n,r){var i=this,a=new qh(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)}},{key:"parse",value:function(e){var t={},n={};function r(e,r){if(void 0!==t[r])return t[r];var i=e.interleavedBuffers[r],a=function(e,t){if(void 0!==n[t])return n[t];var r=e.arrayBuffers[t],i=new Uint32Array(r).buffer;return n[t]=i,i}(e,i.buffer),o=nr(i.type,a),s=new Il(o,i.stride);return s.uuid=i.uuid,t[r]=s,s}var i=e.isInstancedBufferGeometry?new xd:new da,a=e.data.index;if(void 0!==a){var o=nr(a.type,a.array);i.setIndex(new Yi(o,1))}var s=e.data.attributes;for(var l in s){var u=s[l],c=void 0;if(u.isInterleavedBufferAttribute){var h=r(e.data,u.data);c=new Ol(h,u.itemSize,u.offset,u.normalized)}else{var d=nr(u.type,u.array);c=new(u.isInstancedBufferAttribute?hu:Yi)(d,u.itemSize,u.normalized)}void 0!==u.name&&(c.name=u.name),void 0!==u.usage&&c.setUsage(u.usage),void 0!==u.updateRange&&(c.updateRange.offset=u.updateRange.offset,c.updateRange.count=u.updateRange.count),i.setAttribute(l,c)}var f=e.data.morphAttributes;if(f)for(var p in f){for(var v=f[p],m=[],g=0,y=v.length;g<y;g++){var _=v[g],x=void 0;if(_.isInterleavedBufferAttribute){var b=r(e.data,_.data);x=new Ol(b,_.itemSize,_.offset,_.normalized)}else{var w=nr(_.type,_.array);x=new Yi(w,_.itemSize,_.normalized)}void 0!==_.name&&(x.name=_.name),m.push(x)}i.morphAttributes[p]=m}e.data.morphTargetsRelative&&(i.morphTargetsRelative=!0);var M=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==M)for(var S=0,T=M.length;S!==T;++S){var k=M[S];i.addGroup(k.start,k.count,k.materialIndex)}var E=e.data.boundingSphere;if(void 0!==E){var A=new Cr;void 0!==E.center&&A.fromArray(E.center),i.boundingSphere=new Qr(A,E.radius)}return e.name&&(i.name=e.name),e.userData&&(i.userData=e.userData),i}}]),n}(Vh),wd=function(e){p(a,e);var t,n,r,i=m(a);function a(e){return M(this,a),i.call(this,e)}return T(a,[{key:"load",value:function(e,t,n,r){var i=this,a=""===this.path?_d.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;var o=new qh(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(n){var a=null;try{a=JSON.parse(n)}catch(t){return void 0!==r&&r(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}var o=a.metadata;void 0!==o&&void 0!==o.type&&"geometry"!==o.type.toLowerCase()?i.parse(a,t):console.error("THREE.ObjectLoader: Can't load "+e)}),n,r)}},{key:"loadAsync",value:(r=l(w().mark((function e(t,n){var r,i,a,o,s,l;return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this,i=""===this.path?_d.extractUrlBase(t):this.path,this.resourcePath=this.resourcePath||i,(a=new qh(this.manager)).setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),e.next=9,a.loadAsync(t,n);case 9:if(o=e.sent,s=JSON.parse(o),void 0!==(l=s.metadata)&&void 0!==l.type&&"geometry"!==l.type.toLowerCase()){e.next=14;break}throw new Error("THREE.ObjectLoader: Can't load "+t);case 14:return e.next=16,r.parseAsync(s);case 16:return e.abrupt("return",e.sent);case 17:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"parse",value:function(e,t){var n=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,r),a=this.parseImages(e.images,(function(){void 0!==t&&t(l)})),o=this.parseTextures(e.textures,a),s=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,i,s,o,n),u=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,u),void 0!==t){var c=!1;for(var h in a)if(a[h].data instanceof HTMLImageElement){c=!0;break}!1===c&&t(l)}return l}},{key:"parseAsync",value:(n=l(w().mark((function e(t){var n,r,i,a,o,s,l,u;return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.parseAnimations(t.animations),r=this.parseShapes(t.shapes),i=this.parseGeometries(t.geometries,r),e.next=5,this.parseImagesAsync(t.images);case 5:return a=e.sent,o=this.parseTextures(t.textures,a),s=this.parseMaterials(t.materials,o),l=this.parseObject(t.object,i,s,o,n),u=this.parseSkeletons(t.skeletons,l),this.bindSkeletons(l,u),e.abrupt("return",l);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"parseShapes",value:function(e){var t={};if(void 0!==e)for(var n=0,r=e.length;n<r;n++){var i=(new _c).fromJSON(e[n]);t[i.uuid]=i}return t}},{key:"parseSkeletons",value:function(e,t){var n={},r={};if(t.traverse((function(e){e.isBone&&(r[e.uuid]=e)})),void 0!==e)for(var i=0,a=e.length;i<a;i++){var o=(new cu).fromJSON(e[i],r);n[o.uuid]=o}return n}},{key:"parseGeometries",value:function(e,t){var n={};if(void 0!==e)for(var r=new bd,i=0,a=e.length;i<a;i++){var o=void 0,s=e[i];switch(s.type){case"BufferGeometry":case"InstancedBufferGeometry":o=r.parse(s);break;default:s.type in sh?o=sh[s.type].fromJSON(s,t):console.warn('THREE.ObjectLoader: Unsupported geometry type "'.concat(s.type,'"'))}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),!0===o.isBufferGeometry&&void 0!==s.userData&&(o.userData=s.userData),n[s.uuid]=o}return n}},{key:"parseMaterials",value:function(e,t){var n={},r={};if(void 0!==e){var i=new yd;i.setTextures(t);for(var a=0,o=e.length;a<o;a++){var s=e[a];void 0===n[s.uuid]&&(n[s.uuid]=i.parse(s)),r[s.uuid]=n[s.uuid]}}return r}},{key:"parseAnimations",value:function(e){var t={};if(void 0!==e)for(var n=0;n<e.length;n++){var r=e[n],i=Nh.parse(r);t[i.uuid]=i}return t}},{key:"parseImages",value:function(e,t){var n,r=this,i={};function a(e){if("string"==typeof e){var t=e;return function(e){return r.manager.itemStart(e),n.load(e,(function(){r.manager.itemEnd(e)}),void 0,(function(){r.manager.itemError(e),r.manager.itemEnd(e)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(t)?t:r.resourcePath+t)}return e.data?{data:nr(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){var o=new Gh(t);(n=new Zh(o)).setCrossOrigin(this.crossOrigin);for(var s=0,l=e.length;s<l;s++){var u=e[s],c=u.url;if(Array.isArray(c)){for(var h=[],d=0,f=c.length;d<f;d++){var p=a(c[d]);null!==p&&(p instanceof HTMLImageElement?h.push(p):h.push(new su(p.data,p.width,p.height)))}i[u.uuid]=new gr(h)}else{var v=a(u.url);i[u.uuid]=new gr(v)}}}return i}},{key:"parseImagesAsync",value:(t=l(w().mark((function e(t){var n,r,i,a,o,s,u,c,h,d,f,p,v,m,g;return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=function(){return o=l(w().mark((function e(t){var r,a;return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("string"!=typeof t){e.next=8;break}return a=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(r=t)?r:n.resourcePath+r,e.next=5,i.loadAsync(a);case 5:return e.abrupt("return",e.sent);case 8:if(!t.data){e.next=12;break}return e.abrupt("return",{data:nr(t.type,t.data),width:t.width,height:t.height});case 12:return e.abrupt("return",null);case 13:case"end":return e.stop()}}),e)}))),o.apply(this,arguments)},a=function(e){return o.apply(this,arguments)},n=this,r={},!(void 0!==t&&t.length>0)){e.next=33;break}(i=new Zh(this.manager)).setCrossOrigin(this.crossOrigin),s=0,u=t.length;case 8:if(!(s<u)){e.next=33;break}if(c=t[s],h=c.url,!Array.isArray(h)){e.next=26;break}d=[],f=0,p=h.length;case 14:if(!(f<p)){e.next=23;break}return v=h[f],e.next=18,a(v);case 18:null!==(m=e.sent)&&(m instanceof HTMLImageElement?d.push(m):d.push(new su(m.data,m.width,m.height)));case 20:f++,e.next=14;break;case 23:r[c.uuid]=new gr(d),e.next=30;break;case 26:return e.next=28,a(c.url);case 28:g=e.sent,r[c.uuid]=new gr(g);case 30:s++,e.next=8;break;case 33:return e.abrupt("return",r);case 34:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"parseTextures",value:function(e,t){function n(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}var r={};if(void 0!==e)for(var i=0,a=e.length;i<a;i++){var o=e[i];void 0===o.image&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),void 0===t[o.image]&&console.warn("THREE.ObjectLoader: Undefined image",o.image);var s=t[o.image],l=s.data,u=void 0;Array.isArray(l)?(u=new Ga,6===l.length&&(u.needsUpdate=!0)):(u=l&&l.data?new su:new xr,l&&(u.needsUpdate=!0)),u.source=s,u.uuid=o.uuid,void 0!==o.name&&(u.name=o.name),void 0!==o.mapping&&(u.mapping=n(o.mapping,Md)),void 0!==o.offset&&u.offset.fromArray(o.offset),void 0!==o.repeat&&u.repeat.fromArray(o.repeat),void 0!==o.center&&u.center.fromArray(o.center),void 0!==o.rotation&&(u.rotation=o.rotation),void 0!==o.wrap&&(u.wrapS=n(o.wrap[0],Sd),u.wrapT=n(o.wrap[1],Sd)),void 0!==o.format&&(u.format=o.format),void 0!==o.type&&(u.type=o.type),void 0!==o.encoding&&(u.encoding=o.encoding),void 0!==o.minFilter&&(u.minFilter=n(o.minFilter,Td)),void 0!==o.magFilter&&(u.magFilter=n(o.magFilter,Td)),void 0!==o.anisotropy&&(u.anisotropy=o.anisotropy),void 0!==o.flipY&&(u.flipY=o.flipY),void 0!==o.premultiplyAlpha&&(u.premultiplyAlpha=o.premultiplyAlpha),void 0!==o.unpackAlignment&&(u.unpackAlignment=o.unpackAlignment),void 0!==o.userData&&(u.userData=o.userData),r[o.uuid]=u}return r}},{key:"parseObject",value:function(e,t,n,r,i){var a,o,s;function l(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function u(e){if(void 0!==e){if(Array.isArray(e)){for(var t=[],r=0,i=e.length;r<i;r++){var a=e[r];void 0===n[a]&&console.warn("THREE.ObjectLoader: Undefined material",a),t.push(n[a])}return t}return void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),n[e]}}function c(e){return void 0===r[e]&&console.warn("THREE.ObjectLoader: Undefined texture",e),r[e]}switch(e.type){case"Scene":a=new Rl,void 0!==e.background&&(Number.isInteger(e.background)?a.background=new vr(e.background):a.background=c(e.background)),void 0!==e.environment&&(a.environment=c(e.environment)),void 0!==e.fog&&("Fog"===e.fog.type?a.fog=new Ll(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(a.fog=new Pl(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":a=new Ua(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(a.focus=e.focus),void 0!==e.zoom&&(a.zoom=e.zoom),void 0!==e.filmGauge&&(a.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(a.filmOffset=e.filmOffset),void 0!==e.view&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new lo(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(a.zoom=e.zoom),void 0!==e.view&&(a.view=Object.assign({},e.view));break;case"AmbientLight":a=new pd(e.color,e.intensity);break;case"DirectionalLight":a=new fd(e.color,e.intensity);break;case"PointLight":a=new hd(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new vd(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new od(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":a=new ed(e.color,e.groundColor,e.intensity);break;case"LightProbe":a=(new gd).fromJSON(e);break;case"SkinnedMesh":o=l(e.geometry),s=u(e.material),a=new au(o,s),void 0!==e.bindMode&&(a.bindMode=e.bindMode),void 0!==e.bindMatrix&&a.bindMatrix.fromArray(e.bindMatrix),void 0!==e.skeleton&&(a.skeleton=e.skeleton);break;case"Mesh":o=l(e.geometry),s=u(e.material),a=new Pa(o,s);break;case"InstancedMesh":o=l(e.geometry),s=u(e.material);var h=e.count,d=e.instanceMatrix,f=e.instanceColor;(a=new mu(o,s,h)).instanceMatrix=new hu(new Float32Array(d.array),16),void 0!==f&&(a.instanceColor=new hu(new Float32Array(f.array),f.itemSize));break;case"LOD":a=new $l;break;case"Line":a=new Mu(l(e.geometry),u(e.material));break;case"LineLoop":a=new Eu(l(e.geometry),u(e.material));break;case"LineSegments":a=new ku(l(e.geometry),u(e.material));break;case"PointCloud":case"Points":a=new Iu(l(e.geometry),u(e.material));break;case"Sprite":a=new Zl(u(e.material));break;case"Group":a=new _l;break;case"Bone":a=new ou;break;default:a=new Li}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(a.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.quaternion&&a.quaternion.fromArray(e.quaternion),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(a.shadow.bias=e.shadow.bias),void 0!==e.shadow.normalBias&&(a.shadow.normalBias=e.shadow.normalBias),void 0!==e.shadow.radius&&(a.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&a.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(a.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.frustumCulled&&(a.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(a.renderOrder=e.renderOrder),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.layers&&(a.layers.mask=e.layers),void 0!==e.children)for(var p=e.children,v=0;v<p.length;v++)a.add(this.parseObject(p[v],t,n,r,i));if(void 0!==e.animations)for(var m=e.animations,g=0;g<m.length;g++){var y=m[g];a.animations.push(i[y])}if("LOD"===e.type){void 0!==e.autoUpdate&&(a.autoUpdate=e.autoUpdate);for(var _=e.levels,x=0;x<_.length;x++){var b=_[x],w=a.getObjectByProperty("uuid",b.object);void 0!==w&&a.addLevel(w,b.distance)}}return a}},{key:"bindSkeletons",value:function(e,t){0!==Object.keys(t).length&&e.traverse((function(e){if(!0===e.isSkinnedMesh&&void 0!==e.skeleton){var n=t[e.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",e.skeleton):e.bind(n,e.bindMatrix)}}))}}]),a}(Vh),Md={UVMapping:Te,CubeReflectionMapping:ke,CubeRefractionMapping:Ee,EquirectangularReflectionMapping:Ae,EquirectangularRefractionMapping:Ce,CubeUVReflectionMapping:Pe},Sd={RepeatWrapping:Le,ClampToEdgeWrapping:Re,MirroredRepeatWrapping:Ie},Td={NearestFilter:De,NearestMipmapNearestFilter:Oe,NearestMipmapLinearFilter:Ne,LinearFilter:Fe,LinearMipmapNearestFilter:Be,LinearMipmapLinearFilter:He},kd=function(e){p(n,e);var t=m(n);function n(e){var r;return M(this,n),(r=t.call(this,e)).isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),r.options={premultiplyAlpha:"none"},r}return T(n,[{key:"setOptions",value:function(e){return this.options=e,this}},{key:"load",value:function(e,t,n,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=Bh.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout((function(){t&&t(a),i.manager.itemEnd(e)}),0),a;var o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then((function(e){return e.blob()})).then((function(e){return createImageBitmap(e,Object.assign(i.options,{colorSpaceConversion:"none"}))})).then((function(n){Bh.add(e,n),t&&t(n),i.manager.itemEnd(e)})).catch((function(t){r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)})),i.manager.itemStart(e)}}]),n}(Vh),Ed={getContext:function(){return void 0===Fh&&(Fh=new(window.AudioContext||window.webkitAudioContext)),Fh},setContext:function(e){Fh=e}},Ad=function(e){p(n,e);var t=m(n);function n(e){return M(this,n),t.call(this,e)}return T(n,[{key:"load",value:function(e,t,n,r){var i=this,a=new qh(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(n){try{var a=n.slice(0);Ed.getContext().decodeAudioData(a,(function(e){t(e)}))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)}}]),n}(Vh),Cd=function(e){p(n,e);var t=m(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;M(this,n),(i=t.call(this,void 0,a)).isHemisphereLightProbe=!0;var o=(new vr).set(e),s=(new vr).set(r),l=new Cr(o.r,o.g,o.b),u=new Cr(s.r,s.g,s.b),c=Math.sqrt(Math.PI),h=c*Math.sqrt(.75);return i.sh.coefficients[0].copy(l).add(u).multiplyScalar(c),i.sh.coefficients[1].copy(l).sub(u).multiplyScalar(h),i}return T(n)}(gd),Pd=function(e){p(n,e);var t=m(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;M(this,n),(r=t.call(this,void 0,i)).isAmbientLightProbe=!0;var a=(new vr).set(e);return r.sh.coefficients[0].set(a.r,a.g,a.b).multiplyScalar(2*Math.sqrt(Math.PI)),r}return T(n)}(gd),Ld=new oi,Rd=new oi,Id=new oi,Dd=function(){function e(){M(this,e),this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Ua,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Ua,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}}return T(e,[{key:"update",value:function(e){var 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,Id.copy(e.projectionMatrix);var n,r,i=t.eyeSep/2,a=i*t.near/t.focus,o=t.near*Math.tan(Bn*t.fov*.5)/t.zoom;Rd.elements[12]=-i,Ld.elements[12]=i,n=-o*t.aspect+a,r=o*t.aspect+a,Id.elements[0]=2*t.near/(r-n),Id.elements[8]=(r+n)/(r-n),this.cameraL.projectionMatrix.copy(Id),n=-o*t.aspect-a,r=o*t.aspect-a,Id.elements[0]=2*t.near/(r-n),Id.elements[8]=(r+n)/(r-n),this.cameraR.projectionMatrix.copy(Id)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Rd),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Ld)}}]),e}(),Od=function(){function e(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];M(this,e),this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}return T(e,[{key:"start",value:function(){this.startTime=zd(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}},{key:"stop",value:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}},{key:"getElapsedTime",value:function(){return this.getDelta(),this.elapsedTime}},{key:"getDelta",value:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=zd();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}]),e}();function zd(){return("undefined"==typeof performance?Date:performance).now()}var Nd=new Cr,Ud=new Ar,Fd=new Cr,Bd=new Cr,Gd=function(e){p(n,e);var t=m(n);function n(){var e;return M(this,n),(e=t.call(this)).type="AudioListener",e.context=Ed.getContext(),e.gain=e.context.createGain(),e.gain.connect(e.context.destination),e.filter=null,e.timeDelta=0,e._clock=new Od,e}return T(n,[{key:"getInput",value:function(){return this.gain}},{key:"removeFilter",value:function(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}},{key:"getFilter",value:function(){return this.filter}},{key:"setFilter",value:function(e){return null!==this.filter?(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}},{key:"getMasterVolume",value:function(){return this.gain.gain.value}},{key:"setMasterVolume",value:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}},{key:"updateMatrixWorld",value:function(e){d(x(n.prototype),"updateMatrixWorld",this).call(this,e);var t=this.context.listener,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Nd,Ud,Fd),Bd.set(0,0,-1).applyQuaternion(Ud),t.positionX){var i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Nd.x,i),t.positionY.linearRampToValueAtTime(Nd.y,i),t.positionZ.linearRampToValueAtTime(Nd.z,i),t.forwardX.linearRampToValueAtTime(Bd.x,i),t.forwardY.linearRampToValueAtTime(Bd.y,i),t.forwardZ.linearRampToValueAtTime(Bd.z,i),t.upX.linearRampToValueAtTime(r.x,i),t.upY.linearRampToValueAtTime(r.y,i),t.upZ.linearRampToValueAtTime(r.z,i)}else t.setPosition(Nd.x,Nd.y,Nd.z),t.setOrientation(Bd.x,Bd.y,Bd.z,r.x,r.y,r.z)}}]),n}(Li),Hd=function(e){p(n,e);var t=m(n);function n(e){var r;return M(this,n),(r=t.call(this)).type="Audio",r.listener=e,r.context=e.context,r.gain=r.context.createGain(),r.gain.connect(e.getInput()),r.autoplay=!1,r.buffer=null,r.detune=0,r.loop=!1,r.loopStart=0,r.loopEnd=0,r.offset=0,r.duration=void 0,r.playbackRate=1,r.isPlaying=!1,r.hasPlaybackControl=!0,r.source=null,r.sourceType="empty",r._startedAt=0,r._progress=0,r._connected=!1,r.filters=[],r}return T(n,[{key:"getOutput",value:function(){return this.gain}},{key:"setNodeSource",value:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}},{key:"setMediaElementSource",value:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}},{key:"setMediaStreamSource",value:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}},{key:"setBuffer",value:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}},{key:"play",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){this._startedAt=this.context.currentTime+e;var 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()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")}},{key:"pause",value:function(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}},{key:"stop",value:function(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}},{key:"connect",value:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var 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}},{key:"disconnect",value:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var 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}},{key:"getFilters",value:function(){return this.filters}},{key:"setFilters",value:function(e){return e||(e=[]),!0===this._connected?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}},{key:"setDetune",value:function(e){if(this.detune=e,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}},{key:"getDetune",value:function(){return this.detune}},{key:"getFilter",value:function(){return this.getFilters()[0]}},{key:"setFilter",value:function(e){return this.setFilters(e?[e]:[])}},{key:"setPlaybackRate",value:function(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}},{key:"getPlaybackRate",value:function(){return this.playbackRate}},{key:"onEnded",value:function(){this.isPlaying=!1}},{key:"getLoop",value:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}},{key:"setLoop",value:function(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}},{key:"setLoopStart",value:function(e){return this.loopStart=e,this}},{key:"setLoopEnd",value:function(e){return this.loopEnd=e,this}},{key:"getVolume",value:function(){return this.gain.gain.value}},{key:"setVolume",value:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}]),n}(Li),Vd=new Cr,Wd=new Ar,jd=new Cr,qd=new Cr,Xd=function(e){p(n,e);var t=m(n);function n(e){var r;return M(this,n),(r=t.call(this,e)).panner=r.context.createPanner(),r.panner.panningModel="HRTF",r.panner.connect(r.gain),r}return T(n,[{key:"disconnect",value:function(){d(x(n.prototype),"disconnect",this).call(this),this.panner.disconnect(this.gain)}},{key:"getOutput",value:function(){return this.panner}},{key:"getRefDistance",value:function(){return this.panner.refDistance}},{key:"setRefDistance",value:function(e){return this.panner.refDistance=e,this}},{key:"getRolloffFactor",value:function(){return this.panner.rolloffFactor}},{key:"setRolloffFactor",value:function(e){return this.panner.rolloffFactor=e,this}},{key:"getDistanceModel",value:function(){return this.panner.distanceModel}},{key:"setDistanceModel",value:function(e){return this.panner.distanceModel=e,this}},{key:"getMaxDistance",value:function(){return this.panner.maxDistance}},{key:"setMaxDistance",value:function(e){return this.panner.maxDistance=e,this}},{key:"setDirectionalCone",value:function(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}},{key:"updateMatrixWorld",value:function(e){if(d(x(n.prototype),"updateMatrixWorld",this).call(this,e),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose(Vd,Wd,jd),qd.set(0,0,1).applyQuaternion(Wd);var t=this.panner;if(t.positionX){var r=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Vd.x,r),t.positionY.linearRampToValueAtTime(Vd.y,r),t.positionZ.linearRampToValueAtTime(Vd.z,r),t.orientationX.linearRampToValueAtTime(qd.x,r),t.orientationY.linearRampToValueAtTime(qd.y,r),t.orientationZ.linearRampToValueAtTime(qd.z,r)}else t.setPosition(Vd.x,Vd.y,Vd.z),t.setOrientation(qd.x,qd.y,qd.z)}}}]),n}(Hd),Yd=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2048;M(this,e),this.analyser=t.context.createAnalyser(),this.analyser.fftSize=n,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}return T(e,[{key:"getFrequencyData",value:function(){return this.analyser.getByteFrequencyData(this.data),this.data}},{key:"getAverageFrequency",value:function(){for(var e=0,t=this.getFrequencyData(),n=0;n<t.length;n++)e+=t[n];return e/t.length}}]),e}(),Zd=function(){function e(t,n,r){var i,a,o;switch(M(this,e),this.binding=t,this.valueSize=r,n){case"quaternion":i=this._slerp,a=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*r),this._workIndex=5;break;case"string":case"bool":i=this._select,a=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(5*r);break;default:i=this._lerp,a=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*r)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=a,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}return T(e,[{key:"accumulate",value:function(e,t){var n=this.buffer,r=this.valueSize,i=e*r+r,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==r;++o)n[i+o]=n[o];a=t}else{var s=t/(a+=t);this._mixBufferRegion(n,i,0,s,r)}this.cumulativeWeight=a}},{key:"accumulateAdditive",value:function(e){var t=this.buffer,n=this.valueSize,r=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,n),this.cumulativeWeightAdditive+=e}},{key:"apply",value:function(e){var t=this.valueSize,n=this.buffer,r=e*t+t,i=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){var s=t*this._origIndex;this._mixBufferRegion(n,r,s,1-i,t)}a>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(var l=t,u=t+t;l!==u;++l)if(n[l]!==n[l+t]){o.setValue(n,r);break}}},{key:"saveOriginalState",value:function(){var e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(var i=n,a=r;i!==a;++i)t[i]=t[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}},{key:"restoreOriginalState",value:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)}},{key:"_setAdditiveIdentityNumeric",value:function(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,n=e;n<t;n++)this.buffer[n]=0}},{key:"_setAdditiveIdentityQuaternion",value:function(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}},{key:"_setAdditiveIdentityOther",value:function(){for(var e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize,n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}},{key:"_select",value:function(e,t,n,r,i){if(r>=.5)for(var a=0;a!==i;++a)e[t+a]=e[n+a]}},{key:"_slerp",value:function(e,t,n,r){Ar.slerpFlat(e,t,e,t,e,n,r)}},{key:"_slerpAdditive",value:function(e,t,n,r,i){var a=this._workIndex*i;Ar.multiplyQuaternionsFlat(e,a,e,t,e,n),Ar.slerpFlat(e,t,e,t,e,a,r)}},{key:"_lerp",value:function(e,t,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*r}}},{key:"_lerpAdditive",value:function(e,t,n,r,i){for(var a=0;a!==i;++a){var o=t+a;e[o]=e[o]+e[n+a]*r}}}]),e}(),Jd=new RegExp("[\\[\\]\\.:\\/]","g"),Qd="[^\\[\\]\\.:\\/]",Kd="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",$d=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Qd)+/(WCOD+)?/.source.replace("WCOD",Kd)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Qd)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Qd)+"$"),ef=["material","materials","bones","map"],tf=function(){function e(t,n,r){M(this,e);var i=r||nf.parseTrackName(n);this._targetGroup=t,this._bindings=t.subscribe_(n,i)}return T(e,[{key:"getValue",value:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(e,t)}},{key:"setValue",value:function(e,t){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}},{key:"bind",value:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}},{key:"unbind",value:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}]),e}(),nf=function(){function e(t,n,r){M(this,e),this.path=n,this.parsedPath=r||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}return T(e,[{key:"_getValue_unavailable",value:function(){}},{key:"_setValue_unavailable",value:function(){}},{key:"_getValue_direct",value:function(e,t){e[t]=this.targetObject[this.propertyName]}},{key:"_getValue_array",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)e[t++]=n[r]}},{key:"_getValue_arrayElement",value:function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}},{key:"_getValue_toArray",value:function(e,t){this.resolvedProperty.toArray(e,t)}},{key:"_setValue_direct",value:function(e,t){this.targetObject[this.propertyName]=e[t]}},{key:"_setValue_direct_setNeedsUpdate",value:function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}},{key:"_setValue_direct_setMatrixWorldNeedsUpdate",value:function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_array",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++]}},{key:"_setValue_array_setNeedsUpdate",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}},{key:"_setValue_array_setMatrixWorldNeedsUpdate",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_arrayElement",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}},{key:"_setValue_arrayElement_setNeedsUpdate",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}},{key:"_setValue_arrayElement_setMatrixWorldNeedsUpdate",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_fromArray",value:function(e,t){this.resolvedProperty.fromArray(e,t)}},{key:"_setValue_fromArray_setNeedsUpdate",value:function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}},{key:"_setValue_fromArray_setMatrixWorldNeedsUpdate",value:function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_getValue_unbound",value:function(e,t){this.bind(),this.getValue(e,t)}},{key:"_setValue_unbound",value:function(e,t){this.bind(),this.setValue(e,t)}},{key:"bind",value:function(){var t=this.node,n=this.parsedPath,r=n.objectName,i=n.propertyName,a=n.propertyIndex;if(t||(t=e.findNode(this.rootNode,n.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(r){var o=n.objectIndex;switch(r){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(var s=0;s<t.length;s++)if(t[s].name===o){o=s;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);t=t.material.map;break;default:if(void 0===t[r])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[r]}if(void 0!==o){if(void 0===t[o])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[o]}}var l=t[i];if(void 0!==l){var u=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?u=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(u=this.Versioning.MatrixWorldNeedsUpdate);var c=this.BindingType.Direct;if(void 0!==a){if("morphTargetInfluences"===i){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[a]&&(a=t.morphTargetDictionary[a])}c=this.BindingType.ArrayElement,this.resolvedProperty=l,this.propertyIndex=a}else void 0!==l.fromArray&&void 0!==l.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=l):Array.isArray(l)?(c=this.BindingType.EntireArray,this.resolvedProperty=l):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][u]}else{var h=n.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+i+" but it wasn't found.",t)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")}},{key:"unbind",value:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}],[{key:"create",value:function(t,n,r){return t&&t.isAnimationObjectGroup?new e.Composite(t,n,r):new e(t,n,r)}},{key:"sanitizeNodeName",value:function(e){return e.replace(/\s/g,"_").replace(Jd,"")}},{key:"parseTrackName",value:function(e){var t=$d.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var i=n.nodeName.substring(r+1);-1!==ef.indexOf(i)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=i)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}},{key:"findNode",value:function(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){var r=function e(n){for(var r=0;r<n.length;r++){var i=n[r];if(i.name===t||i.uuid===t)return i;var a=e(i.children);if(a)return a}return null}(e.children);if(r)return r}return null}}]),e}();nf.Composite=tf,nf.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},nf.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},nf.prototype.GetterByBindingType=[nf.prototype._getValue_direct,nf.prototype._getValue_array,nf.prototype._getValue_arrayElement,nf.prototype._getValue_toArray],nf.prototype.SetterByBindingTypeAndVersioning=[[nf.prototype._setValue_direct,nf.prototype._setValue_direct_setNeedsUpdate,nf.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[nf.prototype._setValue_array,nf.prototype._setValue_array_setNeedsUpdate,nf.prototype._setValue_array_setMatrixWorldNeedsUpdate],[nf.prototype._setValue_arrayElement,nf.prototype._setValue_arrayElement_setNeedsUpdate,nf.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[nf.prototype._setValue_fromArray,nf.prototype._setValue_fromArray_setNeedsUpdate,nf.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var rf=function(){function e(){M(this,e),this.isAnimationObjectGroup=!0,this.uuid=Hn(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var n=0,r=arguments.length;n!==r;++n)t[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}return T(e,[{key:"add",value:function(){for(var e=this._objects,t=this._indicesByUUID,n=this._paths,r=this._parsedPaths,i=this._bindings,a=i.length,o=void 0,s=e.length,l=this.nCachedObjects_,u=0,c=arguments.length;u!==c;++u){var h=arguments[u],d=h.uuid,f=t[d];if(void 0===f){f=s++,t[d]=f,e.push(h);for(var p=0,v=a;p!==v;++p)i[p].push(new nf(h,n[p],r[p]))}else if(f<l){o=e[f];var m=--l,g=e[m];t[g.uuid]=f,e[f]=g,t[d]=m,e[m]=h;for(var y=0,_=a;y!==_;++y){var x=i[y],b=x[m],w=x[f];x[f]=b,void 0===w&&(w=new nf(h,n[y],r[y])),x[m]=w}}else e[f]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}},{key:"remove",value:function(){for(var e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],l=s.uuid,u=t[l];if(void 0!==u&&u>=i){var c=i++,h=e[c];t[h.uuid]=u,e[u]=h,t[l]=c,e[c]=s;for(var d=0,f=r;d!==f;++d){var p=n[d],v=p[c],m=p[u];p[u]=v,p[c]=m}}}this.nCachedObjects_=i}},{key:"uncache",value:function(){for(var e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_,a=e.length,o=0,s=arguments.length;o!==s;++o){var l=arguments[o],u=l.uuid,c=t[u];if(void 0!==c)if(delete t[u],c<i){var h=--i,d=e[h],f=--a,p=e[f];t[d.uuid]=c,e[c]=d,t[p.uuid]=h,e[h]=p,e.pop();for(var v=0,m=r;v!==m;++v){var g=n[v],y=g[h],_=g[f];g[c]=y,g[h]=_,g.pop()}}else{var x=--a,b=e[x];x>0&&(t[b.uuid]=c),e[c]=b,e.pop();for(var w=0,M=r;w!==M;++w){var S=n[w];S[c]=S[x],S.pop()}}}this.nCachedObjects_=i}},{key:"subscribe_",value:function(e,t){var n=this._bindingsIndicesByPath,r=n[e],i=this._bindings;if(void 0!==r)return i[r];var a=this._paths,o=this._parsedPaths,s=this._objects,l=s.length,u=this.nCachedObjects_,c=new Array(l);r=i.length,n[e]=r,a.push(e),o.push(t),i.push(c);for(var h=u,d=s.length;h!==d;++h){var f=s[h];c[h]=new nf(f,e,t)}return c}},{key:"unsubscribe_",value:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){var r=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];t[e[o]]=n,a[n]=s,a.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}}]),e}(),af=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.blendMode;M(this,e),this._mixer=t,this._clip=n,this._localRoot=r,this.blendMode=i;for(var a=n.tracks,o=a.length,s=new Array(o),l={endingStart:jt,endingEnd:jt},u=0;u!==o;++u){var c=a[u].createInterpolant(null);s[u]=c,c.settings=l}this._interpolantSettings=l,this._interpolants=s,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Bt,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}return T(e,[{key:"play",value:function(){return this._mixer._activateAction(this),this}},{key:"stop",value:function(){return this._mixer._deactivateAction(this),this.reset()}},{key:"reset",value:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}},{key:"isRunning",value:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}},{key:"isScheduled",value:function(){return this._mixer._isActiveAction(this)}},{key:"startAt",value:function(e){return this._startTime=e,this}},{key:"setLoop",value:function(e,t){return this.loop=e,this.repetitions=t,this}},{key:"setEffectiveWeight",value:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}},{key:"getEffectiveWeight",value:function(){return this._effectiveWeight}},{key:"fadeIn",value:function(e){return this._scheduleFading(e,0,1)}},{key:"fadeOut",value:function(e){return this._scheduleFading(e,1,0)}},{key:"crossFadeFrom",value:function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){var r=this._clip.duration,i=e._clip.duration,a=i/r,o=r/i;e.warp(1,a,t),this.warp(o,1,t)}return this}},{key:"crossFadeTo",value:function(e,t,n){return e.crossFadeFrom(this,t,n)}},{key:"stopFading",value:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}},{key:"setEffectiveTimeScale",value:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}},{key:"getEffectiveTimeScale",value:function(){return this._effectiveTimeScale}},{key:"setDuration",value:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}},{key:"syncWith",value:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}},{key:"halt",value:function(e){return this.warp(this._effectiveTimeScale,0,e)}},{key:"warp",value:function(e,t,n){var r=this._mixer,i=r.time,a=this.timeScale,o=this._timeScaleInterpolant;null===o&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,l=o.sampleValues;return s[0]=i,s[1]=i+n,l[0]=e/a,l[1]=t/a,this}},{key:"stopWarping",value:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}},{key:"getMixer",value:function(){return this._mixer}},{key:"getClip",value:function(){return this._clip}},{key:"getRoot",value:function(){return this._localRoot||this._mixer._root}},{key:"_update",value:function(e,t,n,r){if(this.enabled){var i=this._startTime;if(null!==i){var a=(e-i)*n;a<0||0===n?t=0:(this._startTime=null,t=n*a)}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0){var l=this._interpolants,u=this._propertyBindings;if(this.blendMode===Zt)for(var c=0,h=l.length;c!==h;++c)l[c].evaluate(o),u[c].accumulateAdditive(s);else for(var d=0,f=l.length;d!==f;++d)l[d].evaluate(o),u[d].accumulate(r,s)}}else this._updateWeight(e)}},{key:"_updateWeight",value:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t}},{key:"_updateTimeScale",value:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;null!==n&&(t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}},{key:"_updateTime",value:function(e){var t=this._clip.duration,n=this.loop,r=this.time+e,i=this._loopCount,a=n===Gt;if(0===e)return-1===i?r:a&&1==(1&i)?t-r:r;if(n===Ft){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else{if(!(r<0)){this.time=r;break e}r=0}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(-1===i&&(e>=0?(i=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),r>=t||r<0){var o=Math.floor(r/t);r-=t*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=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(1===s){var l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=r;if(a&&1==(1&i))return t-r}return r}},{key:"_setEndings",value:function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=qt,r.endingEnd=qt):(r.endingStart=e?this.zeroSlopeAtStart?qt:jt:Xt,r.endingEnd=t?this.zeroSlopeAtEnd?qt:jt:Xt)}},{key:"_scheduleFading",value:function(e,t,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=n,this}}]),e}(),of=new Float32Array(1),sf=function(e){p(n,e);var t=m(n);function n(e){var r;return M(this,n),(r=t.call(this))._root=e,r._initMemoryManager(),r._accuIndex=0,r.time=0,r.timeScale=1,r}return T(n,[{key:"_bindAction",value:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,l=this._bindingsByRootAndName,u=l[s];void 0===u&&(u={},l[s]=u);for(var c=0;c!==i;++c){var h=r[c],d=h.name,f=u[d];if(void 0!==f)++f.referenceCount,a[c]=f;else{if(void 0!==(f=a[c])){null===f._cacheIndex&&(++f.referenceCount,this._addInactiveBinding(f,s,d));continue}var p=t&&t._propertyBindings[c].binding.parsedPath;++(f=new Zd(nf.create(n,d,p),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(f,s,d),a[c]=f}o[c].resultBuffer=f.buffer}}},{key:"_activateAction",value:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}for(var i=e._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}},{key:"_deactivateAction",value:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}}},{key:"_initMemoryManager",value:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var 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}}}}},{key:"_isActiveAction",value:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions}},{key:"_addInactiveAction",value:function(e,t,n){var r=this._actions,i=this._actionsByClip,a=i[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[n]=e}},{key:"_removeInactiveAction",value:function(e){var t=this._actions,n=t[t.length-1],r=e._cacheIndex;n._cacheIndex=r,t[r]=n,t.pop(),e._cacheIndex=null;var i=e._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,l=s[s.length-1],u=e._byClipCacheIndex;l._byClipCacheIndex=u,s[u]=l,s.pop(),e._byClipCacheIndex=null,delete o.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete a[i],this._removeInactiveBindingsForAction(e)}},{key:"_removeInactiveBindingsForAction",value:function(e){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0==--i.referenceCount&&this._removeInactiveBinding(i)}}},{key:"_lendAction",value:function(e){var t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}},{key:"_takeBackAction",value:function(e){var t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}},{key:"_addInactiveBinding",value:function(e,t,n){var r=this._bindingsByRootAndName,i=this._bindings,a=r[t];void 0===a&&(a={},r[t]=a),a[n]=e,e._cacheIndex=i.length,i.push(e)}},{key:"_removeInactiveBinding",value:function(e){var t=this._bindings,n=e.binding,r=n.rootNode.uuid,i=n.path,a=this._bindingsByRootAndName,o=a[r],s=t[t.length-1],l=e._cacheIndex;s._cacheIndex=l,t[l]=s,t.pop(),delete o[i],0===Object.keys(o).length&&delete a[r]}},{key:"_lendBinding",value:function(e){var t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}},{key:"_takeBackBinding",value:function(e){var t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}},{key:"_lendControlInterpolant",value:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return void 0===n&&((n=new Eh(new Float32Array(2),new Float32Array(2),1,of)).__cacheIndex=t,e[t]=n),n}},{key:"_takeBackControlInterpolant",value:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,i=t[r];e.__cacheIndex=r,t[r]=e,i.__cacheIndex=n,t[n]=i}},{key:"clipAction",value:function(e,t,n){var r=t||this._root,i=r.uuid,a="string"==typeof e?Nh.findByName(r,e):e,o=null!==a?a.uuid:e,s=this._actionsByClip[o],l=null;if(void 0===n&&(n=null!==a?a.blendMode:Yt),void 0!==s){var u=s.actionByRoot[i];if(void 0!==u&&u.blendMode===n)return u;l=s.knownActions[0],null===a&&(a=l._clip)}if(null===a)return null;var c=new af(this,a,t,n);return this._bindAction(c,l),this._addInactiveAction(c,o,i),c}},{key:"existingAction",value:function(e,t){var n=t||this._root,r=n.uuid,i="string"==typeof e?Nh.findByName(n,e):e,a=i?i.uuid:e,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[r]||null}},{key:"stopAllAction",value:function(){for(var e=this._actions,t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this}},{key:"update",value:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o)t[o]._update(r,e,i,a);for(var s=this._bindings,l=this._nActiveBindings,u=0;u!==l;++u)s[u].apply(a);return this}},{key:"setTime",value:function(e){this.time=0;for(var t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}},{key:"getRoot",value:function(){return this._root}},{key:"uncacheClip",value:function(e){var t=this._actions,n=e.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){for(var a=i.knownActions,o=0,s=a.length;o!==s;++o){var l=a[o];this._deactivateAction(l);var u=l._cacheIndex,c=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,c._cacheIndex=u,t[u]=c,t.pop(),this._removeInactiveBindingsForAction(l)}delete r[n]}}},{key:"uncacheRoot",value:function(e){var t=e.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot[t];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}var a=this._bindingsByRootAndName[t];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}}},{key:"uncacheAction",value:function(e,t){var n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}]),n}(Nn),lf=function(){function e(t){M(this,e),this.value=t}return T(e,[{key:"clone",value:function(){return new e(void 0===this.value.clone?this.value:this.value.clone())}}]),e}(),uf=0,cf=function(e){p(n,e);var t=m(n);function n(){var e;return M(this,n),(e=t.call(this)).isUniformsGroup=!0,Object.defineProperty(y(e),"id",{value:uf++}),e.name="",e.usage=Tn,e.uniforms=[],e}return T(n,[{key:"add",value:function(e){return this.uniforms.push(e),this}},{key:"remove",value:function(e){var t=this.uniforms.indexOf(e);return-1!==t&&this.uniforms.splice(t,1),this}},{key:"setName",value:function(e){return this.name=e,this}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"dispose",value:function(){return this.dispatchEvent({type:"dispose"}),this}},{key:"copy",value:function(e){this.name=e.name,this.usage=e.usage;var t=e.uniforms;this.uniforms.length=0;for(var n=0,r=t.length;n<r;n++)this.uniforms.push(t[n].clone());return this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),n}(Nn),hf=function(e){p(n,e);var t=m(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return M(this,n),(i=t.call(this,e,r)).isInstancedInterleavedBuffer=!0,i.meshPerAttribute=a,i}return T(n,[{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}},{key:"clone",value:function(e){var t=d(x(n.prototype),"clone",this).call(this,e);return t.meshPerAttribute=this.meshPerAttribute,t}},{key:"toJSON",value:function(e){var t=d(x(n.prototype),"toJSON",this).call(this,e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}]),n}(Il),df=function(){function e(t,n,r,i,a){M(this,e),this.isGLBufferAttribute=!0,this.buffer=t,this.type=n,this.itemSize=r,this.elementSize=i,this.count=a,this.version=0}return T(e,[{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setBuffer",value:function(e){return this.buffer=e,this}},{key:"setType",value:function(e,t){return this.type=e,this.elementSize=t,this}},{key:"setItemSize",value:function(e){return this.itemSize=e,this}},{key:"setCount",value:function(e){return this.count=e,this}}]),e}(),ff=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1/0;M(this,e),this.ray=new ai(t,n),this.near=r,this.far=i,this.camera=null,this.layers=new gi,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}return T(e,[{key:"set",value:function(e,t){this.ray.set(e,t)}},{key:"setFromCamera",value:function(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)}},{key:"intersectObject",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return vf(e,this,n,t),n.sort(pf),n}},{key:"intersectObjects",value:function(e){for(var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=0,i=e.length;r<i;r++)vf(e[r],this,n,t);return n.sort(pf),n}}]),e}();function pf(e,t){return e.distance-t.distance}function vf(e,t,n,r){if(e.layers.test(t.layers)&&e.raycast(t,n),!0===r)for(var i=e.children,a=0,o=i.length;a<o;a++)vf(i[a],t,n,!0)}var mf=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return M(this,e),this.radius=t,this.phi=n,this.theta=r,this}return T(e,[{key:"set",value:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}},{key:"copy",value:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}},{key:"makeSafe",value:function(){var e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this}},{key:"setFromVector3",value:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}},{key:"setFromCartesianCoords",value:function(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Vn(t/this.radius,-1,1))),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),gf=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return M(this,e),this.radius=t,this.theta=n,this.y=r,this}return T(e,[{key:"set",value:function(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}},{key:"copy",value:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}},{key:"setFromVector3",value:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}},{key:"setFromCartesianCoords",value:function(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),yf=new Kn,_f=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Kn(1/0,1/0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Kn(-1/0,-1/0);M(this,e),this.isBox2=!0,this.min=t,this.max=n}return T(e,[{key:"set",value:function(e,t){return this.min.copy(e),this.max.copy(t),this}},{key:"setFromPoints",value:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}},{key:"setFromCenterAndSize",value:function(e,t){var n=yf.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.min.copy(e.min),this.max.copy(e.max),this}},{key:"makeEmpty",value:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}},{key:"isEmpty",value:function(){return this.max.x<this.min.x||this.max.y<this.min.y}},{key:"getCenter",value:function(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}},{key:"getSize",value:function(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}},{key:"expandByPoint",value:function(e){return this.min.min(e),this.max.max(e),this}},{key:"expandByVector",value:function(e){return this.min.sub(e),this.max.add(e),this}},{key:"expandByScalar",value:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this}},{key:"containsPoint",value:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}},{key:"containsBox",value:function(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}},{key:"getParameter",value:function(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))}},{key:"intersectsBox",value:function(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)}},{key:"clampPoint",value:function(e,t){return t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return yf.copy(e).clamp(this.min,this.max).sub(e).length()}},{key:"intersect",value:function(e){return this.min.max(e.min),this.max.min(e.max),this}},{key:"union",value:function(e){return this.min.min(e.min),this.max.max(e.max),this}},{key:"translate",value:function(e){return this.min.add(e),this.max.add(e),this}},{key:"equals",value:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}]),e}(),xf=new Cr,bf=new Cr,wf=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Cr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Cr;M(this,e),this.start=t,this.end=n}return T(e,[{key:"set",value:function(e,t){return this.start.copy(e),this.end.copy(t),this}},{key:"copy",value:function(e){return this.start.copy(e.start),this.end.copy(e.end),this}},{key:"getCenter",value:function(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}},{key:"delta",value:function(e){return e.subVectors(this.end,this.start)}},{key:"distanceSq",value:function(){return this.start.distanceToSquared(this.end)}},{key:"distance",value:function(){return this.start.distanceTo(this.end)}},{key:"at",value:function(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}},{key:"closestPointToPointParameter",value:function(e,t){xf.subVectors(e,this.start),bf.subVectors(this.end,this.start);var n=bf.dot(bf),r=bf.dot(xf)/n;return t&&(r=Vn(r,0,1)),r}},{key:"closestPointToPoint",value:function(e,t,n){var r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}},{key:"applyMatrix4",value:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}},{key:"equals",value:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),Mf=new Cr,Sf=function(e){p(n,e);var t=m(n);function n(e,r){var i;M(this,n),(i=t.call(this)).light=e,i.light.updateMatrixWorld(),i.matrix=e.matrixWorld,i.matrixAutoUpdate=!1,i.color=r;for(var a=new da,o=[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],s=0,l=1;s<32;s++,l++){var u=s/32*Math.PI*2,c=l/32*Math.PI*2;o.push(Math.cos(u),Math.sin(u),1,Math.cos(c),Math.sin(c),1)}a.setAttribute("position",new ra(o,3));var h=new gu({fog:!1,toneMapped:!1});return i.cone=new ku(a,h),i.add(i.cone),i.update(),i}return T(n,[{key:"dispose",value:function(){this.cone.geometry.dispose(),this.cone.material.dispose()}},{key:"update",value:function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Mf.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Mf),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}]),n}(Li),Tf=new Cr,kf=new oi,Ef=new oi,Af=function(e){p(n,e);var t=m(n);function n(e){var r;M(this,n);for(var i=Cf(e),a=new da,o=[],s=[],l=new vr(0,0,1),u=new vr(0,1,0),c=0;c<i.length;c++){var h=i[c];h.parent&&h.parent.isBone&&(o.push(0,0,0),o.push(0,0,0),s.push(l.r,l.g,l.b),s.push(u.r,u.g,u.b))}a.setAttribute("position",new ra(o,3)),a.setAttribute("color",new ra(s,3));var d=new gu({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});return(r=t.call(this,a,d)).isSkeletonHelper=!0,r.type="SkeletonHelper",r.root=e,r.bones=i,r.matrix=e.matrixWorld,r.matrixAutoUpdate=!1,r}return T(n,[{key:"updateMatrixWorld",value:function(e){var t=this.bones,r=this.geometry,i=r.getAttribute("position");Ef.copy(this.root.matrixWorld).invert();for(var a=0,o=0;a<t.length;a++){var s=t[a];s.parent&&s.parent.isBone&&(kf.multiplyMatrices(Ef,s.matrixWorld),Tf.setFromMatrixPosition(kf),i.setXYZ(o,Tf.x,Tf.y,Tf.z),kf.multiplyMatrices(Ef,s.parent.matrixWorld),Tf.setFromMatrixPosition(kf),i.setXYZ(o+1,Tf.x,Tf.y,Tf.z),o+=2)}r.getAttribute("position").needsUpdate=!0,d(x(n.prototype),"updateMatrixWorld",this).call(this,e)}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(ku);function Cf(e){var t=[];!0===e.isBone&&t.push(e);for(var n=0;n<e.children.length;n++)t.push.apply(t,Cf(e.children[n]));return t}var Pf=function(e){p(n,e);var t=m(n);function n(e,r,i){var a;M(this,n);var o=new eh(r,4,2),s=new ji({wireframe:!0,fog:!1,toneMapped:!1});return(a=t.call(this,o,s)).light=e,a.light.updateMatrixWorld(),a.color=i,a.type="PointLightHelper",a.matrix=a.light.matrixWorld,a.matrixAutoUpdate=!1,a.update(),a}return T(n,[{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}},{key:"update",value:function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}]),n}(Pa),Lf=new Cr,Rf=new vr,If=new vr,Df=function(e){p(n,e);var t=m(n);function n(e,r,i){var a;M(this,n),(a=t.call(this)).light=e,a.light.updateMatrixWorld(),a.matrix=e.matrixWorld,a.matrixAutoUpdate=!1,a.color=i;var o=new Qc(r);o.rotateY(.5*Math.PI),a.material=new ji({wireframe:!0,fog:!1,toneMapped:!1}),void 0===a.color&&(a.material.vertexColors=!0);var s=o.getAttribute("position"),l=new Float32Array(3*s.count);return o.setAttribute("color",new Yi(l,3)),a.add(new Pa(o,a.material)),a.update(),a}return T(n,[{key:"dispose",value:function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}},{key:"update",value:function(){var e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var t=e.geometry.getAttribute("color");Rf.copy(this.light.color),If.copy(this.light.groundColor);for(var n=0,r=t.count;n<r;n++){var i=n<r/2?Rf:If;t.setXYZ(n,i.r,i.g,i.b)}t.needsUpdate=!0}e.lookAt(Lf.setFromMatrixPosition(this.light.matrixWorld).negate())}}]),n}(Li),Of=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4473924,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8947848;M(this,n),a=new vr(a),o=new vr(o);for(var s=i/2,l=r/i,u=r/2,c=[],h=[],d=0,f=0,p=-u;d<=i;d++,p+=l){c.push(-u,0,p,u,0,p),c.push(p,0,-u,p,0,u);var v=d===s?a:o;v.toArray(h,f),f+=3,v.toArray(h,f),f+=3,v.toArray(h,f),f+=3,v.toArray(h,f),f+=3}var m=new da;m.setAttribute("position",new ra(c,3)),m.setAttribute("color",new ra(h,3));var g=new gu({vertexColors:!0,toneMapped:!1});return(e=t.call(this,m,g)).type="GridHelper",e}return T(n,[{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(ku),zf=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:64,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:4473924,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:8947848;M(this,n),s=new vr(s),l=new vr(l);var u=[],c=[];if(i>1)for(var h=0;h<i;h++){var d=h/i*(2*Math.PI),f=Math.sin(d)*r,p=Math.cos(d)*r;u.push(0,0,0),u.push(f,0,p);var v=1&h?s:l;c.push(v.r,v.g,v.b),c.push(v.r,v.g,v.b)}for(var m=0;m<a;m++)for(var g=1&m?s:l,y=r-r/a*m,_=0;_<o;_++){var x=_/o*(2*Math.PI),b=Math.sin(x)*y,w=Math.cos(x)*y;u.push(b,0,w),c.push(g.r,g.g,g.b),x=(_+1)/o*(2*Math.PI),b=Math.sin(x)*y,w=Math.cos(x)*y,u.push(b,0,w),c.push(g.r,g.g,g.b)}var S=new da;S.setAttribute("position",new ra(u,3)),S.setAttribute("color",new ra(c,3));var T=new gu({vertexColors:!0,toneMapped:!1});return(e=t.call(this,S,T)).type="PolarGridHelper",e}return T(n,[{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(ku),Nf=new Cr,Uf=new Cr,Ff=new Cr,Bf=function(e){p(n,e);var t=m(n);function n(e,r,i){var a;M(this,n),(a=t.call(this)).light=e,a.light.updateMatrixWorld(),a.matrix=e.matrixWorld,a.matrixAutoUpdate=!1,a.color=i,void 0===r&&(r=1);var o=new da;o.setAttribute("position",new ra([-r,r,0,r,r,0,r,-r,0,-r,-r,0,-r,r,0],3));var s=new gu({fog:!1,toneMapped:!1});return a.lightPlane=new Mu(o,s),a.add(a.lightPlane),(o=new da).setAttribute("position",new ra([0,0,0,0,0,1],3)),a.targetLine=new Mu(o,s),a.add(a.targetLine),a.update(),a}return T(n,[{key:"dispose",value:function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}},{key:"update",value:function(){Nf.setFromMatrixPosition(this.light.matrixWorld),Uf.setFromMatrixPosition(this.light.target.matrixWorld),Ff.subVectors(Uf,Nf),this.lightPlane.lookAt(Uf),void 0!==this.color?(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(Uf),this.targetLine.scale.z=Ff.length()}}]),n}(Li),Gf=new Cr,Hf=new Na,Vf=function(e){p(n,e);var t=m(n);function n(e){var r;M(this,n);var i=new da,a=new gu({color:16777215,vertexColors:!0,toneMapped:!1}),o=[],s=[],l={};function u(e,t){c(e),c(t)}function c(e){o.push(0,0,0),s.push(0,0,0),void 0===l[e]&&(l[e]=[]),l[e].push(o.length/3-1)}u("n1","n2"),u("n2","n4"),u("n4","n3"),u("n3","n1"),u("f1","f2"),u("f2","f4"),u("f4","f3"),u("f3","f1"),u("n1","f1"),u("n2","f2"),u("n3","f3"),u("n4","f4"),u("p","n1"),u("p","n2"),u("p","n3"),u("p","n4"),u("u1","u2"),u("u2","u3"),u("u3","u1"),u("c","t"),u("p","c"),u("cn1","cn2"),u("cn3","cn4"),u("cf1","cf2"),u("cf3","cf4"),i.setAttribute("position",new ra(o,3)),i.setAttribute("color",new ra(s,3)),(r=t.call(this,i,a)).type="CameraHelper",r.camera=e,r.camera.updateProjectionMatrix&&r.camera.updateProjectionMatrix(),r.matrix=e.matrixWorld,r.matrixAutoUpdate=!1,r.pointMap=l,r.update();var h=new vr(16755200),d=new vr(16711680),f=new vr(43775),p=new vr(16777215),v=new vr(3355443);return r.setColors(h,d,f,p,v),r}return T(n,[{key:"setColors",value:function(e,t,n,r,i){var 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,n.r,n.g,n.b),a.setXYZ(33,n.r,n.g,n.b),a.setXYZ(34,n.r,n.g,n.b),a.setXYZ(35,n.r,n.g,n.b),a.setXYZ(36,n.r,n.g,n.b),a.setXYZ(37,n.r,n.g,n.b),a.setXYZ(38,r.r,r.g,r.b),a.setXYZ(39,r.r,r.g,r.b),a.setXYZ(40,i.r,i.g,i.b),a.setXYZ(41,i.r,i.g,i.b),a.setXYZ(42,i.r,i.g,i.b),a.setXYZ(43,i.r,i.g,i.b),a.setXYZ(44,i.r,i.g,i.b),a.setXYZ(45,i.r,i.g,i.b),a.setXYZ(46,i.r,i.g,i.b),a.setXYZ(47,i.r,i.g,i.b),a.setXYZ(48,i.r,i.g,i.b),a.setXYZ(49,i.r,i.g,i.b),a.needsUpdate=!0}},{key:"update",value:function(){var e=this.geometry,t=this.pointMap;Hf.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Wf("c",t,e,Hf,0,0,-1),Wf("t",t,e,Hf,0,0,1),Wf("n1",t,e,Hf,-1,-1,-1),Wf("n2",t,e,Hf,1,-1,-1),Wf("n3",t,e,Hf,-1,1,-1),Wf("n4",t,e,Hf,1,1,-1),Wf("f1",t,e,Hf,-1,-1,1),Wf("f2",t,e,Hf,1,-1,1),Wf("f3",t,e,Hf,-1,1,1),Wf("f4",t,e,Hf,1,1,1),Wf("u1",t,e,Hf,.7,1.1,-1),Wf("u2",t,e,Hf,-.7,1.1,-1),Wf("u3",t,e,Hf,0,2,-1),Wf("cf1",t,e,Hf,-1,0,1),Wf("cf2",t,e,Hf,1,0,1),Wf("cf3",t,e,Hf,0,-1,1),Wf("cf4",t,e,Hf,0,1,1),Wf("cn1",t,e,Hf,-1,0,-1),Wf("cn2",t,e,Hf,1,0,-1),Wf("cn3",t,e,Hf,0,-1,-1),Wf("cn4",t,e,Hf,0,1,-1),e.getAttribute("position").needsUpdate=!0}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(ku);function Wf(e,t,n,r,i,a,o){Gf.set(i,a,o).unproject(r);var s=t[e];if(void 0!==s)for(var l=n.getAttribute("position"),u=0,c=s.length;u<c;u++)l.setXYZ(s[u],Gf.x,Gf.y,Gf.z)}var jf,qf,Xf=new Rr,Yf=function(e){p(n,e);var t=m(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16776960;M(this,n);var a=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]),o=new Float32Array(24),s=new da;return s.setIndex(new Yi(a,1)),s.setAttribute("position",new Yi(o,3)),(r=t.call(this,s,new gu({color:i,toneMapped:!1}))).object=e,r.type="BoxHelper",r.matrixAutoUpdate=!1,r.update(),r}return T(n,[{key:"update",value:function(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Xf.setFromObject(this.object),!Xf.isEmpty()){var t=Xf.min,n=Xf.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=t.x,i[4]=n.y,i[5]=n.z,i[6]=t.x,i[7]=t.y,i[8]=n.z,i[9]=n.x,i[10]=t.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=t.z,i[15]=t.x,i[16]=n.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=n.x,i[22]=t.y,i[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}}},{key:"setFromObject",value:function(e){return this.object=e,this.update(),this}},{key:"copy",value:function(e,t){return d(x(n.prototype),"copy",this).call(this,e,t),this.object=e.object,this}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(ku),Zf=function(e){p(n,e);var t=m(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16776960;M(this,n);var a=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]),o=[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 da;return s.setIndex(new Yi(a,1)),s.setAttribute("position",new ra(o,3)),(r=t.call(this,s,new gu({color:i,toneMapped:!1}))).box=e,r.type="Box3Helper",r.geometry.computeBoundingSphere(),r}return T(n,[{key:"updateMatrixWorld",value:function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),d(x(n.prototype),"updateMatrixWorld",this).call(this,e))}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(ku),Jf=function(e){p(n,e);var t=m(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16776960;M(this,n);var o=a,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],l=new da;l.setAttribute("position",new ra(s,3)),l.computeBoundingSphere(),(r=t.call(this,l,new gu({color:o,toneMapped:!1}))).type="PlaneHelper",r.plane=e,r.size=i;var u=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],c=new da;return c.setAttribute("position",new ra(u,3)),c.computeBoundingSphere(),r.add(new Pa(c,new ji({color:o,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1}))),r}return T(n,[{key:"updateMatrixWorld",value:function(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),d(x(n.prototype),"updateMatrixWorld",this).call(this,e)}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}]),n}(Mu),Qf=new Cr,Kf=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Cr(0,0,1),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Cr(0,0,0),a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:16776960,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.2*a,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:.2*s;return M(this,n),(e=t.call(this)).type="ArrowHelper",void 0===jf&&((jf=new da).setAttribute("position",new ra([0,0,0,0,1,0],3)),(qf=new cc(0,.5,1,5,1)).translate(0,-.5,0)),e.position.copy(i),e.line=new Mu(jf,new gu({color:o,toneMapped:!1})),e.line.matrixAutoUpdate=!1,e.add(e.line),e.cone=new Pa(qf,new ji({color:o,toneMapped:!1})),e.cone.matrixAutoUpdate=!1,e.add(e.cone),e.setDirection(r),e.setLength(a,s,l),e}return T(n,[{key:"setDirection",value:function(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{Qf.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Qf,t)}}},{key:"setLength",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2*e,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.2*t;this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}},{key:"setColor",value:function(e){this.line.material.color.set(e),this.cone.material.color.set(e)}},{key:"copy",value:function(e){return d(x(n.prototype),"copy",this).call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}},{key:"dispose",value:function(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}]),n}(Li),$f=function(e){p(n,e);var t=m(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;M(this,n);var i=[0,0,0,r,0,0,0,0,0,0,r,0,0,0,0,0,0,r],a=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],o=new da;o.setAttribute("position",new ra(i,3)),o.setAttribute("color",new ra(a,3));var s=new gu({vertexColors:!0,toneMapped:!1});return(e=t.call(this,o,s)).type="AxesHelper",e}return T(n,[{key:"setColors",value:function(e,t,n){var r=new vr,i=this.geometry.attributes.color.array;return r.set(e),r.toArray(i,0),r.toArray(i,3),r.set(t),r.toArray(i,6),r.toArray(i,9),r.set(n),r.toArray(i,12),r.toArray(i,15),this.geometry.attributes.color.needsUpdate=!0,this}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(ku),ep=function(){function e(){M(this,e),this.type="ShapePath",this.color=new vr,this.subPaths=[],this.currentPath=null}return T(e,[{key:"moveTo",value:function(e,t){return this.currentPath=new oc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}},{key:"lineTo",value:function(e,t){return this.currentPath.lineTo(e,t),this}},{key:"quadraticCurveTo",value:function(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}},{key:"bezierCurveTo",value:function(e,t,n,r,i,a){return this.currentPath.bezierCurveTo(e,t,n,r,i,a),this}},{key:"splineThru",value:function(e){return this.currentPath.splineThru(e),this}},{key:"toShapes",value:function(e){function t(e,t){for(var n=t.length,r=!1,i=n-1,a=0;a<n;i=a++){var o=t[i],s=t[a],l=s.x-o.x,u=s.y-o.y;if(Math.abs(u)>Number.EPSILON){if(u<0&&(o=t[a],l=-l,s=t[i],u=-u),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var c=u*(e.x-o.x)-l*(e.y-o.y);if(0===c)return!0;if(c<0)continue;r=!r}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return r}var n,r,i,a=jc.isClockWise,o=this.subPaths;if(0===o.length)return[];var s=[];if(1===o.length)return r=o[0],(i=new _c).curves=r.curves,s.push(i),s;var l=!a(o[0].getPoints());l=e?!l:l;var u,c,h=[],d=[],f=[],p=0;d[p]=void 0,f[p]=[];for(var v=0,m=o.length;v<m;v++)n=a(u=(r=o[v]).getPoints()),(n=e?!n:n)?(!l&&d[p]&&p++,d[p]={s:new _c,p:u},d[p].s.curves=r.curves,l&&p++,f[p]=[]):f[p].push({h:r,p:u[0]});if(!d[0])return function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n],a=new _c;a.curves=i.curves,t.push(a)}return t}(o);if(d.length>1){for(var g=!1,y=0,_=0,x=d.length;_<x;_++)h[_]=[];for(var b=0,w=d.length;b<w;b++)for(var M=f[b],S=0;S<M.length;S++){for(var T=M[S],k=!0,E=0;E<d.length;E++)t(T.p,d[E].p)&&(b!==E&&y++,k?(k=!1,h[E].push(T)):g=!0);k&&h[b].push(T)}y>0&&!1===g&&(f=h)}for(var A=0,C=d.length;A<C;A++){i=d[A].s,s.push(i);for(var P=0,L=(c=f[A]).length;P<L;P++)i.holes.push(c[P].h)}return s}}]),e}(),tp=np();function np(){for(var e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),r=new Uint32Array(512),i=new Uint32Array(512),a=0;a<256;++a){var o=a-127;o<-27?(r[a]=0,r[256|a]=32768,i[a]=24,i[256|a]=24):o<-14?(r[a]=1024>>-o-14,r[256|a]=1024>>-o-14|32768,i[a]=-o-1,i[256|a]=-o-1):o<=15?(r[a]=o+15<<10,r[256|a]=o+15<<10|32768,i[a]=13,i[256|a]=13):o<128?(r[a]=31744,r[256|a]=64512,i[a]=24,i[256|a]=24):(r[a]=31744,r[256|a]=64512,i[a]=13,i[256|a]=13)}for(var s=new Uint32Array(2048),l=new Uint32Array(64),u=new Uint32Array(64),c=1;c<1024;++c){for(var h=c<<13,d=0;0==(8388608&h);)h<<=1,d-=8388608;h&=-8388609,d+=947912704,s[c]=h|d}for(var f=1024;f<2048;++f)s[f]=939524096+(f-1024<<13);for(var p=1;p<31;++p)l[p]=p<<23;l[31]=1199570944,l[32]=2147483648;for(var v=33;v<63;++v)l[v]=2147483648+(v-32<<23);l[63]=3347054592;for(var m=1;m<64;++m)32!==m&&(u[m]=1024);return{floatView:t,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:l,offsetTable:u}}var rp=Object.freeze({__proto__:null,toHalfFloat:function(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=Vn(e,-65504,65504),tp.floatView[0]=e;var t=tp.uint32View[0],n=t>>23&511;return tp.baseTable[n]+((8388607&t)>>tp.shiftTable[n])},fromHalfFloat:function(e){var t=e>>10;return tp.uint32View[0]=tp.mantissaTable[tp.offsetTable[t]+(1023&e)]+tp.exponentTable[t],tp.floatView[0]}});function ip(){console.error("THREE.ImmediateRenderObject has been removed.")}var ap=function(e){p(n,e);var t=m(n);function n(e,r,i){var a;return M(this,n),console.error('THREE.WebGLMultisampleRenderTarget has been removed. Use a normal render target and set the "samples" property to greater 0 to enable multisampling.'),(a=t.call(this,e,r,i)).samples=4,a}return T(n)}(wr),op=function(e){p(n,e);var t=m(n);function n(e,r,i,a){return M(this,n),console.warn("THREE.DataTexture2DArray has been renamed to DataArrayTexture."),t.call(this,e,r,i,a)}return T(n)}(Mr),sp=function(e){p(n,e);var t=m(n);function n(e,r,i,a){return M(this,n),console.warn("THREE.DataTexture3D has been renamed to Data3DTexture."),t.call(this,e,r,i,a)}return T(n)}(Tr),lp=function(e){p(n,e);var t=m(n);function n(e,r,i,a,o,s){return M(this,n),console.warn("THREE.BoxBufferGeometry has been renamed to THREE.BoxGeometry."),t.call(this,e,r,i,a,o,s)}return T(n)}(Ra),up=function(e){p(n,e);var t=m(n);function n(e,r,i,a){return M(this,n),console.warn("THREE.CapsuleBufferGeometry has been renamed to THREE.CapsuleGeometry."),t.call(this,e,r,i,a)}return T(n)}(lc),cp=function(e){p(n,e);var t=m(n);function n(e,r,i,a){return M(this,n),console.warn("THREE.CircleBufferGeometry has been renamed to THREE.CircleGeometry."),t.call(this,e,r,i,a)}return T(n)}(uc),hp=function(e){p(n,e);var t=m(n);function n(e,r,i,a,o,s,l){return M(this,n),console.warn("THREE.ConeBufferGeometry has been renamed to THREE.ConeGeometry."),t.call(this,e,r,i,a,o,s,l)}return T(n)}(hc),dp=function(e){p(n,e);var t=m(n);function n(e,r,i,a,o,s,l,u){return M(this,n),console.warn("THREE.CylinderBufferGeometry has been renamed to THREE.CylinderGeometry."),t.call(this,e,r,i,a,o,s,l,u)}return T(n)}(cc),fp=function(e){p(n,e);var t=m(n);function n(e,r){return M(this,n),console.warn("THREE.DodecahedronBufferGeometry has been renamed to THREE.DodecahedronGeometry."),t.call(this,e,r)}return T(n)}(fc),pp=function(e){p(n,e);var t=m(n);function n(e,r){return M(this,n),console.warn("THREE.ExtrudeBufferGeometry has been renamed to THREE.ExtrudeGeometry."),t.call(this,e,r)}return T(n)}(Yc),vp=function(e){p(n,e);var t=m(n);function n(e,r){return M(this,n),console.warn("THREE.IcosahedronBufferGeometry has been renamed to THREE.IcosahedronGeometry."),t.call(this,e,r)}return T(n)}(Jc),mp=function(e){p(n,e);var t=m(n);function n(e,r,i,a){return M(this,n),console.warn("THREE.LatheBufferGeometry has been renamed to THREE.LatheGeometry."),t.call(this,e,r,i,a)}return T(n)}(sc),gp=function(e){p(n,e);var t=m(n);function n(e,r){return M(this,n),console.warn("THREE.OctahedronBufferGeometry has been renamed to THREE.OctahedronGeometry."),t.call(this,e,r)}return T(n)}(Qc),yp=function(e){p(n,e);var t=m(n);function n(e,r,i,a){return M(this,n),console.warn("THREE.PlaneBufferGeometry has been renamed to THREE.PlaneGeometry."),t.call(this,e,r,i,a)}return T(n)}(Ka),_p=function(e){p(n,e);var t=m(n);function n(e,r,i,a){return M(this,n),console.warn("THREE.PolyhedronBufferGeometry has been renamed to THREE.PolyhedronGeometry."),t.call(this,e,r,i,a)}return T(n)}(dc),xp=function(e){p(n,e);var t=m(n);function n(e,r,i,a,o,s){return M(this,n),console.warn("THREE.RingBufferGeometry has been renamed to THREE.RingGeometry."),t.call(this,e,r,i,a,o,s)}return T(n)}(Kc),bp=function(e){p(n,e);var t=m(n);function n(e,r){return M(this,n),console.warn("THREE.ShapeBufferGeometry has been renamed to THREE.ShapeGeometry."),t.call(this,e,r)}return T(n)}($c),wp=function(e){p(n,e);var t=m(n);function n(e,r,i,a,o,s,l){return M(this,n),console.warn("THREE.SphereBufferGeometry has been renamed to THREE.SphereGeometry."),t.call(this,e,r,i,a,o,s,l)}return T(n)}(eh),Mp=function(e){p(n,e);var t=m(n);function n(e,r){return M(this,n),console.warn("THREE.TetrahedronBufferGeometry has been renamed to THREE.TetrahedronGeometry."),t.call(this,e,r)}return T(n)}(th),Sp=function(e){p(n,e);var t=m(n);function n(e,r,i,a,o){return M(this,n),console.warn("THREE.TorusBufferGeometry has been renamed to THREE.TorusGeometry."),t.call(this,e,r,i,a,o)}return T(n)}(nh),Tp=function(e){p(n,e);var t=m(n);function n(e,r,i,a,o,s){return M(this,n),console.warn("THREE.TorusKnotBufferGeometry has been renamed to THREE.TorusKnotGeometry."),t.call(this,e,r,i,a,o,s)}return T(n)}(rh),kp=function(e){p(n,e);var t=m(n);function n(e,r,i,a,o){return M(this,n),console.warn("THREE.TubeBufferGeometry has been renamed to THREE.TubeGeometry."),t.call(this,e,r,i,a,o)}return T(n)}(ih);"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:k}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=k);var Ep=n(440),Ap=n(266);function Cp(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Pp(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pp(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Lp="undefined"==typeof window||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent)?Ep.useEffect:Ep.useLayoutEffect;function Rp(e){var t="function"==typeof e?function(e){var t,n=new Set,r=function(e,r){var i="function"==typeof e?e(t):e;if(i!==t){var a=t;t=r?i:Object.assign({},t,i),n.forEach((function(e){return e(t,a)}))}},i=function(){return t},a={setState:r,getState:i,subscribe:function(e,r,a){return r||a?function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Object.is;console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");var o=r(t);function s(){var n=r(t);if(!a(o,n)){var i=o;e(o=n,i)}}return n.add(s),function(){return n.delete(s)}}(e,r,a):(n.add(e),function(){return n.delete(e)})},destroy:function(){return n.clear()}};return t=e(r,i,a),a}(e):e,n=function(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.getState,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object.is,i=(0,Ep.useReducer)((function(e){return e+1}),0),a=Cp(i,2),o=a[1],s=t.getState(),l=(0,Ep.useRef)(s),u=(0,Ep.useRef)(n),c=(0,Ep.useRef)(r),h=(0,Ep.useRef)(!1),d=(0,Ep.useRef)();void 0===d.current&&(d.current=n(s));var f=!1;(l.current!==s||u.current!==n||c.current!==r||h.current)&&(e=n(s),f=!r(d.current,e)),Lp((function(){f&&(d.current=e),l.current=s,u.current=n,c.current=r,h.current=!1}));var p=(0,Ep.useRef)(s);Lp((function(){var e=function(){try{var e=t.getState(),n=u.current(e);c.current(d.current,n)||(l.current=e,d.current=n,o())}catch(e){h.current=!0,o()}},n=t.subscribe(e);return t.getState()!==p.current&&e(),n}),[]);var v=f?e:d.current;return(0,Ep.useDebugValue)(v),v};return Object.assign(n,t),n[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");var e=[n,t];return{next:function(){var t=e.length<=0;return{value:e.shift(),done:t}}}},n}var Ip=n(915),Dp=n.n(Ip),Op=n(258);function zp(e){return function(e){if(Array.isArray(e))return Fp(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Up(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Np(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Up(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function Up(e,t){if(e){if("string"==typeof e)return Fp(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Fp(e,t):void 0}}function Fp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Bp(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e,t){return e===t};if(e===t)return!0;if(!e||!t)return!1;var r=e.length;if(t.length!==r)return!1;for(var i=0;i<r;i++)if(!n(e[i],t[i]))return!1;return!0}var Gp=[];function Hp(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=Np(Gp);try{for(a.s();!(n=a.n()).done;){var o=n.value;if(Bp(t,o.keys,o.equal)){if(r)return;if(Object.prototype.hasOwnProperty.call(o,"error"))throw o.error;if(Object.prototype.hasOwnProperty.call(o,"response"))return o.response;if(!r)throw o.promise}}}catch(e){a.e(e)}finally{a.f()}var s={keys:t,equal:i.equal,promise:e.apply(void 0,zp(t)).then((function(e){return s.response=e})).then((function(){i.lifespan&&i.lifespan>0&&setTimeout((function(){var e=Gp.indexOf(s);-1!==e&&Gp.splice(e,1)}),i.lifespan)})).catch((function(e){return s.error=e}))};if(Gp.push(s),!r)throw s.promise}var Vp=["children","key","ref"],Wp=["children","key","ref"],jp=["args","attach"],qp=["args","children"],Xp=["args","children"],Yp=["params"],Zp=["events","size"];function Jp(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=nv(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function Qp(e,t,n){return Qp=pv()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&dv(i,n.prototype),i},Qp.apply(null,arguments)}function Kp(e){return function(e){if(Array.isArray(e))return rv(e)}(e)||$p(e)||nv(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $p(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function ev(e,t){return iv(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||nv(e,t)||tv()}function tv(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function nv(e,t){if(e){if("string"==typeof e)return rv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rv(e,t):void 0}}function rv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function iv(e){if(Array.isArray(e))return e}function av(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function ov(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function sv(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ov(Object(n),!0).forEach((function(t){lv(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ov(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function lv(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function uv(e){return uv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},uv(e)}function cv(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hv(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function dv(e,t){return dv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},dv(e,t)}function fv(e,t){if(t&&("object"===uv(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function pv(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function vv(e){return vv=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},vv(e)}var mv,gv,yv=Object.freeze({__proto__:null}),_v=function(e){return e&&e.isOrthographicCamera},xv="undefined"!=typeof window&&(null!=(mv=window.document)&&mv.createElement||"ReactNative"===(null==(gv=window.navigator)?void 0:gv.product))?Ep.useLayoutEffect:Ep.useEffect;function bv(e){var t=Ep.useRef(e);return xv((function(){t.current=e}),[e]),t}function wv(e){var t=e.set;return xv((function(){return t(new Promise((function(){return null}))),function(){return t(!1)}}),[t]),null}var Mv=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&dv(e,t)}(o,e);var t,n,r,i,a=(t=o,n=pv(),function(){var e,r=vv(t);if(n){var i=vv(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return fv(this,e)});function o(){var e;cv(this,o);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return(e=a.call.apply(a,[this].concat(n))).state={error:!1},e}return r=o,(i=[{key:"componentDidCatch",value:function(e){this.props.set(e)}},{key:"render",value:function(){return this.state.error?null:this.props.children}}])&&hv(r.prototype,i),Object.defineProperty(r,"prototype",{writable:!1}),o}(Ep.Component);Mv.getDerivedStateFromError=function(){return{error:!0}};var Sv="__default";function Tv(e){var t="undefined"!=typeof window?window.devicePixelRatio:1;return Array.isArray(e)?Math.min(Math.max(e[0],t),e[1]):e}var kv=function(e){var t;return null==(t=e.__r3f)?void 0:t.root.getState()},Ev={obj:function(e){return e===Object(e)&&!Ev.arr(e)&&"function"!=typeof e},fun:function(e){return"function"==typeof e},str:function(e){return"string"==typeof e},num:function(e){return"number"==typeof e},boo:function(e){return"boolean"==typeof e},und:function(e){return void 0===e},arr:function(e){return Array.isArray(e)},equ:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.arrays,i=void 0===r?"shallow":r,a=n.objects,o=void 0===a?"reference":a,s=n.strict,l=void 0===s||s;if(uv(e)!==uv(t)||!!e!=!!t)return!1;if(Ev.str(e)||Ev.num(e))return e===t;var u=Ev.obj(e);if(u&&"reference"===o)return e===t;var c,h=Ev.arr(e);if(h&&"reference"===i)return e===t;if((h||u)&&e===t)return!0;for(c in e)if(!(c in t))return!1;for(c in l?t:e)if(e[c]!==t[c])return!1;if(Ev.und(c)){if(h&&0===e.length&&0===t.length)return!0;if(u&&0===Object.keys(e).length&&0===Object.keys(t).length)return!0;if(e!==t)return!1}return!0}};function Av(e){var t={nodes:{},materials:{}};return e&&e.traverse((function(e){e.name&&(t.nodes[e.name]=e),e.material&&!t.materials[e.material.name]&&(t.materials[e.material.name]=e.material)})),t}function Cv(e){for(var t in e.dispose&&"Scene"!==e.type&&e.dispose(),e)null==t.dispose||t.dispose(),delete e[t]}function Pv(e,t){var n=e;return(null!=t&&t.primitive||!n.__r3f)&&(n.__r3f=sv({type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null},t)),e}function Lv(e,t){var n=e;if(t.includes("-")){var r=t.split("-"),i=r.pop();return n=r.reduce((function(e,t){return e[t]}),e),{target:n,key:i}}return{target:n,key:t}}var Rv=/-\d+$/;function Iv(e,t,n){if(Ev.str(n)){if(Rv.test(n)){var r=Lv(e,n.replace(Rv,"")),i=r.target,a=r.key;Array.isArray(i[a])||(i[a]=[])}var o=Lv(e,n),s=o.target,l=o.key;t.__r3f.previousAttach=s[l],s[l]=t}else t.__r3f.previousAttach=n(e,t)}function Dv(e,t,n){var r,i;if(Ev.str(n)){var a=Lv(e,n),o=a.target,s=a.key,l=t.__r3f.previousAttach;void 0===l?delete o[s]:o[s]=l}else null==(r=t.__r3f)||null==r.previousAttach||r.previousAttach(e,t);null==(i=t.__r3f)||delete i.previousAttach}function Ov(e,t){t.children,t.key,t.ref;var n,r=av(t,Vp),i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=(i.children,i.key,i.ref,av(i,Wp)),o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=null!=(n=null==e?void 0:e.__r3f)?n:{},l=Object.entries(r),u=[];if(o)for(var c=Object.keys(a),h=0;h<c.length;h++)r.hasOwnProperty(c[h])||l.unshift([c[h],Sv+"remove"]);l.forEach((function(t){var n,i=ev(t,2),o=i[0],s=i[1];if(!(null!=(n=e.__r3f)&&n.primitive&&"object"===o||Ev.equ(s,a[o]))){if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(o))return u.push([o,s,!0,[]]);var l=[];for(var c in o.includes("-")&&(l=o.split("-")),u.push([o,s,!1,l]),r){var h=r[c];c.startsWith("".concat(o,"-"))&&u.push([c,h,!1,c.split("-")])}}}));var d=sv({},r);return s.memoizedProps&&s.memoizedProps.args&&(d.args=s.memoizedProps.args),s.memoizedProps&&s.memoizedProps.attach&&(d.attach=s.memoizedProps.attach),{memoized:d,changes:u}}function zv(e,t){var n,r,i,a,o,s=null!=(n=e.__r3f)?n:{},l=s.root,u=null!=(r=null==l||null==l.getState?void 0:l.getState())?r:{},c=(a=t)&&a.memoized&&a.changes?t:Ov(e,t),h=c.memoized,d=c.changes,f=s.eventCount;e.__r3f&&(e.__r3f.memoizedProps=h);for(var p=0;p<d.length;p++){var v,m=ev(d[p],4),g=m[0],y=m[1],_=m[2],x=m[3],b=e,w=b[g];if(x.length&&(w=x.reduce((function(e,t){return e[t]}),e),!w||!w.set)){var M=iv(o=x.reverse())||$p(o)||nv(o)||tv(),S=M[0];b=M.slice(1).reverse().reduce((function(e,t){return e[t]}),e),g=S}if(y===Sv+"remove")if(w&&w.constructor)y=Qp(w.constructor,Kp(null!=(v=h.args)?v:[]));else if(b.constructor){var T,k=Qp(b.constructor,Kp(null!=(T=b.__r3f.memoizedProps.args)?T:[]));y=k[w],k.dispose&&k.dispose()}else y=0;if(_)y?s.handlers[g]=y:delete s.handlers[g],s.eventCount=Object.keys(s.handlers).length;else if(w&&w.set&&(w.copy||w instanceof gi)){var E;if(Array.isArray(y))w.fromArray?w.fromArray(y):(E=w).set.apply(E,Kp(y));else if(w.copy&&y&&y.constructor&&w.constructor.name===y.constructor.name)w.copy(y);else if(void 0!==y){!(w instanceof vr)&&w.setScalar?w.setScalar(y):w instanceof gi&&y instanceof gi?w.mask=y.mask:w.set(y)}}else b[g]=y,!u.linear&&b[g]instanceof xr&&(b[g].encoding=en);Nv(e)}if(s.parent&&u.internal&&e.raycast&&f!==s.eventCount){var A=u.internal.interaction.indexOf(e);A>-1&&u.internal.interaction.splice(A,1),s.eventCount&&u.internal.interaction.push(e)}return d.length&&null!=(i=e.__r3f)&&i.parent&&Uv(e),e}function Nv(e){var t,n,r=null==(t=e.__r3f)||null==(n=t.root)||null==n.getState?void 0:n.getState();r&&0===r.internal.frames&&r.invalidate()}function Uv(e){null==e.onUpdate||e.onUpdate(e)}function Fv(e,t){e.manual||(_v(e)?(e.left=t.width/-2,e.right=t.width/2,e.top=t.height/2,e.bottom=t.height/-2):e.aspect=t.width/t.height,e.updateProjectionMatrix(),e.updateMatrixWorld())}function Bv(e,t,n){var r=n.pop(),i=n.reduce((function(e,t){return e[t]}),e);return i[r]=t}function Gv(e){return(e.eventObject||e.object).uuid+"/"+e.index+e.instanceId}function Hv(e,t,n,r){var i=n.get(t);i&&(n.delete(t),0===n.size&&(e.delete(r),i.target.releasePointerCapture(r)))}function Vv(e){function t(e){return e.filter((function(e){return["Move","Over","Enter","Out","Leave"].some((function(t){var n;return null==(n=e.__r3f)?void 0:n.handlers["onPointer"+t]}))}))}function n(t){var n,r=e.getState().internal,i=Jp(r.hovered.values());try{var a=function(){var e=n.value;if(!t.length||!t.find((function(t){return t.object===e.object&&t.index===e.index&&t.instanceId===e.instanceId}))){var i=e.eventObject.__r3f,a=null==i?void 0:i.handlers;if(r.hovered.delete(Gv(e)),null!=i&&i.eventCount){var o=sv(sv({},e),{},{intersections:t});null==a.onPointerOut||a.onPointerOut(o),null==a.onPointerLeave||a.onPointerLeave(o)}}};for(i.s();!(n=i.n()).done;)a()}catch(e){i.e(e)}finally{i.f()}}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n].__r3f;null==r||null==r.handlers.onPointerMissed||r.handlers.onPointerMissed(e)}}return{handlePointer:function(i){switch(i){case"onPointerLeave":case"onPointerCancel":return function(){return n([])};case"onLostPointerCapture":return function(t){var r=e.getState().internal;"pointerId"in t&&!r.capturedMap.has(t.pointerId)&&(r.capturedMap.delete(t.pointerId),n([]))}}return function(a){var o=e.getState(),s=o.onPointerMissed,l=o.internal;l.lastEvent.current=a;var u="onPointerMove"===i,c="onClick"===i||"onContextMenu"===i||"onDoubleClick"===i,h=function(t,n){for(var r=e.getState(),i=new Set,a=[],o=n?n(r.internal.interaction):r.internal.interaction,s=0;s<o.length;s++){var l=kv(o[s]);l&&(l.raycaster.camera=void 0)}r.previousRoot||null==r.events.compute||r.events.compute(t,r);var u=o.flatMap((function(e){var n,r=kv(e);return r&&r.events.enabled&&null!==r.raycaster.camera?(void 0===r.raycaster.camera&&(null==r.events.compute||r.events.compute(t,r,null==(n=r.previousRoot)?void 0:n.getState()),void 0===r.raycaster.camera&&(r.raycaster.camera=null)),r.raycaster.camera?r.raycaster.intersectObject(e,!0):[]):[]})).sort((function(e,t){var n=kv(e.object),r=kv(t.object);return n&&r?r.events.priority-n.events.priority||e.distance-t.distance:0})).filter((function(e){var t=Gv(e);return!i.has(t)&&(i.add(t),!0)}));r.events.filter&&(u=r.events.filter(u,r));var c,h=Jp(u);try{for(h.s();!(c=h.n()).done;)for(var d=c.value,f=d.object;f;){var p;null!=(p=f.__r3f)&&p.eventCount&&a.push(sv(sv({},d),{},{eventObject:f})),f=f.parent}}catch(e){h.e(e)}finally{h.f()}if("pointerId"in t&&r.internal.capturedMap.has(t.pointerId)){var v,m=Jp(r.internal.capturedMap.get(t.pointerId).values());try{for(m.s();!(v=m.n()).done;){var g=v.value;a.push(g.intersection)}}catch(e){m.e(e)}finally{m.f()}}return a}(a,u?t:void 0),d=c?function(t){var n=e.getState().internal,r=t.offsetX-n.initialClick[0],i=t.offsetY-n.initialClick[1];return Math.round(Math.sqrt(r*r+i*i))}(a):0;"onPointerDown"===i&&(l.initialClick=[a.offsetX,a.offsetY],l.initialHits=h.map((function(e){return e.eventObject}))),c&&!h.length&&d<=2&&(r(a,l.interaction),s&&s(a)),u&&n(h),function(t,r,i,a){var o=e.getState();t.length&&function(){var e,s={stopped:!1},l=Jp(t);try{var u=function(){var l=e.value,u=kv(l.object)||o,c=u.raycaster,h=u.pointer,d=u.camera,f=u.internal,p=new Cr(h.x,h.y,0).unproject(d),v=function(e){var t,n;return null!=(t=null==(n=f.capturedMap.get(e))?void 0:n.has(l.eventObject))&&t},m=function(e){var t={intersection:l,target:r.target};f.capturedMap.has(e)?f.capturedMap.get(e).set(l.eventObject,t):f.capturedMap.set(e,new Map([[l.eventObject,t]])),r.target.setPointerCapture(e)},g=function(e){var t=f.capturedMap.get(e);t&&Hv(f.capturedMap,l.eventObject,t,e)},y={};for(var _ in r){var x=r[_];"function"!=typeof x&&(y[_]=x)}var b=sv(sv(sv({},l),y),{},{pointer:h,intersections:t,stopped:s.stopped,delta:i,unprojectedPoint:p,ray:c.ray,camera:d,stopPropagation:function(){var e="pointerId"in r&&f.capturedMap.get(r.pointerId);if((!e||e.has(l.eventObject))&&(b.stopped=s.stopped=!0,f.hovered.size&&Array.from(f.hovered.values()).find((function(e){return e.eventObject===l.eventObject})))){var i=t.slice(0,t.indexOf(l));n([].concat(Kp(i),[l]))}},target:{hasPointerCapture:v,setPointerCapture:m,releasePointerCapture:g},currentTarget:{hasPointerCapture:v,setPointerCapture:m,releasePointerCapture:g},nativeEvent:r});if(a(b),!0===s.stopped)return"break"};for(l.s();!(e=l.n()).done&&"break"!==u(););}catch(e){l.e(e)}finally{l.f()}}()}(h,a,d,(function(e){var t=e.eventObject,n=t.__r3f,o=null==n?void 0:n.handlers;if(null!=n&&n.eventCount)if(u){if(o.onPointerOver||o.onPointerEnter||o.onPointerOut||o.onPointerLeave){var s=Gv(e),h=l.hovered.get(s);h?h.stopped&&e.stopPropagation():(l.hovered.set(s,e),null==o.onPointerOver||o.onPointerOver(e),null==o.onPointerEnter||o.onPointerEnter(e))}null==o.onPointerMove||o.onPointerMove(e)}else{var d=o[i];d?c&&!l.initialHits.includes(t)||(r(a,l.interaction.filter((function(e){return!l.initialHits.includes(e)}))),d(e)):c&&l.initialHits.includes(t)&&r(a,l.interaction.filter((function(e){return!l.initialHits.includes(e)})))}}))}}}}var Wv,jv={},qv=function(e){jv=sv(sv({},jv),e)},Xv=["set","get","setSize","setFrameloop","setDpr","events","invalidate","advance","size","viewport"],Yv=function(e){return!(null==e||!e.render)},Zv=Ep.createContext(null);function Jv(e,t){var n={callback:e};return t.add(n),function(){t.delete(n)}}var Qv,Kv,$v=new Set,em=new Set,tm=new Set,nm=function(e){return Jv(e,$v)},rm=function(e){return Jv(e,em)},im=function(e){return Jv(e,tm)};function am(e,t){if(e.size){var n,r=Jp(e.values());try{for(r.s();!(n=r.n()).done;)(0,n.value.callback)(t)}catch(e){r.e(e)}finally{r.f()}}}function om(e,t){switch(e){case"before":return am($v,t);case"after":return am(em,t);case"tail":return am(tm,t)}}function sm(e,t,n){var r=t.clock.getDelta();for("never"===t.frameloop&&"number"==typeof e&&(r=e-t.clock.elapsedTime,t.clock.oldTime=t.clock.elapsedTime,t.clock.elapsedTime=e),Qv=t.internal.subscribers,Wv=0;Wv<Qv.length;Wv++)(Kv=Qv[Wv]).ref.current(Kv.store.getState(),r,n);return!t.internal.priority&&t.gl.render&&t.gl.render(t.scene,t.camera),t.internal.frames=Math.max(0,t.internal.frames-1),"always"===t.frameloop?1:t.internal.frames}function lm(e){var t=Ep.useRef(null);return xv((function(){t.current=e.current.__r3f}),[e]),t}function um(){var e=Ep.useContext(Zv);if(!e)throw new Error("R3F: Hooks can only be used within the Canvas component!");return e}function cm(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(e){return e},t=arguments.length>1?arguments[1]:void 0;return um()(e,t)}function hm(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=um(),r=n.getState().internal.subscribe,i=bv(e);return xv((function(){return r(i,t,n)}),[t,r,n]),null}function dm(e){return Ep.useMemo((function(){return Av(e)}),[e])}function fm(e,t){return function(n){var r=new n;e&&e(r);for(var i=arguments.length,a=new Array(i>1?i-1:0),o=1;o<i;o++)a[o-1]=arguments[o];return Promise.all(a.map((function(e){return new Promise((function(n,i){return r.load(e,(function(e){e.scene&&Object.assign(e,Av(e.scene)),n(e)}),t,(function(t){return i(new Error("Could not load ".concat(e,": ").concat(t.message,")")))}))}))})))}}function pm(e,t,n,r){var i=Array.isArray(t)?t:[t],a=function(e,t,n){return Hp(e,t,!1,n)}(fm(n,r),[e].concat(Kp(i)),{equal:Ev.equ});return Array.isArray(t)?a:a[0]}pm.preload=function(e,t,n){var r=Array.isArray(t)?t:[t];return function(e,t,n){Hp(e,t,!0,void 0)}(fm(n),[e].concat(Kp(r)))},pm.clear=function(e,t){var n=Array.isArray(t)?t:[t];return function(e){if(void 0===e||0===e.length)Gp.splice(0,Gp.length);else{var t=Gp.find((function(t){return Bp(e,t.keys,t.equal)}));if(t){var n=Gp.indexOf(t);-1!==n&&Gp.splice(n,1)}}}([e].concat(Kp(n)))};var vm=new Map,mm=function(e){var t,n,r,i=!1;function a(o){n=requestAnimationFrame(a),i=!0,t=0,om("before",o);var s,l=Jp(e.values());try{for(l.s();!(s=l.n()).done;){var u,c=s.value;!(r=c.store.getState()).internal.active||!("always"===r.frameloop||r.internal.frames>0)||null!=(u=r.gl.xr)&&u.isPresenting||(t+=sm(o,r))}}catch(e){l.e(e)}finally{l.f()}if(om("after",o),0===t)return om("tail",o),i=!1,cancelAnimationFrame(n)}return{loop:a,invalidate:function t(n){var r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!n)return e.forEach((function(e){return t(e.store.getState())}),o);null!=(r=n.gl.xr)&&r.isPresenting||!n.internal.active||"never"===n.frameloop||(n.internal.frames=Math.min(60,n.internal.frames+o),i||(i=!0,requestAnimationFrame(a)))},advance:function(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;if(n&&om("before",t),r)sm(t,r,i);else{var a,o=Jp(e.values());try{for(o.s();!(a=o.n()).done;){var s=a.value;sm(t,s.store.getState())}}catch(e){o.e(e)}finally{o.f()}}n&&om("after",t)}}}(vm),gm=mm.invalidate,ym=mm.advance,_m=function(e,t){function n(e,t,n){var r,i=t.args,a=void 0===i?[]:i,o=t.attach,s=av(t,jp),l="".concat(e[0].toUpperCase()).concat(e.slice(1));if("primitive"===e){if(void 0===s.object)throw new Error("R3F: Primitives without 'object' are invalid!");r=Pv(s.object,{type:e,root:n,attach:o,primitive:!0})}else{var u=jv[l];if(!u)throw new Error("R3F: ".concat(l," is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively"));if(!Array.isArray(a))throw new Error("R3F: The args prop must be an array!");r=Pv(Qp(u,Kp(a)),{type:e,root:n,attach:o,memoizedProps:{args:a}})}return void 0===r.__r3f.attach&&(r instanceof da?r.__r3f.attach="geometry":r instanceof Wi&&(r.__r3f.attach="material")),"inject"!==l&&zv(r,s),r}function r(e,t){var n,r,i=!1;t&&(null!=(n=t.__r3f)&&n.attach?Iv(e,t,t.__r3f.attach):t.isObject3D&&e.isObject3D&&(e.add(t),i=!0),i||null==(r=e.__r3f)||r.objects.push(t),t.__r3f||Pv(t,{}),t.__r3f.parent=e,Uv(t),Nv(t))}function i(e,t,n){var r=!1;if(t){var i,a;if(null!=(i=t.__r3f)&&i.attach)Iv(e,t,t.__r3f.attach);else if(t.isObject3D&&e.isObject3D){t.parent=e,t.dispatchEvent({type:"added"});var o=e.children.filter((function(e){return e!==t})),s=o.indexOf(n);e.children=[].concat(Kp(o.slice(0,s)),[t],Kp(o.slice(s))),r=!0}r||null==(a=e.__r3f)||a.objects.push(t),t.__r3f||Pv(t,{}),t.__r3f.parent=e,Uv(t),Nv(t)}}function a(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e&&Kp(e).forEach((function(e){return o(t,e,n)}))}function o(e,t,n){if(t){var r,i,o;if(t.__r3f&&(t.__r3f.parent=null),null!=(r=e.__r3f)&&r.objects&&(e.__r3f.objects=e.__r3f.objects.filter((function(e){return e!==t}))),null!=(i=t.__r3f)&&i.attach)Dv(e,t,t.__r3f.attach);else if(t.isObject3D&&e.isObject3D){var s;e.remove(t),null!=(s=t.__r3f)&&s.root&&(h=t.__r3f.root,d=t,(f=h.getState().internal).interaction=f.interaction.filter((function(e){return e!==d})),f.initialHits=f.initialHits.filter((function(e){return e!==d})),f.hovered.forEach((function(e,t){e.eventObject!==d&&e.object!==d||f.hovered.delete(t)})),f.capturedMap.forEach((function(e,t){Hv(f.capturedMap,d,e,t)})))}var l,u=null==(o=t.__r3f)?void 0:o.primitive,c=void 0===n?null!==t.dispose&&!u:n;u||(a(null==(l=t.__r3f)?void 0:l.objects,t,c),a(t.children,t,c)),t.__r3f&&(delete t.__r3f.root,delete t.__r3f.objects,delete t.__r3f.handlers,delete t.__r3f.memoizedProps,u||delete t.__r3f),c&&t.dispose&&"Scene"!==t.type&&(0,Op.unstable_scheduleCallback)(Op.unstable_IdlePriority,(function(){try{t.dispose()}catch(e){}})),Nv(e)}var h,d,f}var s=function(){return console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.")};return{reconciler:Dp()({createInstance:n,removeChild:o,appendChild:r,appendInitialChild:r,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:function(e,t){if(t){var n=e.getState().scene;n.__r3f&&(n.__r3f.root=e,r(n,t))}},removeChildFromContainer:function(e,t){t&&o(e.getState().scene,t)},insertInContainerBefore:function(e,t,n){if(t&&n){var r=e.getState().scene;r.__r3f&&i(r,t,n)}},getRootHostContext:function(){return null},getChildHostContext:function(e){return e},finalizeInitialChildren:function(e){var t,n=null!=(t=null==e?void 0:e.__r3f)?t:{};return Boolean(n.handlers)},prepareUpdate:function(e,t,n,r){if(e.__r3f.primitive&&r.object&&r.object!==e)return[!0];var i=r.args,a=void 0===i?[]:i,o=(r.children,av(r,qp)),s=n.args,l=void 0===s?[]:s,u=(n.children,av(n,Xp));if(!Array.isArray(a))throw new Error("R3F: the args prop must be an array!");if(a.some((function(e,t){return e!==l[t]})))return[!0];var c=Ov(e,o,u,!0);return c.changes.length?[!1,c]:null},commitUpdate:function(e,t,i,a,s,l){var u=ev(t,2),c=u[0],h=u[1];c?function(e,t,i,a){var s,l=null==(s=e.__r3f)?void 0:s.parent;if(l){var u=n(t,i,e.__r3f.root);if(e.children){var c,h=Jp(e.children);try{for(h.s();!(c=h.n()).done;){var d=c.value;d.__r3f&&r(u,d)}}catch(e){h.e(e)}finally{h.f()}e.children=e.children.filter((function(e){return!e.__r3f}))}e.__r3f.objects.forEach((function(e){return r(u,e)})),e.__r3f.objects=[],o(l,e),r(l,u),u.raycast&&u.__r3f.eventCount&&u.__r3f.root.getState().internal.interaction.push(u),[a,a.alternate].forEach((function(e){null!==e&&(e.stateNode=u,e.ref&&("function"==typeof e.ref?e.ref(u):e.ref.current=u))}))}}(e,i,s,l):zv(e,h)},commitMount:function(e,t,n,r){var i,a=null!=(i=e.__r3f)?i:{};e.raycast&&a.handlers&&a.eventCount&&e.__r3f.root.getState().internal.interaction.push(e)},getPublicInstance:function(e){return e},prepareForCommit:function(){return null},preparePortalMount:function(e){return Pv(e.getState().scene)},resetAfterCommit:function(){},shouldSetTextContent:function(){return!1},clearContainer:function(){return!1},hideInstance:function(e){var t,n=null!=(t=e.__r3f)?t:{},r=n.attach,i=n.parent;r&&i&&Dv(i,e,r),e.isObject3D&&(e.visible=!1),Nv(e)},unhideInstance:function(e,t){var n,r=null!=(n=e.__r3f)?n:{},i=r.attach,a=r.parent;i&&a&&Iv(a,e,i),(e.isObject3D&&null==t.visible||t.visible)&&(e.visible=!0),Nv(e)},createTextInstance:s,hideTextInstance:s,unhideTextInstance:s,getCurrentEventPriority:function(){return t?t():Ap.DefaultEventPriority},beforeActiveInstanceBlur:function(){},afterActiveInstanceBlur:function(){},detachDeletedInstance:function(){},now:"undefined"!=typeof performance&&Ev.fun(performance.now)?performance.now:Ev.fun(Date.now)?Date.now:function(){return 0},scheduleTimeout:Ev.fun(setTimeout)?setTimeout:void 0,cancelTimeout:Ev.fun(clearTimeout)?clearTimeout:void 0}),applyProps:zv}}(0,(function(){var e,t="undefined"!=typeof self&&self||"undefined"!=typeof window&&window;if(!t)return Ap.DefaultEventPriority;switch(null==(e=t.event)?void 0:e.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Ap.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Ap.ContinuousEventPriority;default:return Ap.DefaultEventPriority}})),xm=_m.reconciler,bm=_m.applyProps,wm={objects:"shallow",strict:!1},Mm=function(e,t){var n="function"==typeof e?e(t):e;return Yv(n)?n:new El(sv({powerPreference:"high-performance",canvas:t,antialias:!0,alpha:!0},e))};function Sm(e,t){if(t)return t;if(e instanceof HTMLCanvasElement&&e.parentElement){var n=e.parentElement.getBoundingClientRect();return{width:n.width,height:n.height,top:n.top,left:n.left}}return{width:0,height:0,top:0,left:0}}function Tm(e){var n=vm.get(e),r=null==n?void 0:n.fiber,i=null==n?void 0:n.store;n&&console.warn("R3F.createRoot should only be called once!");var a,o,s,l,u,c,h,d,f="function"==typeof reportError?reportError:console.error,p=i||(a=gm,o=ym,s=Rp((function(e,t){var n=new Cr,r=new Cr,i=new Cr;function s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t().camera,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t().size,s=o.width,l=o.height,u=o.top,c=o.left,h=s/l;a instanceof Cr?i.copy(a):i.set.apply(i,Kp(a));var d=e.getWorldPosition(n).distanceTo(i);if(_v(e))return{width:s/e.zoom,height:l/e.zoom,top:u,left:c,factor:1,distance:d,aspect:h};var f=e.fov*Math.PI/180,p=2*Math.tan(f/2)*d,v=p*(s/l);return{width:v,height:p,top:u,left:c,factor:s/v,distance:d,aspect:h}}var l=void 0,u=function(t){return e((function(e){return{performance:sv(sv({},e.performance),{},{current:t})}}))},c=new Kn,h={set:e,get:t,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,invalidate:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return a(t(),e)},advance:function(e,n){return o(e,n,t())},legacy:!1,linear:!1,flat:!1,scene:Pv(new Rl),controls:null,clock:new Od,pointer:c,mouse:c,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:function(){var e=t();l&&clearTimeout(l),e.performance.current!==e.performance.min&&u(e.performance.min),l=setTimeout((function(){return u(t().performance.max)}),e.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:s},setEvents:function(t){return e((function(e){return sv(sv({},e),{},{events:sv(sv({},e.events),t)})}))},setSize:function(n,i,a,o,l){var u=t().camera,c={width:n,height:i,top:o||0,left:l||0,updateStyle:a};e((function(e){return{size:c,viewport:sv(sv({},e.viewport),s(u,r,c))}}))},setDpr:function(t){return e((function(e){var n=Tv(t);return{viewport:sv(sv({},e.viewport),{},{dpr:n,initialDpr:e.viewport.initialDpr||n})}}))},setFrameloop:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"always",r=t().clock;r.stop(),r.elapsedTime=0,"never"!==n&&(r.start(),r.elapsedTime=0),e((function(){return{frameloop:n}}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:Ep.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:function(e,n,r){var i=t().internal;return i.priority=i.priority+(n>0?1:0),i.subscribers.push({ref:e,priority:n,store:r}),i.subscribers=i.subscribers.sort((function(e,t){return e.priority-t.priority})),function(){var r=t().internal;null!=r&&r.subscribers&&(r.priority=r.priority-(n>0?1:0),r.subscribers=r.subscribers.filter((function(t){return t.ref!==e})))}}}};return h})),l=s.getState(),u=l.size,c=l.viewport.dpr,h=l.camera,s.subscribe((function(){var e=s.getState(),t=e.camera,n=e.size,r=e.viewport,i=e.gl,a=e.set;n===u&&r.dpr===c||(u=n,c=r.dpr,Fv(t,n),i.setPixelRatio(r.dpr),i.setSize(n.width,n.height,n.updateStyle)),t!==h&&(h=t,a((function(e){return{viewport:sv(sv({},e.viewport),e.viewport.getCurrentViewport(t))}})))})),s.subscribe((function(e){return a(e)})),s),v=r||xm.createContainer(p,Ap.ConcurrentRoot,null,!1,null,"",f,null);n||vm.set(e,{fiber:v,store:p});var m=!1;return{configure:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.gl,i=n.size,a=n.events,o=n.onCreated,s=n.shadows,l=void 0!==s&&s,u=n.linear,c=void 0!==u&&u,h=n.flat,f=void 0!==h&&h,v=n.legacy,g=void 0!==v&&v,y=n.orthographic,_=void 0!==y&&y,x=n.frameloop,b=void 0===x?"always":x,w=n.dpr,M=void 0===w?[1,2]:w,S=n.performance,T=n.raycaster,k=n.camera,E=n.onPointerMissed,A=p.getState(),C=A.gl;A.gl||A.set({gl:C=Mm(r,e)});var P=A.raycaster;P||A.set({raycaster:P=new ff});var L=T||{},R=L.params,I=av(L,Yp);if(Ev.equ(I,P,wm)||bm(P,sv({},I)),Ev.equ(R,P.params,wm)||bm(P,{params:sv(sv({},P.params),R)}),!A.camera){var D=k instanceof Na,z=D?k:_?new lo(0,0,0,0,.1,1e3):new Ua(75,0,.1,1e3);D||(z.position.z=5,k&&bm(z,k),null!=k&&k.rotation||z.lookAt(0,0,0)),A.set({camera:z})}if(!A.xr){var N=function(e,t){var n=p.getState();"never"!==n.frameloop&&ym(e,!0,n,t)},U=function(){var e=p.getState();e.gl.xr.enabled=e.gl.xr.isPresenting,e.gl.xr.setAnimationLoop(e.gl.xr.isPresenting?N:null),e.gl.xr.isPresenting||gm(e)},F={connect:function(){var e=p.getState().gl;e.xr.addEventListener("sessionstart",U),e.xr.addEventListener("sessionend",U)},disconnect:function(){var e=p.getState().gl;e.xr.removeEventListener("sessionstart",U),e.xr.removeEventListener("sessionend",U)}};C.xr&&F.connect(),A.set({xr:F})}if(C.shadowMap){var B=Ev.boo(l);if(B&&C.shadowMap.enabled!==l||!Ev.equ(l,C.shadowMap,wm)){var G=C.shadowMap.enabled;C.shadowMap.enabled=!!l,B?C.shadowMap.type=O:Object.assign(C.shadowMap,l),G!==C.shadowMap.enabled&&(C.shadowMap.needsUpdate=!0)}}Bv(t,g,["ColorManagement","legacyMode"]);var H=c?$t:en,V=f?_e:Me;C.outputEncoding!==H&&(C.outputEncoding=H),C.toneMapping!==V&&(C.toneMapping=V),A.legacy!==g&&A.set((function(){return{legacy:g}})),A.linear!==c&&A.set((function(){return{linear:c}})),A.flat!==f&&A.set((function(){return{flat:f}})),!r||Ev.fun(r)||Yv(r)||Ev.equ(r,C,wm)||bm(C,r),a&&!A.events.handlers&&A.set({events:a(p)}),M&&A.viewport.dpr!==Tv(M)&&A.setDpr(M);var W=Sm(e,i);return Ev.equ(W,A.size,wm)||A.setSize(W.width,W.height,W.updateStyle,W.top,W.left),A.frameloop!==b&&A.setFrameloop(b),A.onPointerMissed||A.set({onPointerMissed:E}),S&&!Ev.equ(S,A.performance,wm)&&A.set((function(e){return{performance:sv(sv({},e.performance),S)}})),d=o,m=!0,this},render:function(t){return m||this.configure(),xm.updateContainer(Ep.createElement(Em,{store:p,children:t,onCreated:d,rootElement:e}),v,null,(function(){})),p},unmount:function(){Am(e)}}}function km(e,t,n){console.warn("R3F.render is no longer supported in React 18. Use createRoot instead!");var r=Tm(t);return r.configure(n),r.render(e)}function Em(e){var t=e.store,n=e.children,r=e.onCreated,i=e.rootElement;return xv((function(){var e=t.getState();e.set((function(e){return{internal:sv(sv({},e.internal),{},{active:!0})}})),r&&r(e),t.getState().events.connected||null==e.events.connect||e.events.connect(i)}),[]),Ep.createElement(Zv.Provider,{value:t},n)}function Am(e,t){var n=vm.get(e),r=null==n?void 0:n.fiber;if(r){var i=null==n?void 0:n.store.getState();i&&(i.internal.active=!1),xm.updateContainer(null,r,null,(function(){i&&setTimeout((function(){try{var n,r,a,o;null==i.events.disconnect||i.events.disconnect(),null==(n=i.gl)||null==(r=n.renderLists)||null==r.dispose||r.dispose(),null==(a=i.gl)||null==a.forceContextLoss||a.forceContextLoss(),null!=(o=i.gl)&&o.xr&&i.xr.disconnect(),Cv(i),vm.delete(e),t&&t(e)}catch(e){}}),500)}))}}function Cm(e,t,n){return Ep.createElement(Pm,{key:t.uuid,children:e,container:t,state:n})}function Pm(e){var t=e.state,n=void 0===t?{}:t,r=e.children,i=e.container,a=n.events,o=n.size,s=av(n,Zp),l=um(),u=ev(Ep.useState((function(){return new ff})),1)[0],c=ev(Ep.useState((function(){return new Kn})),1)[0],h=Ep.useCallback((function(e,t){var n=sv({},e);Object.keys(e).forEach((function(r){(Xv.includes(r)||e[r]!==t[r])&&delete n[r]}));var r=void 0;if(t&&o){var h=t.camera;r=e.viewport.getCurrentViewport(h,new Cr,o),h!==e.camera&&Fv(h,o)}return sv(sv({},n),{},{scene:i,raycaster:u,pointer:c,mouse:c,previousRoot:l,events:sv(sv(sv({},e.events),null==t?void 0:t.events),a),size:sv(sv({},e.size),o),viewport:sv(sv({},e.viewport),r)},s)}),[n]),d=Ep.useState((function(){var e=l.getState(),t=Rp((function(t,n){return sv(sv(sv({},e),{},{scene:i,raycaster:u,pointer:c,mouse:c,previousRoot:l,events:sv(sv({},e.events),a),size:sv(sv({},e.size),o)},s),{},{set:t,get:n,setEvents:function(e){return t((function(t){return sv(sv({},t),{},{events:sv(sv({},t.events),e)})}))}})}));return t})),f=ev(d,1)[0];return Ep.useEffect((function(){var e=l.subscribe((function(e){return f.setState((function(t){return h(e,t)}))}));return function(){e(),f.destroy()}}),[]),Ep.useEffect((function(){f.setState((function(e){return h(l.getState(),e)}))}),[h]),Ep.createElement(Ep.Fragment,null,xm.createPortal(Ep.createElement(Zv.Provider,{value:f},r),f,null))}xm.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:Ep.version});var Lm=Ep.unstable_act;function Rm(){return Rm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Rm.apply(this,arguments)}var Im=n(617),Dm=n.n(Im);function Om(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||zm(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zm(e,t){if(e){if("string"==typeof e)return Nm(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Nm(e,t):void 0}}function Nm(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Um(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Fm(e,t,n){return t&&Um(e.prototype,t),n&&Um(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Bm(e){var t=void 0===e?{debounce:0,scroll:!1,offsetSize:!1}:e,n=t.debounce,r=t.scroll,i=t.polyfill,a=t.offsetSize,o=i||("undefined"==typeof window?Fm((function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)})):window.ResizeObserver);if(!o)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");var s=Om((0,Ep.useState)({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),2),l=s[0],u=s[1],c=(0,Ep.useRef)({element:null,scrollContainers:null,resizeObserver:null,lastBounds:l}),h=n?"number"==typeof n?n:n.scroll:null,d=n?"number"==typeof n?n:n.resize:null,f=(0,Ep.useRef)(!1);(0,Ep.useEffect)((function(){return f.current=!0,function(){f.current=!1}}));var p,v,m,g=Om((0,Ep.useMemo)((function(){var e=function(){if(c.current.element){var e=c.current.element.getBoundingClientRect(),t={left:e.left,top:e.top,width:e.width,height:e.height,bottom:e.bottom,right:e.right,x:e.x,y:e.y};c.current.element instanceof HTMLElement&&a&&(t.height=c.current.element.offsetHeight,t.width=c.current.element.offsetWidth),Object.freeze(t),f.current&&!Vm(c.current.lastBounds,t)&&u(c.current.lastBounds=t)}};return[e,d?Dm()(e,d):e,h?Dm()(e,h):e]}),[u,a,h,d]),3),y=g[0],_=g[1],x=g[2];function b(){c.current.scrollContainers&&(c.current.scrollContainers.forEach((function(e){return e.removeEventListener("scroll",x,!0)})),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null)}function w(){c.current.element&&(c.current.resizeObserver=new o(x),c.current.resizeObserver.observe(c.current.element),r&&c.current.scrollContainers&&c.current.scrollContainers.forEach((function(e){return e.addEventListener("scroll",x,{capture:!0,passive:!0})})))}return p=x,v=Boolean(r),(0,Ep.useEffect)((function(){if(v){var e=p;return window.addEventListener("scroll",e,{capture:!0,passive:!0}),function(){window.removeEventListener("scroll",e,!0)}}}),[p,v]),m=_,(0,Ep.useEffect)((function(){var e=m;return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[m]),(0,Ep.useEffect)((function(){b(),w()}),[r,x,_]),(0,Ep.useEffect)((function(){return b}),[]),[function(e){e&&e!==c.current.element&&(b(),c.current.element=e,c.current.scrollContainers=Gm(e),w())},l,y]}function Gm(e){var t=[];if(!e||e===document.body)return t;var n,r=window.getComputedStyle(e);return[r.overflow,r.overflowX,r.overflowY].some((function(e){return"auto"===e||"scroll"===e}))&&t.push(e),[].concat(t,function(e){if(Array.isArray(e))return Nm(e)}(n=Gm(e.parentElement))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||zm(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}var Hm=["x","y","top","bottom","left","right","width","height"],Vm=function(e,t){return Hm.every((function(n){return e[n]===t[n]}))};function Wm(e){return Wm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wm(e)}function jm(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qm(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Xm(e,t){return Xm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Xm(e,t)}function Ym(e,t){if(t&&("object"===Wm(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Zm(e){return Zm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Zm(e)}function Jm(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Qm(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qm(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function Qm(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Km=Object.defineProperty,$m=Object.defineProperties,eg=Object.getOwnPropertyDescriptors,tg=Object.getOwnPropertySymbols,ng=Object.prototype.hasOwnProperty,rg=Object.prototype.propertyIsEnumerable,ig=function(e,t,n){return t in e?Km(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},ag=function(e,t){for(var n in t||(t={}))ng.call(t,n)&&ig(e,n,t[n]);if(tg){var r,i=Jm(tg(t));try{for(i.s();!(r=i.n()).done;)n=r.value,rg.call(t,n)&&ig(e,n,t[n])}catch(e){i.e(e)}finally{i.f()}}return e};function og(e,t,n){if(e){if(!0===n(e))return e;for(var r=t?e.return:e.child;r;){var i=og(r,t,n);if(i)return i;r=t?null:r.sibling}}}function sg(e){try{return Object.defineProperties(e,{_currentRenderer:{get:function(){return null},set:function(){}},_currentRenderer2:{get:function(){return null},set:function(){}}})}catch(t){return e}}var lg=sg(Ep.createContext(null)),ug=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Xm(e,t)}(o,e);var t,n,r,i,a=(r=o,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=Zm(r);if(i){var n=Zm(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Ym(this,e)});function o(){return jm(this,o),a.apply(this,arguments)}return t=o,(n=[{key:"render",value:function(){return Ep.createElement(lg.Provider,{value:this._reactInternals},this.props.children)}}])&&qm(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),o}(Ep.Component),cg=Ep.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,hg=cg.ReactCurrentOwner,dg=cg.ReactCurrentDispatcher;var fg=[],pg=new WeakMap;function vg(){var e,t=function(){var e=Ep.useContext(lg);if(!e)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");var t=Ep.useId();return Ep.useMemo((function(){var n;return null!=(n=hg.current)?n:og(e,!1,(function(e){for(var n=e.memoizedState;n;){if(n.memoizedState===t)return!0;n=n.next}}))}),[e,t])}();fg.splice(0,fg.length),og(t,!0,(function(e){var t,n=null==(t=e.type)?void 0:t._context;n&&n!==lg&&fg.push(sg(n))}));var n,r=Jm(fg);try{for(r.s();!(n=r.n()).done;){var i=n.value,a=null==(e=dg.current)?void 0:e.readContext(i);pg.set(i,a)}}catch(e){r.e(e)}finally{r.f()}return Ep.useMemo((function(){return fg.reduce((function(e,t){return function(n){return Ep.createElement(e,null,Ep.createElement(t.Provider,(r=ag({},n),i={value:pg.get(t)},$m(r,eg(i)))));var r,i}}),(function(e){return Ep.createElement(ug,ag({},e))}))}),[])}var mg=["children","fallback","resize","style","gl","events","eventSource","eventPrefix","shadows","linear","flat","legacy","orthographic","frameloop","dpr","performance","raycaster","camera","onPointerMissed","onCreated"];function gg(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return yg(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yg(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function yg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _g(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function xg(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_g(Object(n),!0).forEach((function(t){bg(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_g(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function bg(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var wg={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function Mg(e){var t=Vv(e).handlePointer;return{priority:1,enabled:!0,compute:function(e,t,n){t.pointer.set(e.offsetX/t.size.width*2-1,-e.offsetY/t.size.height*2+1),t.raycaster.setFromCamera(t.pointer,t.camera)},connected:void 0,handlers:Object.keys(wg).reduce((function(e,n){return xg(xg({},e),{},bg({},n,t(n)))}),{}),connect:function(t){var n,r=e.getState(),i=r.set,a=r.events;null==a.disconnect||a.disconnect(),i((function(e){return{events:xg(xg({},e.events),{},{connected:t})}})),Object.entries(null!=(n=a.handlers)?n:[]).forEach((function(e){var n=gg(e,2),r=n[0],i=n[1],a=gg(wg[r],2),o=a[0],s=a[1];t.addEventListener(o,i,{passive:s})}))},disconnect:function(){var t,n=e.getState(),r=n.set,i=n.events;i.connected&&(Object.entries(null!=(t=i.handlers)?t:[]).forEach((function(e){var t=gg(e,2),n=t[0],r=t[1];if(i&&i.connected instanceof HTMLElement){var a=gg(wg[n],1)[0];i.connected.removeEventListener(a,r)}})),r((function(e){return{events:xg(xg({},e.events),{},{connected:void 0})}})))}}}var Sg=Ep.forwardRef((function(e,n){var r=e.children,i=e.fallback,a=e.resize,o=e.style,s=e.gl,l=e.events,u=void 0===l?Mg:l,c=e.eventSource,h=e.eventPrefix,d=e.shadows,f=e.linear,p=e.flat,v=e.legacy,m=e.orthographic,g=e.frameloop,y=e.dpr,_=e.performance,x=e.raycaster,b=e.camera,w=e.onPointerMissed,M=e.onCreated,S=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,mg);Ep.useMemo((function(){return qv(t)}),[]);var T=vg(),k=gg(Bm(xg({scroll:!0,debounce:{scroll:50,resize:0}},a)),2),E=k[0],A=k[1],C=Ep.useRef(null),P=Ep.useRef(null),L=gg(Ep.useState(null),2),R=L[0],I=L[1];Ep.useImperativeHandle(n,(function(){return C.current}));var D=bv(w),O=gg(Ep.useState(!1),2),z=O[0],N=O[1],U=gg(Ep.useState(!1),2),F=U[0],B=U[1];if(z)throw z;if(F)throw F;var G=Ep.useRef(null);A.width>0&&A.height>0&&R&&(G.current||(G.current=Tm(R)),G.current.configure({gl:s,events:u,shadows:d,linear:f,flat:p,legacy:v,orthographic:m,frameloop:g,dpr:y,performance:_,raycaster:x,camera:b,size:A,onPointerMissed:function(){return null==D.current?void 0:D.current.apply(D,arguments)},onCreated:function(e){var t;null==e.events.connect||e.events.connect(c?(t=c)&&t.hasOwnProperty("current")?c.current:c:P.current),h&&e.setEvents({compute:function(e,t){var n=e[h+"X"],r=e[h+"Y"];t.pointer.set(n/t.size.width*2-1,-r/t.size.height*2+1),t.raycaster.setFromCamera(t.pointer,t.camera)}}),null==M||M(e)}}),G.current.render(Ep.createElement(T,null,Ep.createElement(Mv,{set:B},Ep.createElement(Ep.Suspense,{fallback:Ep.createElement(wv,{set:N})},r))))),xv((function(){I(C.current)}),[]),Ep.useEffect((function(){if(R)return function(){return Am(R)}}),[R]);var H=c?"none":"auto";return Ep.createElement("div",Rm({ref:P,style:xg({position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:H},o)},S),Ep.createElement("div",{ref:E,style:{width:"100%",height:"100%"}},Ep.createElement("canvas",{ref:C,style:{display:"block"}},i)))})),Tg=Ep.forwardRef((function(e,t){return Ep.createElement(ug,null,Ep.createElement(Sg,Rm({},e,{ref:t})))}))})(),r})()));